判断通关:
上传效果截图完成作业
1. 在linux官网下载 https://www.kernel.org/
2. tar -vxf 解压
3. 进入arch/arm/configs文件夹 查找适配开发板的config文件。
4. 导入配置(配置列表见 arch/arm/configs/ 找最类似的)
不修改linux-5.4.79/Makefile
直接执行 make ARCH=arm exynos_defconfig
此处可能会因为缺少安装包而报错,对应处理方案如下:
问题1:缺少flex
/bin/sh: 1: flex: not found
scripts/Makefile.host:9: recipe for target 'scripts/kconfig/lexer.lex.c' failed
make[1]: *** [scripts/kconfig/lexer.lex.c] Error 127
Makefile:590: recipe for target 'exynos_defconfig' failed
make: *** [exynos_defconfig] Error 2
解决方案:
apt-get install flex
问题2: 缺少bison
/bin/sh: 1: bison: not found
scripts/Makefile.host:17: recipe for target 'scripts/kconfig/parser.tab.h' failed
make[1]: *** [scripts/kconfig/parser.tab.h] Error 127
Makefile:590: recipe for target 'exynos_defconfig' failed
make: *** [exynos_defconfig] Error 2
解决方案:
sudo apt-get install bison
5. 配置内核 make ARCH=arm menuconfig
此处可能会因为缺少安装包而报错,对应处理方案如下:
错误1:
scripts/kconfig/Makefile:208: recipe for target 'scripts/kconfig/mconf-cfg' failed
make[1]: *** [scripts/kconfig/mconf-cfg] Error 1
Makefile:591: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2
解决方案:
sudo apt-get install ncurses-dev
System Type --->
[*] Samsung EXYNOS --->
[ ] SAMSUNG EXYNOS3
[*] SAMSUNG EXYNOS4
[ ] SAMSUNG EXYNOS5
*** EXYNOS SoCs ***
-*- SAMSUNG EXYNOS4210
[ ] SAMSUNG EXYNOS4212
[*] SAMSUNG EXYNOS4412
[ ] SAMSUNG EXYNOS4415
退出 保存
6. 编译内核 uImage
make -j6 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
编译将会生成 zImage
进入目录 linux-5.4.79/arch/arm/boot
执行命令将 zImage 制作成 uImage
mkimage -A arm -O linux -T kernel -C none -a 0x41000000 -e 0x41000040 -n "aaa" -d zImage uImage
此处可能会因为缺少安装包而报错,对应处理方案如下:
错误1:
scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
#include <openssl/bio.h>
^~~~~~~~~~~~~~~
compilation terminated.
scripts/Makefile.host:107: recipe for target 'scripts/extract-cert' failed
make[1]: *** [scripts/extract-cert] Error 1
Makefile:1124: recipe for target 'scripts' failed
make: *** [scripts] Error 2
解决方案:
sudo apt install libssl-dev
错误2:没有配置写入地址
This is incompatible with uImages
Specify LOADADDR on the commandline to build an uImage
arch/arm/boot/Makefile:90: recipe for target 'arch/arm/boot/uImage' failed
make[1]: *** [arch/arm/boot/uImage] Error 1
arch/arm/Makefile:342: recipe for target 'uImage' failed
make: *** [uImage] Error 2
解决方案:注意该地址应与 开发板pri环境变量中指定uImage位置相匹配
make uImage LOADADDR=0x41000000
7. 修改设备树文件并编译设备树
vim arch/arm/boot/dts/exynos4412-orange.dts
make -j6 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- dtbs
添加如下内容:
srom-cs1@5000000 {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x5000000 0x1000000>;
ranges;
ethernet@5000000 {
compatible = "davicom,dm9000";
reg = <0x5000000 0x2 0x5000004 0x2>;
interrupt-parent = <&gpx0>;
interrupts = <6 4>;
davicom,no-eeprom;
mac-address = [00 0a 2d a6 55 a2];
};
};
8. 上传到NAS,观测效果。
使用 linux-5.4.79/arch/arm/boot/uImage 和
linux-5.4.79/arch/arm/boot/dts/exynos4412-origen.dtb
至此没有异常的话可以正常启动 linux,
但是挂载不了根文件系统,因为没有配置网卡驱动
9. 配置网卡驱动
make ARCH=arm menuconfig
[*] Networking support --->
Networking options --->
<*> Packet socket
<*>Unix domain sockets
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
Device Drivers --->
[*] Network device support --->
[*] Ethernet driver support (NEW) --->
<*> DM9000 support
File systems --->
[*] Network File Systems (NEW) --->
<*> NFS client support
[*] NFS client support for NFS version 3
[*] NFS client support for the NFSv3 ACL protocol extension
[*] Root file system on NFS
10. 配置时钟
这部分不是必须修改的 要看内核,先执行上面9步,如无法正常启动,
并报错s5m-rtc s5m-rtc: hctosys: unable to read the hardware clock,可尝试一下修改:
修改文件driver/clk/clk.c
static bool clk_ignore_unused;
改为static bool clk_ignore_unused = true;
11. 结果展示: