Linux v2.6.26.5嵌入在设备上,Squashfs在NAND闪存芯片上。我需要从busybox shell(initramfs)安装根文件系统。旧的Linux内核缺少自动设置/dev
的fs驱动程序,而不是使用devtmpfs,因此我需要手动创建基本设备节点 mknod (/ dev / null,/ dev / zero ,dev / mtdblock4,ttys)。根据给定的详细信息,从busybox shell设置和挂载root的正确步骤是什么?
已加载内核,文件系统具有以下结构:
BusyBox v1.10.2 (2017-08-02 14:07:25 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/bin/sh: can't access tty; job control turned off
# mount -t proc proc /proc
# mount -t sysfs sysfs /sys
# ls -l
drwxrwxr-x 2 1005 1005 432 Aug 2 2017 bin
-rwxr-xr-x 1 1005 1005 715844 Aug 2 2017 cordless_nodect.coma
drwxr-xr-x 2 0 0 32 Aug 2 2017 dev
drwxr-xr-x 2 1005 1005 3 Aug 2 2017 eeprom
drwxr-xr-x 4 1005 1005 386 Aug 2 2017 etc
drwxr-xr-x 2 1005 1005 3 Aug 2 2017 fpar
drwxr-xr-x 4 0 0 48 Aug 2 2017 home
drwxr-xr-x 2 1005 1005 3 Aug 2 2017 hsfw
drwxr-xr-x 3 1005 1005 287 Aug 2 2017 lib
drwxrwxr-x 2 1005 1005 3 Aug 2 2017 mnt
drwxr-xr-x 2 1005 1005 3 Aug 2 2017 nvram
dr-xr-xr-x 27 0 0 0 Jan 1 00:00 proc
lrwxrwxrwx 1 1005 1005 8 Aug 2 2017 root -> tmp/root
drwxr-xr-x 2 1005 1005 642 Aug 2 2017 sbin
drwxr-xr-x 10 0 0 0 Jan 1 00:00 sys
drwxr-xr-x 2 1005 1005 3 Aug 2 2017 tmp
drwxr-xr-x 7 1005 1005 73 Aug 2 2017 usr
lrwxrwxrwx 1 1005 1005 7 Aug 2 2017 var -> tmp/var
drwxr-xr-x 6 1005 1005 4051 Aug 2 2017 www
# mount -t devtmpfs devtmpfs /dev
mount: mounting devtmpfs on /dev failed: No such device
# mount /dev/mtd4 /mnt/root
mount: mounting /dev/mtd4 on /mnt/root failed: No such file or directory
# cat /proc/partitions
major minor #blocks name
31 0 384 mtdblock0
31 1 128 mtdblock1
31 2 20352 mtdblock2
31 3 7168 mtdblock3
31 4 18816 mtdblock4
31 5 2048 mtdblock5
31 6 1024 mtdblock6
31 7 512 mtdblock7
31 8 128 mtdblock8
31 9 512 mtdblock9
31 10 512 mtdblock10
# cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev debugfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev tmpfs
nodev inotifyfs
nodev configfs
nodev devpts
squashfs
nodev ramfs
nodev nfs
nodev jffs2
nodev mqueue
nodev rpc_pipefs
# cat /proc/devices
Character devices:
1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
89 i2c
90 mtd
108 ppp
128 ptm
136 pts
153 spi
204 ttyJ
254 cordless
Block devices:
1 ramdisk
31 mtdblock
93 nftl