标签:uboot1-1-6 s3c2440 uboot移植 tq2440
Makefile:
# load ARCH, BOARD, and CPU configuration
include $(OBJTREE)/include/config.mk
export ARCH CPU BOARD VENDOR SOC
MKCONFIG := $(SRCTREE)/mkconfig
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
endif
smdk2410_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
unconfig:
@rm -f $(obj)include/config.h $(obj)include/config.mk $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp
# load other configuration
include $(TOPDIR)/config.mk
以smdk2410_config为例:
当make smdk2410_config 时 会删除unconfig对应的文件,然后执行源码下的mkconfig smdk2410 arm arm920t smdk2410 NULL s3c24x0,查看源码下的mkconfig:
# Script to create header files and links to configure
# U-Boot for a specific board.
#
# Parameters: Target Architecture CPU Board [VENDOR] [SOC]
cd ./include
rm -f asm
ln -s asm-$2 asm
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
echo "/* Automatically generated - do not edit */" >>config.h
echo "#include <configs/$1.h>" >>config.h
根据Parameters 知道 Target =smdk2410 Architecture =arm CPU=arm920t Board=smdk2410 VENDOR=NULL SOC=s3c24x0 并在include 目录下新建config.mk将ARCH CPU BOARD 等写入,而makefile include/config.mk 后就将这几个export了。同时还是include下新建config.h 包含#include
config.mk:
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
RANLIB = $(CROSS_COMPILE)RANLIB
ifdef ARCH
sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules
endif
ifdef CPU
sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
endif
ifdef SOC
sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules
endif
ifdef VENDOR
BOARDDIR = $(VENDOR)/$(BOARD)
else
BOARDDIR = $(BOARD)
endif
ifdef BOARD
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
endif
LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
在makefile设置好CROSS_COMPILE后剩下就由这个顶层的config.mk具体设置了。
板子具体的bin分布由u-boot.lds决定 在LDSCRIPT :=
SECTIONS
{
. = 0x00000000;
. = ALIGN(4);
.text :
{
cpu/arm920t/start.o (.text)
*(.text)
}
. = ALIGN(4);
.rodata : { *(.rodata) }
. = ALIGN(4);
.data : { *(.data) }
. = ALIGN(4);
.got : { *(.got) }
. = .;
__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;
. = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) }
_end = .;
}
唯一值得注意的是cpu/arm920t/start.o 要在最前面,uboot有两个启动阶段,第一阶段由汇编写的,最基本的初始化,就在这个start.S
6.综上所述,如果要新增一个板子的配置要:
a. 修改makefile的CROSS_COMPILE指定编译器
b. 在makefile里增加类似该配置
smdk2410_config : unconfig
@
c. 在board目录下新增板子的名称为目录
d. 在include/configs下新增板子的头文件,文件名是配置第一个参数名
e. make xxx_config 配置板子
f. make all 编译配置信息
标签:uboot1-1-6 s3c2440 uboot移植 tq2440
原文地址:http://blog.csdn.net/fzk374470412/article/details/45484459