ok6410 u-boot-2012.04.01移植七完善u-boot移植(u-boot移植结束)
继ok6410 u-boot-2012.04.01移植六后,开发板已支持MLC NAND、DM9000等。但还需要完善比如环境变量、mtdpart分区、裁剪、制作补丁等。下面的工作就是完善移植的u-boot。
开发环境:
系统:ubuntu 10.04.4
单板:ok6410
NAND FLASH:K9GAG08U0D 2048MB
NOR Flash:EN29LV160AB 2MB
DDR:K4X1G163PCX2 256MB
NET:DM9000AEP
编译器:arm-linux-gcc-4.3.2
搭建开发环境详见ubuntu 10.04.4开发环境配置。
目标:
1.板级初始化,支持单板ok6410
2.修改u-boot,支持NAND启动
3.增加菜单update功能
4.增加MLC NAND支持
5.支持DM9000,网卡下载程序
6.修改环境变量以及mtdpart分区
7.u-boot裁剪及制作补丁
一、修改环境变量
根据u-boot启动界面输出的using default environment,找到common/enc_common.c,还可以通过save命令找到env_nand.c,就不进一步分析了,直接修改代码。修改smdk6410.h
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 512*1024)
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_SIZE 0x80000//0x4000 /* Total Size of Environment Sector */
#define CONFIG_ENV_OFFSET 0x80000
#define CONFIG_ENV_RANGE CONFIG_ENV_SIZE
接着编译测试
SMDK6410 # set bootdelay 5
SMDK6410 # save
Saving Environment to NAND...
Erasing Nand...
nand0: MTD Erase failure: -22
Writing to Nand... done
SMDK6410 # reset
重启发现没有保存,看来还有问题,根据提示继续修改
change@change:/si/OK6410/u-boot-2012.04.01$ grep "MTD Erase failure" * -nR
Binary file drivers/mtd/nand/libnand.o matches
drivers/mtd/nand/nand_util.c:149: printf("\n%s: MTD Erase failure: %d\n",
ok,去drivers/mtd/nand/nand_util.c:149
result = meminfo->erase(meminfo, &erase);
if (result != 0) {
printf("\n%s: MTD Erase failure: %d\n",
mtd_device, result);
continue;
}
没看出啥问题,那还是从save命令分析saveenv()是在common/env_nand.c中实现的,进去看看,加了很多打印语句还是没找到。后来在头文件include/asm-generic/errno.h找到#define EINVAL 22 /* Invalid argument */原来failure: -22是参数问题。输的u-boot命令肯定没问题。没办法只好到配置文件smdk6410.h找问题。仔细看了一遍还真找到了,原来#define CONFIG_ENV_OFFSET 0x40000没有改成#define CONFIG_ENV_OFFSET 0x80000。因为K9GAG08U0D的BLOCK SIZE是512K。下面测试
SMDK6410 # set bootdelay 5
SMDK6410 # save
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x80000 -- 100% complete.
Writing to Nand... done
SMDK6410 # reset
resetting ...
U-Boot 2012.04.01 (Jul 09 2013 - 21:30:25) for SMDK6400
CPU: S3C6400@532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
Board: SMDK6400
DRAM: 128 MiB
WARNING: Caches not enabled
Flash: 0 KB
NAND: select s3c_nand_oob_mlc_64
NAND_ECC_NONE selected by board driver. This is not recommended !!
2048 MiB
In: serial
Out: serial
Err: serial
Net: dm9000
Hit any key to stop autoboot: 0
##### Update menu for ok6410 #####
[g] get file, and write to nand flash 0 block
[b] Boot the system
[r] Reset the u-boot
[q] Quit from menu
Enter your selection: q
SMDK6410 #
重启发现bootdelay变为5,正常了。
二、修改mtdpart分区
这个比较简单,仿照别人做法,直接在配置文件smdk6410.h增加如下:
/*-----------------------------------------------------------------------
* Dynamic MTD partition support
*/
#define CONFIG_CMD_MTDPARTS
#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */
//#define CONFIG_FLASH_CFI_MTD
#define MTDIDS_DEFAULT "nand0=OK6410-0"
#define MTDPARTS_DEFAULT "mtdparts=OK6410-0:512k(u-boot)," \
"512k(params)," \
"4M(kernel)," \
"-(rootfs)"
添加后编译在测试
SMDK6410 # mtdparts default
SMDK6410 # mtdparts
device nand0 <OK6410-0>, # parts = 4
#: name size offset mask_flags
0: u-boot 0x00080000 0x00000000 0
1: params 0x00080000 0x00080000 0
2: kernel 0x00400000 0x00100000 0
3: rootfs 0x7fb00000 0x00500000 0
active partition: nand0,0 - (u-boot) 0x00080000 @ 0x00000000
defaults:
mtdids : nand0=OK6410-0
mtdparts: mtdparts=OK6410-0:512k(u-boot),512k(params),4M(kernel),-(rootfs)
SMDK6410 #
测试基本正常。下面制作补丁。
三、整个移植代码修改量比较大,这里制作一个补丁文件,大家直接打个补丁就可以用了。
change@change:/si/OK6410/u-boot-2012.04.01$ make distclean
change@change:/si/OK6410/u-boot-2012.04.01$ cd ..
change@change:/si/OK6410$ mv u-boot-2012.04.01 u-boot-2012.04.01_ok
change@change:/si/OK6410$ tar xjf u-boot-2012.04.01.tar.bz2
change@change:/si/OK6410$ diff -urN u-boot-2012.04.01 u-boot-2012.04.01_ok > u-boot-2012.04.01_ok6410.patch
change@change:/si/OK6410$
生成补丁文件u-boot-2012.04.01_ok6410.patch,不想做繁琐的修改,打个上面的补丁文件就OK了。打补丁方法如下:
change@change:/si/OK6410/u-boot-2012.04.01$ patch -p1 < ../u-boot-2012.04.01_ok6410.patch
patching file arch/arm/config.mk
patching file arch/arm/cpu/arm1176/start.S
patching file arch/arm/include/asm/arch-s3c64xx/s3c6400.h
patching file arch/arm/lib/board.c
patching file board/samsung/smdk6410/config.mk
patching file board/samsung/smdk6410/.gitignore
patching file board/samsung/smdk6410/init.c
patching file board/samsung/smdk6410/lowlevel_init.S
patching file board/samsung/smdk6410/Makefile
patching file board/samsung/smdk6410/sdram.c
patching file board/samsung/smdk6410/smdk6400_nand_spl.c
patching file board/samsung/smdk6410/smdk6410.c
patching file board/samsung/smdk6410/u-boot-nand.lds
patching file common/cmd_menu.c
patching file common/env_nand.c
patching file common/main.c
patching file common/Makefile
patching file drivers/mtd/nand/nand_base.c
patching file drivers/mtd/nand/s3c64xx.c
patching file include/common.h
patching file include/configs/smdk6410.h
patching file include/linux/mtd/mtd-abi.h
patching file Makefile
change@change:/si/OK6410/u-boot-2012.04.01$ make
System not configured - see README
make: *** [all] Error 1
change@change:/si/OK6410/u-boot-2012.04.01$ 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...
change@change:/si/OK6410/u-boot-2012.04.01$ make
编译ok就可以用了。想偷懒可以这样做,最简单。但不建议,自己亲自移植一遍更能学到东西。至此ok6410 u-boot-2012.04.01移植部分告一段落,下一篇linux移植。
ok6410 u-boot-2012.04.01移植七完善u-boot移植(u-boot移植结束)的更多相关文章
- 移植u-boot.2012.04.01
/*************************************************** *u-boot版本:u-boot2012.04.01 *gcc版本:arm-linux-gcc ...
- z-index总结【转载http://www.cnblogs.com/mind/archive/2012/04/01/2198995.html】
元素位置重叠的背景常识 (x)html文档中的元素默认处于普通流(normal flow)中,也就是说其顺序由元素在文档中的先后位置决定,此时一般不会产生重叠(但指定负边距可能产生重叠).当我们用cs ...
- ok6410 u-boot-2012.04.01移植六完善MLC NAND支持
继ok6410 u-boot-2012.04.01移植四.五后,开发板基本已支持MLC NAND,支持DM9000.但是通过NAND命令更新u-boot到NAND,还存在问题,需要根据u-boot的n ...
- ok6410 u-boot-2012.04.01移植五支持DM9000
继ok6410 u-boot-2012.04.01移植四后,开发板基本已支持MLC NAND,但还有一些细节地方修改,这节增加DM9000支持,通过网卡tftp程序到内存,接着通过NAND命令写到NA ...
- ok6410 u-boot-2012.04.01移植二修改源码支持单板
继ok6410 u-boot-2012.04.01移植一后修改代码,对ok6410单板初始化,主要包括时钟.串口.NAND.DDR等初始化.这些工作在以前的裸板程序都写了,直接拿来用.我觉得先写裸板程 ...
- 移植u-boot-2012.04.01到JZ2440
开发环境:Ubuntu 12.04 开发板:JZ2440 256M NandFlash 64M SDRAM 交叉编译器:arm-linux-gcc-4.3.2 u-boot:u-boot-2012 ...
- uboot-2012.04.01移植编译前准备
一:准备移植1.从下面的官网下载uboot-2012.04.012.建立sourceinsight工程 a.解压并在E:\colin weidongshan\transplant_u-boot-201 ...
- Spring Boot 2.0系列文章(七):SpringApplication 深入探索
关注我 转载请务必注明原创地址为:http://www.54tianzhisheng.cn/2018/04/30/springboot_SpringApplication/ 前言 在 Spring B ...
- Spring Boot 揭秘与实战(七) 实用技术篇 - Java Mail 发送邮件
文章目录 1. Spring Boot 集成 Java Mail 2. 单元测试 3. 源代码 Spring 对 Java Mail 有很好的支持.因此,Spring Boot 也提供了自动配置的支持 ...
随机推荐
- android 多媒体数据库详解
主要分为几节: 1. Android的媒体文件内部是如何存储的? 2. Andoid的媒体文件如何获取? 3. 在使用媒体文件的一些小技巧. 1. Android的多媒体如何存储的? Android的 ...
- Mysql找回管理员password
我们使用MYSQL的时候有可能由于种种原因忘记ROOTpassword,假设是那样数据库可能就废掉了.可是今天给大家分享下找回ROOTpassword的方法或者说是在不知道rootpassword的情 ...
- c语言指针具体解释
指针是C语言中广泛使用的一种数据类型. 运用指针编程是C语言最基本的风格之中的一个.利用指针变量能够表示各种数据结构: 能非常方便地使用数组和字符串: 并能象汇编语言一样处理内存地址,从而编出精练而高 ...
- 一劳永逸解决UAC问题(修改QMAKE_LFLAGS_EXE的设置)
如果你的程序跑在一个开启了UAC保护的系统中,而你的程序又没有"盾牌"的话,程序总是会受到各种阻挠的,比如读写文件,写注册表等. 有了"盾牌"的话就不会出现一些 ...
- 深度RAMOS,把操作系统全部安装在内存上
你看下深度RAMOS就知道了 RAMOS+音速启动+绿色软件+云端 很爽 http://www.shenduwin7.com/jiaocheng/52.html
- dm642在线写EPROM.txt
void wirteEPROM() { //#include <stdio.h> unsigned short bufeprom[30],i,val; FILE *fp; ...
- HDU1452Happy 2004(高次幂取模+积性函数+逆元)
题目意思:2004^x的所有正因数的和(S)对29求余:输出结果: 原题链接 题目解析:解析参照来源:点击打开链接 因子和 6的因子是1,2,3,6; 6的因子和是s(6)=1+2+3+6=12; 2 ...
- 用Python制作游戏外挂(上)
源地址:http://eyehere.net/2012/python-game-bot-autopy-1/ 悲剧成我这样的人,我知道肯定不止我一个,所以我一点都不悲伤:-( 所以我打开了4399小游戏 ...
- 【剑指offer】和为定值的两个数
转载请注明出处:http://blog.csdn.net/ns_code/article/details/24933341 题目描写叙述: 输入一个递增排序的数组和一个数字S,在数组中查找两个数,是的 ...
- 数字证书, 数字签名, SSL(TLS) , SASL .
因为项目中要用到TLS + SASL 来做安全认证层. 所以看了一些网上的资料, 这里做一个总结. 1. 首先推荐几个文章: 数字证书: http://www.cnblogs.com/hyddd/ar ...