1.overlay_mount_fs()2.mount_extroot();3.mount_move("/tmp", "", "/overlay")4.fopivot("/overlay", "/rom") 4.1 find_filesystem("overlay") 4.2 mount_f("overlayfs:/overlay", "/mnt", "overlayfs", MS_NOATIME, "lowerdir=/,upperdir=/overlay") 4.3 pivot("/mnt", "/rom")翻譯為腳本:1.mkdir /tmp/overlaymount -n -t jffs2 /dev/mtdblock3 -o rw,noatime,mode=0755 /tmp/overlay2.檢查無 /tmp/overlay/sbin/block,ret=-13.mount("/tmp/overlay", "/overlay", 0, MS_NOATIME | MS_MOVE, 0);等效 mount -n -t NULL /tmp/overlay -o noatime,--move /overlaymount -n /tmp/overlay -o noatime,--move /overlay4. 4.1 /proc/filesystem 下確認(rèn)是否支持overlay 4.2 mount -n -t overlayfs overlayfs:/overlay -o rw,noatime,lowerdir=/,upperdir=/overlay /mnt 4.3 mount -n /proc -o noatime,--move /mnt/proc pivot_root /mnt /mnt/rom mount -n /rom/dev -o noatime,--move /dev mount -n /rom/tmp -o noatime,--move /tmp mount -n /rom/sys -o noatime,--move /sys mount -n /rom/overlay -o noatime,--move /overlay提煉一下,核心的mount jffs2分區(qū)并實(shí)現(xiàn)overlayfs的腳本就是:mount -n -t jffs2 /dev/mtdblock3 -o rw,noatime,mode=0755 /overlaymount -n -t overlayfs overlayfs:/overlay -o rw,noatime,lowerdir=/,upperdir=/overlay /mntmount -n /proc -o noatime,--move /mnt/procpivot_root /mnt /mnt/rom mount -n /rom/dev -o noatime,--move /devmount -n /rom/tmp -o noatime,--move /tmpmount -n /rom/sys -o noatime,--move /sysmount -n /rom/overlay -o noatime,--move /overlayexit 0不想用openwrt的init,把上面的腳本放到 /etc/preinit開頭。
轉(zhuǎn)自:http://blog.chinaunix.net/uid-27057175-id-4584360.html
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注