Re: [問題] mtdblock 到 file system的大小變化

看板LinuxDev作者 (Cos)時間9年前 (2014/11/05 12:46), 9年前編輯推噓2(205)
留言7則, 2人參與, 最新討論串2/2 (看更多)
: [ 0.710000] Creating 5 MTD partitions on "spi0.0": : [ 0.720000] 0x000000000000-0x000000020000 : "u-boot" : [ 0.720000] 0x000000020000-0x00000012ed38 : "kernel" : [ 0.730000] mtd: partition "kernel" must either start or end on erase : block boundary or be smaller than an erase block -- forcing read-only : [ 0.740000] 0x00000012ed38-0x0000007f0000 : "rootfs" : [ 0.750000] mtd: partition "rootfs" must either start or end on erase : block boundary or be smaller than an erase block -- forcing read-only : [ 0.760000] mtd: device 2 (rootfs) set to be root filesystem : [ 0.770000] 1 squashfs-split partitions found on MTD device rootfs : [ 0.770000] 0x000000300000-0x0000007f0000 : "rootfs_data" : [ 0.780000] 0x0000007f0000-0x000000800000 : "art" : [ 0.790000] 0x000000020000-0x0000007f0000 : "firmware" 以下所說,都沒去trace code, 不保證都對(不負責任的心得 先講結論: rootfs這個partition的每個檔案大小加起來,總合是2048K 把這些檔案壓起來的root.squashfs image, 大小是1860K,直接放在mtd openwrt在打包images(含kernel和rootfs), 是使用piggy back的方式,把rootfs接在kernel的後面, |magic_header|kernel|rootfs|.... 所以從上面來看,kernel一定是從0x000000020000開始放 問題1,kernel實際有多大? 我不知道"實際"有多大 但至少用掉 (0x00000012ed38-0x000000020000)空間來放kernel 剩下的區塊(0x00000012ed38-0x0000007f0000)來放rootfs. 問題2, rootfs實際有多大? 我不知道"實然"有多大 但我知道(0x000000300000-0x0000007f0000)會拿來放rootfs_data (overlayfs) 所以我知道rootfs至少用掉: (0x000000300000-0x00000012ed38)=0x1D12C8=1905352=1860K 注意,openwrt沒有限定kernel和rootfs的大小 有可能image中的kernel變大,rootfs也跟著往後移 同時rootfs_data可用的空間就跟著變小 所以"實際"上的kernel"大小,要看build code後,kernel image大小 (檔名忘了) 同樣地,"實際"上rootfs大小,會有個rootfs.squashfs檔案, 這個檔案,就是實際的rootfs大小 (檔名不確定) ※ 編輯: qsort (210.61.29.28), 11/05/2014 12:54:35

11/05 12:57, , 1F
我一直很想問,這種piggy back的打包方式,kernel要
11/05 12:57, 1F

11/05 12:58, , 2F
如何知道rootfs在哪裡?
11/05 12:58, 2F

11/05 13:10, , 3F
piggy back有很多種方式,最常用的是前面有super header
11/05 13:10, 3F

11/05 13:12, , 4F
kernel可以自己讀super header, 或是bootloader帶參數給ker
11/05 13:12, 4F

11/05 13:13, , 5F
nel, 至於detail,要去trace gen image的source code.
11/05 13:13, 5F

11/05 13:15, , 6F
例如: mkimage
11/05 13:15, 6F

11/05 20:13, , 7F
了解,感謝
11/05 20:13, 7F
文章代碼(AID): #1KMQkotj (LinuxDev)
文章代碼(AID): #1KMQkotj (LinuxDev)