Difference between revisions of "Rpi kernel compilation"
(→compiling) |
|||
| Line 1: | Line 1: | ||
= Raspberry PI kernel compilation = | = Raspberry PI kernel compilation = | ||
| − | You can compile the kernel on the board itself, but you can | + | You can compile the kernel on the board itself, but because of the limited resources it will take a lot of time. Alternatively you can crosscompile the kernel on another machine running Linux, Windows or OS X. |
| − | + | == Compiling on the Raspberry pi itself == | |
| − | == | + | TODO: write the rest of this section. |
| + | |||
| + | == Cross compiling on a foreign machine== | ||
| + | |||
| + | === Ubuntu Linux === | ||
| − | === getting the compiler === | + | ==== getting the compiler ==== |
On Ubuntu Oneiric getting the arm cross compiler can be as easy as: | On Ubuntu Oneiric getting the arm cross compiler can be as easy as: | ||
| Line 15: | Line 19: | ||
(TODO: Is this the right one? More packages required? I did this a while ago! TODO: Other distributions?) | (TODO: Is this the right one? More packages required? I did this a while ago! TODO: Other distributions?) | ||
| − | === getting the sources === | + | ==== getting the sources ==== |
| − | |||
| − | |||
create a directory where you can work on the raspberry pi software. I called mine "raspberrypi". Then clone the git repository. | create a directory where you can work on the raspberry pi software. I called mine "raspberrypi". Then clone the git repository. | ||
| Line 26: | Line 28: | ||
cd linux | cd linux | ||
| − | ==== | + | ==== compiling ==== |
| − | + | Next you have to configure the kernel: | |
| + | cp arch/arm/configs/bcmrpi_cutdown_defconfig .config | ||
| + | make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig | ||
| + | Then building the kernel: | ||
| + | make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k | ||
| − | === compiling === | + | You can use the "-j" flag to improve compilation time. If you have a dual core machine you can use "-j 3", for a quad core machine you can use "-j 6", and so on. |
| + | |||
| + | === Gentoo Linux === | ||
| + | |||
| + | ==== getting the compiler ==== | ||
| + | |||
| + | Build the cross toolchain: | ||
| + | crossdev -v -t arm-unknown-linux-gnueabi | ||
| + | |||
| + | This command will most certainly fail on your machine. What you have to do to make it work, is to adjust the cross tools versions with the "--b", "--g", "--k" and "--l" flags. For the exact usage refer to the crossdev manpage. A good starting point for figuring out the right versions are those which are stable for the arm architecture. | ||
| + | |||
| + | ==== getting the sources ==== | ||
| + | |||
| + | create a directory where you can work on the raspberry pi software. I called mine "raspberrypi". Then clone the git repository. | ||
| + | |||
| + | mkdir raspberrypi | ||
| + | cd raspberrypi | ||
| + | git clone https://github.com/raspberrypi/linux.git | ||
| + | cd linux | ||
| + | |||
| + | ==== compiling ==== | ||
Next you have to configure the kernel: | Next you have to configure the kernel: | ||
| Line 42: | Line 68: | ||
You can use the "-j" flag to improve compilation time. If you have a dual core machine you can use "-j 3", for a quad core machine you can use "-j 6", and so on. | You can use the "-j" flag to improve compilation time. If you have a dual core machine you can use "-j 3", for a quad core machine you can use "-j 6", and so on. | ||
| − | == | + | === Windows === |
| − | + | TODO | |
| − | TODO | + | === OS X === |
| + | |||
| + | TODO | ||
Revision as of 13:45, 22 January 2012
Contents |
Raspberry PI kernel compilation
You can compile the kernel on the board itself, but because of the limited resources it will take a lot of time. Alternatively you can crosscompile the kernel on another machine running Linux, Windows or OS X.
Compiling on the Raspberry pi itself
TODO: write the rest of this section.
Cross compiling on a foreign machine
Ubuntu Linux
getting the compiler
On Ubuntu Oneiric getting the arm cross compiler can be as easy as:
sudo apt-get install gcc-4.6-arm-linux-gnueabi
(TODO: Is this the right one? More packages required? I did this a while ago! TODO: Other distributions?)
getting the sources
create a directory where you can work on the raspberry pi software. I called mine "raspberrypi". Then clone the git repository.
mkdir raspberrypi cd raspberrypi git clone https://github.com/raspberrypi/linux.git cd linux
compiling
Next you have to configure the kernel:
cp arch/arm/configs/bcmrpi_cutdown_defconfig .config make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig
Then building the kernel:
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k
You can use the "-j" flag to improve compilation time. If you have a dual core machine you can use "-j 3", for a quad core machine you can use "-j 6", and so on.
Gentoo Linux
getting the compiler
Build the cross toolchain:
crossdev -v -t arm-unknown-linux-gnueabi
This command will most certainly fail on your machine. What you have to do to make it work, is to adjust the cross tools versions with the "--b", "--g", "--k" and "--l" flags. For the exact usage refer to the crossdev manpage. A good starting point for figuring out the right versions are those which are stable for the arm architecture.
getting the sources
create a directory where you can work on the raspberry pi software. I called mine "raspberrypi". Then clone the git repository.
mkdir raspberrypi cd raspberrypi git clone https://github.com/raspberrypi/linux.git cd linux
compiling
Next you have to configure the kernel:
cp arch/arm/configs/bcmrpi_cutdown_defconfig .config make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig
Then building the kernel:
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k
You can use the "-j" flag to improve compilation time. If you have a dual core machine you can use "-j 3", for a quad core machine you can use "-j 6", and so on.
Windows
TODO
OS X
TODO