Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

FBTFT image build process

notro edited this page Jul 27, 2014 · 14 revisions

Note: This is obsolete. fbtft-spindle is used now.

This shows the steps used to make the prebuilt FBTFT images. All done on the Raspberry Pi itself.

Start with a fresh image: 2013-12-20-wheezy-raspbian

Preparation

Expand root file system size.

sudo raspi-config
# expand_rootfs

Disk space needed: src,build 1.0 GB + zip,image 2.8 GB = 3.8 GB

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           15G  1.4G   13G  11% /

Setup

sudo apt-get update
sudo apt-get -y install git bc libncurses5-dev zip kpartx

Update rpi-update

sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update

Source

Kernel source.
We don't need the complete git history (--depth 1). This will speed things up considerly.

cd
git clone --depth 1 git://github.com/raspberrypi/linux.git

DMA capable SPI master driver

wget -O ~/linux/drivers/spi/spi-bcm2708.c https://raw.github.com/notro/spi-bcm2708/master/spi-bcm2708.c

FBTFT source

cd linux/drivers/video/
git clone https://github.com/notro/fbtft.git

# Let make/kbuild see the directory and config options.
echo "obj-y += fbtft/" >> Makefile
sed -i 's/endmenu/source "drivers\/video\/fbtft\/Kconfig"\n\nendmenu/' Kconfig

Configuration

Use default config

cd ~/linux && make bcmrpi_defconfig

Start kernel configuration program

make menuconfig

Enable FBTFT as modules

Device Drivers  ---> Graphics support  --->
<M> Support for small TFT LCD display modules (NEW)  --->  

--- Support for small TFT LCD display modules
Enable all as modules

Framebuffer Console Config Enable rotation and include all fonts

Device Drivers  ---> Graphics support  ---> Console display driver support  --->  

<*> Framebuffer Console support
[ ]   Map the console to the primary display device
[*]   Framebuffer Console Rotation
[*] Select compiled-in fonts
[*]   VGA 8x8 font
-*-   VGA 8x16 font
[*]   Mac console 6x11 font (not supported by all drivers)
[*]   console 7x14 font (not supported by all drivers)
[*]   Pearl (old m68k) console 8x8 font
[*]   Acorn console 8x8 font
[*]   Mini 4x6 font
[*] Sparc console 8x16 font
[*] Sparc console 12x22 font (not supported by all drivers)
[*] console 10x18 font (not supported by all drivers)

Touch screen support

Device Drivers  ---> Input device support  --->
[*]   Touchscreens  --->

--- Touchscreens
<M>   ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens

gpio_mouse

Device Drivers  ---> Input device support  --->
[*]   Mice  --->

 --- Mice
< >   PS/2 mouse (NEW)
< >   Serial mouse (NEW)
< >   Apple USB Touchpad support (NEW)
< >   Apple USB BCM5974 Multitouch trackpad support (NEW)
< >   DEC VSXXX-AA/GA mouse and VSXXX-AB tablet (NEW)
<M>   GPIO mouse (NEW)
< >   Synaptics I2C Touchpad support (NEW)
< >   Synaptics USB device support (NEW)

gpio_keys & gpio_keys_polled

Device Drivers  ---> Input device support  --->
[*]   Keyboards  --->

--- Keyboards
<M>   GPIO Buttons
<M>   Polled GPIO buttons

Build

# This takes 8-9 hours
make

Tip:
I run this command on a laptop through SSH. Some time after the laptop goes to sleep, the SSH connection terminates and the build process stops. To alleviate this I use screen (terminal multiplexer)

Install

# Install modules
sudo make modules_install

# Install kernel
sudo cp --preserve=timestamps ~/linux/arch/arm/boot/zImage /boot/kernel.img

# Reboot into the new kernel
sudo shutdown -r now

Install helper modules

cd
git clone https://github.com/notro/fbtft_tools.git
cd ~/fbtft_tools/ads7846_device; make && sudo make install
cd ~/fbtft_tools/gpio_keys_device; make && sudo make install
cd ~/fbtft_tools/gpio_mouse_device; make && sudo make install

Image

Set variables

IMAGE=2013-12-20-wheezy-raspbian
FBTFT=2014-01-03-fbtft

Copy $IMAGE.zip to working dir (Tunnelier is free for Windows)

Unzip

unzip $IMAGE.zip

Rename image

mv $IMAGE.img $IMAGE-$FBTFT.img

Mount image partitions

sudo mkdir /media/{bootfs,rootfs}
sudo losetup /dev/loop0 $IMAGE-$FBTFT.img
sudo kpartx -a /dev/loop0
sudo mount /dev/mapper/loop0p1 /media/bootfs
sudo mount /dev/mapper/loop0p2 /media/rootfs

Update firmware

sudo UPDATE_SELF=0 SKIP_KERNEL=1 ROOT_PATH=/media/rootfs BOOT_PATH=/media/bootfs WORK_PATH=~/rpi-firmware rpi-update

Copy kernel and modules into image

sudo cp --preserve=timestamps /boot/kernel.img /media/bootfs/
sudo rm -R /media/rootfs/lib/modules/*
sudo cp -R /lib/modules/$(uname -r) /media/rootfs/lib/modules/

Copy files needed for development

mkdir /media/rootfs/home/pi/extra
cp ~/linux/{.config,Module.symvers} /media/rootfs/home/pi/extra

Uncomment SPI blacklisting

sudo nano /media/rootfs/etc/modprobe.d/raspi-blacklist.conf

Fix X windows issue
Disable option in /media/rootfs/usr/share/X11/xorg.conf.d/99-fbturbo.conf

#        Option          "fbdev" "/dev/fb0"

Unmount partitions

sudo umount /media/bootfs
sudo umount /media/rootfs
sudo kpartx -d /dev/loop0
sudo losetup -d /dev/loop0

Zip up image

# Takes approx. 45 minutes
zip $IMAGE-$FBTFT.zip $IMAGE-$FBTFT.img

![piwik](https://tronnes-org.secure.domeneshop.no/piwik/piwik.php?idsite=5&rec=1&action_name=FBTFT image_build_process)

Clone this wiki locally