Makefile analysis of U-boot top layer

Source: Internet
Author: User

1.u-boot Making commands

Make forlinx_nand_ram256_config;

Make all;

2. Top layer Mkconfig analysis, reference U-boot Top level catalogue Mkconfig Analysis

The following 3 files are generated after the Mkconfig script executes, and the variables provided in these files are used elsewhere in makefile.

 the # Load ARCH, BOARD, and CPU configuration 117 include $ (objtree)/include/config.mk118 export    ARCH CPU BOARD VENDOR SOC

./include/config.mk

./board/samsung/smdk6410/config.mk

./include/config.h

3. Top layer CONFIG.MK analysis, reference u-boot top level catalogue CONFIG.MK Analysis

The variables set by this file will be used elsewhere in the makefile.

4. Variable print, modify makefile view the specific contents of the variable.

display1: @echo"platform_relflags: $ (platform_relflags)"@echo"platform_cppflags: $ (platform_cppflags)"@echo"cppflags: $ (cppflags)"@echo"CFLAGS: $ (CFLAGS)"@echo"aflags: $ (aflags)"@echo"ldflags: $ (ldflags)"@echo"CPP: $ (CPP)"@echo"Make : $ (make)"@echo"cross_compile: $ (cross_compile)"@echo"Boarddir: $ (boarddir)"@echo"HOSTCC: $ (HOSTCC)"@echo"hostcflags: $ (hostcflags)"@echo"All : $ (All)"@echo"subdirs: $ (subdirs)"@echo"OBJS: $ (OBJS)"@echo"__OBJS: $ (__OBJS)"@echo"LIBS: $ (LIBS)"@echo"__libs: $ (__libs)"@echo"ldscript: $ (ldscript)"

Execute make display1 to see the specific values for each variable as follows:

1Platform_relflags:-fno-strict-aliasing-fno-common-ffixed-r8-msoft-float 2Platform_cppflags:-dconfig_arm-d__arm__-march=armv5t3Cppflags:-g-os-fno-strict-aliasing-fno-common-ffixed-r8-msoft-float-d__kernel__-dtext_base=0xcfe00000-i/home/yjg/arm6410/qudong/ on-uboot/uboot_ok6410/include-fno-builtin-ffreestanding-nostdinc-isystem/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/include-pipe-dconfig_arm-d__arm__-march=armv5t4CFLAGS:-g-os-fno-strict-aliasing-fno-common-ffixed-r8-msoft-float-d__kernel__-dtext_base=0xcfe00000-i/home/yjg/arm6410/qudong/ on-uboot/uboot_ok6410/include-fno-builtin-ffreestanding-nostdinc-isystem/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/include-pipe-dconfig_arm-d__arm__-march=armv5t-wall-wstrict-prototypes5Aflags:-d__assembly__-g-os-fno-strict-aliasing-fno-common-ffixed-r8-msoft-float-d__kernel__-dtext_base=0xcfe00000-i/home/yjg/arm6410/qudong/ on-uboot/uboot_ok6410/include-fno-builtin-ffreestanding-nostdinc-isystem/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/include-pipe-dconfig_arm-d__arm__-march=armv5t6Ldflags:-bstatic-t/home/yjg/arm6410/qudong/ on-uboot/uboot_ok6410/board/samsung/smdk6410/u-boot.lds-ttext0xcfe00000 7CPP:/usr/local/arm/4.3.2/BIN/ARM-LINUX-GCC-E8 Make:make9Cross_compile:/usr/local/arm/4.3.2/bin/arm-linux-Tenboarddir:samsung/smdk6410 One HOSTCC:GCC AHostcflags:-wall-wstrict-prototypes-o2-fomit-frame-Pointer -All:u-boot.srec uBoot.bin System.map -Subdirs:tools Examples Post post/CPU theobjs:cpu/s3c64xx/START.O -__objs:cpu/s3c64xx/START.O -LIBS:LIB_GENERIC/LIBGENERIC.A board/samsung/smdk6410/libsmdk6410.a cpu/s3c64xx/libs3c64xx.a cpu/s3c64xx/s3c6410/ libs3c6410.a lib_arm/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/ REISERFS/LIBREISERFS.A fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a drivers/ LIBDRIVERS.A drivers/nand/libnand.a drivers/nand_legacy/libnand_legacy.a drivers/onenand/libonenand.a drivers/ Sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a common/Libcommon.a -__LIBS:LIB_GENERIC/LIBGENERIC.A board/samsung/smdk6410/libsmdk6410.a cpu/s3c64xx/libs3c64xx.a cpu/s3c64xx/s3c6410 /libs3c6410.a lib_arm/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/ REISERFS/LIBREISERFS.A fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a drivers/ LIBDRIVERS.A drivers/nand/libnand.a drivers/nand_legacy/libnand_legacy.a drivers/onenand/libonenand.a drivers/ Sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a common/Libcommon.a +Ldscript:/home/yjg/arm6410/qudong/ on-uboot/uboot_ok6410/board/samsung/smdk6410/u-boot.lds
Make display1

5. Make U-boot analysis, refer to detailed analysis make Uboot the final compile link to the specific execution process

$ (obj) U-boot:        depend version $ (subdirs) $ (OBJS) $ (LIBS) $ (ldscript)        undef_sym= ' $ (OBJDUMP)-X $ (LIBS) |sed  's/.*\ (__u_boot_cmd_.*\)/-u\1/p'|sort|  Uniq ';         && $ (LD) $ (ldflags) $ $UNDEF _sym $ (__OBJS)             --start-group $ (__libs)--end-Group $ (platform_ LIBS)             -map u-boot.map-o u-boot

The above target generation can be decomposed into 3 steps:

5.1 Determining the value of the UNDEF_SYM variable

Print out the value of the UNDEF_SYM variable as follows, where-u__u_boot_cmd_xxx is used as a parameter to the ARM-LINUX-LD command, meaning that these symbols are not defined in LD, that is, they do not define __u_boot_cmd_xxx, and so on, My understanding is that since the beginning of the need to load other symbols from a library, and this time has not been loaded into the library containing the definition of this symbol, so temporarily join this-u description, do not define these symbols, wait until all the libraries are loaded to find the definition of these symbols, this time has loaded all the library, You can also find the definition of these symbols.

-U__u_boot_cmd_base-U__u_boot_cmd_bdinfo-u__u_boot_cmd_bootelf-U__u_boot_cmd_bootm-U__U_BOOT_CMD_BOOTP-U__U_BOOT_CMD_BOOTVX-U__u_boot_cmd_branch-u__u_boot_cmd_cmp-U__U_BOOT_CMD_CP-U__U_BOOT_CMD_CRC32-u__u_boot_cmd_date-U__u_boot_cmd_dcache-U__U_BOOT_CMD_DNW-U__u_boot_cmd_echo-U__u_boot_cmd_end-U__u_boot_cmd_erase-U__u_boot_cmd_exit-U__u_boot_cmd_fatinfo-U__u_boot_cmd_fatload-U__u_boot_cmd_fatls-U__u_boot_cmd_flinfo-U__u_boot_cmd_go-U__u_boot_cmd_help-U__u_boot_cmd_icache-u__u_boot_cmd_imls-u__u_boot_cmd_itest-u__u_boot_cmd_loadb-u__u_boot_cmd_loads-U__u_boot_cmd_loady-U__u_boot_cmd_loop-U__U_BOOT_CMD_MD-u__u_boot_cmd_mm-U__u_boot_cmd_movi-u__u_boot_cmd_mtest-U__U_BOOT_CMD_MW-U__u_boot_cmd_nand-U__u_boot_cmd_nboot-U__u_boot_cmd_nfs-u__u_boot_cmd_nm-u__u_boot_cmd_ping-u__u_boot_cmd_printenv-U__u_boot_cmd_protect-U__u_boot_cmd_question_mark-U__u_boot_cmd_rarpboot-U__u_boot_cmd_reset-u__u_boot_cmd_saveenv-u__u_boot_cmd_setenv-U__u_boot_cmd_sleep-U__u_boot_cmd_start-u__u_boot_cmd_test-U__u_boot_cmd_tftpboot-U__u_boot_cmd_usb-u__u_boot_cmd_version
Undef_sym:

5.2 Switch to U-boot top level directory

The 5.3 arm-linux-ld chain was delivered into the final elf type U-boot.

Note here that the connector script file U-boot.lds

Ldflags:-bstatic-t/home/yjg/arm6410/qudong/0xcfe00000

From which Cpu/s3c64xx/start can be found. S is the first file executed by U-boot, which is followed by analyzing the U-boot start-up process from this function.

1Output_format ("Elf32-littlearm","Elf32-littlearm","Elf32-littlearm")2 /*Output_format ("Elf32-arm", "Elf32-arm", "Elf32-arm")*/3 Output_arch (ARM)4 ENTRY (_start)5 SECTIONS6 {7. =0x00000000;8 9. = ALIGN (4);Ten . Text: One     { Acpu/s3c64xx/start.o (. Text) -cpu/s3c64xx/s3c6410/cpu_init.o (. Text) -cpu/s3c64xx/onenand_cp.o (. Text) thecpu/s3c64xx/nand_cp.o (. Text) -cpu/s3c64xx/movi.o (. Text) -*(. Text) -lib_arm/DIV0.O +     } -  +. = ALIGN (4); A. Rodata: {*(. rodata)} at  -. = ALIGN (4); -. Data: {*(. Data)} -  -. = ALIGN (4); -. Got: {*(. Got)} in  -__u_boot_cmd_start = .; to. U_boot_cmd: {*(. u_boot_cmd)} +__u_boot_cmd_end = .; -  the. = ALIGN (4); *. Mmudata: {*(. mmudata)} $ Panax Notoginseng. = ALIGN (4); -__bss_start = .; the. BSS: {*(. BSS)} +_end = .; A}

Makefile analysis of U-boot top layer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.