Raspberry Pi 3 --- Kernel Building and Run in A New Version Kernal
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的更多相关文章
- 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 ...
- .NET Core on Raspberry Pi
原文地址:传送门 .NET Core on Raspberry Pi Arm32 builds are available as community supported builds for .NET ...
- Raspberry Pi Kernel Compilation 内核编译官方文档
elinux.org/Raspberry_Pi_Kernel_Compilation#Use_the_provided_compiler Software & Distributions: S ...
- 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 ...
- 在ubuntu上编译rasbian kernel(for raspberry pi 1)
raspberry pi官网的编译手册写的简洁有力,照着操作即可 https://www.raspberrypi.org/documentation/linux/kernel/building.md ...
- RASPBERRY PI 外设学习资源
参考: http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html Raspberry Pi Get st ...
- Raspberry Pi I2C驱动 (Python)
本文参考 http://www.instructables.com/id/Raspberry-Pi-I2C-Python/all/?lang=zh 作者 AntMan232 In this instr ...
- 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 ...
- Arduino VS. Raspberry Pi VS. Beaglebone Black
The Arduino is a small Atmel-based microcontroller development board easily integrated into many dif ...
随机推荐
- web安全——代理(nginx)
场景 过滤非正常用户使用的http请求. 限制正常用户使用的范围(下载速度.访问频率等). 通过架构规划来提升安全. 能自动解决http请求问题. 解决方案 代理自身的安全 千万不要使用root启动! ...
- Android开发自学笔记—1.1(番外)AndroidStudio常用功能介绍
一.界面区介绍 1.项目组织结构区,用于浏览项目文件,默认Project以Android组织方式展示. 2.设计区,默认在打开布局文件时为设计模式,可直接拖动控件到界面上实现所见即所得,下方的Desi ...
- 样条函数 -- spline function
一类分段(片)光滑.并且在各段交接处也有一定光滑性的函数.简称样条.样条一词来源于工程绘图人员为了将一些指定点连接成一条光顺曲线所使用的工具,即富有弹性的细木条或薄钢条.由这样的样条形成的曲线在连接点 ...
- java中的集合和数组
数组Array和集合的区别: (1)数组是大小固定的,并且同一个数组只能存放类型一样的数据(基本类型/引用类型) (2)JAVA集合可以存储和操作数目不固定的一组数据. (3)若程序时不知道究竟需要多 ...
- android开发------初识Activity
之前我们简单说过,Activity实际上是一个窗体,用来存放我们的程序外观. 我们先来创建一个空的Activity,不加载任何layout.要做的是,定义自己的类,继承android的Activity ...
- python基础_制作多级菜单_(运用:字典_列表_元组等知识)
#!/usr/bin/env python # -*- coding:utf-8 -*- #Author: nulige db = {} path = {} while True: temp = db ...
- linux基础-第十一单元 系统监控
第十一单元 系统监控 系统监视和进程控制工具-top和free top命令的功能 TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序 ...
- PHP与MySQL
这周学习了PHP与MySQL的搭接下面来给大家分享一下: 1.账号注册,论坛发帖... 思路:通过form表单提交到PHP页面,PHP页面往MySQL中插入数据: 2.账号登陆 思路:form提交数据 ...
- 安卓activity生命周期
相信不少朋友也已经看过这个流程图了,也基本了解了Activity生命周期的几个过程,我们就来说一说这几个过程. 1.启动Activity:系统会先调用onCreate方法,然后调用onStart方法, ...
- Jenkins的maven工程打包的时候怎么指定不同环境的配置文件
http://outofmemory.cn/code-snippet/6643/maven-profile-define-enviroment-package 在打包的时候我们添加上 这里我们指定配置 ...