[RaspPi] Raspberry Pi and the ili9341 Display

https://www.youtube.com/watch?v=cEcIem6R4aQ

1.) Enable SPI
# remove or comment out the spi blacklist line
sudo nano /etc/modprobe.d/raspi-blacklist.conf

2.) Install
a) FBTFT drivers as loadable modules
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
sudo shutdown -r now

OR

b) FBTFT drivers built into the kernel proper
sudo REPO_URI=https://github.com/notro/rpi-firmware BRANCH=builtin rpi-update
sudo shutdown -r now

3.) Install the frame buffer driver (as root):
apt-get install xserver-xorg-video-fbdev

4.) Configure frame buffer driver:
sudo vi /usr/share/X11/xorg.conf.d/99-fbdev.conf
Section "Device"
Identifier "myfb"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
EndSection

5.) add Autostart:
( the gpios= Pins need to be changed to YOUR specification and connection! )
sudo vi /etc/modules
fbtft_device custom name=tm022hdh26 gpios=reset:25,led:23,dc:24 rotate=90 bgr=1
#on my selfbuild shield
#from usb -> sd card laengs
#fbtft_device custom name=tm022hdh26 gpios=reset:25,led:23,dc:24 rotate=180 bgr=1
#from cinch -> hdmi quer
#fbtft_device custom name=tm022hdh26 gpios=reset:25,led:23,dc:24 rotate=270 bgr=1

6.) add Auto login:
sudo vi /etc/inittab
#1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1

7.) add Autostart X:
sudo vi /etc/rc.local
su -l pi -c "env FRAMEBUFFER=/dev/fb1 startx &"

8.) Console at boot
Add kernel argument to file /boot/cmdline.txt
fbcon=map:10

Infos taken from:
https://github.com/notro/fbtft/wiki#install
http://marcosgildavid.blogspot.de/2014/02/getting-ili9341-spi-screen-working-on.html

Video was played with this worm-of-a-command-string:
sudo mplayer -nolirc -vo fbdev2:/dev/fb1 -fs -x 320 -y 240 -zoom -framedrop -lavdopts lowres=1:fast:skiploopfilter=all ~/BadApple.avi

[RaspPi] Build Raspberry Pi Kernel 3.10 / NEXT for Debian Wheezy / Raspbian with eGalax Touchscreen Support on Ubuntu 12.04

This is about building the latest Kernel / 3.10 for RPi. Bleeding Edge.
# Preperations
sudo apt-get install git libncurses5 libncurses5-dev qt4-dev-tools qt4-qmake pkg-config build-essential gcc-arm-linux-gnueabi bc
# NEEDS BC!!!!

# Clone Stuff
mkdir rpi_kernel_10
cd rpi_kernel_10
git clone https://github.com/raspberrypi/tools.git
git clone https://github.com/raspberrypi/linux.git
cd ~/rpi_kernel_10/linux/.git
git branch -a
cd ~/rpi_kernel_10/linux
git checkout -t -b rpi-3.10.y remotes/origin/rpi-3.10.y
git pull
cd ~/rpi_kernel_10
git clone https://github.com/raspberrypi/firmware.git
cd ~/rpi_kernel_10/firmware/.git
git branch -a
cd ~/rpi_kernel_10/firmware
git checkout -t -b next remotes/origin/next
git pull
cd ~/rpi_kernel_10

# Make Kernel
cd linux
make mrproper
mkdir ../kernel
# Kernel Types
# find . -name *bcmrpi*config -print
# ./arch/arm/configs/bcmrpi_emergency_defconfig
# ./arch/arm/configs/bcmrpi_defconfig
# ./arch/arm/configs/bcmrpi_cutdown_defconfig
make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- bcmrpi_defconfig
make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig #xconfig
#Device Drivers->Input Device Support->TouchScreens->USB Touchscreen Driver (Build it into or as module, check if eGalax here!)
make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j3
cd ../
cd tools/mkimage
./imagetool-uncompressed.py ../../kernel/arch/arm/boot/Image
cd ../../

# Make Modules
cd kernel
mkdir ../modules/
make modules_install ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=../modules/
# Install Kernel on existing RPi SD Card / Raspbian
# mount sdcard in your Ubuntu (I made an folder sdb1 for boot partiton and sdb2 for the root partition)
cd ~
mkdir sdb1 sdb2
mount /dev/sdb1 sdb1
mount /dev/sdb2 sdb2

# boot partition
#replace /sdb1/boot/bootcode.bin with rpi_kernel_10/firmware/boot/bootcode.bin
sudo rm ~/sdb1/bootcode.bin
cp ~/rpi_kernel_10/firmware/boot/bootcode.bin ~/sdb1/
#replace /sdb1/boot/kernel.img with the previously created kernel image
sudo rm ~/sdb1/kernel.img
cp ~/rpi_kernel_10/tools/mkimage/kernel.img ~/sdb1/
#replace /sdb1/boot/start.elf with rpi_kernel_10/firmware/boot/start.elf
sudo rm ~/sdb1/start.elf
cp ~/rpi_kernel_10/firmware/boot/start.elf ~/sdb1/

# root partition
#replace /sdb2/lib/firmware with <modules_builded_above_folder>/lib/firmware
sudo rm -rf ~/sdb2/lib/firmware/
sudo cp -a ~/rpi_kernel_10/modules/lib/firmware/ ~/sdb2/lib/
#replace /sdb2/lib/modules with <modules_builded_above_folder>/lib/modules
sudo rm -rf ~/sdb2/lib/modules/
sudo cp -a ~/rpi_kernel_10/modules/lib/modules/ ~/sdb2/lib/
#replace /sdb2/opt/vc with firmware-next/hardfp/opt/vc/
sudo rm -rf ~/sdb2/opt/vc
sudo cp -a ~/rpi_kernel_10/firmware/hardfp/opt/vc/ ~/sdb2/opt/

# sync usb mount
sync

# Unmount sdcard
cd ~
umount sdb1
umount sdb2
# Boot Pi and calibrate Touchscreen
# This stuff happens on the Pi!
# Preperations
sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev

# Install Tool / xinput_calibrator
cd ~
wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz
tar -xvzf xinput_calibrator-0.7.5.tar.gz
cd xinput_calibrator-0.7.5
./configure
make
sudo make install

# Calibrate (in Xserver, so open Terminal while beeing in Graphical User Mode)
xinput_calibrator

It will give output like this:
Calibrating EVDEV driver for "eGalax Inc. USB TouchController" id=8
current calibration values (from XInput): min_x=1938, max_x=114 and min_y=1745, max_y=341

Doing dynamic recalibration:
Setting new calibration data: 121, 1917, 317, 1741
--> Making the calibration permanent <--
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'
Section "InputClass"
Identifier "calibration"
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "121 1917 317 1741"
Option "SwapAxes" "1"
EndSection

Use the Output after "--> Making the calibration permanent <--
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'"
And copy the part after that into following file:

sudo mkdir /etc/X11/xorg.conf.d
sudo vi /etc/X11/xorg.conf.d/01-input.conf

After that, save, exit and reboot.
That should conclude your newly "Custom baked Kernel" and your EGalax Touchscreen Support.

Thanks a lot to http://engineering-diy.blogspot.de/2013/01/adding-7inch-display-with-touchscreen.html

Raspberry Pi Kernel Compile


and http://karuppuswamy.com/wordpress/2013/01/17/how-to-get-evtouch-touch-screen-kit-working-in-linux/
from which I learnt and borrowed most of the stuff and tips and rewrote this How To with minor changes
Upgrade
cd linux
make mrproper
git pull
cd ../tools
git pull
cd ../firmware
git pull

[RaspPi] Build Raspberry Pi Kernel for Debian Wheezy / Raspbian with eGalax Touchscreen Support on Ubuntu 12.04

# Preperations
sudo apt-get install git libncurses5 libncurses5-dev qt4-dev-tools qt4-qmake pkg-config build-essential gcc-arm-linux-gnueabi bc

# Clone Stuff
mkdir rpi_kernel
cd rpi_kernel
git clone https://github.com/raspberrypi/tools.git
git clone https://github.com/raspberrypi/linux.git
git clone https://github.com/raspberrypi/firmware.git
cd ~/rpi_kernel/firmware/.git
git branch -a
cd ~/rpi_kernel/firmware
git checkout -t -b next remotes/origin/next
git pull
cd ~/rpi_kernel

# Make Kernel
cd linux
make mrproper
mkdir ../kernel
# Kernel Types
# find . -name *bcmrpi*config -print
# ./arch/arm/configs/bcmrpi_emergency_defconfig
# ./arch/arm/configs/bcmrpi_defconfig
# ./arch/arm/configs/bcmrpi_cutdown_defconfig
make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- bcmrpi_defconfig
make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig #xconfig
#Device Drivers->Input Device Support->TouchScreens->USB Touchscreen Driver (Build it into or as module, check if eGalax here!)
make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j3
cd ../
cd tools/mkimage
./imagetool-uncompressed.py ../../kernel/arch/arm/boot/Image
cd ../../

# Make Modules
cd kernel
mkdir ../modules/
make modules_install ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=../modules/
# Install Kernel on existing RPi SD Card / Raspbian
# mount sdcard in your Ubuntu (I made an folder sdb1 for boot partiton and sdb2 for the root partition)
cd ~
mkdir sdb1 sdb2
mount /dev/sdb1 sdb1
mount /dev/sdb2 sdb2

# backup config
cp ~/sdb1/config.txt ~/rpi_kernel/
# boot partition
sudo rm -rf ~/sdb1/*
# Copy all Files from boot
cp -R ~/rpi_kernel/firmware/boot/* ~/sdb1/
#replace /sdb1/boot/kernel.img with the previously created kernel image
sudo rm ~/sdb1/kernel.img
cp ~/rpi_kernel/tools/mkimage/kernel.img ~/sdb1/
# restore config
cp ~/rpi_kernel/config.txt ~/sdb1/

# root partition
#replace /sdb2/lib/firmware with <modules_builded_above_folder>/lib/firmware
sudo rm -rf ~/sdb2/lib/firmware/
sudo cp -R ~/rpi_kernel/modules/lib/firmware/ ~/sdb2/lib/
#replace /sdb2/lib/modules with <modules_builded_above_folder>/lib/modules
sudo rm -rf ~/sdb2/lib/modules/
sudo cp -R ~/rpi_kernel/modules/lib/modules/ ~/sdb2/lib/
#replace /sdb2/opt/vc with firmware-next/hardfp/opt/vc/
sudo rm -rf ~/sdb2/opt/vc
sudo cp -R ~/rpi_kernel/firmware/hardfp/opt/vc/ ~/sdb2/opt/

# sync usb mount
sync

# Unmount sdcard
cd ~
umount sdb1
umount sdb2
# Boot Pi and calibrate Touchscreen
# This stuff happens on the Pi!
# Preperations
sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev

# Install Tool / xinput_calibrator
cd ~
wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz
tar -xvzf xinput_calibrator-0.7.5.tar.gz
cd xinput_calibrator-0.7.5
./configure
make
sudo make install

# Calibrate (in Xserver, so open Terminal while beeing in Graphical User Mode)
xinput_calibrator

It will give output like this:
Calibrating EVDEV driver for "eGalax Inc. USB TouchController" id=8
current calibration values (from XInput): min_x=1938, max_x=114 and min_y=1745, max_y=341

Doing dynamic recalibration:
Setting new calibration data: 121, 1917, 317, 1741
--> Making the calibration permanent <--
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'
Section "InputClass"
Identifier "calibration"
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "121 1917 317 1741"
Option "SwapAxes" "1"
EndSection

Use the Output after "--> Making the calibration permanent <--
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'"
And copy the part after that into following file:

sudo mkdir /etc/X11/xorg.conf.d
sudo vi /etc/X11/xorg.conf.d/01-input.conf

After that, save, exit and reboot.
That should conclude your newly "Custom baked Kernel" and your EGalax Touchscreen Support.

Thanks a lot to http://engineering-diy.blogspot.de/2013/01/adding-7inch-display-with-touchscreen.html

Raspberry Pi Kernel Compile


and http://karuppuswamy.com/wordpress/2013/01/17/how-to-get-evtouch-touch-screen-kit-working-in-linux/
from which I learnt and borrowed most of the stuff and tips and rewrote this How To with minor changes
Upgrade
cd linux
make mrproper
git pull
cd ../tools
git pull
cd ../firmware
git pull
# then make and build like shown above

Check hard/softfp version of OS
${CCPREFIX}gcc -v 2>&1 | grep hard