接着上一篇文章itop4412 uboot-2017.11移植(一)。
五、设备树的适配
暂时直接使用大佬提供的设备树,后期有时间再研究。
/*
* Odroid-U3/X2 board device tree source
*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
/dts-v1/;
#include "exynos4412.dtsi"
/ {
model = "itop-4412 based on Exynos4412";
compatible = "samsung,itop-4412", "samsung,exynos4412";
aliases {
i2c0 = "/i2c@13860000";
i2c1 = "/i2c@13870000";
i2c2 = "/i2c@13880000";
i2c3 = "/i2c@13890000";
i2c4 = "/i2c@138a0000";
i2c5 = "/i2c@138b0000";
i2c6 = "/i2c@138c0000";
i2c7 = "/i2c@138d0000";
serial0 = "/serial@13820000";
console = "/serial@13820000";
mmc2 = "sdhci@12530000";
mmc4 = "dwmmc@12550000";
};
fimd@11c00000 {
compatible = "samsung,exynos-fimd";
reg = <0x11c00000 0xa4>;
samsung,vl-freq = <60>;
samsung,vl-col = <480>;
samsung,vl-row = <272>;
samsung,vl-width = <480>;
samsung,vl-height = <272>;
samsung,vl-clkp = <0>;
samsung,vl-oep = <0>;
samsung,vl-hsp = <1>;
samsung,vl-vsp = <0>;
samsung,vl-dp = <1>;
samsung,vl-bpix = <4>;
samsung,vl-hspw = <32>;
samsung,vl-hbpd = <80>;
samsung,vl-hfpd = <48>;
samsung,vl-vspw = <2>;
samsung,vl-vbpd = <1>;
samsung,vl-vfpd = <13>;
samsung,vl-cmd-allow-len = <0xf>;
samsung,winid = <0>;
samsung,power-on-delay = <30>;
samsung,interface-mode = <1>;
samsung,mipi-enabled = <0>;
//samsung,dp-enabled;
//samsung,dual-lcd-enabled;
samsung,logo-on = <1>;
samsung,resolution = <0>;
samsung,rgb-mode = <1>;
samsung,pwm-out-gpio = <&gpd0 1 1>;
samsung,bl-en-gpio = <&gpd0 0 1>;
};
mipidsi@11c80000 {
compatible = "samsung,exynos-mipi-dsi";
reg = <0x11c80000 0x5c>;
samsung,dsim-config-e-interface = <1>;
samsung,dsim-config-e-virtual-ch = <0>;
samsung,dsim-config-e-pixel-format = <7>;
samsung,dsim-config-e-burst-mode = <1>;
samsung,dsim-config-e-no-data-lane = <3>;
samsung,dsim-config-e-byte-clk = <0>;
samsung,dsim-config-hfp = <1>;
samsung,dsim-config-p = <3>;
samsung,dsim-config-m = <120>;
samsung,dsim-config-s = <1>;
samsung,dsim-config-pll-stable-time = <500>;
samsung,dsim-config-esc-clk = <20000000>;
samsung,dsim-config-stop-holding-cnt = <0x7ff>;
samsung,dsim-config-bta-timeout = <0xff>;
samsung,dsim-config-rx-timeout = <0xffff>;
samsung,dsim-device-id = <0xffffffff>;
samsung,dsim-device-bus-id = <0>;
samsung,dsim-device-reverse-panel = <1>;
};
i2c@13860000 {
samsung,i2c-sda-delay = <100>;
samsung,i2c-slave-addr = <0x10>;
samsung,i2c-max-bus-freq = <100000>;
status = "okay";
max77686_pmic@09 {
compatible = "maxim,max77686_pmic";
interrupts = <7 0>;
reg = <0x09 0 0>;
#clock-cells = <1>;
};
};
serial@13820000 {
status = "okay";
};
sdhci@12510000 {
status = "disabled";
};
sdhci@12520000 {
status = "disabled";
};
sdhci@12530000 {
samsung,bus-width = <4>;
/*samsung,timing = <1 2 3>;*/
/*cd-gpios = <&gpk2 2 0>;*/
status = "okay";
};
sdhci@12540000 {
status = "disabled";
};
dwmmc@12550000 {
samsung,bus-width = <4>;
samsung,timing = <2 1 0>;
samsung,removable = <0>;
fifoth_val = <0x203f0040>;
bus_hz = <400000000>;
div = <0x3>;
index = <4>;
};
ehci@12580000 {
compatible = "samsung,exynos-ehci";
reg = <0x12580000 0x100>;
#address-cells = <1>;
#size-cells = <1>;
phy {
compatible = "samsung,exynos-usb-phy";
reg = <0x125B0000 0x100>;
};
};
emmc-reset {
compatible = "samsung,emmc-reset";
reset-gpio = <&gpk1 2 0>;
};
};
进行到这一步是发现编译总是报错:
Error: You must add new CONFIG options using Kconfig
The following new ad-hoc CONFIG options were detected:
CONFIG_ITOP4412
主要是顶层Makefile中的,执行CFGCHK u-boot.cfg时出错。相关宏我们在文件中直接定义的,直接屏蔽如下这三行即可:
# quiet_cmd_cfgcheck = CFGCHK $2
# cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
# $(srctree)/scripts/config_whitelist.txt $(srctree)
六、添加bl1和烧写uboot脚本
编译完成后会生成一个u-boot.bin
和itop4412-spl.bin
二进制文件。
- 拼接脚本
$ cat E4412_N.bl1.bin itop4412-spl.bin env.bin u-boot.bin > u-boot-iTOP-4412.bin
Note: 其中的E4412_N.bl1.bin为讯为官方提供的 BL1 文件,后面为编译好的uboot目录下生产的文件。其中的env.bin???(环境变量二进制,怎么生产的待研究);最后将多个文件拼接到一个bin文件中。
- 烧写uboot脚本
$ dd iflag=dsync oflag=dsync if=u-boot-iTOP-4412.bin of=$1 seek=1
Note: $1为传入的SD卡盘符,如/dev/sdb。
七、总结:
移植工作到这里就暂时告一段落了,后期再研究uboot的工作大致流程;后期有时间研究下Uboot的初始化流程,和env.bin与spl.bin的工作机理。
下一步进行Linux内核的移植,接着更新。
八、源码地址
贴出同步更新的github链接:https://github.com/jason416/itop4412-uboot。