烧写文件系统
tftp 30000000 fs_mini_mdev.jffs2
nand erase.part root
nand write.jffs2 30000000 260000 5b89a8
启动之前修改启动参数
set bootargs console=ttySAC0 root=/dev/mtdblock3 rootfstype=jffs2 //重新设置文件系统属性
bootm //启动
s3c2410iis_probe...
UDA1341 audio driver initialized
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 1
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
s3c2410-sdi s3c2410-sdi: running at 0kHz (requested: 0kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
VFS: Mounted root (jffs2 filesystem). //挂载成功
Freeing init memory: 140K
init started: BusyBox v1.7.0 (2008-01-22 10:04:09 EST)
starting pid 765, tty '': '/etc/init.d/rcS
烧写yaffs文件系统
tftp 30000000 fs_mini_mdev.yaffs2
nand erase.part rootfs
nand write.yaffs 30000000 260000 889bc0
或者直接一起输入:tftp 30000000 fs_mini_mdev.yaffs2;nand erase.part rootfs;nand write.yaffs 30000000 260000 889bc0
启动会出现如下错误
SMDK2410 # nand write.yaffs2 30000000 260000 889bc0
NAND write: device 0 offset 0x260000, size 0x889bc0
Unknown nand command suffix '.yaffs'.
根据错误信息,在cmd_nand.c里搜索.yaffs,可以知道需要加入CONFIG_CMD_NAND_YAFFS的宏,
#ifdef CONFIG_CMD_NAND_YAFFS
} else if (!strcmp(s, ".yaffs")) {
if (read) {
printf("Unknown nand command suffix '%s'.\n", s);
return 1;
}
ret = nand_write_skip_bad(nand, off, &rwsize,
(u_char *)addr, WITH_YAFFS_OOB);
#endif
重新编译程序,烧写文件系统
VFS: Mounted root (yaffs filesystem).
Freeing init memory: 140K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
然后对比烧到板子里的文件和原来的文件系统,可以发现烧写的不一样,然后定位到程序中nand_util.c中,有些东西需要修改
if (!need_skip && !(flags & WITH_DROP_FFS) && !(flags & WITH_YAFFS_OOB)) { //需要加!(flags & WITH_YAFFS_OOB)判断,但是韦东山视频里没有说明,直接比较两个文件才知道需要加入这个参数
rval = nand_write (nand, offset, length, buffer);
if (rval == 0)
return 0;
*length = 0;
printf ("NAND write to offset %llx failed %d\n",
offset, rval);
return rval;
}
ops.len = pagesize;
ops.ooblen = nand->oobsize;
ops.mode = MTD_OOB_RAW; //读取原来自己的oob
ops.ooboffs = 0;
for (page = 0; page < pages; page++) {
WATCHDOG_RESET();
ops.datbuf = p_buffer;
ops.oobbuf = ops.datbuf + pagesize;
rval = nand->write_oob(nand, offset, &ops);
if (rval) /*如果是非0才错误*/
break;
offset += pagesize;
p_buffer += pagesize_oob;
}
再重新编译烧写,测试文件系统
tftp 30000000 u-boot.bin;protect off all;erase 0 3ffff;cp.b 30000000 0 40000
VFS: Mounted root (yaffs filesystem).
Freeing init memory: 140K
init started: BusyBox v1.7.0 (2008-01-22 10:04:09 EST) //可以正常启动busybox
starting pid 764, tty '': '/etc/init.d/rcS'
s3c2410-sdi s3c2410-sdi: running at 0kHz (requested: 0kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
制作补丁
将制作完成的uboot目录 和解压缩出来的原来目录用diff命令去实现
make distclean //首先清除所有文件
diff -urN 老目录 新目录 > my_1st_uboot.pach
打补丁 patch -p1 < 补丁文件 p的参数根据当前打补丁的目录决定