Uboot 2019.01移植之搭建模板(二)

一、搭建模板

如上一章所说选用origen板子作为移植的参考

1.1 搜索与origen/ORIGEN相关的文件

·grep "origen" -nR·

·grep "ORIGEN" -nR·

以下是搜索结果:

拷贝配置文件

configs/origen_defconfig

拷贝板级文件

board/samsung/origen/Kconfig

board/samsung/origen/MAINTAINERS

board/samsung/origen/Makefile

arch/arm/mach-exynos/Kconfig

拷贝头文件

include/configs/origen.h

文件关联

arch/arm/mach-exynos/Kconfig

arch/arm/mach-exynos/dmc_init_exynos4.c

arch/arm/mach-exynos/exynos4_setup.h

添加机器码

arch/arm/include/asm/mach-types.h

添加设备树支持

arch/arm/dts/Makefile

arch/arm/dts/exynos4210-origen.dts

1.2 拷贝配置文件

·cp configs/origen_defconfig configs/itop4412_defconfig` 拷贝origen板子的配置作为itop4412的配置。并将其中的ORIGEN/origen替换成ITOP4412/itop4412。

vim configs/itop4412_defconfig,使用正则进行替换:%s/origen/itop4412/g和:%s/ORIGEN/ITOP4412/g,并进行SOC替换(4210改为4412)

1.3 拷贝板级文件

·cp board/samsung/origen board/samsung/itop4412 -rf· 同样进行字符串替换

1.4 拷贝头文件

·cp include/configs/origen.h include/configs/itop4412.h· 同样进行字符串替换以及SOC替换,以及修改代码段位置

·#define CONFIG_SPL_TEXT_BASE 0x02023400·

1.5 文件关联

主要是修改上层调用的Kconfig和Makefile

·vim arch/arm/mach-exynos/Kconfig· 主要的工作是搜索origen/ORIGEN,将相应的操作为itop4412增加一份

···

index ed04369cfa..1b0e2d6ced 100644

--- a/arch/arm/mach-exynos/Kconfig

+++ b/arch/arm/mach-exynos/Kconfig

@@ -60,6 +60,10 @@ config TARGET_ORIGEN

        bool "Exynos4412 Origen board"

        select SUPPORT_SPL

+config TARGET_ITOP4412

+      bool "Exynos4412 Itop4412 board"

+      select SUPPORT_SPL

+

config TARGET_TRATS2

        bool "Exynos4412 Trat2 board"

@@ -156,6 +160,7 @@ source "board/samsung/smdkv310/Kconfig"

source "board/samsung/trats/Kconfig"

source "board/samsung/universal_c210/Kconfig"

source "board/samsung/origen/Kconfig"

+source "board/samsung/itop4412/Kconfig"

source "board/samsung/trats2/Kconfig"

source "board/samsung/odroid/Kconfig"

source "board/samsung/arndale/Kconfig"

···

修改Makefile,支持Exynos4412。

由Makefile看到Exynos4210会去编译dmc_init_exynos4.c clock_init_exynos4.c,且两个文件均包含exynos4_setup.h,拷贝这三个文件并重命名,替换字符串。

·cp dmc_init_exynos4.c dmc_init_exynos4412.c·

·cp clock_init_exynos4.c clock_init_exynos4412.c·

·cp exynos4_setup.h exynos4412_setup.h·

···

diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile

index e895c13157..b3efbbcf8a 100644

--- a/arch/arm/mach-exynos/Makefile

+++ b/arch/arm/mach-exynos/Makefile

@@ -13,6 +13,7 @@ ifdef CONFIG_SPL_BUILD

obj-$(CONFIG_EXYNOS5)  += clock_init_exynos5.o

obj-$(CONFIG_EXYNOS5)  += dmc_common.o dmc_init_ddr3.o

obj-$(CONFIG_EXYNOS4210)+= dmc_init_exynos4.o clock_init_exynos4.o

+obj-$(CONFIG_EXYNOS4412)+= dmc_init_exynos4412.o clock_init_exynos4412.o

obj-y  += spl_boot.o tzpc.o

obj-y  += lowlevel_init.o

endif

···

1.6 添加机器码

·vim arch/arm/include/asm/mach-types.h·

···

index 9f82efe007..e19b24b48a 100644

--- a/arch/arm/include/asm/mach-types.h

+++ b/arch/arm/include/asm/mach-types.h

@@ -5057,4 +5057,5 @@

#define MACH_TYPE_NASM25              5112

#define MACH_TYPE_TOMATO              5113

#define MACH_TYPE_OMAP3_MRC3D          5114

+#define MACH_TYPE_ITOP4412            5115

#endif

···

1.7 添加设备树支持

·cp arch/arm/dts/exynos4210-origen.dts arch/arm/dts/exynos4412-itop4412.dts· 同样替换字符串和SOC

修改Makefile,编译exynos4412-itop4412.dtb

···

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile

index dda4e59491..ea89e4db82 100644

--- a/arch/arm/dts/Makefile

+++ b/arch/arm/dts/Makefile

@@ -12,7 +12,8 @@ dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \

        exynos4210-universal_c210.dtb \

        exynos4210-trats.dtb \

        exynos4412-trats2.dtb \

-      exynos4412-odroid.dtb

+      exynos4412-odroid.dtb \

+      exynos4412-itop4412.dtb

dtb-$(CONFIG_TARGET_HIKEY) += hi6220-hikey.dtb

···

做出以上修改,尝试编译·make itop4412_defconfig;make -j8·

1.8 跳过符号校验

CFG u-boot.cfg

CFGCHK  u-boot.cfg

Error: You must add new CONFIG options using Kconfig

The following new ad-hoc CONFIG options were detected:

CONFIG_EXYNOS4412

CONFIG_ITOP4412

Please add these via Kconfig instead. Find a suitable Kconfig

file and add a 'config' or 'menuconfig' option.

Makefile:1002: recipe for target 'all' failed

make: *** [all] Error 1

对错误信息进行搜索,·grep  "You must add new CONFIG options using Kconfig" -nR·

scripts/check-config.sh:53: echo >&2 "Error: You must add new CONFIG options using Kconfig"

直接搜索check-config.sh在哪里调用,·grep "check-config.sh" -nR·

Makefile:912:cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \

scripts/check-config.sh:12:#    check-config.sh

scripts/check-config.sh:15:#  scripts/check-config.sh b/chromebook_link/u-boot.cfg kconfig_whitelist.txt .

由此可见是Makefile运行发生错误导致的,修改Makeifle

···

diff --git a/Makefile b/Makefile

index d799567535..a83013d285 100644

--- a/Makefile

+++ b/Makefile

@@ -908,9 +908,9 @@ cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@

cfg: u-boot.cfg

-quiet_cmd_cfgcheck = CFGCHK  $2

-cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \

-              $(srctree)/scripts/config_whitelist.txt $(srctree)

+#quiet_cmd_cfgcheck = CFGCHK  $2

+#cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \

+#              $(srctree)/scripts/config_whitelist.txt $(srctree)

all:          $(ALL-y) cfg

ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)

···


你可能感兴趣的:(Uboot 2019.01移植之搭建模板(二))