[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

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

  1. HI, I have done this up to where I need to insert the SD Card back into the pi, touch screen is working now but I have another problem, now I don't have any network interface working not my wireless nor my Ethernet, what have I done wrong or is there a way to fix this without internet connection. please any help will be appreciated.

  2. Best bet would be to check your ifconfig and /etc/network/interfaces
    If you can't see an eth0 Interface on ifconfig, then your /etc/network/interfaces could be faulty.

    It should look something like that:

    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp

    Other than that, maybe something went wrong with the ethernet drivers.
    You could check the output of dmesg | grep smsc
    That would show you if the ethernet interface got recognized.
    If that was successful, you should get an output similar to this:

    [ 0.782237] usbcore: registered new interface driver smsc95xx
    [ 2.188173] smsc95xx v1.0.4
    [ 2.250670] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet,
    [ 18.879854] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
    [ 20.509174] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

    Best of luck

Leave a Reply

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