创建多个 SquashFS 分区
我正在开发嵌入式平台(Broadcom 的 bcm5358u 处理器,带有 MIPS 内核),我需要额外的分区以便进一步升级过程。使用的文件系统是SquashFS,所以我相应地修改了“struct mtd_partition”,将其传递给MTD相关代码,最后我得到了这样的结果:
#cat /proc/partitions
major minor #blocks name
- 31 0 128 mtdblock0
- 31 0 128 mtdblock0
- 31 1 6016 mtdblock1
- 31 2 4573 mtdblock2
- 31 3 6016 mtdblock3
- 31 4 4445 mtdblock4
- 31 5 4160 mtdblock5
- 31 6 64 mtdblock6
现在我希望能够在系统升级期间挂载/dev/mtdblock4作为临时存储,但我不能这样做,因为这个分区 mtdblock4 似乎没有安装任何 FS。内核映像和 FS 集成在一个映像中,该映像闪存到 /dev/mtdblock2(作为 root_fs 提供给内核)。
我只看到一种解决方案:创建一个空的 squashFS 映像,将其写入 /dev/mtdblock4 ,也许它会按照我想要的方式工作(?)。有没有一种方法可以在内核启动时动态格式化分区,或者违反 MTD 概念?
谢谢。
I'm working on embedded platform (Broadcom's bcm5358u processor with MIPS core), where I need extra partitions for the purpose of further upgrade procedure. The filesystem used is SquashFS, so I modified 'struct mtd_partition' accordingly, which is passed to MTD related code, and I ended up with this:
#cat /proc/partitions
major minor #blocks name
- 31 0 128 mtdblock0
- 31 0 128 mtdblock0
- 31 1 6016 mtdblock1
- 31 2 4573 mtdblock2
- 31 3 6016 mtdblock3
- 31 4 4445 mtdblock4
- 31 5 4160 mtdblock5
- 31 6 64 mtdblock6
Now I want to be able to mount /dev/mtdblock4 as a temporary storage during system upgrade, but I can't do this, because it appears that this partition mtdblock4 doesn't have any FS installed. The kernel image and FS are integrated in one image, which is flashed down the /dev/mtdblock2 (which is supplied as root_fs to kernel).
I see only one solution: create a empty squashFS image, write it on /dev/mtdblock4 and may be it will work as I want (?). Is there a way to, like, format the partition on the fly, whenever the kernel boots, or it violates the MTD concepts?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在空(已擦除)闪存上安装 JFFS2 文件系统。它会自动
在安装时“格式化”闪存分区。 Squashfs 不是一个好的候选者,因为它是一个只读文件系统。
You can mount a JFFS2 filesystem on an empty (erased) flash. It will automatically
"format" the flash partition at mount time. Squashfs is not a good candidate, because it is a read-only filesystem.
是否有原因导致您无法即时创建挂载新的 FS?
您绝对不想要空的 squashFS 映像。如果您想要临时可写存储,可以使用 tmpfs 卷之类的东西。如果需要支持系统重新启动,可以在原始闪存设备上使用 JFFS。您应该能够像任何其他块设备一样格式化/安装 MTD 设备。
Is there a reason you can't create a mount a new FS on the fly?
You definitely do not want an empty squashFS image. If you want temporary writeable storage you can use something like a tmpfs volume. If you need to support a system reboot, you can use JFFS on a raw flash device. You should be able to format/mount the MTD devices just like any other block device.
感谢您的回复。
是的,SquashFS 是只读的,但我仍然可以通过平台供应商提供的 Web 界面更新我的系统。平台SDK提供API从用户空间直接访问MTD。
Thanks for responses.
Yes, SquashFS is read-only, but nevertheless I'm able to update my system via Web interface provided by the platform vendor. The platform SDK provides API to directly access MTD from user space.