Compiling the Pi Kernel.. My Way..
This is how I compile ARM kernels. There are other ways of doing this, but this works, for me..
First – I should mention – Read the Wicki! This is at http://elinux.org/R-Pi_Hub
After getting the ‘forked’ kernel I then had to obtain a suitable config file, which included the necessary extra items for the Pi Broadcom chipset.. Brief details are on the RPi wiki, at http://elinux.org/RPi_Kernel_Compilation.
According to the details elsewhere in the Wicki, the LAN chipset is SMSC LAN9512, and this is already selected, as ‘SMSC LAN95XX based USB 2.0 10/100 ethernet devices’ under ‘USB Network Adapters’..
Using the armv7xx cross-compiler already mentioned in an earlier post, the compilation was straightforward, and I then created the uImage boot image using # make uImage..
I – personally – didn’t use the method for cross-compilation mentioned in the Wicki, but instead modified the top-level Makefile, as I wanted the modules etc. to be resident in a local directory..
First, unpack the kernel source (from github..) in its own directory (raspberrypi-319 in the example below..).
I changed the unpacked kernel source directory name to something more appropriate (linux-3.1.9pi in the example below)
Then create a ‘lib’ (sub)directory there.
Then edit the Makefile, as follows (changing the armvxx……. description to suite your particular cross-compiler installation, if different..)
around line 195: change: ARCH ?= $(SUBARCH) CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) to: ARCH ?= arm CROSS_COMPILE ?= armv7l-mandriva-linux-gnueabi- -------------------------------------------------^ Don't forget the dash at the end, so the script will find the correct version of gcc.. To install modules etc. locally - under the ../lib directory, edit Makefile: around line 681: change: export INSTALL_PATH ?= /boot to: export INSTALL_PATH ?= ../boot and add: export INSTALL_MOD_PATH ?= ../ - then run # make xconfig (or whatever you prefer...) # make and.. # make modules_install
Do Not run # make install!
Update:
The Pi uses a kernel.img file, along with some binary ‘firmware’ files (for the GPU) and config files, residing in the fat partition. More details of this – and how to create the kernel.img file, will be in a separate post..
So, the whole kernel (compiled) source / lib / kernel.img package directory structure looks like:
raspberrypi-319 | | | | | tools (containing kernel.img file) | | | linux-3.1.9pi (containing compiled kernel source) | lib (containing modules and firmware directories created by the kernel compilation)
Then just tar up the raspberrypi-319 directory and contents, and ftp it to the Pi, then untar, and copy/move the bits to their correct destination, and copy the kernel.img file to the (FAT) partition, to be accessed by the bootloader….
Of course, I now have to wait for the Raspberry Pi hardware to arrive, to test this!
Usual disclaimer – This worked on my system It may not on yours. If you are unsure how to do all this – Don’t!
Comments
Compiling the Pi Kernel.. My Way.. — No Comments