Chinaunix首页 | 论坛 | 博客
  • 博客访问: 876290
  • 博文数量: 284
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1960
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-04 16:41
文章分类

全部博文(284)

文章存档

2018年(5)

2017年(95)

2016年(69)

2015年(15)

2014年(100)

我的朋友

分类: 嵌入式

2014-08-24 14:53:50

 mini2440_Linux移植开发指南学习笔记(二)yaffs2移植 (Fedora9)
 
参考:http://blog.chinaunix.net/uid-25194149-id-3235257.html
       
      http://blog.csdn.net/cinmyheart/article/details/38747505
      http://blog.csdn.net/hl5654/article/details/6978285

1、获取yaffs2 源代码 
    在  可以下载到最新的yaffs2 源代码,需要使用git工具,在mini2440目录下命令行输入: 
     #git  clone git://
    稍等片刻,就可以下载到最新的yaffs2 的源代码目录,

2、为内核打上yaffs2 补丁
     进入yaffs2 源代码目录执行:
   ./patch-ker.sh c /opt/FriendlyARM/mini2440/linux-2.6.32.2
    usage:  ./patch-ker.sh  c/l m/s kernelpath
    if c/l is c, then copy. If l then link
    if m/s is m, then use multi version code. If s then use single version code
   命令不正确: 
   
./patch-ker.sh c m /opt/FriendlyARM/mini2440/linux-2.6.32.2
   注意第二个参数m/s要特别注意如果不是最新的linux内核就要使用参数m而不是s,否则内核编译时就会发生错误。所以 我在这里强烈建议用m。可能产生的YAFFS2文件
   补丁OK

patch-ker.sh后自动完成下面三点

1)修改内核fs/Kconfig 增加一行:source "fs/yaffs2/Kconfig"

2)修改内核fs/Makefile 增加一行ojb-$(CONFIG_YAFFS_FS) +=yaffs2/

3) 在内核fs/目录下创建yaffs2目录将yaffs2源码目录下面的Makefile.kernel文件复制为内核fs/yaffs2 /Makefie;yaffs2 源码目录的Kconfig文件复制到内核fs/yaffs2目录下yaffs2源码目录下的*.c *.h文件复制到内核fs/yaffs2目录下。

   此时进入linux-2.6.32.2/fs 目录,可以看到已经多了一个yaffs2 目录

3、配置和编译带YAFFS2 支持的内核 

   在Linux 内核源代码根目录运行:make menuconfig,移动上下按键找到 File Systems,
  再找到“Miscellaneous filesystems”菜单项,按回车进入该子菜单,
  找到“YAFFS2 file system support”,并按空格选中它,这样我们就在内核中添加了yaffs2 文件系统的支持,按“Exit ”退出内核配置。
 
  在命令行执行: 
   #make zImage 
  出现错误
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_flush':
fs/yaffs2/yaffs_vfs.c:741: error: too few arguments to function 'yaffs_flush_file'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_sync_object':
fs/yaffs2/yaffs_vfs.c:771: error: too few arguments to function 'yaffs_flush_file'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_flush_inodes':
fs/yaffs2/yaffs_vfs.c:2190: error: too few arguments to function 'yaffs_flush_file'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_flush_super':
fs/yaffs2/yaffs_vfs.c:2203: error: too few arguments to function 'yaffs_flush_whole_cache'
      哎,好多问题。还没搜到解决方法,不爽啊!郁闷了一下午,
      应该是版本不对,函数不对?
    下了个旧点版本,还是老问题。。。
   
  终于有人有同样的问题了:http://blog.csdn.net/cinmyheart/article/details/38747505

yaffs_flush_file的定义:

在yaffs_guts.c  3788 line

int yaffs_flush_file(struct yaffs_obj *in,
    int update_time,
    int data_sync,
    int discard_cache)
{
if (!in->dirty)
return YAFFS_OK;
yaffs_flush_file_cache(in, discard_cache);

if (data_sync)
return YAFFS_OK;

if (update_time)
yaffs_load_current_time(in, 0, 0);

return (yaffs_update_oh(in, NULL, 0, 0, 0, NULL) >= 0) ?
YAFFS_OK : YAFFS_FAIL;
}

在yafss_vfs.c中

yaffs_flush_file(obj, 1, 0);   741
yaffs_flush_file(obj, 1, datasync);   771
yaffs_flush_file(obj, 1, 0);   2190

yaffs_flush_whole_cache(dev);   2203        //调用格式不对,都少了最后一个discard;  都设为0,试试

1513 line
void yaffs_flush_whole_cache(struct yaffs_dev *dev, int discard)
{
struct yaffs_obj *obj;
int n_caches = dev->param.n_caches;
int i;

/* Find a dirty object in the cache and flush it...
* until there are no further dirty objects.
*/
do {
obj = NULL;
for (i = 0; i < n_caches && !obj; i++) {
if (dev->cache[i].object && dev->cache[i].dirty)
obj = dev->cache[i].object;
}
if (obj)
yaffs_flush_file_cache(obj, discard);
} while (obj);

}

调用格式不对,都少了最后一个discard   都设为0,试试;   (或则下载yaffs2-4e188b0.tar.gz 
zImage下载到开发版,启动成功。
Enter your selection: b
Copy linux kernel from 0x00060000 to 0x30008000, size = 0x00500000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySA
C0"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux.............................................................
....................................................................... done, bo
oting the kernel.
Linux version 2.6.32.2 (root@localhost.localdomain) (gcc version 4.3.2 (Sourcery
 G++ Lite 2008q3-72) ) #4 Sun Aug 24 18:15:29 CST 2014
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60492KB available (3676K code, 418K data, 132K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 923 at 0x000007360000
Creating 5 MTD partitions on "NAND 128MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
uncorrectable error :
0x000000560000-0x000040560000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 128MiB 3,3V 8-bit"
-- size truncated to 0x7aa0000
ftl_cs: FTL header not found.
0x000000000000-0x000040000000 : "nand"
mtd: partition "nand" extends beyond the end of device "NAND 128MiB 3,3V 8-bit"
-- size truncated to 0x8000000
dm9000 Ethernet Driver, V1.31
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.21.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
ALSA device list:
  No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 132K
hwclock: can't open '/dev/misc/rtc': No such file or directory
[01/Jan/1970:00:00:10 +0000] boa: server version Boa/0.94.13
[01/Jan/1970:00:00:10 +0000] boa: server built Mar 26 2009 at 15:28:42.
[01/Jan/1970:00:00:10 +0000] boa: starting server pid=749, port 80


open device leds: No such file or directory
Try to bring eth0 interface up......ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCSIFHWADDR: No such device
ifconfig: SIOCSIFADDR: No such device
route: SIOCADDRT: No such process
Done
Please press Enter to activate this console.

上面出现还出现“ftl_cs: FTL header not found.”原来应在配置菜单->Device Drivers ->Memory Technology Devices (MTD),
按空格键取消选择,然后选“Exit”退出,最后出现保存提示时选择“Yes”保存。
# make clean        ;每次执行完make clean 时,在编译内核是就要花费很长时间,所以不要每次都make clean
# make zImage
虽然出现了“ftl_cs: FTL header not found.”但yaffs挂载成功,手册上也有这FTL错误,先放着,继续后面的驱动

下载运行

前面的出现“ftl_cs: FTL header not found.”信息没有了。但还是看到下面信息

Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "mtdblock3" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

这是因为内核引导参数设置问题,在u-boot命令行执行
因为使用的不是uboot而是supervivi  而且supervivi没办法用tftp
还是需要先由移植uboot开始------》内核

U-boot移植可参考http://blog.csdn.net/swgsunhj/article/details/5502121
还有mini2440U-boot移植手册  
暂时转到uboo移植
(暂时放缓,后面再继续)
虽然出现了“ftl_cs: FTL header not found.”    但yaffs挂载成功,手册上也有这FTL错误,先放着,继续后面的驱动
阅读(2532) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~