arm9

mac2022-06-30  26

1.解压缩

tar xjf u-boot-1.1.6.tar.bz2

2.打补丁

patch -p1 < ../u-boot-1.1.6_jz2440.patch

3.配置

make 100ask24x0_config,下面为Makefile

MKCONFIG := $(SRCTREE)/mkconfig unconfig:      #清楚配置信息     @rm -f $(obj)include/config.h $(obj)include/config.mk \         $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp   100ask24x0_config   :   unconfig     @$(MKCONFIG) $(@:_config=) arm arm920t 100ask24x0 NULL s3c24x0 #上面这段翻译为:mkconfig 100ask24x0  arm arm920t 100ask24x0 NULL s3c24x0

make 100ask24x0_config这个命令执行的就是 mkconfig 100ask24x0  arm arm920t 100ask24x0 NULL s3c24x0这个脚本,下面我们看下mkconfig文件

  #!/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 # mkconfig 100ask24x0  arm arm920t 100ask24x0 NULL s3c24x0 # $0         $1         $2   $3      $4       $5     $6 [ "${BOARD_NAME}" ] || BOARD_NAME="$1" [ $# -lt 4 ] && exit 1 [ $# -gt 6 ] && exit 1 echo "Configuring for ${BOARD_NAME} board..." # # Create link to architecture specific headers #     cd ./include     rm -f asm     ln -s asm-$2 asm  #ln -s asm-arm asm 创建链接文件,以指定特定架构 rm -f asm-$2/arch ln -s ${LNPREFIX}arch-$6 asm-$2/arch   #ln -s arch-s3c24x0 asm-arm/arch if [ "$2" = "arm" ] ; then     rm -f asm-$2/proc     ln -s ${LNPREFIX}proc-armv asm-$2/proc  #ln -s proc-armv asm-arm/proc fi # # Create include file for Make # echo "ARCH   = $2" >  config.mk  #新建 echo "CPU    = $3" >> config.mk  #添加 echo "BOARD  = $4" >> config.mk  #添加 [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk  #NULL [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC    = $6" >> config.mk  #添加 # # Create board specific header file # if [ "$APPEND" = "yes" ]    # Append to existing config file then     echo >> config.h   else     > config.h      # 新建 fi echo "/* Automatically generated - do not edit */" >>config.h echo "#include <configs/$1.h>" >>config.h exit 0  

mkconfig新建的文件打印内容如下:

 

 

4.编译

make

继续提取Makefile一些主要成分:

# load ARCH, BOARD, and CPU configuration include $(OBJTREE)/include/config.mk ifeq ($(ARCH),arm) CROSS_COMPILE = arm-linux- # 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 ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) all: $(ALL) $(obj)u-boot.bin:   $(obj)u-boot         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@   $(obj)u-boot:       depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\         cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \             --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \             -Map u-boot.map -o u-boot # LDFLAGS在根目录config.mk中: LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)   # TEXT_BASE在board/100ask24x0/config.mk中: TEXT_BASE = 0x33F80000

再看一下u-boot.lds

/* * (C) Copyright 2002 * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") /*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/ OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { . = 0x00000000; //0x33F80000这个地址是0x30000000+64M-512Kb所在位置,当uboot大于512就要修改这个地址 . = ALIGN(4); .text : { cpu/arm920t/start.o (.text) board/100ask24x0/boot_init.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 = .; }

 

转载于:https://www.cnblogs.com/lzd626/p/11530560.html

最新回复(0)