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学习笔记-选择器集合调用方法

    <script type="text/javascript"> function uu(namePd) { //判断id var reId = new RegExp(/ ...

  2. DatePicker及其监听

    xml文件: <DatePicker android:id="@+id/datep" android:layout_width="wrap_content" ...

  3. 浅谈SEO翻倍提升网站流量

    本文是在简单了解并且熟悉SEO技术的基础上加上自己的总结归纳,对于SEO还是一个长期的工程不是一天就能一下优化排名第一.下面就是我对SEO的一些见解: 一.关键字选择 内容相关 搜索次数多,竞争小 主 ...

  4. Linux内核参数配置

    Linux在系统运行时修改内核参数(/proc/sys与/etc/sysctl.conf),而不需要重新引导系统,这个功能是通过/proc虚拟文件系统实现的. 在/proc/sys目录下存放着大多数的 ...

  5. URI 中特殊字符

    URL中的特殊字符 有些符号在URL中是不能直接传递的,如果要在URL中传递这些特殊符号,那么就要使用他们的编码了.编码的格式为:%加字符的ASCII码,即一个百分号%,后面跟对应字符的ASCII(1 ...

  6. C#-WinForm-客户端程序-Form基本属性

    WinForm - 客服端程序(C/S) WindowsForm 的简称 客户端应用程序:是需要安装在用户电脑上才可以使用的程序,代码部分在用户电脑上执行 特点:不需要联网也可以打开使用部分功能,但现 ...

  7. 用 phylomatic 软件生成的进化树

    用 phylomatic 软件生成的进化树 Phylomatic是在线软件,可以利用植物名录,按照APGIII的被子植物科的拓扑结构,生成进化树. 参考 张金龙博士 工作目录 setwd(" ...

  8. PLSQL设置显示的字符集及PLSQL的一些自身设置

    一.关于PLSQL无法正确显示中文 刚才下载安装了PLSQL Developer 9.0.0.1601 汉化绿色版,执行SQL查询语句,发现显示的数据中只要有中文都会以?表示.经过网上查询得知这是客户 ...

  9. python 学习笔记 8(闭包)

    30.  闭包 首先理清几个关系. 函数式编程 面向对象编程 : 对象 面向过程编程 : 函数 对象和函数都是一种逻辑方式来组织代码,为了提高可重复利用性(reusability). 而闭包作用和对象 ...

  10. ml的线性回归应用(python语言)

    线性回归的模型是:y=theta0*x+theta1   其中theta0,theta1是我们希望得到的系数和截距. 下面是代码实例: 1. 用自定义数据来看看格式: # -*- coding:utf ...