Thursday, December 12. 2013
Cross Compiling The RaspberryPi Linux Kernel
These are a jumbled set of notes as I worked my way through downloading and building the Pi linux kernel from source code.
References
#ref: http://blog.eihis.com/?p=423
#ref: http://simonthepiman.com/how_to_setup_windows_file_server.php
#ref: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=57401
#ref: http://elinux.org/RPi_Kernel_Compilation#Get_the_kernel_source
On Pi
apt-get update
apt-get dist-upgrade
apt-get install build-essential
apt-get install module-assistant
m-a prepare
wget http://blog.eihis.com/wp-content/uploads/2013/07/linux-headers-3611_3611-2_armhf.deb
dpkg -i http://blog.eihis.com/wp-content/uploads/2013/07/linux-headers-3611_3611-2_armhf.deb
ln -s /usr/src/linux-headers-3.6.11+ /lib/modules/3.6.11+/src
ln -s /usr/src/linux-headers-3.6.11+ /lib/modules/3.6.11+/build
apt-get install samba
apt-get install samba-common-bin
m-a prepare
On Ubuntu
git clone -b rpi-3.10.y https://github.com/raspberrypi/linux.git
cd linux
git checkout master
git checkout rpi-3.6.y
export KERNEL_SRC=/home/robert/raspberry-pi/src/linux/
cd /home/robert/raspberry-pi/
git clone https://github.com/raspberrypi/tools
export CCPREFIX=/home/robert/raspberry-pi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-
cd /home/robert/raspberry-pi/src/linux/
make mrproper
scp root@192.168.10.31:/proc/config.gz ./
gunzip config
mv config .config
make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig
make ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig
export MODULES_TEMP=/home/robert/raspberry-pi/modules/
make ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP} modules_install
cd /home/robert/raspberry-pi/tools/mkimage
./imagetool-uncompressed.py ${KERNEL_SRC}/arch/arm/boot/zImage
cd /home/robert/raspberry-pi/modules/lib/
tar -czvpf firmware+modules.tar.gz ./firmware ./modules
scp firmware+modules.tar.gz root@192.168.10.31:/lib/
On Pi
cd /boot
mv kernel.img kernel_original.img
mv fixup.dat fixup_original.dat
mv start.elf start_original.elf
mv bootcode.bin bootcode_original.bin
cd /opt
tar -czvpf vc_original.tar.gz ./vc
rm -fR vc
cd /lib
tar -czvpf firmware+modules_original.tar.gz ./firmware ./modules
tar -xzvpf firmware+modules.tar.gz
On Host
cd /home/robert/raspberry-pi/
git clone https://github.com/raspberrypi/firmware
cd /home/robert/raspberry-pi/firmware
git checkout next # d4f5315cfac4e was current on my pi before being overwrit
cd /home/robert/raspberry-pi/firmware/boot
scp bootcode.bin fixup.dat start.elf root@192.168.10.31:/boot/
cd /home/robert/raspberry-pi/tools/mkimage
scp kernel.img root@192.168.10.31:/boot/
${CCPREFIX}gcc -v 2>&1 | grep hard # check for hard float, even though came back as soft it looks like the board need hard!
cd /home/robert/raspberry-pi/firmware/hardfp/opt
tar -czvpf vc-hard.tar.gz ./vc
scp vc-hard.tar.gz root@192.168.10.31:/opt/
On Pi
cd /opt
tar -xzvpf vc-hard.tag.gz
Update
# I packaged up the linux kernel source and moved them to the pi and compiled locally
On Host
cd /home/robert/raspberry-pi/src
tar -czvpf linux.tar.gz ./linux
mkdir tmp
cd tmp
tar -xzvpf ../linux.tar.gz
cd linux
make mrproper
rm -fR ./.git
rm ./.gitignore
cd ..
tar -czvpf linux.tar.gz ./linux
scp linux.tar.gz root@192.168.10.31:/usr/src/
On Pi
cd /usr/src
rm linux
tar -xzvpf ../linux.tar.gz
cd linux
cp /proc/config.gz .config.gz
gunzip .config.gz
apt-get install ncurses-dev
make oldconfig
make menuconfig
make # commenced at 12:52 (13:10 for cross host)
... Robert
(Page 1 of 1, totaling 1 entries)