To compile the Linux kernel for Raspberry Pi (i.e. ARM architecture) one should accomplish at least 8 different steps:
- fetching the (last) Linux kernel source code (git://github.com/raspberrypi/linux.git)
- fetching the (last) RPi firmware (git://github.com/raspberrypi/firmware.git)
- configuring the kernel according with the target architecture
- compiling the kernel and its modules
- copying the kernel image to the boot partition
- copying the RPi firmware to the boot partition
- (optional) configuring the kernel boot command-line and its start-up configuration
- last but not least, copying the RPi firmware utilities to the target /opt/ directory
If you have to do often this task then it would be better to automate those steps. Because I did that many times and because I love to create my own scripts that makes my live easier (in the future), I wrote an automation script that accomplish all these steps in order to boost Linux kernel compilation for Raspberry Pi.
This script assumes that you have already a crossdev environment prepared so you can use your cross-arm-compiler right away:
Raspberry Pi kernel compilation automation script. Usage Â Â Â : /usr/sbin/rpi-build [options] Options Â : Â Â Â Â Â -w : the working directory (mandatory) Â Â Â Â Â -c : CC prefix for the TARGET architecture Â Â Â Â Â -f : the path to your predefined Linux kernel .config file Â Â Â Â Â -p : the name of the boot partition of your RPi Â Â Â Â Â -t : the type of the partition specified by -p parameter Â Â Â Â Â -h : print this help message Report bugs to eugenmihailescux at gmail dot com
The <.config> is the path to a predefined Linux kernel .config file. You can use a predefined .config Linux kernel configuration file so that you don't have to configure the kernel every time you run this script. For my RPi model B I have already created a cut-down RPi configuration and can be found here.
The script can be downloaded from here.
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.
Latest posts by Eugen Mihailescu (see all)
- Dual monitor setup in Xfce - January 9, 2019
- Gentoo AMD Ryzen stabilizator - April 29, 2018
- Symfony Compile Error Failed opening required Proxies - January 22, 2018