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

2017-05-23 Thread Philip Prindeville
Inline

> On May 22, 2017, at 6:23 AM, Paul Spooren  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 
> ---
> 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 < Usage: $SELF [-h|--help]
>  $SELF [--do-setup]
> +$SELF [--extend-squashfs]


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


>$SELF 
>  [ []]
>  [--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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


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

2017-05-22 Thread Paul Spooren
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 
---
 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 <
  [ []]
  [--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


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev