[Buildroot] [PATCH v3] linux: add fbtft kernel extension

Peter Seiderer ps.report at gmx.net
Sat Jan 3 20:01:47 UTC 2015


Tested with RaspberryPi B+ and PiTFT Mini Kit - 320x240 2.8" TFT
(see [1] and [2]) and the following target configuration changes:
- cmdline.txt: add 'fbcon=map:10 fbcon=font:VGA8x8'
- add /etc/modules-load.d/fbtft.conf with 'fbtft_device'
- add /etc/modprobe.d/00-fbtft.conf with 'options fbtft_device name=adafruit28 rotate=90 gpios=dc:25'

[1] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9893.jpg
[2] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9897.jpg

Signed-off-by: Peter Seiderer <ps.report at gmx.net>
---
Changes v1 -> v2:
  - added missing linux/linux-ext-fbtft.mk file

Changes v2 -> v3:
  - removed automatic kernel configurations changes
  - added kernel configuration hint to linux/Config.ext.in help text
  - added second installation directory for linux >= 3.15
---
 linux/Config.ext.in      | 25 +++++++++++++++++++++++++
 linux/linux-ext-fbtft.mk | 41 +++++++++++++++++++++++++++++++++++++++++
 package/Config.in        |  1 +
 package/fbtft/Config.in  | 13 +++++++++++++
 package/fbtft/fbtft.mk   | 11 +++++++++++
 5 files changed, 91 insertions(+)
 create mode 100644 linux/linux-ext-fbtft.mk
 create mode 100644 package/fbtft/Config.in
 create mode 100644 package/fbtft/fbtft.mk

diff --git a/linux/Config.ext.in b/linux/Config.ext.in
index 40c4684..c31628a 100644
--- a/linux/Config.ext.in
+++ b/linux/Config.ext.in
@@ -42,4 +42,29 @@ config BR2_LINUX_KERNEL_EXT_RTAI_PATCH
 	help
 	  Optionally, explicitly specify the RTAI patch to use.
 
+# fbtft
+config BR2_LINUX_KERNEL_EXT_FBTFT
+	bool "fbtft patch"
+	select BR2_PACKAGE_FBTFT
+	help
+	  Linux Framebuffer drivers for small TFT LCD display modules,
+	  e.g. Adafruit PiTFT displays for Raspberry Pi.
+
+	  To enable fbtft, e.g. for Adafruit 2.8 PiTFT, enable the
+	  following kernel configuarations:
+	  - CONFIG_SPI: Device Drivers ---> SPI support
+	  - CONFIG_SPI_BCM2708: Device Drivers ---> SPI support
+	                           ---> BCM2708 SPI controller driver
+	  - CONFIG_GPIOLIB: Device Drivers ---> GPIO Support
+	  - CONFIG_FB: Device Drives ---> Graphics support
+	                  ---> Support for frame buffer devices
+	  - CONFIG_FB_TFT: Device Drivers ---> 
+	                     Support for small TFT LCD display modules
+	  - CONFIG_FB_TFT_ILI9341: Device Drivers --->
+	                     Support for small TFT LCD display modules --->
+	                       FB driver for the ILI9341 LCD Controller
+	  or another FB_TFT submodule corresponding to your display.
+
+	  https://github.com/notro/fbtft
+
 endmenu
diff --git a/linux/linux-ext-fbtft.mk b/linux/linux-ext-fbtft.mk
new file mode 100644
index 0000000..d555a3f
--- /dev/null
+++ b/linux/linux-ext-fbtft.mk
@@ -0,0 +1,41 @@
+################################################################################
+# Linux fbtft extensions
+#
+# Patch the linux kernel with fbtft extension
+################################################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_FBTFT),y)
+# Add dependency to fbtft package (download helper for the fbtft source)
+LINUX_DEPENDENCIES += fbtft
+
+define FBTFT_PREPARE_KERNEL
+	# for linux >= 3.15 install to drivers/video/fbdev/fbtft
+	# for linux < 3.15 install to drivers/video/fbtft
+	if [ -e $(LINUX_DIR)/drivers/video/fbdev ]; then \
+		mkdir $(LINUX_DIR)/drivers/video/fbdev/fbtft; \
+		$(INSTALL) $(FBTFT_DIR)/*.h \
+			$(FBTFT_DIR)/*.c \
+			$(FBTFT_DIR)/Makefile \
+			$(FBTFT_DIR)/Kconfig \
+			$(FBTFT_DIR)/README \
+			$(LINUX_DIR)/drivers/video/fbdev/fbtft; \
+		echo 'source "drivers/video/fbdev/fbtft/Kconfig"' \
+			>> $(LINUX_DIR)/drivers/video/fbdev/Kconfig; \
+		echo 'obj-y += fbtft/' >> $(LINUX_DIR)/drivers/video/fbdev/Makefile; \
+	else \
+		mkdir $(LINUX_DIR)/drivers/video/fbtft; \
+		$(INSTALL) $(FBTFT_DIR)/*.h \
+			$(FBTFT_DIR)/*.c \
+			$(FBTFT_DIR)/Makefile \
+			$(FBTFT_DIR)/Kconfig \
+			$(FBTFT_DIR)/README \
+			$(LINUX_DIR)/drivers/video/fbtft; \
+		echo 'source "drivers/video/fbtft/Kconfig"' \
+			>> $(LINUX_DIR)/drivers/video/Kconfig; \
+		echo 'obj-y += fbtft/' >> $(LINUX_DIR)/drivers/video/Makefile; \
+	fi
+endef
+
+LINUX_PRE_PATCH_HOOKS += FBTFT_PREPARE_KERNEL
+
+endif #BR2_LINUX_KERNEL_EXT_FBTFT
diff --git a/package/Config.in b/package/Config.in
index 3b37bb2..c658a28 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -311,6 +311,7 @@ endif
 	source "package/evemu/Config.in"
 	source "package/evtest/Config.in"
 	source "package/fan-ctrl/Config.in"
+	source "package/fbtft/Config.in"
 	source "package/fconfig/Config.in"
 	source "package/fis/Config.in"
 	source "package/flashrom/Config.in"
diff --git a/package/fbtft/Config.in b/package/fbtft/Config.in
new file mode 100644
index 0000000..eceea85
--- /dev/null
+++ b/package/fbtft/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_FBTFT
+	bool "fbtft"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Linux Framebuffer drivers for small TFT LCD display modules,
+	  e.g. Adafruit PiTFT displays for Raspberry Pi.
+
+	  This is only the download helper for the kernel patch.
+
+	  https://github.com/notro/fbtft
+
+comment "fbtft needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
diff --git a/package/fbtft/fbtft.mk b/package/fbtft/fbtft.mk
new file mode 100644
index 0000000..9f46bdb
--- /dev/null
+++ b/package/fbtft/fbtft.mk
@@ -0,0 +1,11 @@
+################################################################################
+#
+# fbtft
+#
+################################################################################
+
+FBTFT_VERSION = 274035404701245e7491c0c6471c5b72ade4d491
+FBTFT_SITE = $(call github,notro,fbtft,$(FBTFT_VERSION))
+FBTFT_LICENSE = GPLv2+
+
+$(eval $(generic-package))
-- 
2.1.2



More information about the buildroot mailing list