Run the "make xxx_config" command before compiling U-boot. In general, you can configure U-boot to compile the bootloader suitable for the target board. What is the specific execution process of this command?
We can start with the MAKEFILE file of U-boot. For example, if we first execute the "make smd2410_config" command, the makefile will execute:
MKCONFIG := $(SRCTREE)/mkconfigexport MKCONFIGsmdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
That is:
./Mkconfig smdk2410 arm ARM920T smdk2410 null s3c24x0
That is to say, after "make xxx_config" is executed, the mkconfig script is actually executed. The following is an analysis of the mkconfig file:
#! /Bin/sh-e append = No # default: Create New config fileboard_name = "" # name to print in make output # If the command line parameter contains --,-, -N and other parameters, execute the following loop. # If-N xxx_config or-n xxx exists, take XXX as the name of the target board while [$ #-GT 0]; do case "$1" in --) shift; break;-A) shift; append = yes;-N) shift; board_name = "$ {1% % _ config}"; shift; *) break ;; esacdone # if the number of parameters passed to the script is less than 4 or greater than 6, exit ["$ {board_name}"] | board_name = "$1" # If board_name is empty, then board_name is equal to the first parameter [$ #-lt 4] & Exit 1 [$ #-GT 6] & Exit 1 echo "processing ing for $ {board_name} board... "# objtree and SR Ctree are all variables exported in makefile, which are the compilation directory and source directory. # If the compilation directory and source directory are different, run the following command to create $ (objtree) /include and other directories if ["$ srctree "! = "$ Objtree"]; then mkdir-p $ {objtree}/include mkdir-p ${objtree}/include2 CD ${objtree}/include2 Rm-f asm ln-S $ {srctree}/include/ ASM-$2 ASM lnprefix = ".. /.. /include2/ASM/"CD .. /include Rm-rf asm-$2 Rm-f asm mkdir ASM-$2 ln-s ASM-$2 asmelse # If the compiling directory is the same as the source directory, go to the include directory, delete the old ASM link, and create the link from the Project # template to the ASM. For example, if the target architecture is arm, create the ASM soft link to the ASM-arm. CD. /include Rm-f asm ln-s ASM-$2 asmfi # Delete the old arch link Rm-f asm-$2/arch under the target platform # if the length of the 6th parameter is 0 or its value is null, create a link from arch-$3 to ASM-$2. For command #". /mkconfig smdk2410 arm ARM920T smdk2410 null s3c24x0 "# $6 = s3c24x0 not empty #$3 = ARM920T $2 = arm # The final command executed is" ln-s arch-s3c24x0 ASM- ARM/arch "If [-z" $6 "-o" $6 "=" null "]; then ln-S $ {lnprefix} arch-$3 ASM-$2/archelse ln-S $ {lnprefix} arch-$6 ASM-$2/archfi # If the target platform is arm, deletes the created ASM-arm chain. Then, re-establish the link from proc-armv to ASM-arm if ["$2" = "arm"]; then Rm-f asm-$2/proc ln-S $ {lnprefix} proc-armv ASM-$2/procfi # create include file for make # echo "arch = $2 "> config. mkecho "CPU = $3"> config. mkecho "board = $4"> config. MK # If parameter 5 exists and is not null, add the vendor = $5 to config. ["$5"] & ["$5 "! = "Null"] & Echo "vendor = $5"> config. MK # If parameter 6 exists and is not null, append SOC = $6 to config. ["$6"] & ["$6" in the MK file "! = "Null"] & Echo "Soc = $6"> config. MK # create config. h file if ["$ APPEND" = "yes"] # append to existing config filethen echo> config. helse> config. h # create new config filefiecho "/* automatically generated-do not edit */"> config. hecho "# include <configs/$ 1.h>"> config. h exit 0
To sum up, "Make xxx_config" has done a total of work:
(1) determine the development board name as board_name = $1. (2) create some link files to prepare for compiling U-boot: ln-s ASM-$2 ASM ln-s arch-$6 ASM-$2/arch ln-s proc-armv ASM-$2/proc # arm only on the Target Platform. (3) create the File Include/config. mk contained in the top-level makefile. Arch = $2 CPU = $3 board = $4 vendor = $5 SOC = $6 (4) Create the Development Board-related header file include/config. h. /* Automatically generated-do not edit */# include