at91sam9260 OpenWRT u-boot移植

本文介绍如何在AT91SAM9260EK平台上移植OpenWRT U-Boot,解决CRC校验失败问题,并介绍了编译配置过程,包括启动配置、watchdog配置及DTS支持的增加。

#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” >>KaTeX parse error: Expected 'EOF', got '#' at position 34: …g.h ; \ echo "#̲define CONFIG_H…(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,
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值