linux内核mtd分区,linux-kernel – 在运行时调整MTD分区大小
我正在使用嵌入式設(shè)備,并希望能夠通過
Linux調(diào)整其MTD分區(qū)大小而無需重新啟動.
問題是我的Linux映像大小已經(jīng)增加,它所在的當(dāng)前MTD分區(qū)(mtd0)現(xiàn)在太小了.但是,它之后的分區(qū)(mtd1)是用于存儲配置信息的JFFS2部分,因此重新調(diào)整大小不是一個選項,因為配置可能會丟失.
我的目標(biāo)是:
1. Copy contents of JFFS2 into /tmp/
2. Unmount JFFS2 from mtd1
3. Increase the starting offset + reduce size of mtd1 by X bytes (or delete mtd1 and create new mtd of proper size and offset)
4. Mount JFFS2 on new mtd1 and restore contents from /tmp/
5. Increase the size of mtd0 by X bytes
6. Burn new (larger) Linux image into mtd0 (the new image will contain a device tree with an updated partition structure)
7. Reboot
幾年前我找到了“mtd-utils”的補丁:
http://article.gmane.org/gmane.linux.drivers.mtd/30949
http://article.gmane.org/gmane.linux.drivers.mtd/30950
http://article.gmane.org/gmane.linux.drivers.mtd/30951
以此為指導(dǎo),我能夠編寫內(nèi)核和用戶空間代碼來創(chuàng)建一個新的MTD分區(qū),我可以在其上安裝JFFS2.但是,此代碼無法正確刪除分區(qū).即使從mtd1卸載JFFS2并調(diào)用put_mtd_device,當(dāng)調(diào)用del_mtd_device時,內(nèi)核會抱怨:
user.notice kernel: Removing MTD device #1 (jffs2) with use count 1
我想知道的是:
1. How to fix the patch to allow deleting my old mtd1
2. How to change the starting offset of mtd1 instead of creating/deleting partitions
我嘗試聯(lián)系該補丁的作者,但他們的電子郵件不再有效,所以我將不勝感激任何建議!
更新:
似乎mtdchar.c中的mtd_open()觸發(fā)了get_mtd_device(),這可能會占用額外的usecount增量.但我的用戶空間應(yīng)用程序需要調(diào)用分區(qū)上的open()來發(fā)送一個ioctl()來刪除分區(qū):/ catch 22?有沒有更正確的方法呢?
總結(jié)
以上是生活随笔為你收集整理的linux内核mtd分区,linux-kernel – 在运行时调整MTD分区大小的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java双击添加文本框_java图形界面
- 下一篇: mysql四种隔离级别知乎_详解MySQ