u-boot 2013.04-rc1移植(2)

来源:互联网 发布:公文写作神器软件 编辑:程序博客网 时间:2024/06/06 16:57

模板建立

原生u-boot里面支持了很多种的架构的mcu,但并没有对s3c6410进行适配,需要参考已有的s3c6400相关文件,对源码进行修改,增加对6410的支持。

1、将下载好的u-boot-2013.04.tar.bz2解压,里面包含如下信息

eric@eric-PC:~/Documents/u-boot-2013.04-rc1$ lsapi         config.mk  drivers    include      mkconfig  rules.mkarch        COPYING    dts        lib          nand_spl  snapshot.commitboard       CREDITS    examples   MAINTAINERS  net       splboards.cfg  disk       fs         MAKEALL      post      testcommon      doc        helper.mk  Makefile     README    tools

2、修改顶层Makefile,将所有6400,替换成6410。

smdk6410_noUSB_config   \smdk6410_config :   unconfig    @mkdir -p $(obj)include $(obj)board/samsung/smdk6410    @mkdir -p $(obj)nand_spl/board/samsung/smdk6410    @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h    @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk    @if [ -z "$(findstring smdk6410_noUSB_config,$@)" ]; then          \    echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6410/config.tmp;\    else                                        \        echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6410/config.tmp;\    fi    @$(MKCONFIG) smdk6410 arm arm1176 smdk6410 samsung s3c64xx    @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk  

3、尝试对6410进行配置

eric@eric-PC:~/Documents/u-boot-2013.04-rc1$ make smdk6410_config    warning: Please migrate to boards.cfg.  Failure to do so will             mean removal of your board in the next release.Configuring for smdk6410 board...eric@eric-PC:~/Documents/u-boot-2013.04-rc1$

Configuring for smdk6410 board…可以成功配置6410!

4、修改相关文件6400字段为6410,包含以下两种情况

a、文件中含有6400字段替换成6410(包括头文件引用和宏判断、定义)
b、含有6400字段的文件夹,均复制出相应的6410文件夹,包含文件夹中的文件

涉及的文件如下:

1、u-boot-2013.04-rc1/arch/arm/cpu/arm1176/s3c64xx/cpu_init.S
2、u-boot-2013.04-rc1/arch/arm/cpu/arm1176/s3c64xx/Makefile
3、u-boot-2013.04-rc1/arch/arm/cpu/arm1176/s3c64xx/Reset.S
4、u-boot-2013.04-rc1/arch/arm/cpu/arm1176/s3c64xx/speed.c
4、u-boot-2013.04-rc1/arch/arm/cpu/arm1176/s3c64xx/timer.c
5、u-boot-2013.04-rc1/arch/arm/include/asm/arch-s3c64xx/s3c64x0.h
6、u-boot-2013.04-rc1/board/samsung/smdk6410 【添加smdk6410文件夹】
7、u-boot-2013.04-rc1/drivers/mtd/nand/s3c64xx.c
8、u-boot-2013.04-rc1/drivers/usb/host/s3c64xx-hcd.c
9、u-boot-2013.04-rc1/drivers/serial/s3c64xx.c
10、u-boot-2013.04-rc1/include/common.h 【defined(CONFIG_S3C6410) || \】
11、u-boot-2013.04-rc1/drivers/usb/host/ohci-hcd.c 【defined(CONFIG_S3C6410) || \】

5、公共文件夹中添加6410头文件(复制6400.h)

u-boot-2013.04-rc1/arch/arm/include/asm/arch-s3c64xx/s3c6410.h
u-boot-2013.04-rc1/include/configs/smdk6410.h

6、以上修改完成,模板基本已经添加了6410所需的支持。尝试进行编译

.../usr/local/arm/arm-linux-gcc-4.4.3/bin/.arm-none-linux-gnueabi-ld:u-boot.lds:19: syntax errorMakefile:569: recipe for target 'u-boot' failedmake: *** [u-boot] Error 1eric@eric-PC:~/Documents/u-boot-2013.04-rc1$ 

发现第一个错误:u-boot.lds:19: syntax error
语法错误,修改u-boot-2013.04-rc1/board/samsung/smdk6410/u-boot-nand.lds 51,56行(由于文件会随时修改,具体行数会有出入)

. = align(4); —> . = ALIGN(4);

7、再次编译

make[1]: Leaving directory '/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/board/samsung/smdk6410'Makefile:603: recipe for target 'nand_spl' failedmake: *** [nand_spl] Error 2

第二个错误:Makefile:603: recipe for target ‘nand_spl’ failed
修改: /home/eric/Documents/u-boot-2013.04-rc1/nand_spl/board/samsung/smdk6410/Makefile
34行,添加 crt0.o

SOBJS = start.o cpu_init.o lowlevel_init.o crt0.o ##eric++ crt0.o

71行:添加

$(obj)crt0.S:        @rm -f $@        @ln -s $(TOPDIR)/arch/arm/lib/crt0.S $@

8、再次编译

...crt0.o: In function `clbss_l':/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/board/samsung/smdk6410/crt0.S:153: undefined reference to `coloured_LED_init'/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/board/samsung/smdk6410/crt0.S:154: undefined reference to `red_led_on'Makefile:59: recipe for target '/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/u-boot-spl' failedmake[1]: *** [/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/u-boot-spl] Error 1make[1]: Leaving directory '/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/board/samsung/smdk6410'Makefile:603: recipe for target 'nand_spl' failedmake: *** [nand_spl] Error 2

错误,修复:/home/eric/Documents/u-boot-2013.04-rc1/nand_spl/board/samsung/smdk6410/crt0.c
153行:添加CONFIG_NAND_SPL限制

#ifndef(CONFIG_NAND_SPL)    bl coloured_LED_init    bl red_led_on#endif

9、再此编译

...make -C examples/api allmake[1]: Entering directory '/home/eric/Documents/u-boot-2013.04-rc1/examples/api'make[1]: Nothing to be done for 'all'.make[1]: Leaving directory '/home/eric/Documents/u-boot-2013.04-rc1/examples/api'eric@eric-PC:~/Documents/u-boot-2013.04-rc1$ 

至此,Nothing to be done for ‘all’.所以内容全部编译通过!!!

虽然,编译已经通过,但目前还并不能成功启动开发板,因为底层驱动,如SD卡,NAND falsh等还未进行适配。

原创粉丝点击