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
(cherry picked from commit d159645)
  • Loading branch information
kdoren authored and scuciurean committed Mar 23, 2022
1 parent 8429cc6 commit 6e9210c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 5 deletions.
44 changes: 41 additions & 3 deletions export-image/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,52 @@ BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B)
ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B)
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B)


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 "Mounting BOOTLOADER_DEV..."
cnt=0
until BOOTLOADER_DEV=$(losetup --show -f -o "${BOOTLOADER_OFFSET}" --sizelimit "${BOOTLOADER_LENGTH}" "${IMG_FILE}"); do
if [ $cnt -lt 5 ]; then
cnt=$((cnt + 1))
echo "Error in losetup for BOOTLOADER_DEV. Retrying..."
sleep 5
else
echo "ERROR: losetup for BOOTLOADER_DEV failed; exiting"
exit 1
fi
done

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

ROOT_FEATURES="^huge_file"
for FEATURE in metadata_csum 64bit; do
Expand Down
28 changes: 26 additions & 2 deletions export-noobs/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,32 @@ BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B)
ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B)
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | 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}")
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 6e9210c

Please # to comment.