前言
环境介绍:
1.编译环境
Ubuntu 18.04.5 LTS
2.SDK
orangepi Linux 5.4 SDK
3.uboot
v2020.04
4.gcc
arm-linux-gnueabihf-gcc
gcc version 7.5.0
这是通过ubunt默认安装的交叉编译器,此编译器编译buildroot时存在异常,
使用linaro的gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar则不会。
或者改用:
sudo make ARCH=arm CROSS_COMPILE=/usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
4.单板
orangepi pc plus
# 一、uboot编译
1.进入uboot目录
cd ~/orangepi/orangepi-build/u-boot/v2020.04
2.生成 orangepi pc plus的配置文件
arm-linux-gnueabihf- 编译时会自动补上gcc
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- orangepi_pc_plus_defconfig
3.进行编译,-j4为多核编译
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
4.编译完
u-boot-sunxi-with-spl.bin
二、内核编译
1.进入内核目录
cd ~/orangepi/orangepi-build/kernel/orange-pi-5.4
2.清除一开始的配置
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
3.生成配置
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
4.配置内核,添加nfs启动内容
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
按照如下配置
Networking support–>Networking options
–>[*]IP: DHCP support
–>[*]IP:BOOTP support
–>[*]IP:RARP support
File systems --->
[*] Network File Systems --->
<*> NFS client support
<*> NFS client support for NFS version 2
<*> NFS client support for NFS version 3
[*] NFS client support for the NFSv3 ACL protocol extension
<> NFS client support for NFS version 4 /* 这个不要选,测试发现单板内核无法启动 */
[] Provide swap over NFS support
[*] Root file system on NFS /* 必须选上 */
5.编译内核
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make -j4 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf-
6.编译设备树
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs
7.生成文件路径
arch/arm/boot/zImage //内核
arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dtb //设备树
6.Buildroot制作镜像
内容有点多,先放其他人的链接