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 也提供了自动配置的支持 ...
随机推荐
- 后台调用外部程序的完美实现(使用CreateDesktop建立隐藏桌面)
最近在做的一个软件,其中有一部分功能需要调用其它的软件来完成,而那个软件只有可执行文件,根本没有源代码,幸好,我要做的事不难,只需要在我的程序启动后,将那个软件打开,在需要的时候,对其中的一个文本矿设 ...
- WinSock - 建立无连接的通信
1.建立一个基于对话框的工程,并在第二步中选择WOSA支持 2.建立客户端 (1)在头文件中添加成员变量 public: CSocket m_clientsocket; (2)每隔一秒钟向服务端发送一 ...
- python处理中文字符
1.在py文件中使用中文字符 unicode.py文件内容如下所示: # -*- coding:utf-8 -*- str_ch = '我们women' uni_ch = u'我们women' pri ...
- SQLServer行转列
近期面试遇到了一道面试题.顿时有点迷糊,仅仅说出了思路.后来百度了一下.整理了一下思路,于是记录下来,方便以后学习.(面试题请參见附件) 相关的数据表: 1.Score表 2.[User]表 SQL语 ...
- Delphi Socket的最好项目——FastMsg IM(还有一些IM控件),RTC,RO,Sparkle等等,FileZilla Client/Server,wireshark,NSClient
https://www.nsclient.org/nsclient/ 好好学习,天天向上
- WKE——Webkit精简的纯C接口的浏览器
以前不知道有这个东西 https://github.com/cexer/wke http://blog.csdn.net/weolar/article/details/50383491 http:// ...
- HTML中Id和Name的区别
源地址:http://www.cnblogs.com/laodai/articles/2244215.html 在html中:name指的是用户名称,ID指的是用户注册是系统自动分配给用户的一个序列号 ...
- hdu 2055 An easy problem (java)
问题: 開始尝试用字符做数组元素.可是并没实用. 在推断语句时把a z排出了. An easy problem Time Limit: 1000/1000 MS (Java/Others) Me ...
- [Android学习笔记]Android Library Project的使用
RT http://developer.android.com/tools/projects/index.html
- SMART原则_百度百科
SMART原则_百度百科 SMART原则