U-Boot编译之后会在其顶级目录中生成System.map和u-boot.map两个文件:
1 System.map
该文件按链接地址由小到大的顺序列出了所有符号:u-boot-2010.03配置编译smdk2410所生成的System.map文件开头部分如下:
33f80000 T _start 33f80020 t _undefined_instruction 33f80024 t _software_interrupt 33f80028 t _prefetch_abort 33f8002c t _data_abort 33f80030 t _not_used 33f80034 t _irq 33f80038 t _fiq 33f80040 t _TEXT_BASE 33f80044 T _armboot_start 33f80048 T _bss_start 33f8004c T _bss_end 34f80050 t start_code ...由上面信息可知, _start符号被链接在最前面的地址 0x33f80000,它是U-Boot的入口。SDRAM初始化完成后,需要将U-Boot加载到上述地址(SDRAM初始化前,U-Boot在Nor Flash或者芯片内部RAM中运行)。
2 u-boot.map
u-boot-2010.03配置编译smdk2410所生成的u-boot.map文件开头部分如下:
Archive member included because of file (symbol) lib_arm/libarm.a(board.o) cpu/arm920t/start.o (start_armboot) lib_arm/libarm.a(interrupts.o) lib_arm/libarm.a(board.o) (enable_interrupts) net/libnet.a(eth.o) lib_arm/libarm.a(board.o) (eth_initialize) net/libnet.a(net.o) lib_arm/libarm.a(board.o) (copy_filename) net/libnet.a(nfs.o) net/libnet.a(net.o) (NfsStart) net/libnet.a(rarp.o) net/libnet.a(net.o) (RarpRequest) net/libnet.a(tftp.o) net/libnet.a(net.o) (TftpStart) net/libnet.a(bootp.o) net/libnet.a(net.o) (BootpRequest) drivers/serial/libserial.a(serial_s3c24x0.o) lib_arm/libarm.a(board.o) (serial_init) common/libcommon.a(cmd_bdinfo.o) (__u_boot_cmd_bdinfo) common/libcommon.a(cmd_boot.o) (__u_boot_cmd_go) common/libcommon.a(cmd_bootm.o) lib_arm/libarm.a(board.o) (load_addr) common/libcommon.a(cmd_cache.o) (__u_boot_cmd_icache) common/libcommon.a(cmd_console.o) (__u_boot_cmd_coninfo) common/libcommon.a(cmd_date.o) (__u_boot_cmd_date) common/libcommon.a(cmd_echo.o) (__u_boot_cmd_echo) common/libcommon.a(cmd_elf.o) common/libcommon.a(cmd_bootm.o) (do_bootvx) common/libcommon.a(cmd_flash.o) (__u_boot_cmd_flinfo) common/libcommon.a(cmd_help.o) (__u_boot_cmd_help) common/libcommon.a(cmd_itest.o) (__u_boot_cmd_itest) common/libcommon.a(cmd_load.o) (__u_boot_cmd_loads) common/libcommon.a(cmd_mem.o) (__u_boot_cmd_md) common/libcommon.a(cmd_misc.o) (__u_boot_cmd_sleep) common/libcommon.a(cmd_net.o) (__u_boot_cmd_bootp) common/libcommon.a(cmd_nvedit.o) net/libnet.a(eth.o) (get_env_id) common/libcommon.a(cmd_source.o) (__u_boot_cmd_source) common/libcommon.a(cmd_version.o) (__u_boot_cmd_version) common/libcommon.a(cmd_ximg.o) (__u_boot_cmd_imxtract) common/libcommon.a(command.o) common/libcommon.a(cmd_itest.o) (cmd_get_data_size) common/libcommon.a(console.o) lib_arm/libarm.a(board.o) (printf) common/libcommon.a(dlmalloc.o) common/libcommon.a(cmd_source.o) (free) common/libcommon.a(env_common.o) common/libcommon.a(cmd_nvedit.o) (env_get_addr) common/libcommon.a(env_flash.o) common/libcommon.a(env_common.o) (env_get_char_spec) common/libcommon.a(exports.o) lib_arm/libarm.a(board.o) (jumptable_init) common/libcommon.a(flash.o) common/libcommon.a(cmd_load.o) (addr2info) common/libcommon.a(image.o) common/libcommon.a(cmd_ximg.o) (image_multi_count) common/libcommon.a(main.o) common/libcommon.a(cmd_bootm.o) (run_command) common/libcommon.a(s_record.o) common/libcommon.a(cmd_load.o) (srec_decode) common/libcommon.a(stdio.o) common/libcommon.a(cmd_console.o) (stdio_get_list) common/libcommon.a(xyzModem.o) common/libcommon.a(cmd_load.o) (xyzModem_error) board/samsung/smdk2410/libsmdk2410.a(smdk2410.o) lib_arm/libarm.a(board.o) (dram_init) board/samsung/smdk2410/libsmdk2410.a(flash.o) common/libcommon.a(flash.o) (write_buff) board/samsung/smdk2410/libsmdk2410.a(lowlevel_init.o) cpu/arm920t/start.o (lowlevel_init) lib_generic/libgeneric.a(crc16.o) common/libcommon.a(xyzModem.o) (cyg_crc16) lib_generic/libgeneric.a(crc32.o) common/libcommon.a(cmd_mem.o) (crc32) lib_generic/libgeneric.a(display_options.o) lib_arm/libarm.a(board.o) (print_size) lib_generic/libgeneric.a(gunzip.o) common/libcommon.a(cmd_bootm.o) (gunzip) lib_generic/libgeneric.a(net_utils.o) lib_arm/libarm.a(board.o) (string_to_ip) lib_generic/libgeneric.a(string.o) net/libnet.a(net.o) (strcpy) lib_generic/libgeneric.a(time.o) common/libcommon.a(cmd_load.o) (udelay) lib_generic/libgeneric.a(vsprintf.o) lib_arm/libarm.a(board.o) (simple_strtoul) lib_generic/libgeneric.a(zlib.o) lib_generic/libgeneric.a(gunzip.o) (inflateInit2_) lib_generic/libgeneric.a(ctype.o) lib_generic/libgeneric.a(display_options.o) (_ctype) lib_generic/libgeneric.a(div64.o) lib_generic/libgeneric.a(vsprintf.o) (__div64_32) cpu/arm920t/s3c24x0/libs3c24x0.a(speed.o) drivers/serial/libserial.a(serial_s3c24x0.o) (get_PCLK) cpu/arm920t/s3c24x0/libs3c24x0.a(timer.o) lib_generic/libgeneric.a(time.o) (__udelay) lib_arm/libarm.a(bootm.o) common/libcommon.a(cmd_bootm.o) (do_bootm_linux) lib_arm/libarm.a(cache.o) common/libcommon.a(cmd_elf.o) (flush_cache) lib_arm/libarm.a(cache-cp15.o) common/libcommon.a(cmd_cache.o) (icache_enable) lib_arm/libarm.a(reset.o) common/libcommon.a(cmd_boot.o) (do_reset) drivers/net/libnet.a(cs8900.o) board/samsung/smdk2410/libsmdk2410.a(smdk2410.o) (cs8900_initialize) drivers/rtc/librtc.a(date.o) common/libcommon.a(cmd_date.o) (GregorianDay) drivers/rtc/librtc.a(s3c24x0_rtc.o) common/libcommon.a(cmd_date.o) (rtc_get) cpu/arm920t/libarm920t.a(cpu.o) lib_arm/libarm.a(bootm.o) (cleanup_before_linux) /home/liyihai/Mini2440/Toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/libgcc.a(_udivsi3.o) net/libnet.a(tftp.o) (__aeabi_uidiv) /home/liyihai/Mini2440/Toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/libgcc.a(_divsi3.o) common/libcommon.a(cmd_date.o) (__aeabi_idiv) /home/liyihai/Mini2440/Toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/libgcc.a(_lshrdi3.o) lib_generic/libgeneric.a(vsprintf.o) (__aeabi_llsr) /home/liyihai/Mini2440/Toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/libgcc.a(_dvmd_lnx.o) /home/liyihai/Mini2440/Toolschain/4.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.3/libgcc.a(_udivsi3.o) (__div0) Memory Configuration Name Origin Length Attributes *default* 0x00000000 0xffffffff Linker script and memory map 0x00000000 . = 0x0 0x00000000 . = ALIGN (0x4) .text 0x33f80000 0x13414 cpu/arm920t/start.o(.text) .text 0x33f80000 0x400 cpu/arm920t/start.o 0x33f80000 _start 0x33f80044 _armboot_start 0x33f80048 _bss_start 0x33f8004c _bss_end *(.text) .text 0x33f80400 0x248 lib_arm/libarm.a(board.o) 0x33f80400 coloured_LED_init 0x33f80400 __coloured_LED_init 0x33f80404 red_LED_on 0x33f80404 __red_LED_on 0x33f80408 __red_LED_off 0x33f80408 red_LED_off 0x33f8040c green_LED_on 0x33f8040c __green_LED_on 0x33f80410 __green_LED_off 0x33f80410 green_LED_off 0x33f80414 __yellow_LED_on 0x33f80414 yellow_LED_on 0x33f80418 __yellow_LED_off 0x33f80418 yellow_LED_off 0x33f8041c blue_LED_on 0x33f8041c __blue_LED_on 0x33f80420 blue_LED_off 0x33f80420 __blue_LED_off 0x33f80424 hang 0x33f804e0 start_armboot ...由上述信息可见,u-boot.map中包含了链接过程中涉及的目标文件将其所依赖的库文件,然后所链接的目标文件的先后顺序列出各目标文件中各符号所链接的地址。
参考资料
[1]System.map解析
[2]关于uboot.map 文件的作用