Raspberry Pi Development Series Tutorial 8--Raspberry Pi kernel compilation and firmware upgrade

Source: Internet
Author: User
Tags config documentation mkdir git clone

we have already used the official image to set up the Raspberry Pi development environment, it can be said to be able to use the application, but if the official kernel has some features that do not meet our needs or need to partially crop the kernel, then we need to crop the Raspberry Pi kernel, Here we teach you how to update the Raspberry Pi kernel


1, access to upgrade the source code required

1) Download address:

Official website: Https://github.com/raspberrypi

It lists all the open source software for Raspberry Pi: firmware: Raspberry Pi cross-compiled binary kernels, modules, libraries, bootloader Linux: Kernel source tools : Tools needed to compile kernels and other source code- Cross compiler, etc.

We only need the above three files, the following works can be understood
Documentation: Raspberry Pi offline help documentation to teach you how to use, Deploy Raspberry Pi (Raspberry Pi official tutorial) userland:arm end user space for some application library source--VC video hard float, EGL, mmal, OPENVG, etc. Hats:hardware attached on Top, Raspberry Pi B + Board information Maynard: a GTK-written desktop environment Scratch: A simple, visual programming environment noobs: A Raspberry Pi image management tool, He can let you deploy multiple mirrors on a Raspberry Pi Weston: One application Target_fs: Raspberry Pi Minimal file system, using BusyBox to make Quake3: Thor Hammer 3 Wired development Source Firmwareb

2) Download method:

A, the Web directly download:



point to the need to download the project, the upper left corner of the selected version, to the right there is a download Zip button can be downloaded directly (after the author download completed, in Linux decompression prompt error, Windows is very slow cutting kernel recommended not to extract in the Windows environment, So I do not recommend the use of this method)


b. Download with Git

$ mkdir RASPEBERRYPI_SRC
$ CD RASPBERRYPI_SRC
$ git clone git://github.com/raspberrypi/firmware.git
$ git clone git://github.com/raspberrypi/linux.git
$ git clone git://github.com/raspberrypi/tools.git


will get three folders:

Firmware Linux Tools


2. Compiling and extracting the kernel and its modules


1) Obtain the kernel configuration file

Run in a Raspberry Pi run:

$ls/proc/

Can see a file called config.gz, he is the current Raspberry Pi configuration options log file, we will copy him out, into our kernel source directory tree


$CP/proc/config/home/pi

We use the previously handed Samba to copy and copy into the kernel source directory, unfamiliar people can refer to the previous article


Execute under the Linux kernel source code:

$zcat config.gz >. config




2) Configuring and compiling the kernel

A, modify the kernel source makefile arch type and compiler path

$vi Makefile +195

Find the code similar to the above, as shown in the figure



B. View and modify configuration options

$make Menuconfig

The following interface can appear




If you do not make changes, simply select Exit (note using the keyboard)


c, compile kernel image

$make

In the Arch/arm/boot directory you can see a file called Zimage, which is our new kernel


But the Raspberry Pi needs another form of image, which needs to be dealt with, and execute the following command

$CD tools/mkimage


$./imagetool-uncompressed.py. /.. /linux/arch/arm/boot/zimage

You can see a file called: Kernel.img under the current folder, which is the new kernel we need.


d, extract modules

The previous step actually not only compiled the kernel source code, some module files are also compiled, here we extract

$CD RASPBERRYPI_SRC

$mkdir Modules

$CD Linux

$ make Modules_install install_mod_path=. /modules

We can get the module files we need in modules


2, upgrade the RPI kernel, Firmware, Lib

Unplug the SD card and plug it into the computer (Card reader is available)

1) Upgrading the kernel

Copy the new kernel into the SD card, renamed: Kernel_new.img

Open the Boot directory

Locate Config.txt file, join: kernel=kernel_new.img this line


2) Upgrade boot

Copy the following files from the firmware/boot/directory into the SD card boot directory: Fbootcode.bin fixup.dat fixup_cd.dat start.elf


3) Update VC library and kernel modules

Copy the Modules/lib/modules compiled in step 3rd D into the Raspberry Pi file system/lib



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.