0K6410 learning make_smdk6410_config

Source: Internet
Author: User


1. Use the board-level configuration command: make smdk6410_config, and find it in makefile under the root directory

########################################################################### ARM1176 Systems#########################################################################smdk6410_noUSB_config    \smdk6410_config   :   unconfig    @mkdir-p $(obj)include $(obj)board/samsung/smdk6410    @mkdir-p $(obj)nand_spl/board/samsung/smdk6410    @echo"#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h    @if[ -z "$(findstring smdk6410_noUSB_config,$@)" ]; then          \       echo"RAM_TEXT = 0x57e00000" >>$(obj)board/samsung/smdk6410/config.tmp;\       $(MKCONFIG)$(@:_config=) arm arm1176 smdk6410 samsung s3c64xx;       \    else                                   \       echo"RAM_TEXT = 0xc7e00000" >>$(obj)board/samsung/smdk6410/config.tmp;\       $(MKCONFIG)$(@:_noUSB_config=) arm arm1176 smdk6410 samsung s3c64xx; \    fi    @echo"CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk########################################################################### ARM1176 Systems#########################################################################

1. Normally, make will output the command line to be executed to the screen before the command is executed. When we use the "@" character before the command line, this command will not be displayed by make.

2. @ mkdir-p $ (obj) include $ (obj) board/samsung/smdk6410 create a directory $ (obj) =/. If a directory exists, no directory is created.

3. @ mkdir-p $ (obj) nand_spl/board/samsung/smdk6410 similarly

4. @ echo "# define CONFIG_NAND_U_BOOT"> $ (obj) include/config. h

> Create a config. h file and add # define CONFIG_NAND_U_BOOT to it.

> Adds content to a file.

5. "$ (findstringsmdk6410_noUSB_config, $ @)" <==> "tips:

$ (Findstring FIND, IN)

Function Name: Find the string function-findstring.

Function: Search for the string "IN" and FIND the string "FIND.

Return Value: If "FIND" exists IN "IN", "FIND" is returned; otherwise, null is returned.

Function Description: the string "IN" can contain spaces and [Tab]. Search requires strict text matching.

Example:

$ (Findstring a, a B c)

$ (Findstring a, B c)

The first function returns the word "a", and the second value is a null character.

6. if [-z "$ (findstring smdk6410_noUSB_config, $ @)"]-z should indicate the inverse meaning, that is, the sentence following the non-null execution

Echo "RAM_TEXT = 0x57e00000" >$ (obj) board/samsung/smdk6410/config. tmp ;\

$ (MKCONFIG) $ (@: _ config =) arm arm1176 smdk6410 samsung cloud64xx ;\

First, recover RAM_TEXT = 0x57e00000 to config. tmp, and then execute $ (MKCONFIG) $ (@: _ config =) arm
Arm1176 smdk6410 samsunginiti64xx;

7. $ (MKCONFIG) $ (@: _ config =) arm arm1176 smdk6410 samsung cloud64xx;

MKCONFIG: = $ (SRCTREE)/mkconfig <====> MKCONFIG = mkconfig,

$ (@: _ Config =) means replacing _ config with spaces, while $ (@: _ config) <==> smdk6410:

$ (@ D)

Indicates the directory part of the target file (excluding the slash ). If "$ @" is "dir/foo. o", then "$ (@ D )"

The value is "dir ". If "$ @" does not contain a slash, its value is "." (current directory ).

8. @ echo "CONFIG_NAND_U_BOOT = y"> $ (obj) include/config. mk is also an append information.

2. We know that executing make smdk6410_config is equivalent to executing

Mkconfig smdk6410 arm arm1176 smdk6410 samsung cloud64xx

$0 $1 $2 $3 $4 $5 $6

Then run the script file mkconfig in the root directory to see that there is such a piece of code first.

1、while[ $# -gt0 ] ; do      case"$1" in    --)shift ; break ;;    -a)shift ; APPEND=yes ;;    -n)shift ; BOARD_NAME="${1%%_config}" ; shift ;;    -t)shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;    *)  break ;;    esacdone

While [$ #-gt 0] means to execute the following when the number of input parameters is greater than 0.

These lines of code are used to determine whether the first parameter $1 has the following four cases: case. Add minor knowledge

2. ["$ {BOARD_NAME}"] | BOARD_NAME = "$1" indicates that if no board name is defined, the Board name is assigned $1. Obviously, no board name is defined here.

3. [$ #-lt 4] & exit 1
# Determine the number of input parameters. Exit if the value is smaller than 4,

[$ #-Gt 6] & exit 1
# Exit if it is greater than 6

4. if ["$ {ARCH}"-a "$ {ARCH }"! = "$2"]; then

Echo "Failed: \ $ ARCH =$ {ARCH}, shocould be '$ 2' for $ {BOARD_NAME}" 1> & 2

Exit1

If ARCH has been defined and is defined as arm, the following information will be printed. Obviously, the condition is not true and skipped.

5. echo "tracing ing for $ {BOARD_NAME} board..." # print the information. Please try make smdk6410_config.

6. # Create link to architecture specific headers

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 mkdirasm-$2 ln-s asm-$2 asmelse # apparently the condition is not true and the cd is transferred here. /include rm-f asm ln-s asm-$2 asmfi

Check the makefile source code and you will know the content after executing else because SRCTREE = OBJTREE.

Cd./include

Rm-f asm

Ln-s asm-$2 asm

Ln-s asm-$2 asm indicates creating an asm temporary file pointing to the asm-arm architecture. For example,

The include directory contains many folders starting with asm. After executing this command, we will point to the unique asm-arm.

7. if [-z "$6"-o "$6" = "NULL"]; then

Ln-s $ {LNPREFIX} arch-$3 asm-$2/arch

Else

Ln-s $ {LNPREFIX} arch-$6 asm-$2/arch # create a link file

Fi

If the sixth parameter is null, then is executed. Otherwise, else is executed. It is obviously not empty. A link file is also created, and LNPREFIX is not defined as null.

Currently, the-z (shell not learned) That is summed up by myself indicates the reverse;-o or operation;-a and operation. I don't know, right? Wait until you have a network!

8. if ["$2" = "arm"]; then

Rm-f asm-$2/proc

Ln-s $ {LNPREFIX} proc-armv asm-$2/proc

Fi

I will not repeat the above.

9 ,#

# Create include file for Makeecho "ARCH   = $2" >  config.mkecho "CPU    = $3" >> config.mkecho "BOARD  = $4" >> config.mk[ "$5" ] && ["$5" != "NULL" ] && echo "VENDOR = $5">> config.mk[ "$6" ] && ["$6" != "NULL" ] && echo "SOC    = $6" >> config.mk

Create a file and append it ..

10. # Assign board directory to BOARDIR variable

if [ -z "$5" -o "$5" ="NULL" ] ; then   BOARDDIR=$4else    BOARDDIR=$5/$4Fi

The Board Sub-directory Samsung/smdk6410 is defined here

11、if[ "$APPEND" = "yes" ]    #Append to existing config filethen    echo>> config.helse    >config.h    # Create new config filefiecho "/* Automatically generated - donot edit */" >>config.h

APPEND = no. Therefore, create config. h under the current directory include.

11. fori in $ {TARGETS}; do

Echo "# define CONFIG_MK _ $ {I} 1"> config. h;

Done

I guess I exists in targets? It is null and does not exist. skip this step.

cat << EOF >> config.h#define CONFIG_BOARDDIR board/$BOARDDIR#include <config_defaults.h>#include <configs/$1.h>#include <asm/config.h>EOF

Open config. h and enter the above information.

Exit 0 should be the end character

At this point, the whole board-level Configuration Analysis is complete, and some places do not know whether the analysis is correct. Wait until the school is verifying it!

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.