Skip to content

Commit

Permalink
workaround build failure on AWS M6g instances (RPi-Distro#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdoren authored and SRaus committed Mar 4, 2022
1 parent 7fd9f45 commit 579c79c
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions export-image/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,32 @@ EOF
BOOTLOADER_OFFSET=$(echo "$PARTED_OUT" | grep -e '^3:' | cut -d':' -f 2 | tr -d B)
BOOTLOADER_LENGTH=$(echo "$PARTED_OUT" | grep -e '^3:' | cut -d':' -f 4 | tr -d B)

BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}")
ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}")
BOOTLOADER_DEV=$(losetup --show -f -o "${BOOTLOADER_OFFSET}" --sizelimit "${BOOTLOADER_LENGTH}" "${IMG_FILE}")
echo "Mounting BOOT_DEV..."
cnt=0
until BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}"); do
if [ $cnt -lt 5 ]; then
cnt=$((cnt + 1))
echo "Error in losetup for BOOT_DEV. Retrying..."
sleep 5
else
echo "ERROR: losetup for BOOT_DEV failed; exiting"
exit 1
fi
done

echo "Mounting ROOT_DEV..."
cnt=0
until ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}"); do
if [ $cnt -lt 5 ]; then
cnt=$((cnt + 1))
echo "Error in losetup for ROOT_DEV. Retrying..."
sleep 5
else
echo "ERROR: losetup for ROOT_DEV failed; exiting"
exit 1
fi
done

echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH"
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"

Expand Down

0 comments on commit 579c79c

Please # to comment.