[LEDE-DEV] [PATCH] add --extend-squasfs to qemustart script

Paul Spooren paul at spooren.de
Mon May 22 05:23:20 PDT 2017


scripts/qemustart

using squashfs results in a "no space left on device" error. You need to
manually extend the new build with a tool like dd.

This patch adds the --extend-squasfs parameter to enlarge the image to
64MB. The (64MB - 20MB =) ~44MB free space will be used by the
overlayfs.

This approach is very simple and resets the overlayfs if used twices.

Signed-off-by: Paul Spooren <paul at spooren.de>
---
 scripts/qemustart | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index f77c674a9c..4dc4051696 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -85,6 +85,7 @@ usage() {
 	cat >&2 <<EOF
 Usage: $SELF [-h|--help]
 	   $SELF [--do-setup]
+	   $SELF [--extend-squashfs]
        $SELF <target>
          [<subtarget> [<extra-qemu-options>]]
          [--kernel <kernel>]
@@ -124,7 +125,8 @@ parse_args() {
 			   echo "running setup"
 		   	   do_setup 
 			   exit 0
-			   ;;
+				;;
+			--extend-squashfs) EXTEND_SQUASHFS=true; shift 1; ;;
 			--kernel) o_kernel="$2"; shift 2 ;;
 			--rootfs) o_rootfs="$2"; shift 2 ;;
 			--help|-h)
@@ -223,6 +225,11 @@ start_qemu_x86() {
 
 	[ -n "$rootfs" ] || {
 		rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-squashfs.img"
+		if [ -f "$rootfs" ] && [ "$EXTEND_SQUASHFS" ]; then
+			mv "$rootfs" "${rootfs}_org"
+			dd if=/dev/zero of="$rootfs" bs=1M count=64
+			dd if="${rootfs}_org" of="$rootfs" conv=notrunc
+		fi
 		if [ ! -f "$rootfs" ]; then
 			rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-ext4.img"
 
-- 
2.11.0




More information about the Lede-dev mailing list