Compare commits

...

5 Commits
4.17 ... 4.18

Author SHA1 Message Date
Stefan Agner
ca30c0c338 Linux: Update kernel 5.4.80 (#1019) 2020-11-25 17:59:38 +01:00
Stefan Agner
635e648a0a Avoid trying to boot non-existing kernel image in failover case (#1016)
* Avoid trying to boot non-existing kernel image in fail-over case

The A/B update system automatically switches to the other boot slot when
booting fails. However, in a fresh installation, only boot slot A
exists. If booting fails three times (e.g. if somebody plugs out power
before the slot can be marked as good), then the system switches to boot
slot B which does not contain a kernel image yet. Avoid trying to boot
the non-existing kernel image.

With this change, if slot B is empty U-Boot will restore both slots to 3
attempts and retry booting from slot A on next reboot:

```
Trying to boot slot B, 2 attempts remaining. Loading kernel ...
** Unrecognized filesystem type **
No valid slot found, resetting tries to 3
storing env...
```

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
2020-11-25 10:57:30 +01:00
Stefan Agner
cf49bda43a Load loop module before starting the container (#824)
This makes sure that the kernel module loop is loaded, the loop devices
under /dev have been created before the container starts. Docker uses
the current /dev as template for the container /dev. If the loop entries
are missing, loop devices can't be used inside the container. Use
losetup which does not make assumption weather loop support is built-in.

This fixes issues seen on my machine when entering the build environment
the first time after build:
  mount: /mnt/data: failed to setup loop device for /export/data.ext4.
  make[2]: *** [package/pkg-generic.mk:364: /build/buildroot/output_rpi4/build/hassio-1.0.0/.stamp_target_installed] Error 32
2020-11-25 10:55:44 +01:00
Stefan Agner
3f1223e4b4 ODROID: disable USB enumeration (#1015)
* Fix N2+ boot by disabling USB enumeration

On some devices USB enumeration in U-Boot seems to freeze:
starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... <freeze>

We don't use USB currenty in the U-Boot script, disable it for now.

* Disable USB enumeration on all ODROID devices
2020-11-23 11:39:46 +01:00
Stefan Agner
8e8b0c6231 Add on-board RTC support for ODROID-N2+ (#999)
Make the NXP PCF8563TS on-board RTC the primary RTC of the system.
2020-11-23 11:39:33 +01:00
14 changed files with 124 additions and 79 deletions

View File

@@ -5,14 +5,14 @@ Default Kernel tree: 5.4
| Board | Version |
|-------|---------|
| Open Virtual Appliance | 5.4.77 |
| Open Virtual Appliance | 5.4.80 |
| Raspberry Pi | 4.19.127 |
| Raspberry Pi 0-W | 4.19.127 |
| Raspberry Pi 2 | 4.19.127 |
| Raspberry Pi 3 | 4.19.127 |
| Raspberry Pi 4 | 4.19.127 |
| Tinker Board | 5.4.77 |
| Tinker Board | 5.4.80 |
| Odroid-C2 | 5.7.19 |
| Odroid-N2 | 5.7.19 |
| Odroid-XU4 | 5.7.19 |
| Intel NUC | 5.4.77 |
| Intel NUC | 5.4.80 |

View File

@@ -36,16 +36,17 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
elif test "x${BOOT_SLOT}" = "xA"; then
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:2 ${kernel_addr_r} zImage"
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:2 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
elif test "x${BOOT_SLOT}" = "xB"; then
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:4 ${kernel_addr_r} zImage"
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:4 ${kernel_addr_r} zImage"; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi
done
@@ -60,10 +61,8 @@ else
reset
fi
echo "Loading kernel"
run load_kernel
echo " Starting kernel"
echo "Starting kernel"
bootz ${kernel_addr_r} - ${fdt_addr_r}
echo "Fails on boot"
echo "Boot failed, resetting..."
reset

View File

@@ -4954,7 +4954,7 @@ CONFIG_RTC_DRV_RK808=m
# CONFIG_RTC_DRV_PCF8523 is not set
# CONFIG_RTC_DRV_PCF85063 is not set
# CONFIG_RTC_DRV_PCF85363 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
CONFIG_RTC_DRV_PCF8563=y
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_BQ32K is not set

View File

@@ -25,8 +25,6 @@ setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=ap
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
usb start
# Load extraargs
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
fatload mmc ${devnum}:1 ${fdt_addr_r} meson-gxbb-odroidc2.dtb
@@ -48,16 +46,18 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
elif test "x${BOOT_SLOT}" = "xA"; then
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:5 ${kernel_addr_r} Image"
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
elif test "x${BOOT_SLOT}" = "xB"; then
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:7 ${kernel_addr_r} Image"
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi
fi
done
@@ -72,12 +72,9 @@ else
reset
fi
echo "Loading kernel"
run load_kernel
echo " Starting kernel"
printenv load_kernel
printenv bootargs
echo "Starting kernel"
booti ${kernel_addr_r} - ${fdt_addr_r}
echo "Fails on boot"
echo "Boot failed, resetting..."
reset

View File

@@ -25,8 +25,6 @@ setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=ap
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
usb start
# Load extraargs
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
if test "${board_rev}" = "c"; then
@@ -52,16 +50,18 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
elif test "x${BOOT_SLOT}" = "xA"; then
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:5 ${kernel_addr_r} Image"
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
elif test "x${BOOT_SLOT}" = "xB"; then
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:7 ${kernel_addr_r} Image"
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi
fi
done
@@ -76,12 +76,9 @@ else
reset
fi
echo "Loading kernel"
run load_kernel
echo " Starting kernel"
printenv load_kernel
printenv bootargs
echo "Starting kernel"
booti ${kernel_addr_r} - ${fdt_addr_r}
echo "Fails on boot"
echo "Boot failed, resetting..."
reset

View File

@@ -27,8 +27,6 @@ setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=ap
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
#usb start
# Load extraargs
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
fatload mmc ${devnum}:1 ${fdt_addr_r} exynos5422-odroidxu4.dtb
@@ -52,16 +50,18 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
elif test "x${BOOT_SLOT}" = "xA"; then
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:5 ${kernel_addr_r} zImage"
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
elif test "x${BOOT_SLOT}" = "xB"; then
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
setenv load_kernel "ext4load mmc ${devnum}:7 ${kernel_addr_r} zImage"
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi
fi
done
@@ -76,13 +76,9 @@ else
reset
fi
echo "Loading kernel"
run load_kernel
echo " Starting kernel"
printenv load_kernel
printenv bootargs
dmc ${ddr_freq}
bootz ${kernel_addr_r} - ${fdt_addr_r}
echo "Starting kernel"
booti ${kernel_addr_r} - ${fdt_addr_r}
echo "Fails on boot"
echo "Boot failed, resetting..."
reset

View File

@@ -0,0 +1,52 @@
From 9a736bfb2ee71ed09e5f37ec4a506e7bd2a80bf5 Mon Sep 17 00:00:00 2001
Message-Id: <9a736bfb2ee71ed09e5f37ec4a506e7bd2a80bf5.1606127729.git.stefan@agner.ch>
In-Reply-To: <59bbf3567b02c36edfa4ee013d7e7e8c492756f2.1606127729.git.stefan@agner.ch>
References: <59bbf3567b02c36edfa4ee013d7e7e8c492756f2.1606127729.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 16 Nov 2020 23:11:02 +0100
Subject: [PATCH 15/15] arm64: dts: meson: add RTC to ODROID-N2 boards
All ODROID-N2 boards come with a NXP PCF8563TS RTC connected to I2C bus
3. This is the RTC which is connected to the on-board RTC backup battery.
Use it as primary RTC.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
.../boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 6982632ae646..40390feba053 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -13,6 +13,8 @@ / {
aliases {
serial0 = &uart_AO;
ethernet0 = &ethmac;
+ rtc0 = &board_rtc;
+ rtc1 = &vrtc;
};
dioo2133: audio-amplifier-0 {
@@ -471,6 +473,18 @@ hdmi_tx_tmds_out: endpoint {
};
};
+&i2c3 {
+ status = "okay";
+ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
+ pinctrl-names = "default";
+ clock-frequency = <400000>;
+
+ board_rtc: rtc@51 {
+ compatible = "nxp,pcf8563";
+ reg = <0x51>;
+ };
+};
+
&ir {
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
--
2.29.2

View File

@@ -37,16 +37,18 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
elif test "x${BOOT_SLOT}" = "xA"; then
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
setenv load_kernel "ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} zImage"
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
fi
fi
elif test "x${BOOT_SLOT}" = "xB"; then
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
setenv load_kernel "ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} zImage"
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} zImage"; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
fi
fi
fi
done
@@ -62,10 +64,8 @@ else
reset
fi
echo "Loading kernel"
run load_kernel
echo " Starting kernel"
echo "Starting kernel"
bootz ${kernel_addr_r} - ${fdt_org}
echo "Fails on boot"
echo "Boot failed, resetting..."
reset

View File

@@ -37,16 +37,18 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
elif test "x${BOOT_SLOT}" = "xA"; then
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
setenv load_kernel "ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} Image"
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
fi
fi
elif test "x${BOOT_SLOT}" = "xB"; then
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
setenv load_kernel "ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} Image"
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} Image"; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
fi
fi
fi
done
@@ -62,10 +64,8 @@ else
reset
fi
echo "Loading kernel"
run load_kernel
echo " Starting kernel"
echo "Starting kernel"
booti ${kernel_addr_r} - ${fdt_org}
echo "Fails on boot"
echo "Boot failed, resetting..."
reset

View File

@@ -22,7 +22,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/intel/nuc $(BR2_EXTERNAL_HASSOS_PATH)/board/intel/nuc/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.77"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.80"
BR2_LINUX_KERNEL_DEFCONFIG="x86_64"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/board/intel/nuc/kernel.config"
BR2_LINUX_KERNEL_LZ4=y

View File

@@ -23,7 +23,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/intel/ova $(BR2_EXTERNAL_HASSOS_PATH)/board/intel/ova/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.77"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.80"
BR2_LINUX_KERNEL_DEFCONFIG="x86_64"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/board/intel/ova/kernel.config"
BR2_LINUX_KERNEL_LZ4=y

View File

@@ -24,7 +24,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/asus/tinker $(BR2_EXTERNAL_HASSOS_PATH)/board/asus/hassos-hook.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.77"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.80"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/asus/tinker/kernel.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"

View File

@@ -1,5 +1,5 @@
VERSION_MAJOR=4
VERSION_BUILD=17
VERSION_BUILD=18
HASSOS_NAME="HassOS"
HASSOS_ID="hassos"

View File

@@ -6,6 +6,10 @@ CACHE_DIR="${CACHE_DIR:-$HOME/hassos-cache}"
sudo mkdir -p "${CACHE_DIR}"
sudo chown -R "${BUILDER_UID}:${BUILDER_GID}" "${CACHE_DIR}"
sudo docker build -t hassos:local .
# Make sure loop devices are present before starting the container
sudo losetup -f > /dev/null
sudo docker run -it --rm --privileged \
-v "$(pwd):/build" -v "${CACHE_DIR}:/cache" \
-e BUILDER_UID="${BUILDER_UID}" -e BUILDER_GID="${BUILDER_GID}" \