-
Notifications
You must be signed in to change notification settings - Fork 2
FBTFT image build process
This shows the steps used to make the prebuilt FBTFT images. All done on the Raspberry Pi itself.
Start with a fresh image: 2013-05-25-wheezy-raspbian
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% /
sudo apt-get update
sudo apt-get -y install git libncurses5-dev zip kpartx
''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 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
SPI is disabled on this distro. Comment out blacklisting.
Edit file /etc/modprobe.d/raspi-blacklist.conf
#blacklist spi-bcm2708
We will use rpi-update to update the firmware on the new image, but we want to store the repo locally.
Edit /usr/bin/rpi-update
# Change this line
-FW_REPOLOCAL="${ROOT_PATH}/root/.rpi-firmware"
+FW_REPOLOCAL=${FW_REPOLOCAL:-"${ROOT_PATH}/root/.rpi-firmware"}
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
The SPI controller driver spi-bcm2708
puts a restriction on the available speed choices (more).
Edit ~/linux/drivers/spi/spi-bcm2708.c
- Enable debug output
- Remove roundup_pow_of_two()
diff --git a/drivers/spi/spi-bcm2708.c b/drivers/spi/spi-bcm2708.c
index 1744c1e..5a81b15 100644
--- a/drivers/spi/spi-bcm2708.c
+++ b/drivers/spi/spi-bcm2708.c
@@ -1,3 +1,4 @@
+#define DEBUG
/*
* Driver for Broadcom BCM2708 SPI Controllers
*
@@ -235,9 +236,6 @@ static int bcm2708_setup_state(struct spi_master *master,
} else if (hz) {
cdiv = DIV_ROUND_UP(bus_hz, hz);
- /* CDIV must be a power of 2, so round up */
- cdiv = roundup_pow_of_two(cdiv);
-
if (cdiv > 65536) {
dev_dbg(dev,
"setup: %d Hz too slow, cdiv %u; min %ld Hz\n",
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 device adder module
Device Drivers ---> Graphics support --->
<M> Module for adding an ads7846 device
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
# 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)
sudo make modules_install
# Install kernel
sudo make zinstall
# Reboot into the new kernel
sudo shutdown -r now
cd
git clone https://github.com/notro/fbtft_tools.git
cd ~/fbtft_tools/gpio_keys_device; make && sudo make install
cd ~/fbtft_tools/gpio_mouse_device; make && sudo make install
Set variables
IMAGE=2013-05-25-wheezy-raspbian
FBTFT=2013-07-07-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 FW_REPOLOCAL=/root/.rpi-firmware rpi-update
Copy kernel and modules into image
sudo cp /boot/kernel.img /media/bootfs/
sudo rm -R /media/rootfs/lib/modules/$(uname -r)
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 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)