#!/bin/sh -e# Script to create header files and links to configure
# U-Boot for a specific board.
#
# Parameters: Target Architecture CPU Board [VENDOR] [SOC] //注释此文件参数形式
#
# (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
#APPEND=no # Default: Create new config file
BOARD_NAME="" # Name to print in make output
//# $#表示输入进来的参数个 数,-gt(great than)表示左边大于右边则返回真
//# SHELL常用内部参数:
//# $# ----传递给程序的总的参数数目
//# $? ----上一个代码或者shell程序在shell中退出的情况,如果正常退出则返回0,反之为非0值。
//# $* ----传递给程序的所有参数组成的字符串。
//# $n ----表示第几个参数,$1 表示第一个参数,$2 表示第二个参数 ...
//# $0 ----当前程序的名称
//# $@ ----以"参数1" "参数2" ... 形式保存所有参数
//# $$ ----本程序的(进程ID号)PID
//# $! ----上一个命令的PID while [ $# -gt 0 ] ; docase "$1" in--) shift ; break ;;-a) shift ; APPEND=yes ;;-n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;*) break ;;esac
done[ "${BOARD_NAME}" ] || BOARD_NAME="$1" //此处很重要,给BOARD_NAME赋值为$1,即smdk2410[ $# -lt 4 ] && exit 1
[ $# -gt 6 ] && exit 1 //文件参数个数应该在4-6之间,否则退出echo "Configuring for ${BOARD_NAME} board..."#
# Create link to architecture specific headers
#
if [ "$SRCTREE" != "$OBJTREE" ] ; then //判断源代码目录是否和目标文件目录一致,可以在其他目录下编译,保持源代码目录干净mkdir -p ${OBJTREE}/includemkdir -p ${OBJTREE}/include2cd ${OBJTREE}/include2rm -f asmln -s ${SRCTREE}/include/asm-$2 asmLNPREFIX="../../include2/asm/"cd ../includerm -rf asm-$2rm -f asmmkdir asm-$2ln -s asm-$2 asm
elsecd ./includerm -f asm //删除旧的连接文件ln -s asm-$2 asm //建立新的连接文件
firm -f asm-$2/archif [ -z "$6" -o "$6" = "NULL" ] ; then //第六个参数是否存在,或为NULLln -s ${LNPREFIX}arch-$3 asm-$2/arch
elseln -s ${LNPREFIX}arch-$6 asm-$2/arch //建立连接文件 arch-s3c24x0 -> sam-arm/arch
fiif [ "$2" = "arm" ] ; thenrm -f asm-$2/procln -s ${LNPREFIX}proc-armv asm-$2/proc //再次建立连接文件proc-armv -> asm-arm/proc
fi#
# Create include file for Make
#//创建顶层包含的include/config.mk文件。 其内容很简单。此处>是重定向,>>也是重定向,只是追加在文件尾部。
//往config.mk 里面写入:ARCH = arm ,CPU = arm920t ,BOARD = smdk2410,SOC = s3c24x0
//可以在顶层目录输入make smdk2410_config, 在include 目录里面多了 一个 config.mk 文 件,里面内容就是刚刚写入的内容
echo "ARCH = $2" > config.mk
echo "CPU = $3" >> config.mk
echo "BOARD = $4" >> config.mk[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk[ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk#
# Create board specific header file
#
if [ "$APPEND" = "yes" ] # Append to existing config file
thenecho >> config.h
else> config.h # Create new config file //因为APPEND维持为0,故config.h被重新建立
fi
echo "/* Automatically generated - do not edit */" >>config.h
echo "#include <configs/$1.h>" >>config.hexit 0总结一下mkconifg的主要工作,mkconfig在UBOOT的底层目录的Makefile中被以如下方法使用
smdk2410_config : unconfig@$(MKCONFIG) $(@:_config=) arm arm920t sdmd2410 NULL s3c24x0
这句话结合Makefile中的上下文,可翻译为./mkconfig smdk2410 arm arm920t sdmd2410 NULL s3c24x0
其中,代码中$0=mkconfig,$1=smdk2410,$2=arm,$3=arm920t,$4=smdk2410 $5=NULL $6=s3c24x0
(1)开发板名称BOARD_NAME=smdk2410
(2)创建到平台/开发板相关的头文件的连接ln -s asm-$2 asmln -s arch-$6 asm-$2/archln -s proc-armv asm-$2/proc
(3)创建顶层Makefile包含的文件include/config.mkARCH=$2CPU=$3BOARD=$4VENDOR=$5SOC=$6
(4)创建开发板相关的头文件#include <configs/$1.h>
详细解决方案
u-boot mkconfig 文件分析
热度:71 发布时间:2023-12-17 10:51:24.0
相关解决方案
- 44b0+u-boot+vxworks 牛人指点下贝解决方案
- 新装电脑 开机后boot and select proper boot device or insert boot media in selected boot,该怎么处理
- can not mount boot archive解决方法
- u-boot-2014.04移栽FL2440(使用eclipse编辑uboot)
- Android开机卡通片 (boot animation)制作
- u-boot-1.3.4移植出现有关问题,求高手解答
- VisualDDK target boot.ini有关问题
- u-boot-1.1.6链接脚本的变量取址是什么含义?该怎么解决
- u-boot tag代码疑点
- IM515 ROM BOOT CODE解决方案
- IM515 ROM BOOT CODE,该如何解决
- u-boot tag代码疑义
- u-boot-1.1.6链接脚本的变量取址是什么含意
- 移植 u-boot 2011.06 有关问题
- 6410 u-boot 支持 usb的有关问题
- 在u-boot-1.3.4没法调用内核
- u-boot 移栽,内存中运行死机,求指导
- 2416,在U-boot 1.3.4上移植dm9000cep驱动,该怎么处理
- 系统移植的一个异常 .but target u-boot has EABI version 5
- DELL 服务器启动出现NO boot device availabel解决方法
- 怎么编译生成Fast boot,请问
- 如何在spring boot test的@sql注释中打印脚本文件的完整路径
- 事务注释在Spring Boot 2.1.3中不起作用
- Spring Boot @Autowired空初始化
- spring-boot camel case嵌套属性作为环境变量
- 启用登录 Spring Boot 执行器健康检查 API
- 用application.properties覆盖默认的Spring-Boot application.properties
- 如何使用 spring boot 和 oauth2 公开端点
- Spring Boot:使用 Java Bean 类从 application.properties 文件中读取 spring.jms.jndi-name 属性
- 部署在Tomcat 7.0.57上的Spring Boot 1.2.2应用程序无法启动