Build fbtft drivers for Linux 4.4 on BeagleBone Black

Build fbtft drivers for Linux 4.4 kernel so that BeagleBone Black can use TFT LCD connected via SPI as Framebuffer

Build fbtft drivers for Linux 4.4 on BeagleBone Black

Posted by Angel on 2015-12-02T01:28:45-05:00

small_linus.jpg

In previous blog posts, I’ve showed how to use small LCD displays as a Linux framebuffer on the BeagleBone Black thanks to the fbtft drivers:

In this post, I will show how to use fbtft drivers on BBB with the latest version of the Linux kernel.  In this case, that is Linux 4.4.

Full transcript in this GitHub Gist.

Step 1: Build kernel

Clone Robert C. Nelson’s bb-kernel repo and checkout the am33x-v4.4 branch.  When I did last week, the latest kernel version was 4.4-rc1-bone0:

laptop$ git clone https://github.com/RobertCNelson/bb-kernel

laptop$ cd bb-kernel/

laptop$ git checkout am33x-v4.4

laptop$ ./build_kernel.sh

The build kernel script will at some point open the kernel config menu system.  Enable Device Drivers->Staging->fbtft:

a.png

b.png

c.png

d.png

 

 

Step 2: Install kernel

Flash latest Debian 8.2 (Jessie) console image for the BBB:

laptop$ wget https://rcn-ee.com/rootfs/bb.org/testing/2015-11-15/console/bone-debian-8.2-console-armhf-2015-11-15-2gb.img.xz

laptop$ xz -d bone-debian-8.2-console-armhf-2015-11-15-2gb.img.xz

laptop$ sudo dd if=/home/afustini/Downloads/bbb-images/bone-debian-8.2-console-armhf-2015-11-15-2gb.img.xz of=/dev/sdc

laptop$ sudo eject /dev/sdc

Remove and re-insert so that fs gets mounted.  Run this from bb-kernel directory:

laptop$ ./tools/install_kernel.sh

Eject card and boot the BeagleBone with it.  Once booted, grow the filesystem to make use of free space on the card:

bone$ sudo /opt/scripts/tools/grow_partition.sh

bone$ sudo reboot

Finish installation of the new kernel on the BeagleBone.  The install script fails to do this.  In this case, my new kernel is 4.4.0-rc1-bone0:

bone$ sudo cp -pr /dtbs /boot/dtbs/4.4.0-rc1-bone0

bone$ sudo cp /zImage /boot/vmlinuz-4.4.0-rc1-bone0

Edit /boot/uEnv.txt on Beaglebone so that the new kernel is booted:

bone$ sudo vi /boot/uEnv.txt

uname_r=4.4.0-rc1-bone0

dtb=am335x-boneblack-overlay.dtb

bone$ sudo reboot

Verify the the BeagleBone booted the new kernel:

bone$ uname -a

Linux beaglebone 4.4.0-rc1-bone0 #4 Thu Nov 19 20:26:04 CST 2015 armv7l GNU/Linux

Step 3: Configure SPI

Build the latest Device Tree Overlays:

bone$ sudo apt-get update

bone$ sudo apt-get install git

bone$ git clone https://github.com/beagleboard/bb.org-overlays

bone$ cd bb.org-overlays

bone$ ./dtc-overlay.sh

bone$ ./install.sh

 

Load the Device Tree Overlay for BB-SPIDEV1 “virtual cape” as my LCD is wired up to spi1 pins:

bone$ cat /sys/devices/platform/bone_capemgr/slots

0: PF—-  -1

1: PF—-  -1

2: PF—-  -1

3: PF—-  -1

 

bone$ sudo /bin/sh -c ‘echo BB-SPIDEV1 > /sys/devices/platform/bone_capemgr/slots’

 

bone$ cat /sys/devices/platform/bone_capemgr/slots

0: PF—-  -1

1: PF—-  -1

2: PF—-  -1

3: PF—-  -1

4: P-O-L-  0 Override Board Name,00A0,Override Manuf,BB-SPIDEV1

Step 4: Load fbtft drivers

Load fbtft_device module for adafruit18 (Adafruit 1.8″ TFT LCD) which will use the fb_st7735r driver:

bone$ sudo modprobe fbtft_device busnum=1 name=adafruit18 debug=7 verbose=3 gpios=dc:48,reset:60

 

Display image on the LCD display:

bone$ sudo apt-get install fbi

bone$ wget ‘http://beagleboard.org/static/uploads/BorisTux_w_Logo.png

bone$ sudo fbi -d /dev/fb0 -T 1 -a BorisTux_w_Logo.png

Comments are not currently available for this post.