Cross-compiled Raspberry Pi 2 kernel in CentOS

Source: Internet
Author: User

Cross-compiled Raspberry Pi 2 kernel in CentOS

Cross-compilation toolchain in CentOS 6.6 x64 requires glibc-2.14 support (x86 is not needed), so first install the glibc-2.14

Install the relevant compilation tools before installation. Here I will install the entire group directly.

Yum groupinstall "Development tools"-y

Download the glibc-2.14 source code, compile, install

Wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.xz
Mkdir/ usr/local/glibc-2.14
Tar xvf glibc-2.14.tar.xz
Cd glibc-2.14
Mkdir build
Cd build
../Configure -- prefix =/usr/local/glibc-2.14/
Make & make install

Set temporary environment variables

Export LD_LIBRARY_PATH =/usr/local/The glibc-2.14/lib: $ LD_LIBRARY_PATH

Obtain the cross-compilation toolchain, kernel, and firmware (this method is used in this article)

Wget-O https://github.com/raspberrypi/tools/archive/master.tar.gz
Wget-O https://github.com/raspberrypi/linux/archive/rpi-4.1.y.tar.gz
Wget-O https://github.com/raspberrypi/firmware/archive/master.tar.gz

You can also use git to clone related repositories:

Git init
Git clone -- depth 1 git: // github.com/raspberrypi/linux.git
Git clone -- depth 1 git: // github.com/raspberrypi/tools.git
Git clone git: // github.com/raspberrypi/firmware.git

Install the tool chain and add it to the environment variable:

Tar xvf tools-master.tar.gz-C/opt
Vim/etc/profile
Export PATH = $ PATH:/opt/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
./Etc/profile
Music linux-rpi-4.1.y linux
Cd linux

Ensure that the compilation directory is clean (if extracted from the tar.gz file, it can be omitted)

Make mrproper

Generate the default Kernel configuration file

Make ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf-bcm2709_defconfig

To change the configuration, run the following command:

# CentOS 6.6x64 run yum install ncurses-devel
Make ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf-menuconfig

Set Environment Variables

KERNEL = kernel7

Start Compilation

Make ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf-zImage modules dtbs

After compilation, remove the Raspberry Pi SD card and put it on CentOS.

Mkdir/mnt/fat32
Mkdir/mnt/ext4
Mount/dev/sdb1/mnt/fat32
Mount/dev/sdb2/mnt/ext4

Installation Module

Make ARCH = arm CROSS_COMPILE = arm-linux-gnueabihf-INSTALL_MOD_PATH =/mnt/ext4 modules_install

Copy the kernel and drive to the SD card

# Back up the original kernel first
Cp/mnt/fat32/$ KERNEL. img/mnt/fat32/$ KERNEL-backup.img
Scripts/mkknlimg arch/arm/boot/zImage mnt/fat32/$ KERNEL. img
Cp arch/arm/boot/dts/*. dtb/mnt/fat32/
Cp arch/arm/boot/dts/overlays/*. dtb */mnt/fat32/overlays/
Cp arch/arm/boot/dts/overlays/README/mnt/fat32/overlays/

Update firmware

Tar xvf firmware-master.tar.gz
Cd firmware-master
# Replacing Related Files
Cp boot/*. dat/mnt/fat32/
Cp boot/*. elf/mnt/fat32/
Cp boot/bcm2709-rpi-2-b.dtb/mnt/fat32/

Update vc Library

Cp-rv hardfp/opt/vc/mnt/ext4/opt/vc

After that, uninstall the SD card.

Umount/dev/sdb1
Umount/dev/sdb2

Plug the SD card into raspberry pi 2 and power in. OK!

Install NodeJS on the (Raspberry Pi) Raspberry Pi

Install Weston on Raspberry Pi

Linux OS for Raspberry Pi is available

Raspberry Pi (Raspberry Pi) trial note

Introduction to Raspberry Pi (Raspberry Pi) installation, IP configuration, and software source

This article permanently updates the link address:

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.