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 May 9, 2013 · 14 revisions

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

Starting with a fresh image.

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 libncurses5-dev zip kpartx

Enable: make zinstall

''make zinstall'' won't work out of the box. One piece is missing.
''/sbin/installkernel'' needs a script to copy the kernel to /boot.

This is a simple solution with the caveat that ''make install'' will actually do ''zinstall''

Create directory

sudo mkdir -p /etc/kernel/postinst.d/

Create file /etc/kernel/postinst.d/kernel_img

#!/bin/sh

ver="$1"
img="$2"

exec </dev/null >&2

# backup current kernel
mv /boot/kernel.img /boot/kernel_last.img

# fat doesn't support symlinks
mv $img /boot/kernel.img

Make the file execuable

sudo chmod +x /etc/kernel/postinst.d/kernel_img

Enable SPI

SPI is disabled on this distro. Comment out blacklisting.

Edit file /etc/modprobe.d/raspi-blacklist.conf

#blacklist spi-bcm2708

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

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

# Make the header file available to the platform file
ln fbtft/fbtft.h ../../include/linux/fbtft.h

Configuration

Use configuration from the running kernel

cd ~/linux
zcat /proc/config.gz > .config

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

ADS7846 test module

Device Drivers  ---> Graphics support  --->
<M> ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens, MODIFIED for testing

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

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

sudo make modules_install

# Install kernel
sudo make zinstall

# Reboot into the new kernel
sudo shutdown -r now

Image

Set variables

IMAGE=2013-02-09-wheezy-raspbian
FBTFT=2013-05-07-fbtft
KVER=3.6.11+

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

Copy kernel and modules into image

sudo cp /boot/kernel.img /media/bootfs/
sudo rm -R /media/rootfs/lib/modules/$KVER
sudo cp -R /lib/modules/3.6.11+ /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 the SPI blacklisting

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

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. 30 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