Raspberry Pi 3B Kernel compilation

Source: Internet
Author: User
Tags git clone
1. Preparatory work:

1.1 Development environment System Ubuntu 16 (64-bit)

1.2 Download Source: Https://github.com/raspberrypi

Linux: Raspberry Pi kernel source

Tools: Raspberry Pi cross-compilation tool

Download mode:

(1) Web download

Download zip directly

(2) Command download

git clone--depth=1 Https://github.com/raspberrypi/linux

git clone https://github.com/raspberrypi/tools

Save path is ~/raspberry/under 2. Determine version

2.1 View information about the current Raspberry Pi compiler

root@raspberrypi:~# cat/proc/version

Linux version 4.4.13-v7+ (dc4@dc4-xps13-9333) (gcc version 4.9.3 (crosstool-ng crosstool-ng-1.22.0-88-g8460611)) #894 SM P Mon June 13:13:27 BST 2016


2.2 Determining the cross-compilation tool

root@ubuntu:~/raspberry/tools-master/arm-bcm2708# ls

Arm-bcm2708hardfp-linux-gnueabi

Arm-bcm2708-linux-gnueabi

Arm-rpi-4.9.3-linux-gnueabihf

Gcc-linaro-arm-linux-gnueabihf-raspbian

Gcc-linaro-arm-linux-gnueabihf-raspbian-x64


There are 5 directories under this directory and are different versions of the cross-compilation tool. Where ARM-RPI-4.9.3-LINUX-GNUEABIHF and gcc-linaro-arm-linux-gnueabihf-raspbian-x64 are used for 64-bit machines.

Each cross-compilation tool has a bin directory in the directory to enter, execute./arm-linux-gnueabihf-gcc-v to view the GCC version.

I use ARM-RPI-4.9.3-LINUX-GNUEABIHF here because the GCC version on the board is now 4.9.3 3. Start compiling

3.1 Enter the Linux kernel directory:

$ CD ~/RASPBERRY/LINUX-RPI-4.4.Y

$ kernel=kernel7

$ make Arch=arm cross_compile=~/raspberry/tools-master/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/ Arm-linux-gnueabihf-bcm2709_defconfig

Note: If the multi-processing system can add an option-j N, n is a number that represents the number of multiprocessor *1.5. Can speed up compilation

$ make-j4 zimage Modules Dtbs


3.2 Creating a directory Modules

Create the modules directory at the top level of the Linux kernel directory.

$ mkdir Modules

$ make Install_mod_path=modules Modules_install



3.3 Update first the Raspberry Pi kernel will have the system memory card plugged into the computer:

Two directories will appear under the/media/ubuntu/directory boot/2f840c69-cecb-4b10-87e4-01b9d28c231c/


Execute command

sudo cp arch/arm/boot/zimage/media/ubuntu/boot/$ (KERNEL). img

sudo cp arch/arm/boot/dts/*.dtb/media/ubuntu/boot/

sudo cp arch/arm/boot/dts/overlays/*.dtb*/media/ubuntu/boot/overlays/

sudo cp arch/arm/boot/dts/overlays/readme/media/ubuntu/boot/overlays/

CP modules/lib//media/ubuntu/2f840c69-cecb-4b10-87e4-01b9d28c231c/ -R 4. Restart the Raspberry Pi, successfully updated the kernel

Reference connection: HTTPS://WWW.RASPBERRYPI.ORG/DOCUMENTATION/LINUX/KERNEL/BUILDING.MD


  

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.