测试,下载新的内核到板子,挂接jffs2文件系统,启动打印信息: ...... ALSA device list: No soundcards found. VFS: Mounted root (jffs2 filesystem) on device 31:3. Freeing init memory: 164K ifconfig: SIOCSIFADDR: No such device can't open /dev/s3c2410_serial0: No such file or directory can't open /dev/s3c2410_serial0: No such file or directory can't open /dev/s3c2410_serial0: No such file or directory can't open /dev/s3c2410_serial0: No such file or directory can't open /dev/s3c2410_serial0: No such file or directory can't open /dev/s3c2410_serial0: No such file or directory ....
问题1: 打印语句:ifconfig: SIOCSIFADDR: No such device 回答1: 是因为文件系统的配置文件:etc/init.d/rcS #!/bin/sh ifconfig eth0 192.168.1.17 // 目前还没有配置DM9000网卡,所以当运行这句脚本命令将打印找不到设置的警告
mount -a mkdir /dev/pts mount -t devpts devpts /dev/pts echo /sbin/mdev > /proc/sys/kernel/hotplug mdev -s 问题2: 打印语句:can't open /dev/s3c2410_serial0: No such file or directory 回答2: 在配置文件:etc/inittab 定义了这句命令:s3c2410_serial0::askfirst:-/bin/sh # /etc/inittab ::sysinit:/etc/init.d/rcS s3c2410_serial0::askfirst:-/bin/sh ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r
3.1 下载解压yaffs源代码 注意:在linux内核中并没有集成yaffs文件系统的源代码,需要额外去下载。 tar xjf yaffs2.tar.bz2 cd yaffs2/ ./patch-ker.sh c m /work/system/linux-3.4.2
3.2 内核树种查看 查看源代码中是否集成了yaffs源码: cd ../linux-3.4.2/ ls fs/yaffs2/
3.3 配置内核支持yaffs | Symbol: YAFFS_DOES_ECC [=n] | | Type : boolean | | Prompt: Lets yaffs do its own ECC | | Defined at fs/yaffs2/Kconfig:51 | | Depends on: MISC_FILESYSTEMS [=y] && YAFFS_FS [=n] && YAFFS_YAFFS1 [=n] && !YAFFS_9 | | Location: | | -> File systems | | -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y]) | | -> yaffs2 file system support (YAFFS_FS [=n]) | | -> 512 byte / page devices (YAFFS_YAFFS1 [=n]) | | -> Use older-style on-NAND data format with pageStatus byte (YAFFS_9BYTE_ | | 修改为: | Symbol: YAFFS_DOES_ECC [=n] | | Type : boolean | | Prompt: Lets yaffs do its own ECC | | Defined at fs/yaffs2/Kconfig:51 | | Depends on: MISC_FILESYSTEMS [=y] && YAFFS_FS [=y] && YAFFS_YAFFS1 [=y] && !YAFFS_9 | | Location: | | -> File systems | | -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y]) | | -> yaffs2 file system support (YAFFS_FS [=y]) | | -> 512 byte / page devices (YAFFS_YAFFS1 [=y]) | | -> Use older-style on-NAND data format with pageStatus byte (YAFFS_9BYTE_ |
重新编译内核 $ make uImage
打印一堆错误。 ... fs/yaffs2/yaffs_vfs.c:440: warning: initialization from incompatible pointer type fs/yaffs2/yaffs_vfs.c:445: warning: initialization from incompatible pointer type fs/yaffs2/yaffs_vfs.c:447: warning: initialization from incompatible pointer type fs/yaffs2/yaffs_vfs.c: In function 'yaffs_mtd_put_super': fs/yaffs2/yaffs_vfs.c:2514: error: 'struct mtd_info' has no member named 'sync' fs/yaffs2/yaffs_vfs.c:2515: error: 'struct mtd_info' has no member named 'sync'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super': fs/yaffs2/yaffs_vfs.c:2702: error: 'struct mtd_info' has no member named 'erase' fs/yaffs2/yaffs_vfs.c:2703: error: 'struct mtd_info' has no member named 'read' fs/yaffs2/yaffs_vfs.c:2704: error: 'struct mtd_info' has no member named 'write' fs/yaffs2/yaffs_vfs.c:2705: error: 'struct mtd_info' has no member named 'read_oob' fs/yaffs2/yaffs_vfs.c:2706: error: 'struct mtd_info' has no member named 'write_oob' fs/yaffs2/yaffs_vfs.c:2707: error: 'struct mtd_info' has no member named 'block_isbad' fs/yaffs2/yaffs_vfs.c:2708: error: 'struct mtd_info' has no member named 'block_markbad' fs/yaffs2/yaffs_vfs.c:2732: error: 'struct mtd_info' has no member named 'erase' fs/yaffs2/yaffs_vfs.c:2733: error: 'struct mtd_info' has no member named 'block_isbad' fs/yaffs2/yaffs_vfs.c:2734: error: 'struct mtd_info' has no member named 'block_markbad' fs/yaffs2/yaffs_vfs.c:2734: error: 'struct mtd_info' has no member named 'read' fs/yaffs2/yaffs_vfs.c:2734: error: 'struct mtd_info' has no member named 'write' fs/yaffs2/yaffs_vfs.c:2736: error: 'struct mtd_info' has no member named 'read_oob' fs/yaffs2/yaffs_vfs.c:2736: error: 'struct mtd_info' has no member named 'write_oob' fs/yaffs2/yaffs_vfs.c:2757: error: 'struct mtd_info' has no member named 'erase' fs/yaffs2/yaffs_vfs.c:2757: error: 'struct mtd_info' has no member named 'read' fs/yaffs2/yaffs_vfs.c:2757: error: 'struct mtd_info' has no member named 'write' fs/yaffs2/yaffs_vfs.c:2759: error: 'struct mtd_info' has no member named 'read_oob' fs/yaffs2/yaffs_vfs.c:2759: error: 'struct mtd_info' has no member named 'write_oob' fs/yaffs2/yaffs_vfs.c:2967: error: implicit declaration of function 'd_alloc_root' fs/yaffs2/yaffs_vfs.c:2967: warning: assignment makes pointer from integer without a cast make[2]: *** [fs/yaffs2/yaffs_vfs.o] Error 1 make[1]: *** [fs/yaffs2] Error 2 make: *** [fs] Error 2
修改错误,直到编译没有错误.... fs/yaffs2/yaffs_vfs.c:2967: error: implicit declaration of function 'd_alloc_root' 在源码中查找:"sb->s_root" Inode.c (fs\cramfs): sb->s_root = d_make_root(root); 把'd_alloc_root' 修改为 'd_make_root'
启动板子,打印信息: ...... ALSA device list: No soundcards found. yaffs: dev is 32505859 name is "mtdblock3" rw yaffs: passed flags "" VFS: Mounted root (yaffs filesystem) on device 31:3. Freeing init memory: 164K Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. [] (unwind_backtrace+0x0/0xf8) from [] (panic+0x74/0x1c8) [] (panic+0x74/0x1c8) from [] (init_post+0xc0/0x138) [] (init_post+0xc0/0x138) from [] (kernel_init+0x16c/0x1bc)
设置启动参数 set 'nand read 30000000 kernel;bootm 30000000' set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 set machid 16a // smdk2440 mach-smdk2440.c save
4.3 制作内核的补丁文件:
4.3.1 先把配置文件.config拷贝为config_ok (注意:一定要记得备份这个配置文件.config) 4.3.2 make distclean // 清除所有配置生成的东西 4.3.3 清除完后,再制作补丁文件
2. 修改Makefile,将dm9dev9000c.c编译进内核文件 vi /work/system/linux-3.4.2/drivers/net/ethernet/davicom/Makefile #obj-$(CONFIG_DM9000) += dm9000.o 修改为: obj-$(CONFIG_DM9000) += dm9dev9000c.o 3. 重新编译内核 make uImage 4. 烧写进板子,重新启动,可以配置网卡了。 ifconfig eth0 192.168.1.17
挂接/mnt mount -t nfs -o nolock,vers=2 192.168.1.10:/work/nfs_root /mnt
NFS挂接根文件系统: 设置启动参数 set bootargs console=ttySAC0,115200 root=/dev/nfs nfsroot=192.168.1.10:/work/nfs_root/my_fs ip=192.168.1.17:192.168.1.10:192.168.1.1:255.255.255.0::eth0:off save
yaffs文件设置参数: set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 jiffs文件设置参数: set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2