[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

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

  1. Well, I just mount both partitions at this part:
    # 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

    I go to the home directory, create two folders and mount both sdcard partitions (/dev/sdb1 and 2) to the created folders.
    However, depending on your system, the sdcard reader could be at another place like /dev/sdc1 and 2 and such. (1 is partiton 1, 2 the second one)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.