您尚未登录。

#1 2021-02-22 23:03:33

九重天
会员
注册时间: 2020-10-06
累计积分: 2

请问我在 ubuntu 可以模拟挂载ubi 文件系统吗?

如题

离线

#2 2021-02-22 23:08:12

哦豁哦豁
会员
注册时间: 2020-01-17
累计积分: 79

Re: 请问我在 ubuntu 可以模拟挂载ubi 文件系统吗?

$
$ sudo modprobe mtd
$ sudo modprobe mtdblock
$ sudo modprobe nandsim first_id_byte=0xec second_id_byte=0xa1 third_id_byte=0x00 fourth_id_byte=0x15
$ ls /dev/mtd
mtd0       mtd0ro     mtdblock0
$
$ ls /dev/mtd* -l
crw------- 1 root root 90, 0 Feb 22 23:05 /dev/mtd0
crw------- 1 root root 90, 1 Feb 22 23:05 /dev/mtd0ro
brw-rw---- 1 root disk 31, 0 Feb 22 23:05 /dev/mtdblock0
$
$ cat /proc/mt
mtd   mtrr
$ cat /proc/mtd
dev:    size   erasesize  name
mtd0: 08000000 00020000 "NAND simulator partition 0"
$

可以的, 试一试这样

离线

#3 2021-02-23 12:01:34

raspberryman
会员
注册时间: 2019-12-27
累计积分: 361

Re: 请问我在 ubuntu 可以模拟挂载ubi 文件系统吗?

好奇帮楼主测试了一下buildroot 生成ubi文件, 一次成功:

cd /addon/buildroot/output/images

sudo modprobe nandsim first_id_byte=0xad second_id_byte=0xda third_id_byte=0x10 fourth_id_byte=0x95
sudo dd if=rootfs.ubi of=/dev/mtd0
sudo modprobe ubi
sudo modprobe ubifs
sudo ubiattach --mtdn=0 --vid-hdr-offset=2048
sudo mkdir -p /mnt/ubifs/
sudo mount -t ubifs ubi0:rootfs /mnt/ubifs/

显示挂载ubi的文件系统:

$ ls /mnt/ubifs/ -l
total 0
drwxr-xr-x  2 root root 4960 Feb 23 11:34 bin
drwxr-xr-x  4 root root  608 Feb 19 11:32 dev
drwxr-xr-x 12 root root 2096 Feb 23 11:34 etc
drwxr-xr-x  5 root root 2960 Feb 19 11:32 lib
lrwxrwxrwx  1 root root    3 Feb 19 11:39 lib32 -> lib
lrwxrwxrwx  1 root root   11 Feb 19 11:50 linuxrc -> bin/busybox
drwxr-xr-x  2 root root  160 Feb 19 11:32 media
drwxr-xr-x  2 root root  160 Feb 19 11:32 mnt
drwxr-xr-x  2 root root  160 Feb 19 11:32 opt
drwxr-xr-x  2 root root  232 Feb 19 11:32 overlay
drwxr-xr-x  2 root root  160 Feb 19 11:32 proc
drwxr-xr-x  2 root root  232 Feb 19 11:32 rom
drwx------  2 root root  160 Feb 19 11:32 root
drwxr-xr-x  3 root root  224 Feb 19 11:51 run
drwxr-xr-x  2 root root 4008 Feb 23 11:34 sbin
drwxr-xr-x  2 root root  160 Feb 19 11:32 sys
drwxrwxrwt  2 root root  160 Feb 19 11:32 tmp
drwxr-xr-x  7 root root  544 Feb 23 11:34 usr
drwxr-xr-x  4 root root  672 Feb 23 11:34 var

buildroot关于ubi文件系统的配置:

BR2_TARGET_ROOTFS_TAR_OPTIONS=""
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x20000
BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
# BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG is not set
BR2_TARGET_ROOTFS_UBI_OPTS=""
BR2_TARGET_ROOTFS_UBIFS=y
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x800
BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT=2048
# BR2_TARGET_ROOTFS_UBIFS_RT_NONE is not set
# BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB is not set
BR2_TARGET_ROOTFS_UBIFS_RT_LZO=y
BR2_TARGET_ROOTFS_UBIFS_NONE=y
# BR2_TARGET_ROOTFS_UBIFS_GZIP is not set
# BR2_TARGET_ROOTFS_UBIFS_BZIP2 is not set
# BR2_TARGET_ROOTFS_UBIFS_LZMA is not set
# BR2_TARGET_ROOTFS_UBIFS_LZO is not set
# BR2_TARGET_ROOTFS_UBIFS_XZ is not set
BR2_TARGET_ROOTFS_UBIFS_OPTS=""
# BR2_TARGET_ROOTFS_YAFFS2 is not set

离线

#4 2021-02-23 21:11:31

九重天
会员
注册时间: 2020-10-06
累计积分: 2

Re: 请问我在 ubuntu 可以模拟挂载ubi 文件系统吗?

要的就是这个答案, 感谢楼上两位朋友!

离线

#5 2021-02-23 21:34:18

ifree64
会员
注册时间: 2019-06-27
累计积分: 65

Re: 请问我在 ubuntu 可以模拟挂载ubi 文件系统吗?

好强,还不太懂,向大佬学习。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn