编译u-boot,运行于Skyeye

来源:互联网 发布:淘宝ipad pro鉴别 编辑:程序博客网 时间:2024/06/05 15:04

编译u-boot,运行于Skyeye

 

OS平台:

phil@ubuntu-embedded:~/skyeye-tools/u-boot-1.1.4$uname -r

2.6.31.9embedded-hack

 

 

注意:Skyeye模拟smdk2410很难成功,模拟ep7312很容易。

1. 安装SkyEye

      sudo apt-get install skyeye

 

2. 安装交叉编译器cross-3.2.tar.gz

phil@ubuntu-embedded:~/skyeye-tools/u-boot-2010.03$arm-linux-gcc -v

Reading specs from/usr/local/arm/bin/../lib/gcc-lib/arm-linux/3.2/specs

Configured with: ./configure--target=arm-linux --prefix=/usr/local/arm/--with-headers=/home/sylam/armbuild/src/linux/include --disable-shared --disable-threads--enable-languages=c : (reconfigured) ./configure --target=arm-linux--prefix=/usr/local/arm/ --with-headers=/home/sylam/armbuild/src/linux/include

Thread model: posix

gcc version 3.2

 

$vi /etc/environment

 

3. 编译u-boot

 

      开发板的配置都在”include/configs/smdk2410.h

 

源码:

 

#ifdef CONFIG_AMD_LV400

 

#define PHYS_FLASH_SIZE                0x00080000 /* 512KB */

 

#define CFG_MAX_FLASH_SECT        (11)        /* max number of sectors on one chip */

 

#define CFG_ENV_ADDR                (CFG_FLASH_BASE + 0x070000) /*addr of environment */

 

#endif

 

修改:

 

#ifdef CONFIG_AMD_LV400

 

#define PHYS_FLASH_SIZE                0x01000000 /* 16MB */

 

#define CFG_MAX_FLASH_SECT        (12)        /* max number of sectors on one chip */

 

#define CFG_ENV_ADDR                (CFG_FLASH_BASE + 0x020000) /*addr of environment */

 

#endif

 

 

$make distclean;make smdk2410_config;make

 

编译生成u-boot.binu-boot,其中u-boot.binraw的二进制文件,u-bootELF格式的,这里我选用u-boot.binskyeye里运行。

phil@ubuntu-embedded:~/skyeye-tools/u-boot-2010.03$file u-boot*

u-boot:     ELF 32-bit LSB executable, ARM, version 1, statically linked, notstripped

u-boot.bin: data

u-boot.lds: ASCII assembler program text

u-boot.map: ASCII assembler program text

u-boot.srec: Motorola S-Record; binary datain text format

 

4. 配置skyeye.conf

vi include/configs/smdk2410.h

然后根据”include/configs/smdk2410.h”,写内容如下:

 

cpu: arm920t

 

mach: s3c2410x

 

#memory area

 

mem_bank: map=M, type=RW, addr=0x33f00000,size=0x01000000, file=u-boot.bin, boot=yes

 

#all peripherals I/O mapping area

 

mem_bank: map=I, type=RW, addr=0x48000000,size=0x20000000

 

      

 

5. skyeye中运行u-boot

 

      skyeye.confu-boot放在同一目录下运行skyeye

 

 

遇到的问题:

1.      软浮点问题:

I know there isa link error happened when the arm-linux ld want to link two different types oflibs.

因为你用的编译的版本不一致,

你的uboot里面指定了 -msoft-float 编译选项, 是软浮点的,

但是你连接的gcc库是用的硬浮点的,

解决办法

1
uboot里面的Makefile里面的 “-msoft-float”去掉;

或者
2
,换一个soft float软浮点的 工具链;

然后

可以选用3.2的编译器

自己编译一个编译器




编译使用的是arm-linux-gcc-3.4.1.tar.bz2,可能由于glibc使用Hardware FP,而Uboot使用的是SoftwareFP,所以无法正确链接,可能要将glibcSoftware FP的方法重新编译,怎样重新编译呢?


2. 宏调用中有编译开关就出错

a)        1The easiestway would be to upgrade to a _recent_ toolchain (i.e. >4).

b)      2:把编译开关移到宏调用外面
比如:
///////
原来的代码/////////////
/*U_BOOT_CMD(
        autoscr, 2, 0,        do_autoscript,
        "autoscr - run script from memory/n",
        "[addr] - run script starting at addr"
        " - A valid autoscr header must bepresent/n"
#if defined(CONFIG_FIT)
        "For FIT format uImage addr must includesubimage/n"
        "unit name in the form ofaddr:<subimg_uname>/n"
#endif
);*/
////////////
移到外面来就可以了/////////////
#if defined(CONFIG_FIT)
U_BOOT_CMD(
        autoscr, 2, 0,       do_autoscript,
        "autoscr - run script from memory/n",
        "[addr] - run script starting at addr"
        " - A valid autoscr header must bepresent/n"
);
#else
U_BOOT_CMD(
        autoscr, 2, 0,       do_autoscript,
        "autoscr - run script from memory/n",
        "[addr] - run script starting at addr"
        " - A valid autoscr header must bepresent/n"
        "For FIT format uImage addr must includesubimage/n"
        "unit name in the form ofaddr:<subimg_uname>/n"
);
#endif

 

3.

make的过程中,出现:
isystem/usr/local/arm/bin/../lib/gcc-lib/arm-linux/3.2/include -pipe -DCONFIG_ARM-D__ARM__ -march=armv4 -mtune=arm7tdmi -msoft-float -mabi=apcs-gnu -Uarm -Wall-Wstrict-prototypes -c -o hello_world.o hello_world.c
cc1: invalid option `abi=apcs-gnu'
有如下的解决方法:
出错的文件是/cpu/s3c44b0/下的config.mk:
PLATFORM_CPPFLAGS +=$(callcc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
PLATFORM_CPPFLAGS +=$(callcc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu),)

 

4.

make[1]: *** No rule tomake target `hello_world.srec', needed by `all'. Stop.
make[1]: Leaving directory`/home/mort/src/targa/u-boot/u-boot-TOT/examples'
make: *** [examples] Error 2
有如下的解决方法:
打开examples/Makefile 
119 $(LIB): .depend $(LIBOBJS)
120 $(AR) crv $@ $(LIBOBJS)
121 
122 %: %.o $(LIB)
123 $(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) /
124 -o $@ -e $(<:.o=) $< $(LIB) /
125 -L$(gcclibdir) -lgcc
126 %.srec: %
127 $(OBJCOPY) -O srec $< $@ 2>/dev/null
128 
129 %.bin: %
130 $(OBJCOPY) -O binary $< $@ 2>/dev/null
126行和129行改为:
%.srec: %.o
%.bin: %.o

 

参考文献:

http://www.skyeye.org/wiki/SkyeyeUboot

skyeye中运行u-boot goodhttp://blog.csdn.net/hdm125/archive/2009/03/13/3988271.aspx

 

附录:《如何制作支持softfloat的交叉编译器》

转自:http://www.mcuol.com/download/126/1468.htm
下面就介绍如何制作支持softfloat的交叉编译器,文章结束的地方有已经制作好的交叉编译器,供大家下载.

1、到网站http://kegel.com/crosstool/crosstool-0.43.tar.gz下载制作脚本,其中crosstool-0.43是最新的版本,想要使用其他版本请直接修改43两个数字即可.
2
、然后下载制作交叉编译器所需要的源码包,下面就是各个源码包的下载站点:
ftp://ftp.gnu.org/pub/gnu/gcc/gcc-3.4.1/gcc-3.4.1.tar.bz2

ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.3.3.tar.gz

ftp://ftp.gnu.org/pub/gnu/glibc/glibc-2.3.3.tar.gz

ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.15.tar.gz

ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.tar.gz

3
、下载完毕源码包之后,使用root用户登录redhat9,然后新建目录:/opt/crosstool,然后将其所有者修改为您的普通用户(我的redhat9的普通用户是yellow,以下均以yellow为例说明)
4
、修改方法:chown yellow/opt/crosstool,或者在图形界面中右击crosstool目录的图标,然后选择属性,在属性菜单中选择权限,把所有者修改为yellow用户即可.
5
、在目录/home/yellow目录下面新建目录downloads,然后复制刚才下载的几个源码包到目录downloads下面,同时也复制crosstool-0.28.tar.gzdownloads目录下.
6
、然后切换linux的用户,在终端中输入:su yellow,然后此时终端的用户就变成了yellow.
7
、然后进入到目录/opt/crosstool下面:cd /opt/crosstool,解压之前下载的crosstool-0.28.tar.gz文件:tar xvfz /home/yellow/downloads/crosstool-0.28.tar.gz -C /opt/crosstool.
8
、解压完毕后,进入crosstool-0.28目录:cd crosstool-0.28.
9
、然后执行:./demo-arm-softfloat.sh就可以开始制作编译器了.
10
、可能需要12个小时时间,然后会在默认的/opt/crosstool/目录下面产生一个名为arm-softfloat-linux-gnu的目录,它下面就是刚刚编译成功的交叉编译器了.

---------------------------------------------------------------------------

这里有一个链接,只需要添加一些选项就可以解决问题,不过没看明白。
http://lists.arm.linux.org.uk/lurker/message/20031008.170005.5adb1d49.html

以下是其他人同样遇到问题的一些记录,可以参见:
http://www.linuxdiyf.com/viewarticle.php?id=106899
http://blog.tianya.cn/blogger/post_show.asp?BlogID=420361&PostID=5366553&idWriter=0&Key=0

http://blog.csdn.net/leibniz_zsu/archive/2007/10/23/1839788.aspx
感谢网上的朋友们,希望这些内容对遇到同样问题的朋友有帮助:)

原创粉丝点击