U-boot 配置与编译

首先选择默认配置:

sun@machine:~/share/build/u-boot-2018.11$ make vexpress_ca15_tc2_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
sun@machine:~/share/build/u-boot-2018.11$

看到默认配置的扁平设备树默认没有选择,并且 tetx_base 为0X80800000

U-boot 配置与编译_第1张图片

 

最后选来选去,发现很多都不懂,而且不知道如何选择,果断

make distclean

然后使用默认配置:

make vexpress_ca15_tc2_defconfig
make menuconfig

 尽量打印多一点信息,所以开启以下三个选项

LOG打印级别由默认的4改为5,尽量多打印一些信息:

U-boot 配置与编译_第2张图片

然后编译:

make ARCH=arm CROSS_COMPILE=arm-linux- -j4

编译过程中报错:

arm-linux-ld.bfd: common/built-in.o:(.rodata.init_sequence_f+0x40): undefined reference to `print_cpuinfo'
Makefile:1381: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1

查找 print_cpuinfo 函数,筛选出以下信息挨个排查:

./arch/arm/cpu/armv7/s5p-common/cpu_info.c:33:int print_cpuinfo(void)
./arch/arm/cpu/armv7/ls102xa/cpu.c:229:int print_cpuinfo(void)
./arch/arm/cpu/armv7/vf610/generic.c:304:int print_cpuinfo(void)

匹配到二进制文件 ./common/built-in.o
./common/board_f.c:822:	print_cpuinfo,		/* display cpu info (and speed) */
./common/Kconfig:579:	  when U-Boot starts up. The function print_cpuinfo() is called
匹配到二进制文件 ./common/board_f.o

 查看后发现不同的CPU此函数实现方法不同,我使用QEMU模拟,所以此项就取消选择:

清理下:

sun@machine:~/share/build/u-boot-2018.11$ make clean
  CLEAN   env
  CLEAN   examples/standalone
  CLEAN   tools
  CLEAN   tools/lib tools/common
  CLEAN   u-boot-nodtb.bin u-boot.lds u-boot.cfg.configs u-boot.map u-boot.bin u-boot.cfg u-boot.srec u-boot u-boot.sym System.map

编译完成后当前目录下会生成 u-boot 开头的几个文件:

u-boot:             ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, with debug_info, not stripped
u-boot.bin:         COM executable for DOS
u-boot.cfg:         ASCII text, with very long lines
u-boot.cfg.configs: ASCII text
u-boot.lds:         assembler source, ASCII text
u-boot.map:         assembler source, UTF-8 Unicode text
u-boot-nodtb.bin:   COM executable for DOS
u-boot.srec:        Motorola S-Record; binary data in text format
u-boot.sym:         UTF-8 Unicode text

 

至此,编译就初步完成了

你可能感兴趣的:(U-boot 配置与编译)