Supoport compressed squashfs for kernel (#1418) (#1451)

* Add squashfs with LZ4 and LZO compression to Barebox

* Add squashfs with LZO compression to U-Boot

* Use "raw" as type for kernel partition which is compatible with ext4
  image as well as squashfs.

Note: This does not use squashfs for the kernel but merly adds support
for it. This will allow to downgrade/fallback to the non-squashfs
version. Using squashfs for the kernel partition is implemented in dev
(for release 7).
This commit is contained in:
Stefan Agner 2021-07-09 14:42:23 +02:00 committed by GitHub
parent 20f02d2887
commit 48c3c8ccdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 17 deletions

View File

@ -64,7 +64,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:2 ${kernel_addr_r} zImage; then
if load mmc ${devnum}:2 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
@ -72,7 +72,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:4 ${kernel_addr_r} zImage; then
if load mmc ${devnum}:4 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi

View File

@ -71,7 +71,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} Image; then
if load mmc ${devnum}:5 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
@ -79,7 +79,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} Image; then
if load mmc ${devnum}:7 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi

View File

@ -71,7 +71,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} Image; then
if load mmc ${devnum}:5 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
@ -79,7 +79,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} Image; then
if load mmc ${devnum}:7 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi

View File

@ -76,7 +76,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} Image; then
if load mmc ${devnum}:5 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
@ -84,7 +84,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} Image; then
if load mmc ${devnum}:7 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi

View File

@ -51,7 +51,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:5 ${kernel_addr_r} zImage; then
if load mmc ${devnum}:5 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}"
fi
fi
@ -59,7 +59,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load mmc ${devnum}:7 ${kernel_addr_r} zImage; then
if load mmc ${devnum}:7 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}"
fi
fi

View File

@ -38,7 +38,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} zImage; then
if load ${devtype} ${devnum}:2 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
fi
fi
@ -46,7 +46,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} zImage; then
if load ${devtype} ${devnum}:4 ${kernel_addr_r} zImage; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
fi
fi

View File

@ -38,7 +38,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_A_LEFT} -gt 0; then
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
echo "Trying to boot slot A, ${BOOT_A_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} Image; then
if load ${devtype} ${devnum}:2 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
fi
fi
@ -46,7 +46,7 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
if test ${BOOT_B_LEFT} -gt 0; then
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
echo "Trying to boot slot B, ${BOOT_B_LEFT} attempts remaining. Loading kernel ..."
if ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} Image; then
if load ${devtype} ${devnum}:4 ${kernel_addr_r} Image; then
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
fi
fi

View File

@ -47,4 +47,8 @@ CONFIG_FS_EXT4=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
CONFIG_FS_SQUASHFS=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_SQUASHFS_LZO=y
CONFIG_LZ4_DECOMPRESS=y
CONFIG_LZO_DECOMPRESS=y

View File

@ -3,6 +3,6 @@
global linux.bootargs.dyn.root="root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro"
mkdir -p /mnt/system
mount -t ext4 /dev/disk*.hassos-kernel0 /mnt/system
mount /dev/disk*.hassos-kernel0 /mnt/system
global bootm.image="/mnt/system/bzImage"

View File

@ -3,6 +3,6 @@
global linux.bootargs.dyn.root="root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro"
mkdir -p /mnt/system
mount -t ext4 /dev/disk*.hassos-kernel1 /mnt/system
mount /dev/disk*.hassos-kernel1 /mnt/system
global bootm.image="/mnt/system/bzImage"

View File

@ -9,9 +9,12 @@ CONFIG_SYS_PROMPT="HAOS> "
CONFIG_EFI_PARTITION=y
CONFIG_FS_EXT4=y
CONFIG_FS_FAT=y
CONFIG_FS_SQUASHFS=y
# CONFIG_ENV_IS_IN_FAT is not set
# CONFIG_ENV_IS_IN_EXT4 is not set
CONFIG_ENV_IS_NOWHERE=Y
# CONFIG_EFI_LOADER is not set
CONFIG_CMD_SETEXPR=y
CONFIG_CMD_FILEENV=y
CONFIG_CMD_SQUASHFS=y
CONFIG_LZO=y

View File

@ -43,7 +43,7 @@ function _write_rauc_system() {
(
echo "[slot.kernel.${slot_num}]"
echo "device=/dev/disk/by-partlabel/hassos-kernel${slot_num}"
echo "type=ext4"
echo "type=raw"
echo "bootname=${slot_name}"
echo "[slot.rootfs.${slot_num}]"