新版uboot编译的一个问题



1,下载源码。
移植的第一步当然是下载最新版本的uboot源码,下载地址如下:
    ftp://ftp.denx.de/pub/u-boot/u-boot-2010.12.tar.bz2

2,解压缩。
进入相应路径:
    cd /home/bsc
解压缩:
    tar jxvf u-boot-2010.12.tar.bz2

3,编译。
进入生成的文件夹,在uboot主目录:
    cd u-boot-2010.12
首先编译下看看是否可以编译成功(交叉编译器为4.3.2):
    make distclean              /*清除已经形成的链接,修改顶层Makefile文件必须执行*/
    make smdk2410_config
    make all

4,问题一。
make测试一下,产生如下错误
board.c: In function '__dram_init_banksize':
board.c:233: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in this function)
board.c:233: error: (Each undeclared identifier is reported only once
board.c:233: error: for each function it appears in.)
board.c: In function 'board_init_f':
board.c:279: error: 'CONFIG_SYS_INIT_SP_ADDR' undeclared (first use in this function)
board.c:312: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in this function)
make[1]: *** [board.o] Error 1
make[1]: Leaving directory `/home/bsc/u-boot-2010.12/arch/arm/lib'
make: *** [arch/arm/lib/libarm.o] Error 2

新版uboot的bug
在smdk2410.h中添加
#define CONFIG_SYS_SDRAM_BASE        0x00000000
#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_TEXT_BASE - GENERATED_GBL_DATA_SIZE)

5,问题二。

修改完毕再次编译出现如下错误:

arch/arm/lib/libarm.o: In function `arch_lmb_reserve':

/home/bsc/u-boot-2010.12/arch/arm/lib/bootm.c:74: undefined reference to `get_sp'

arm-linux-ld: BFD (Sourcery G++ Lite 2008q3-72) 2.18.50.20080215 assertion fail /scratch/julian/lite-respin/linux/obj/binutils-src-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:9537

arm-linux-ld: BFD (Sourcery G++ Lite 2008q3-72) 2.18.50.20080215 assertion fail /scratch/julian/lite-respin/linux/obj/binutils-src-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:9771

/bin/sh: line 1: 27564 Segmentation fault      arm-linux-ld -Bstatic -T u-boot.lds -pie -Ttext 0x33F80000 $UNDEF_SYM arch/arm/cpu/arm920t/start.o --start-group api/libapi.o arch/arm/cpu/arm920t/libarm920t.o arch/arm/cpu/arm920t/s3c24x0/libs3c24x0.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o net/libnet.o post/libpost.o board/samsung/smdk2410/libsmdk2410.o --end-group /home/bsc/u-boot-2010.12/arch/arm/lib/eabi_compat.o -L /usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/armv4t -lgcc -Map u-boot.map -o u-boot

make: *** [u-boot] Error 139

查看bootm.c:代码,发现里面明明存在get_sp()函数,支持在一些宏定义条件下。可能是这些宏未定义导致该函数未编译。

查到网上一个patch:

[PATCH] arm: get_sp() should always be compiled

<ratbert.chuang <at> gmail.com>
2010-11-01 07:55:27 GMT

From: Po-Yu Chuang <ratbert <at> faraday-tech.com>

get_sp() was incorrectly excluded if none of

  CONFIG_SETUP_MEMORY_TAGS

  CONFIG_CMDLINE_TAG

  CONFIG_INITRD_TAG

  CONFIG_SERIAL_TAG

  CONFIG_REVISION_TAG

were defined.

 

Signed-off-by: Po-Yu Chuang <ratbert <at> faraday-tech.com>

---

 arch/arm/lib/bootm.c |    4 +---

 1 files changed, 1 insertions(+), 3 deletions(-)

 

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c

index a1649ee..7734953 100644

--- a/arch/arm/lib/bootm.c

+++ b/arch/arm/lib/bootm.c

@@ -327,12 +327,12 @@ void setup_revision_tag(struct tag **in_params)

 }

 #endif  /* CONFIG_REVISION_TAG */

 

-

 static void setup_end_tag (bd_t *bd)

 {

        params->hdr.tag = ATAG_NONE;

        params->hdr.size = 0;

 }

+#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */

 

 static ulong get_sp(void)

 {

@@ -341,5 +341,3 @@ static ulong get_sp(void)

        asm("mov %0, sp" : "=r"(ret) : );

        return ret;

 }

-

-#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG*/

修改完毕后,再次编译通过(从编译过程来看,新版本的BUG还不少)。
以上补丁所作的就是把get_sp函数定义后的#endif移到定义之前,这样get_sp就不会包含在CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG编译条件控制中,而当预处理条件不满足是,被略去不编译。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值