在移植 JZ2440 中,include/configs/jz2440.h 中有很多config 项都是已经在 uboot 的主配置中已经存在了的,这些配置造成了重复,需要优化。
先将原先的 smdk2410.h 拷贝进来:cp include/configs/smdk2410.h ../../u-boot-2018.03/include/configs/jz2440.h
并把其中的2410 字样全部改为2440
执行编译
11.1 加入S3C24X0 架构
arch/arm/Kconfig 修改:

11.2 根据报错修改 u-boot
11.2.1 include/configs/jz2440.h:78:10: fatal error: config_cmd_default.h: No such file or directory
此文件找不到,config_cmd_default.h 中定义了一系列的命令行命令,查找以下里面的命令是否已经在,若存在,则打开响应的宏,然后删除 config_cmd_default.h 头文件包含
1 #ifndef _CONFIG_CMD_DEFAULT_H 2 #define _CONFIG_CMD_DEFAULT_H 3 4 /* 5 * Alphabetical list of all commands that are configured by default. 6 * This is essentially all commands minus those that are considered 7 * "non-standard" for some reason (memory hogs, requires special 8 * hardware, not fully tested, etc.). 9 */ 10 11 #define CONFIG_CMD_BDI /* bdinfo */ 12 #define CONFIG_CMD_BOOTD /* bootd */ 13 #define CONFIG_CMD_CONSOLE /* coninfo */ 14 #define CONFIG_CMD_ECHO /* echo arguments */ 15 #define CONFIG_CMD_EDITENV /* editenv */ 16 #define CONFIG_CMD_FPGA /* FPGA configuration Support */ 17 #define CONFIG_CMD_IMI /* iminfo */ 18 #define CONFIG_CMD_ITEST /* Integer (and string) test */ 19 #ifndef CONFIG_SYS_NO_FLASH 20 #define CONFIG_CMD_FLASH /* flinfo, erase, protect */ 21 #define CONFIG_CMD_IMLS /* List all found images */ 22 #endif 23 #define CONFIG_CMD_LOADB /* loadb */ 24 #define CONFIG_CMD_LOADS /* loads */ 25 #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop */ 26 #define CONFIG_CMD_MISC /* Misc functions like sleep etc*/ 27 #define CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ 28 #define CONFIG_CMD_NFS /* NFS support */ 29 #define CONFIG_CMD_RUN /* run command in env variable */ 30 #define CONFIG_CMD_SAVEENV /* saveenv */ 31 #define CONFIG_CMD_SETGETDCR /* DCR support on 4xx */ 32 #define CONFIG_CMD_SOURCE /* "source" command support */ 33 #define CONFIG_CMD_XIMG /* Load part of Multi Image */ 34 35 #endif /* _CONFIG_CMD_DEFAULT_H */
最后发现有两个宏找不到:
CONFIG_SYS_NO_FLASH:这个宏是用来控制是否使用 flash的 CONFIG_CMD_FLASH 和 CONFIG_CMD_IMLS 命令的,这两个命令我们可以单独开,不需要移植进来
CONFIG_CMD_SETGETDCR:主要是为了支持 DCR 寄存器。先看看 2015.01 中关于这个宏的定义:

依赖文件为 cmd_dcr.c,在2018.03 中这个文件被删除了,我们可以添加进来,保证这条命令可以执行。但是先看看这个宏我们是否要开启
2015.01 common/Makefile 中

可以看见依赖于 CONFIG_4xx

CONFIG_4xx 在 Powerpc 架构中才使用,我们不需要,不移植
当前config_cmd_default.h 移植完毕,在 include/configs/jz2440.h 中删掉此头文件。
11.2.2 CONFIG_NAND_S3C2440
include/configs/jz2440.h:173:0: warning: "CONFIG_NAND_S3C2440" redefined
此宏在前面已经添加,直接删除掉
11.2.3 CONFIG_LZMA
include/configs/jz2440.h:127:0: warning: "CONFIG_LZMA" redefined
CONFIG_LZMA:LZMA 是一种压缩算法,使能能它,必须使能 CONFIG_CMD_LZMADEC,在menuconfig 命令行下。若不项使能压缩命令,只使能算法,可以将CONFIG_CMD_LZMADEC 关掉
这个在 uboot 中已经默认开启,删除掉 jz2440.h 的相关定义。
11.2.4 CONFIG_DISPLAY_CPUINFO
include/configs/jz2440.h:117:0: warning: "CONFIG_DISPLAY_CPUINFO" redefined
前面移植已经做过操作,直接删除文件中的 CONFIG_DISPLAY_CPUINFO 即可。
11.2.5 CONFIG_SYS_PROMPT
include/configs/jz2440.h:109:0: warning: "CONFIG_SYS_PROMPT" redefined
前面移植已经做过操作,直接删除文件中的 CONFIG_SYS_PROMPT 即可。
11.2.6 CONFIG_SYS_LONGHELP
include/configs/jz2440.h:108:0: warning: "CONFIG_SYS_LONGHELP" redefined
CONFIG_SYS_LONGHELP:显示长的命令帮助信息
menuconfig 中可以直接开启,删除掉 jz2440.h 中的定义
11.2.7 CONFIG_CMDLINE_EDITING
include/configs/jz2440.h:89:0: warning: "CONFIG_CMDLINE_EDITING" redefined
CONFIG_CMDLINE_EDITING:为交互式命令行输入操作启用编辑和历史功能,即为我们的 uboot 串口shell 启动交互,已经选中,可以关闭jz2440.h 中的定义
11.2.8 CONFIG_RTC_S3C24X0
这个需要添加进 menuconfig 中,添加方式如下
搜索其他版本可以看到如下打印信息:

查看 2018.03 版本 可知道并没有 s3c24x0_rtc.c 文件,需要加进来,并修改 drivers/rtc/Makefile 文件
driver/rtc/Kconfig 中修改:

删除掉jz2440.h 中的定义
11.2.9 CONFIG_CMD_NAND
include/configs/jz2440.h:77:0: warning: "CONFIG_CMD_NAND" redefined
打开 nand 命令,在 menuconfig 中已经有定义,删除掉 jz2440.h 中的定义
11.2.10 CONFIG_CMD_ELF
include/configs/jz2440.h:76:0: warning: "CONFIG_CMD_ELF" redefined
CONFIG_CMD_ELF:从内存中启动一个 EFI 镜像
我们不需要此项设置,在 menuconfig 中关闭,并删除掉 jz2440.h 中的重复定义
11.2.11 CONFIG_S3C24X0_SERIAL
添加 此项定义进 menuconfig 中
u-boot-2018.03$ grep -irn --color "S3C24X0_SERIAL"

修改下面的 Kconfig 文件:

删除掉jz2440.h 中的定义。
11.2.12 cmd/reginfo.c:10:10: fatal error: asm/ppc.h: No such file or directory
ppc 架构我们不需要,但是reginfo.c 这个文件我们调用了,可以在将其隔离。
定义了 CONFIG_CMD_REGINFO 才会编译此文件。

CONFIG_CMD_REGINFO:寄存器 dump,但是只支持 PPC 架构,删除掉。
11.2.13 cmd/ubi.c: In function ‘display_ubi_info’
没打算在 uboot 支持 ubi 文件系统,去掉两个 UBI 宏

注意也在 menuconfig 中关闭,若是有重复定义的话
11.2.14 cmd/built-in.o: In function `do_fat_fsinfo'
与 ubi 一样,是 fat 文件系统的支持,此文件系统可以在 menuconfig 中直接配置,删除掉。

11.2.15 fdt 的错误
(1)common/built-in.o: In function `bootm_find_images':
common/bootm.c:247: undefined reference to `set_working_fdt_addr'
(2)common/built-in.o: In function `boot_relocate_fdt':
common/image-fdt.c:194: undefined reference to `set_working_fdt_addr'
(3)common/built-in.o: In function `cmd_process':
common/command.c:544: undefined reference to `do_bootd'
do_bootd 代码走向依赖于宏CONFIG_CMD_BOOTD,此宏在 jz2440.h 中未定义,关闭掉
(4)lib/built-in.o: In function `efi_exit_boot_services':
lib/efi_loader/efi_boottime.c:1748: undefined reference to `board_quiesce_devices'
lib/efi_loader/efi_boottime.c:1754: undefined reference to `bootm_disable_interrupts'
关掉宏:
- CONFIG_OF_LIBFDT:是嗯那个 FDT 库,S3C2440 并没有支持 设备树,这个宏会关闭 EFI
本文详细介绍了在U-Boot中移植和优化JZ2440平台配置的过程,包括解决重复配置、添加缺失宏定义、处理编译错误及调整架构相关设置。通过具体步骤解析,帮助读者理解如何针对特定硬件进行U-Boot定制。
1146

被折叠的 条评论
为什么被折叠?



