日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux内核mtd分区,linux-kernel – 在运行时调整MTD分区大小

發(fā)布時間:2025/3/11 linux 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux内核mtd分区,linux-kernel – 在运行时调整MTD分区大小 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

我正在使用嵌入式設(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)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。