ABSTRACT

  There are two main methods for building the kernel. You can build locally on a Raspberry Pi which will take a long time; or you can cross-compile, which is much quicker.There is an introduction about cross-compilation as follows.

  You need ubuntu as your development environment.So you can install VMWare on Windows and install ubuntu on VMWare.

  This link is the introduction from the official website :  https://www.raspberrypi.org/documentation/linux/kernel/building.md

CROSS COMPILING:

  Download the cross compiling tools.

  $ mkdir raspberry      //make a folder for use

  $ cd ./raspberry

  $ git clone https://github.com/raspberrypi/tools     // make a folder named "tools" in the "raspberry"

  

  Add the following directory "/home/god/Desktop/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin" to your $PATH in the .bashrc as a environment variable.For the 32-bit host systems,the directory is "/home/god/Desktop/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin".If you put the path to your account rather than "root",you had better execute the following in your account.Otherwise you will be reminded that command not found.

  $ sudo apt-get install gcc-arm-linux-gnueabihf      //if execute it, you can use this gcc-linaro-arm-linux-gnueabihf version,not the version downloaded from "https://github.com/raspberrypi/tools".

GET SOURCE:

  Enter the folder named "raspberry" ,then download the source:

  $ git clone --depth=1 https://github.com/raspberrypi/linux   //make a folder named "linux" in the "raspberry"

  The paramenter "--depth=1" means only downloading the lastest version

BUILD SOURCE:

  $ cd ./linux

  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig   //bcm2709_defconfig作为一个输入参数给makefile,然后通过标准路径“arch/arm/configs/”得到bcm2709_defconfig这个文件,进而把一些参数复制给.config文件,

  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs  //generate zImage,modules and dtbs

  To speed up compilation on multiprocessor systems, and get some improvement on single processor ones, use -j n where n is number of processors * 1.5. Alternatively, feel free to experiment and see what works!

INSTALL ON THE SD CARD:

  Having built the kernel you need to copy it onto your raspberry pi and install modules.This is the best done directly using an sd card reader.

  Use lsblk before and after plugging in your sd card to identify which one is.

  $ lsblk

  $ mkdir /mnt/fat32

  $ mkdir /mnt/ext4

  $ mount /dev/sdc1 /mnt/fat32     //for example sdc1 is the FAT(boot) partition

  $ mount /dev/sdc2 /mnt/ext4      //for example sdc2 is the ext3 filesystem(root) partition

  execute the orders before enter the folder of "linux"

  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/mnt/ext4 modules_install   //install the modules into the "lib/modules/XXXX" folder

  Finally, copy the kernel and Device Tree blobs onto the SD card, making sure to back up your old kernel:

  $ KERNEL=kernel7       //for Pi2 or 3, the kernel file is "kernel7.img" but for Pi 1,the kernel file is "kernel.img".So use "$KERNEL" to replace "kernel7"

  $ cp /mnt/fat32/$KERNEL.img /mnt/fat32/$KERNEL-backup.img

  $ scripts/mkknlimg arch/arm/boot/zImage /mnt/fat32/$KERNEL.img   //zImage is a Compressed kernel image,need transfer to .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/

  $ umount /mnt/fat32

  $ umount /mnt/ext4

FINALLY

  plug the SD card into Pi and boot it.

Raspberry Pi 3 --- Kernel Building and Run in A New Version Kernal的更多相关文章

  1. How to emulate a Raspberry Pi on your PC

    How to emulate a Raspberry Pi on your PC I am very interested in trying simulators and emulators for ...

  2. .NET Core on Raspberry Pi

    原文地址:传送门 .NET Core on Raspberry Pi Arm32 builds are available as community supported builds for .NET ...

  3. Raspberry Pi Kernel Compilation 内核编译官方文档

    elinux.org/Raspberry_Pi_Kernel_Compilation#Use_the_provided_compiler Software & Distributions: S ...

  4. Compiling a kernel module for the raspberry pi 2 via Ubuntu host

    Compiling a kernel module for the raspberry pi 2 via Ubuntu host Normally compiling a kernel module ...

  5. 在ubuntu上编译rasbian kernel(for raspberry pi 1)

    raspberry pi官网的编译手册写的简洁有力,照着操作即可 https://www.raspberrypi.org/documentation/linux/kernel/building.md ...

  6. RASPBERRY PI 外设学习资源

    参考: http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html Raspberry Pi         Get st ...

  7. Raspberry Pi I2C驱动 (Python)

    本文参考 http://www.instructables.com/id/Raspberry-Pi-I2C-Python/all/?lang=zh 作者 AntMan232 In this instr ...

  8. Cross-compiling Qt Embedded 5.5 for Raspberry Pi 2

    This tutorial shows how to cross-compile the Embedded build of Qt 5.5 for Raspberry Pi 2. The Embedd ...

  9. Arduino VS. Raspberry Pi VS. Beaglebone Black

    The Arduino is a small Atmel-based microcontroller development board easily integrated into many dif ...

随机推荐

  1. 浅谈Javascript 中几种克隆(clone)方式

    clone就是把原来的东西原样复制一份,新复制的东西和以前的东西没有任何关系 一:在Javascript里,如果克隆对象是基本类型,我们直接赋值就可以了: var sStr = "kingw ...

  2. 来个linq to js

    说这个话题之前,我们来讲一下C#的linq  语法.在C#里面我们会对列表进行操作,如OrderBy(p=>p.property),Where(p=>p.property==..) 括号里 ...

  3. Beta版本冲刺———第七天

    会议照片: 项目燃尽图: 1.项目进展: 明天就验收了,今天做的是对项目的所有功能进行复查(由郭怡锋和洪大钊负责); 对于新增的功能:排行榜和撤销一步依然没有做出来.

  4. Learning jQuery, 4th Edition 勘误表

    来源于:http://book.learningjquery.com/3145/errata/ Chapter 1 page 14 The CSS snippet is correct, but it ...

  5. Oracle报 ORA-00054资源正忙的解决办法

    来源于:http://www.cnblogs.com/loveLearning/p/3625544.html oracle之报错:ORA-00054: 资源正忙,要求指定 NOWAIT 问题如下: S ...

  6. Linux vsftp配置本地用户

    主要讲的是配置本地用户, ftp现在用的也少了,一般都用ssh和svn 1. 安装ftp  yum -y install vsftpd 2. 配置 /etc/vsftpd/vsftpd.conf # ...

  7. asp.net捕获全局未处理异常的几种方法

    通过HttpModule来捕获未处理的异常[推荐] 首先需要定义一个HttpModule,并监听未处理异常,代码如下: public void Init(HttpApplication context ...

  8. Redis集群(一):基本概念

    一.使用版本:3.0.0.0 二.基本概念:  号至 11000 号的哈希槽, 这样集群就不会因为主节点 B 的下线而无法正常运作了. 异步复制(虽然是异步复制,但是执行写命令和复制命令到从节点几乎是 ...

  9. 网页端压缩解压缩插件JSZIP库的使用

    JSZIP这个库支持在网页端生成zip格式的文件,  官方网站是:http://stuk.github.io/jszip/ 官方网站的DEMO如下: <!DOCTYPE html> < ...

  10. Eclipse 中 安装 SVN 插件

    方法一:使用Eclipse 安装向导安装 1.测试所指环境  Eclipse 4.5/Mars 2.svn 插件的官方网站: http://subclipse.tigris.org 3.打开eclip ...