最近开始弄2440, 以下是一部分记录
1,下载源码。
移植的第一步当然是下载最新版本的uboot源码,下载地址如下:ftp://ftp.denx.de/pub/u-boot/u-boot-2011.03.tar.bz2
2,解压。
进入相应路径:
......................
解压缩:
tar jxvf u-boot-2011.03.tar.bz2
3、进入 uboot cd u-boot-2011.03
4、删减 uboot
进入/board,留下 samsung,其它全部删除
进入/arch,留下 arm,其它全部删除
进入/arch/arm/cpu,留下 arm920t,其它全部删除
5、建立自己的 DEMO 板
cd /board/samsung
mv smdk2410/ smdk2440 //将 2410 下所有的代码复制到 2440 下
cd smdk2440
//进入 smdk2440 目录
mv smdk2410.c smdk2440.c
smdk2440.c
//将 smdk2440 下的 smdk2410.c 改名为
然后在文件夹 samsung 里留下 smdk2440,其它全部删除
cp include/configs/smdk2410.h include/configs/smdk2440.h //建立
2440 头文件
在 include/configs 下留下 smdk2440.h, 其它全部删除
vi board/samsung/smdk2440/Makefile //修改 smdk2440 下 Makefile 的
编译项,如下:
COBJS := smdk2440.o flash.o //修改第 28 行因在 smdk2440 下我们将
smdk2410.c 改名为 smdk2440.c
6、修改 u-boot 跟目录下的 Makefile 文件。指定交叉编译器,修改 160 行
CROSS_COMPILE ?= arm-linux-
//指定交叉编译器为 arm-linux-gcc
7.
修改boards.cfg,在smdk2410后(69行)添加
smdk2440 arm arm920t - samsung s3c24x0
8
#make smdk2440_config
#make
问题1
执行 make smdk2440_config
当出现Configuring for smdk2440.....表示配置以已经成功
出现make: execvp:…………/mkconfig:权限不够
查看mkconfig的权限,发现没有可执行权限,用chmod 764 mkconfig加上权限
然后再make,成功后可出现Configuring for smdk2440.....
问题2
出现如下错误
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
解决方法
在 smdk2440.h 中添加
#define CONFIG_SYS_SDRAM_BASE 0x00000000
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE - GENERATED_GBL_DATA_SIZE)
问题二。
修改完毕再次编译出现如下错误:
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编译条件控制中,而当预处理条件不满足是,被略去不编译。