編譯u-boot,運行於Skyeye

編譯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, not stripped

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 data in 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 is a link error happened when the arm-linux ld want to link two different types of libs.

因爲你用的編譯的版本不一致,

你的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使用的是Software FP,所以無法正確鏈接,可能要將glibcSoftware FP的方法重新編譯,怎樣重新編譯呢?


2. 宏調用中有編譯開關就出錯

a)         1The easiest way 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 be present/n"
#if defined(CONFIG_FIT)
        "For FIT format uImage addr must include subimage/n"
        "unit name in the form of addr:<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 be present/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 be present/n"
        "For FIT format uImage addr must include subimage/n"
        "unit name in the form of addr:<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 +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu),)

 

4.

make[1]: *** No rule to make 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
感謝網上的朋友們,希望這些內容對遇到同樣問題的朋友有幫助:)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章