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

Philip Prindeville philipp_subx at redfish-solutions.com
Tue May 23 12:51:20 PDT 2017


Inline

> On May 22, 2017, at 6:23 AM, Paul Spooren <paul at spooren.de> wrote:
> 
> 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]


Can it take an argument and extend it by that many MB?


>        $SELF <target>
>          [<subtarget> [<extra-qemu-options>]]
>          [--kernel <kernel>]
> @@ -124,7 +125,8 @@ parse_args() {
> 			   echo "running setup"
> 		   	   do_setup 
> 			   exit 0
> -			   ;;
> +				;;


Why does this line need to change?


> +			--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


Also, can you use “conv=sparse” so it’s just allocating empty blocks?

-Philip


> +		fi
> 		if [ ! -f "$rootfs" ]; then
> 			rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-ext4.img"
> 
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev




More information about the Lede-dev mailing list