偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.
全部博文(1748)
分类: LINUX
2009-02-06 15:35:48
定义 arm-elf格式文件的布局。
$(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
/*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
. = 0x00000000;
. = ALIGN(4);
.text :
{
cpu/arm920t/start.o (.text) --> 可以看出整个程序的入口是start.S的源码
board/open24x0/boot_init.o (.text)
*(.text)
}
...
...
}
Config.mk
LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules
sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk
Makefile
include $(TOPDIR)/config.mk
Makefile分析
VERSION_FILE
= $(obj)include/version_autogenerated.h
HOSTARCH=i386
HOSTOS=linux
MKCONFIG := $(SRCTREE)/mkconfig
include $(OBJTREE)/include/config.mk # make xxx_config后内容为配置的内容
export ARCH CPU BOARD VENDOR SOC
CROSS_COMPILE = arm-linux-
include $(TOPDIR)/config.mk
# U-Boot objects....order is important (i.e. start must be first)
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/usb/libusb.a
LIBS += drivers/sk98lin/libsk98lin.a
LIBS += common/libcommon.a
LIBS += $(BOARDLIBS)
LIBS := $(addprefix $(obj),$(LIBS))
xxx_config: unconfig
@echo "#define CONFIG_CPU" >>include/config.h
@echo "#define CONFIG_BOARD" >>include/config.h
@$(MKCONFIG) $(@:_config=) ARCH CPU BOARD VENDOR SOC
@sed -i "s,^TEXT_BASE = .*,TEXT_BASE = (内存的高端地址-足够的运行空间),g" $(obj)board/VENDOR/BOARD/config.mk
@echo "... configured for VENDOR Logic BOARD board"
使用 make xxx_config的时候生成了
include/asm include/asm-arm
include/asm/arch include/asm-arm/arch- CPU
include/config.h
include/config.mk
再次使用Make的时候,Makefile中包含的各项配置文件已经有了