Configuration analysis of U-boot (2)

Source: Internet
Author: User

Brief analysis of Makefile
The compilation connections for all these directories are determined by the makefile of the top-level directory.

1. in the makefile, there are:


Unconfig:
@rm-F $ (obj) include/config.h $ (obj) include/config.mk \
$ (obj) board/*/config.tmp $ (obj) board/*/*/config.tmp

% is a wildcard, make Xxx_config is the target. The target's dependence is unconfig,

unconfig 's command is to delete some files, which are generated from the make xxx_config process. Unconfig is the cleanup configuration.

Mkconfig: = $ (Srctree)/mkconfig

100ask24x0_config:unconfig
@$ (mkconfig) $ (@:_config=) arm arm920t 100ask24x0 NULL s3c24x0         

equivalent to ./mkconfig 100ask24x0 arm arm920t 100ask24x0 NULL s3c24x0

[email protected] means target.

$ (@:_config=) is a substitution reference for a variable

The format is "$ (var:a=b)" (or "${var:a=b}"), meaning: Replace the word "B" at the end of all "A" characters in the variable "VAR".

2. The following is the execution of the Mkconfig script

Mkconfig file:

./mkconfig 100ask24x0 arm arm920t 100ask24x0 NULL s3c24x0

$ $4 $ $6

Objtree: = $ (if $ (build_dir), $ (Build_dir), $ (CURDIR))
Srctree: = $ (CURDIR)
CurDir is a special parameter in Makefile that represents the current directory. So, the meaning of this sentence is to decide whether to use Build_dir or CurDir.

["${board_name}"] | | Board_name= "$" #BOARD_NAME =100ask24x0     
$n under Linux script for incoming parameter nth


[$#-lt 4] && exit 1
[$#-GT 6] && exit 1 #目标参数小于4大于6退出

The number of $# parameters -lt less than-gt greater than

echo "Configuring for ${board_name} BOARD ..."
echo Print

Objtree: = $ (if $ (build_dir), $ (Build_dir), $ (CURDIR))
If the definition build_dir equals Build_dir no person is CurDir

CD./include
Rm-f ASM
Ln-s asm-$2 ASM #ln-S asm-arm ASM

Delete the original ASM build a link file asm point to Asm-arm

Rm-f asm-$2/arch # rm-f Asm-arm/arch

If [-Z ' $6 "-o" $6 "=" NULL "];

if $6 is empty or equals null
Ln-s ${lnprefix}arch-$6 asm-$2/arch # ln-s arch-s3c24x0 asm-100ask24x0/arch

Delete original arch build a link file arch pointing arch-s3c24x0

rm-f asm-$2/proc # rm-f Asm-arm/proc
ln-s ${lnprefix}proc-armv asm-$2/proc # ln-s PROC-ARMV asm-arm/proc

Delete original proc Create a link file proc point to PROC-ARMV

#

# Create include file for Make

#

echo "ARCH = $" > config.mk

echo "CPU = $ $" >> config.mk

echo "BOARD = $4" >> config.mk

["$ $"] && ["$ $"! = "NULL"] && echo "VENDOR = $ $" >> config.mk

["$6"] && ["$6"! = "NULL"] && echo "SOC = $6" >> config.mk

Create a file containing the top level makefile INCLUDE/CONFIG.MK

#
# Create Board Specific header file
#
If ["$APPEND" = "yes"] # APPEND to existing config file
Then
Echo >> config.h
Else
> Config.h # Create new config file
Fi
echo "/* automatically generated-do not edit */" >>config.h
echo "#include <configs/$1.h>" >>config.h

Create a Development Board-related header file Include/config.h

Content is/* automatically generated-do not edit */

#include <configs/100ask24x0.h>

Now summarize and review the configuration command make smdk2410_config; actual execution "./mkconfig 100ask24x0 arm arm920t 100ask24x0 NULL s3c24x0" command

Assume execution "./mkconfig $ $4 $ $6" command. The following results are generated.

(1) Development Board name Board_name equals $ $.

(2) Create a link to the platform, Development Board related files, as shown below;

Ln-s asm-$2 ASM

Ln-s ${lnprefix}arch-$6 Asm-$2/arch

Ln-s ${LNPREFIX}PROC-ARMV Asm-$2/proc

(3) Create the top-level makefile containing the file include/config.mk as follows:

ARCH = Arm

CPU =arm920t

BOARD = 100ask24x0

SOC = s3c24x0

(4) Create the Development Board related header file Include/config.h as follows:

/* Automatically generated-do not edit */

#include <configs/100ask24x0.h>

The top level makefile calls the makefile of each subdirectory to generate the target file or the target file repository.
Then connect all target files (libraries) to generate the final u-boot.bin.
The main goals of the connection (library) are as follows:
OBJS = cpu/$ (CPU)/START.O
LIBS = LIB_GENERIC/LIBGENERIC.A
LIBS + = board/$ (boarddir)/lib$ (board). A
LIBS + = cpu/$ (CPU)/lib$ (CPU). A
Ifdef SOC
LIBS + = cpu/$ (CPU)/$ (SOC)/lib$ (SOC). A
endif
LIBS + = lib_$ (arch)/lib$ (arch). A
LIBS + = FS/CRAMFS/LIBCRAMFS.A fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a/
FS/REISERFS/LIBREISERFS.A FS/EXT2/LIBEXT2FS.A
LIBS + = Net/libnet.a
LIBS + = disk/libdisk.a
LIBS + = RTC/LIBRTC.A
LIBS + = Dtt/libdtt.a
LIBS + = DRIVERS/LIBDRIVERS.A
LIBS + = Drivers/nand/libnand.a
LIBS + = Drivers/nand_legacy/libnand_legacy.a
LIBS + = Drivers/sk98lin/libsk98lin.a
LIBS + = Post/libpost.a post/cpu/libcpu.a
LIBS + = Common/libcommon.a
LIBS + = $ (boardlibs)
The main factors that are obviously related to the platform are:
cpu/$ (CPU)/START.O
board/$ (Boarddir)/lib$ (board). A
cpu/$ (CPU)/lib$ (CPU). A
cpu/$ (CPU)/$ (Soc)/lib$ (SOC). A
lib_$ (Arch)/lib$ (arch). A
The four variables in this are defined in INCLUDE/CONFIG.MK (see above).
The rest are platform independent.
So when considering porting, the main consideration is the corresponding directory of these target files (libraries).

Configuration analysis of U-boot (2)

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.