Out of tree build - notro/fbtft GitHub Wiki

It is possible to build FBTFT out-of-tree if the prerequisites are met:

	depends on FB && SPI && GPIOLIB
	select FB_SYS_FILLRECT
	select FB_SYS_COPYAREA
	select FB_SYS_IMAGEBLIT
	select FB_SYS_FOPS
	select FB_DEFERRED_IO
	select FB_BACKLIGHT

FB_BACKLIGHT is optional

Thanks to wrobell and mweal-ed for making this happen.

Beagle Bone Black

Prebuilt modules from this example: fbtft-2014-02-07-3.8.13-bone50.tar.gz

I'm using BBB as an example.

Debian image used:

Expand filesystem

Ref: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Expanding_File_System_Partition_On_A_microSD

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          1.6G  1.5G  3.4M 100% /

$ cd /opt/scripts/tools/
$ git pull

# ignore error message: The command to re-read the partition table failed.
$ sudo ./grow_partition.sh

# this takes a little longer than usual
$ sudo reboot

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          3.6G  1.5G  2.0G  43% /

Prerequisites

$ zgrep -E "CONFIG_SPI=|CONFIG_GPIOLIB=|DEFERRED|FB_SYS_|FB_BACKLIGHT" /proc/config.gz
CONFIG_SPI=y
CONFIG_GPIOLIB=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_DEFERRED_IO=y

FB_BACKLIGHT is missing, which disables the builtin FBTFT backlight handling.

Kernel headers

Ref: http://dumb-looks-free.blogspot.fr/2014/06/beaglebone-black-bbb-kernal-headers.html

Install kernel source

$ wget https://raw.github.com/gkaindl/beaglebone-ubuntu-scripts/master/bb-get-rcn-kernel-source.sh
$ chmod +x bb-get-rcn-kernel-source.sh
$ sudo ./bb-get-rcn-kernel-source.sh

I had to change EXTRAVERSION to have the modules end up in the right directory when doing make install later.

$ uname -r
3.8.13-bone50
$ cd /usr/src/linux-3.8.13-bone50/
$ sudo nano Makefile
EXTRAVERSION = -bone50

# not sure if this is needed, didn't take the time to find out
$ sudo make prepare

FBTFT

Fetch FBTFT source, build and install drivers

$ cd
$ git clone https://github.com/notro/fbtft
$ cd fbtft
$ make
$ sudo make install
# I don't know why this is needed (it has been run by the previous make command)
$ sudo depmod
# modules should end up here
$ ls -l /lib/modules/3.8.13-bone50/extra/

Load driver

# enable SPI
$ echo BB-SPIDEV0 | sudo tee /sys/devices/bone_capemgr.*/slots
BB-SPIDEV0
$ ls -l /dev/spi*
crw-rw---T 1 root spi 153, 1 Jul  2 15:01 /dev/spidev1.0
crw-rw---T 1 root spi 153, 0 Jul  2 15:01 /dev/spidev1.1
# I didn't test this with a display, only tested to see if the driver would load
$ sudo modprobe fbtft_device name=hy28b busnum=1 #gpios=reset:XX
$ dmesg | tail
<snip>
[74822.230273] graphics fb1: fb_ili9325 frame buffer, 240x320, 150 KiB video memory, 4 KiB DMA buffer memory, fps=51, spi1.0 at 48 MHz

ADS7846

While we're at it, let's look at the ads7846 touch driver as well.
This kernel has ads7846 builtin, but the driver doesn't have Device Tree support (kernel is 3.8.13, DT support added in 3.11).
To remedy this we use ads7846_device.

$ git clone https://github.com/notro/fbtft_tools
$ cd fbtft_tools/ads7846_device/
$ make
$ sudo make install
$ sudo depmod

# example
$ sudo modprobe ads7846_device busnum=1 gpio_pendown=117 x_plate_ohms=100 pressure_max=255
$ dmesg
[   82.150530] edma-dma-engine edma-dma-engine.0: allocated channel for 0:45
[   82.150702] edma-dma-engine edma-dma-engine.0: allocated channel for 0:44
[   82.151310] spi1.1 supply vcc not found, using dummy regulator
[   82.156800] ads7846 spi1.1: touchscreen, irq 245
[   82.162215] input: ADS7846 Touchscreen as /devices/ocp.3/481a0000.spi/spi_master/spi1/spi1.1/input/input3
⚠️ **GitHub.com Fallback** ⚠️