已有一個可以啓動的文件系統,要將其製作爲ext4格式。
1.創建所需大小的文件系統
$ dd if=/dev/zero of=rootfs.ext4 bs=1024 count=xxxx()
2.格式化
$ mkfs.ext4 rootfs.ext4
3.掛載
$ sudo mount -o loop rootfs.ext4 /mnt
4.寫入已備好的文件系統
$ cp rootfs/* /mnt
5.卸載跟文件系統
$ sudo umount /mnt
燒寫到板子上。
製作過程參考了博客:https://www.cnblogs.com/fire909090/p/10955389.html
但是這裏有個問題,在copy的時候,1G大小的文件系統不能拷貝到2G的rootfs.ext4中。