文章目录
一、下载
这里就下载目前最新的版本,今天是 2020.08.30,所以就下载前两天刚发布的稳定版本。
二、配置
源码下载解压后,设置编译器等路径,然后 make menuconfig
打开配置选项界面,选择类似的开发板的配置。
拷贝一份类似的配置,难度就会小一些。
cd arch/arm/configs/
cp exynos_defconfig xhr4412_defconfig
make xhr4412_defconfig
make menuconfig
1. 裁剪掉一些配置
> System Type > Samsung Exynos
我们可以只保留 Exynos 4 相关的,其他的可以去掉,减少内核大小。
2. 设置调试串口
将 UART2 设置为 low-level debug 串口输出。
> Kernel hacking > arm Debugging
[*] Kernel low-level debugging functions (read help!)
Kernel low-level debugging port (Use Samsung S3C UART 2 for low-level debug) --->
[*] Early printk
3. 网卡驱动
> Device Drivers > Network device support > USB Network Adapters
<*> Davicom DM96xx based USB 10/100 ethernet devices
4. 压缩模式
设置内核压缩模式为 LZMA,可以减小文件大小。
> General setup
Kernel compression mode (LZMA) --->
三、build kernel
make uImage LOADADDR=0x40007000 -j$(nproc)
这里需要指定 LOADADDR 的值,才能生成正确的 uImage 文件。因为在 uboot 启动内核时,会先解析 uImage 中的前 64B 文件头信息。具体定义可以在网上找找。
1. 编译报错
-
scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
sudo apt-get install libssl-dev
-
“mkimage” command not found - U-Boot images will not be built
sudo apt-get install uboot-mkimage (似乎已经遗弃)
sudo apt-get install u-boot-tools
2. 编译成功
xhr@ubuntu:~/iTop4412/xhr4412/linux/linux-5.8.5$ make uImage LOADADDR=0x40008000 -j$(nproc)
make[1]: Entering directory '/home/xhr/iTop4412/xhr4412/linux/linux-5.8.5/out'
GEN Makefile
CALL ../scripts/atomic/check-atomics.sh
CALL ../scripts/checksyscalls.sh
CHK include/generated/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
UIMAGE arch/arm/boot/uImage
Image Name: Linux-5.8.5
Created: Sun Aug 30 13:16:01 2020
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 5222448 Bytes = 5100.05 KiB = 4.98 MiB
Load Address: 40007000
Entry Point: 40007000
Kernel: arch/arm/boot/uImage is ready
make[1]: Leaving directory '/home/xhr/iTop4412/xhr4412/linux/linux-5.8.5/out'
四、build dts
查看一下会编译的 dts 文件:
- vim arch/arm/boot/dts/Makefile
看起来官方的 kernel 有支持 itop 的板子,应该简单移植一下就可以支持了。
dtb-$(CONFIG_ARCH_EXYNOS4) += \
exynos4210-i9100.dtb \
exynos4210-origen.dtb \
exynos4210-smdkv310.dtb \
exynos4210-trats.dtb \
exynos4210-universal_c210.dtb \
exynos4412-i9300.dtb \
exynos4412-i9305.dtb \
exynos4412-itop-elite.dtb \
exynos4412-n710x.dtb \
exynos4412-odroidu3.dtb \
exynos4412-odroidx.dtb \
exynos4412-odroidx2.dtb \
exynos4412-origen.dtb \
exynos4412-smdk4412.dtb \
exynos4412-tiny4412.dtb \
exynos4412-trats2.dtb
1. 修改 dtsi
修改文件 arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi
- 屏蔽掉firmware节点(安全相关,不启用,也不知道怎么用…)
- 修改bus_dmc 节点devfreq-events为devfreq-event
- 修改regulators 节点参数(参考原理图中的参数)
修改如下:
--- a/arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi
+++ b/arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi
@@ -23,10 +23,12 @@
reg = <0x40000000 0x40000000>;
};
+#if 0
firmware@203f000 {
compatible = "samsung,secure-firmware";
reg = <0x0203F000 0x1000>;
};
+#endif
fixed-rate-clocks {
xxti {
@@ -70,7 +72,7 @@
};
&bus_dmc {
- devfreq-events = <&ppmu_dmc0_3>, <&ppmu_dmc1_3>;
+ devfreq-event = <&ppmu_dmc0_3>, <&ppmu_dmc1_3>;
vdd-supply = <&buck1_reg>;
status = "okay";
};
@@ -167,8 +169,8 @@
regulators {
ldo1_reg: LDO1 {
regulator-name = "VDD_ALIVE";
- regulator-min-microvolt = <1100000>;
- regulator-max-microvolt = <1100000>;
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1000000>;
regulator-always-on;
regulator-boot-on;
op_mode = <1>; /* Normal Mode */
@@ -230,8 +232,8 @@
ldo9_reg: LDO9 {
regulator-name = "VDD33_LCD";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
op_mode = <1>; /* Normal Mode */
};
@@ -252,8 +254,8 @@
ldo12_reg: LDO12 {
regulator-name = "VDD33_UOTG";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
regulator-always-on;
op_mode = <1>; /* Normal Mode */
};
@@ -300,8 +302,8 @@
/* Used by HSIC */
ldo18_reg: LDO18 {
regulator-name = "VDDIOPERI_28";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
regulator-always-on;
op_mode = <1>; /* Normal Mode */
};
@@ -313,15 +315,15 @@
ldo20_reg: LDO20 {
regulator-name = "VDD28_CAM";
- regulator-min-microvolt = <1800000>;
- regulator-max-microvolt = <2800000>;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
op_mode = <1>; /* Normal Mode */
};
ldo21_reg: LDO21 {
regulator-name = "VDD28_AF";
- regulator-min-microvolt = <1800000>;
- regulator-max-microvolt = <2800000>;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
op_mode = <1>; /* Normal Mode */
};
@@ -341,8 +343,8 @@
ldo24_reg: LDO24 {
regulator-name = "VDD33_A31";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
op_mode = <1>; /* Normal Mode */
};
@@ -430,8 +432,8 @@
buck7_reg: BUCK7 {
regulator-name = "pvdd_buck7";
- regulator-min-microvolt = <750000>;
- regulator-max-microvolt = <2000000>;
+ regulator-min-microvolt = <2050000>;
+ regulator-max-microvolt = <2050000>;
regulator-boot-on;
regulator-always-on;
op_mode = <1>; /* Normal Mode */
2. build
- make dtbs
编译成功,文件在:
- arch/arm/boot/dts/exynos4412-itop-elite.dtb
五、后续
到目前为止还比较顺利,毕竟只是下载后简单修改,能够编译通过,但是是否能够烧写到开发板上 boot 起来还是个问题。