使用emmc做存储, 一般将rootfs单独划分一个分区, 将其他的数据区划定另一个分区.
使用buildroot制作根文件系统的时候, 设置BR2_TARGET_ROOTFS_EXT2_SIZE的大小将直接影响生成的sdcard.img的大小. 通常情况下, 可以将BR2_TARGET_ROOTFS_EXT2_SIZE设置成为一个比较小的值, 仅能够容纳buildroot生成的程序. 在分区表中划定一个大的分区, 之后在系统启动之后由程序进行自动调整.
例如:
将BR2_TARGET_ROOTFS_EXT2_SIZE设置成60M, 但是划定300M的分区.
image boot.vfat {
vfat {
files = {
"kernel/kernel.bin",
"kernel/kernel2.bin"
}
}
size = 32M
}
image sdcard.img {
hdimage {
}
partition u-boot {
in-partition-table = "no"
image = "u-boot/u-boot-with-ddr-emmc-header.bin"
offset = 512 # u-boot with emmc header start at 512 and size is 512K
size = 523776
}
partition kernel-factory {
in-partition-table = "no"
image = "kernel/kernel.bin"
offset = 2M
size = 14M
}
partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
offset = 16M
}
partition rootfs {
partition-type = 0x83
image = "buildroot/rootfs.ext2"
size = 300M
}
partition data {
partition-type = 0x83
size = 3G
}
}
开机之后使用resize2fs扩展大小:
# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 58.1M 20.9M 34.2M 38% /
devtmpfs 29.3M 0 29.3M 0% /dev
tmpfs 29.4M 0 29.4M 0% /dev/shm
tmpfs 29.4M 16.0K 29.4M 0% /tmp
tmpfs 29.4M 20.0K 29.4M 0% /run
/dev/mmcblk0p3 3.0G 44.0K 2.8G 0% /data
# resize2fs /dev/root
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/root EXT4-fs (mmcblk0p2): resizing filesystem from 61440 to 307200 blocks
is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
EXT4-fs (mmcblk0p2): resized filesystem to 307200
The filesystem on /dev/root is now 307200 (1k) blocks long.
# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 291.0M 21.6M 256.9M 8% /
devtmpfs 29.3M 0 29.3M 0% /dev
tmpfs 29.4M 0 29.4M 0% /dev/shm
tmpfs 29.4M 16.0K 29.4M 0% /tmp
tmpfs 29.4M 20.0K 29.4M 0% /run
/dev/mmcblk0p3 3.0G 44.0K 2.8G 0% /data
最近编辑记录 qianfan (2021-07-08 10:35:12)
离线
嗯,学到了,第一次开机运行这个脚本就可以了。
写个脚本做个判断, 开机运行下:
TryResizeRootfs () {
local rootsize=$(df -m | grep '^/dev/root' | awk '{print $2}')
if [ ${rootsize} -lt 200 ] ; then
resize2fs /dev/root
sync
fi
}
离线
学到了, 刚刚ubuntu死活都起不来,发现文件系统只有1.7G,但是16G的eMMC都满了。
然后执行
resize2fs /dev/mmcblk0p4
重启就OK了
试一试用 全志 A133 LCD0 PD0-PD9 驱动 15寸的LVDS电脑显示屏
https://bbs.aw-ol.com/topic/1293/share/33
离线
树莓派好像有个 rpi-backup 就是这么搞的.思路是一样的
离线
root@navi-machine:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 960M 345M 550M 39% /
devtmpfs 27M 0 27M 0% /dev
tmpfs 27M 0 27M 0% /dev/shm
tmpfs 27M 2.2M 25M 9% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 27M 0 27M 0% /sys/fs/cgroup
/dev/mmcblk0p1 32M 4.3M 28M 14% /boot/uboot
root@navi-machine:~# resize2fs /dev/root
resize2fs 1.44.5 (15-Dec-2018)
open: No such file or directory while opening /dev/root
root@navi-machine:~#
自动扩容的时候打不开是怎么回事呀?
open: No such file or directory while opening /dev/root
离线
大佬,想问下这部分,如果想做成默认编译烧写就支持大小固定等于分区大小,需要做哪些修改?不通过resize2fs的方式有没其他方法。
离线