aboutsummaryrefslogtreecommitdiff
path: root/ledge-debian
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2019-08-08 08:00:13 +0300
committerVishal Bhoj <vishal.bhoj@linaro.org>2019-08-08 05:19:47 +0000
commita29cc7e7a78892c04b75545d0280fd2bcf7ef4aa (patch)
treecd67b8b84a968934e3df4663099cfbd578c1a368 /ledge-debian
parentef85c0bb07a3170ecdf4f4e7e5a2dc856288f56c (diff)
ledge: debian: dynamically calculate loop devices
Instead of hardcoding loop4 device for mounting our raw image, find the first available loop device and use that Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Change-Id: I6f1b10379939664be45afc85f2c5513e901b941f
Diffstat (limited to 'ledge-debian')
-rw-r--r--ledge-debian/builders-fai.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/ledge-debian/builders-fai.sh b/ledge-debian/builders-fai.sh
index 6315b25a..38f10a3d 100644
--- a/ledge-debian/builders-fai.sh
+++ b/ledge-debian/builders-fai.sh
@@ -4,7 +4,7 @@ set -ex
trap cleanup_exit INT TERM EXIT
BUILDDIR='/tmp'
-LOOPDEV='loop4'
+LOOPDEV='loop0'
cleanup_exit()
{
@@ -72,6 +72,12 @@ for rootfs in ${ROOTFS}; do
exit 1
fi
+ # linux has 8 loop devices by default
+ for loop_no in $(seq 0 7); do
+ sudo losetup /dev/loop$loop_no
+ [ $? -ne 0 ] && LOOPDEV='loop'$loop_no && break
+ done
+
# create rootfs
# TODO add kernel from OE builds + EFI directory structure
sudo losetup -P /dev/"$LOOPDEV" "$BUILDDIR"/work.raw