raspberrypi 树莓派 内核编译
相关版本信息
硬件:
树莓派 2b
目标系统: linux 4.1.18
编译环境:
ubuntu 14.4 32bit
用户路径:
/home/hi/
安装交叉编译链
cd
mkdir pi/kernel
cd pi/kernel
git clone https://github.com/raspberrypi/tools tools
注:在用户目录下建立一个pi/kernel目录,并将交叉编译工具链下载到此目录中
下载系统源代码
git clone -b rpi-4.1.y_rebase --depth=1 https://github.com/raspberrypi/linux linux
注:将4.1.18版本的系统源代码下载到/home/hi/pi/kernel目录中,此时该目录中就有了两个文件夹 tools 与 linux
开始编译
注:*** 代表交叉编译工具链所在路径,比如 /home/hi/pi/kernel/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
此处路径中的tools 是刚刚下载工具链所在目录
cd linux KERNEL=kernel7 make ARCH=arm CROSS_COMPILE=*** bcm2709_defconfig make ARCH=arm CROSS_COMPILE=*** zImage modules dtbs
参考官方文档
https://www.raspberrypi.org/documentation/linux/kernel/building.md