linux|如何在linux正常启动的系统中(挂载rootfs)某个目录下来加载ubi文件类型的recoveryfs?

如何在正常启动的系统中test2目录下来加载recoveryfs?

1. 执行cat /proc/mtd命令获取recoveryfs的mtd设备号。从如下我们可以得知为13。
cat /proc/mtd
dev:sizeerasesizename
mtd0: 00140000 00020000 "sbl"
mtd1: 00140000 00020000 "mibib"
mtd2: 00c00000 00020000 "efs2"
mtd3: 000c0000 00020000 "tz"
mtd4: 00060000 00020000 "rpm"
mtd5: 000a0000 00020000 "aboot"
mtd6: 007e0000 00020000 "boot"
mtd7: 00040000 00020000 "scrub"
mtd8: 00640000 00020000 "data"
mtd9: 02d00000 00020000 "modem"
mtd10: 00140000 00020000 "misc"
mtd11: 007c0000 00020000 "recovery"
mtd12: 00180000 00020000 "fota"
mtd13: 016e0000 00020000 "recoveryfs"
mtd14: 017e0000 00020000 "data1"
mtd15: 07b20000 00020000 "system"

2. 执行ls /dev/ubi*命令,获取当前的ubi设备
ls /dev/ubi*
/dev/ubi0/dev/ubi0_1/dev/ubi1/dev/ubi_ctrl
/dev/ubi0_0/dev/ubi0_2/dev/ubi1_0

3.执行ubiattach /dev/ubi_ctrl -m 13命令,将mtd13(recoveryfs)连接ubi设备类型
# ubiattach /dev/ubi_ctrl -m 13
UBI device number 2, total 183 LEBs (23236608 bytes, 22.2 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)


4. 再次执行ls /dev/ubi*命令,获取当前的ubi设备(如下),从中可以得知mtd13连接到了ubi2_0
# ls /dev/ubi*
/dev/ubi0/dev/ubi0_1/dev/ubi1/dev/ubi2/dev/ubi_ctrl
/dev/ubi0_0/dev/ubi0_2/dev/ubi1_0/dev/ubi2_0

5. 执行下列命令挂载到test2
mount -t ubifs ubi2_0 /test2

6.cd test2来查看挂载的recoveryfs

    推荐阅读