at91sam9260 OpenWRT u-boot移植

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/linux_embedded/article/details/76033923

ateml9260 移植OpenWRT U-boot

1. 直接在make menuconfig中选择编译at91sam9260ek平台的u-boot,烧写到开发板后效果

**U-Boot 2010.06-dirty (Jun 28 2017 - 09:14:34)

DRAM:  64 MiB
NAND:  1024 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0
macb0: Starting autonegotiation...**

==警告,u-boot环境变量校验失败,并且一段时间后启动重启(怀疑看门狗打开,但没有喂狗)==

编译修改的地方:
1./home/lhl/OpenWRT/openwrt/build_dir/target-arm_arm926ej-s_musl-1.1.16_eabi/linux-at91_legacy/u-boot-2010.06/arch/arm/lib/board.c
的95-102的和/home/lhl/OpenWRT/openwrt/build_dir/target-arm_arm926ej-s_musl-1.1.16_eabi/linux-at91_legacy/u-boot-2010.06/common/main.c
的50的inline去掉

2./home/lhl/OpenWRT/openwrt/build_dir/target-arm_arm926ej-s_musl-1.1.16_eabi/linux-at91_legacy/u-boot-2010.06/commom/usb_strorage.c的412wait_ms未定义,修改./common/usb.c 90行的inline

2.( * Warning - bad CRC, using default environment)

2.1:修改开发板的配置文件
include/configs/at91sam9260ek.h,该文件包括开发板的外围硬件的配置信息以及环境变量配置信息
2.2 :u-boot第一次启动后,需要使用saveenv保存配置信息到nand中,之后在启动后就不会提示( * Warning - bad CRC, using default environment)信息

3.u-boot watchdog复位

编译参考文档:doc/README.at91
3.1因为at91的bootstrap启动了看门狗,所以在u-boot中需要启动看门狗,启动方式如READ.at91文档所说,需要启用CONFIG_AT91SAM9_WATCHDOG和CONFIG_HW_WATCHDOG两个选项,该选项启动后,会在include/config.h中保存.
配置方式为:在Makefile中直接将两个配置项写入例如:
**
echo “#define CONFIG_AT91SAM9_WATCHDOG 1” >>(obj)include/config.h ; \  
 echo “#define CONFIG_HW_WATCHDOG       1”   >>
(obj)include/config.h ; \
**

4.u-boot增加DTS支持

1.CONFIG_OF_LIBFDT
需要在config.h中增加CONFIG_OF_LIBFDT配置项,该配置项的作用为为linux内核提供FDT参数,其提供的功能如下:
*支持libfdt-based
*增加”fdt”命令
*bootm命令会自动的更新fdt

2.CONFIG_SYS_BOOTMAPSZ

如果不定义该选项,会报错:
image.c: In function 'boot_relocate_fdt':
image.c:1210:13: error: 'CONFIG_SYS_BOOTMAPSZ' undeclared (first use in this function)
    ((char *)CONFIG_SYS_BOOTMAPSZ + bootmap_base))

 * For booting Linux, the board info and command line data
 * have to be in the first 8 MB of memory, since this is
 * the maximum mapped by the Linux kernel during initialization.
 */
 #define CONFIG_SYS_BOOTMAPSZ        (8 << 20)
 /* Initial Memory map for Linux */

3.CONFIG_OF_BOARD_SETUP

 Board code has addition modification that it wants to make 
 to the flat device tree before handing it off to the kernel

4.CONFIG_LMB

如果不定义,会报错:
cmd_bootm.c: In function 'do_bootm_subcommand':
cmd_bootm.c:545:35: error: 'bootm_headers_t {aka struct bootm_headers}' has no member named 'lmb'
ret = boot_relocate_fdt(&images.lmb, bootmap_base,

猜你喜欢

转载自blog.csdn.net/linux_embedded/article/details/76033923
今日推荐