From 86da4bdf15dc0cb9e174f8e96b8099ce5a0e9717 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Wed, 1 Jan 2025 17:41:20 -0800 Subject: [PATCH] Auto resizing rootfs. Thanks to josh_32850_99879 on discord for figuring out how and when to use mkenvimage and .env.txt to make the image able to expand rootfs on first boot. --- environment-setup/foxbuntu-builder.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/environment-setup/foxbuntu-builder.sh b/environment-setup/foxbuntu-builder.sh index 1582299..62f149c 100755 --- a/environment-setup/foxbuntu-builder.sh +++ b/environment-setup/foxbuntu-builder.sh @@ -237,6 +237,21 @@ install_rootfs() { create_image() { echo "Creating final sdcard img..." cd /home/${sudoer}/luckfox-pico/output/image + + # File to modify + ENVFILE=".env.txt" + + # Check if the file contains '6G(rootfs)' + if grep -q '6G(rootfs)' "$ENVFILE"; then + # Replace '6G(rootfs)' with '100G(rootfs)' + sed -i 's/6G(rootfs)/100G(rootfs)/' "$ENVFILE" + echo "Updated rootfs size from stock (6G) to 100G." + else + echo "No changes made to rootfs size because it has already been modified." + fi + + /home/${sudoer}/luckfox-pico/sysdrv/tools/pc/uboot_tools/mkenvimage -s 0x8000 -p 0x0 -o env.img .env.txt + /home/${sudoer}/luckfox-pico/output/image/blkenvflash /home/${sudoer}/luckfox-pico/foxbuntu.img if [[ $? -eq 2 ]]; then echo "Error, sdcard img failed to build..."; exit 2; else echo "foxbuntu.img build completed."; fi ls -la /home/${sudoer}/luckfox-pico/foxbuntu.img