From 3f541a2d8d40fb7425d34fafc0a35d35e58b9395 Mon Sep 17 00:00:00 2001 From: Michael Baudino Date: Thu, 19 Nov 2020 14:18:15 +0100 Subject: [PATCH] fix(noobs): fix boot when installed via Noobs This commit changes how partitions are created by Noobs: the first partition is now labeled `RECALBOX` (rather than `boot`) so that it can be found by the kernel parameter `label=RECALBOX` (see patched `cmdline.txt` in `custom/package/rpi-firmware`). Thus, this commit also modifies `partition_setup.sh` because we don't need to change the `dev=` kernel parameter there. This commit also configures the CI to generate a `recalbox.tar.xz` tarball rather than a `boot.tar.xz`. --- board/recalbox/copy-recalbox-archives.sh | 6 +++--- scripts/release/README.md | 13 +------------ .../release/generate_external_installer_assets.sh | 2 ++ scripts/release/templates/noobs/partition_setup.sh | 11 ++++------- scripts/release/templates/noobs/partitions.json | 7 ++++--- 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/board/recalbox/copy-recalbox-archives.sh b/board/recalbox/copy-recalbox-archives.sh index 08e11e7726..3745c686a1 100755 --- a/board/recalbox/copy-recalbox-archives.sh +++ b/board/recalbox/copy-recalbox-archives.sh @@ -119,9 +119,9 @@ case "${RECALBOX_TARGET}" in generate_boot_file_list "${BINARIES_DIR}/rpi-firmware/" | \ grep -v -E '^(boot.lst|config.txt|recalbox-boot.conf)$' >"${BINARIES_DIR}/rpi-firmware/boot.lst" - # boot.tar.xz - tar -C "${BINARIES_DIR}/rpi-firmware" -cJf "${RECALBOX_BINARIES_DIR}/boot.tar.xz" . || - { echo "ERROR : unable to create boot.tar.xz" && exit 1 ; } + # recalbox.tar.xz (formerly boot.tar.xz) + tar -C "${BINARIES_DIR}/rpi-firmware" -cJf "${RECALBOX_BINARIES_DIR}/recalbox.tar.xz" . || + { echo "ERROR : unable to create recalbox.tar.xz" && exit 1 ; } #recalbox.img GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" diff --git a/scripts/release/README.md b/scripts/release/README.md index d191dc6ddb..7daf74fd55 100644 --- a/scripts/release/README.md +++ b/scripts/release/README.md @@ -21,9 +21,6 @@ "Pi Model", "Pi Compute Module Rev", "Pi Zero" - ], - "tarballs": [ - "https://upgrade.recalbox.com/latest/rpi1/boot.tar.xz" ] }, { @@ -37,9 +34,6 @@ "os_info": "https://upgrade.recalbox.com/latest/noobs/os.json", "supported_models": [ "Pi 2" - ], - "tarballs": [ - "https://upgrade.recalbox.com/latest/rpi2/boot.tar.xz" ] }, { @@ -54,9 +48,6 @@ "supported_models": [ "Pi 3", "Pi Compute Module 3" - ], - "tarballs": [ - "https://upgrade.recalbox.com/latest/rpi3/boot.tar.xz" ] }, { @@ -70,9 +61,6 @@ "os_info": "https://upgrade.recalbox.com/latest/noobs/os.json", "supported_models": [ "Pi 4" - ], - "tarballs": [ - "https://upgrade.recalbox.com/latest/rpi4/boot.tar.xz" ] } ] @@ -96,6 +84,7 @@ * `description` * `icon` * `feature_level` ⇒ ??? +* `tarballs` ⇒ array of tarball URLs to be uncompressed in created partitions (they are assigned to partitions defined in `partitions.json` in the same order : 1st tarball in `tarballs` is assigned to 1st partition in `partitions.json`, 2nd tarball in `tarballs` is assigned to 2nd partition in `partitions.json`, etc… and they override any `tarball` directive defined in `partitions.json`!) * `supported_models` ⇒ array of strings which at least one must be present in `/proc/device-tree/model` for the OS to be considered compatible with the hardware * `Pi Zero` matches all Pi Zero models (Zero, Zero W, Zero WH) * `Pi Model` matches all Pi1 models (A, B, A+, B+) diff --git a/scripts/release/generate_external_installer_assets.sh b/scripts/release/generate_external_installer_assets.sh index 52f323024a..369a94a001 100755 --- a/scripts/release/generate_external_installer_assets.sh +++ b/scripts/release/generate_external_installer_assets.sh @@ -47,6 +47,7 @@ function generateNoobsAssets { for arch in rpi1 rpi2 rpi3 rpi4; do local tarball="${params[imagesDir]}/${arch}/boot.tar.xz" local uncompressedTarballSizeInBytes=$(xz --robot --list "${tarball}" | tail -1 | cut -f 5) + metadata["${arch}TarballUrl"]="https://upgrade.recalbox.com/latest/${arch}/recalbox.tar.xz" metadata["${arch}UncompressedTarballSize"]=$((${uncompressedTarballSizeInBytes} / 1024 / 1024)) done @@ -66,6 +67,7 @@ function generateNoobsAssets { mkdir -p "${destinationDir}/${arch}" cat "${templateDir}/partitions.json" \ | sed -e "s|{{uncompressedTarballSize}}|${metadata["${arch}UncompressedTarballSize"]}|" \ + -e "s|{{tarballUrl}}|${metadata["${arch}TarballUrl"]}|" \ > "${destinationDir}/${arch}/partitions.json" done } diff --git a/scripts/release/templates/noobs/partition_setup.sh b/scripts/release/templates/noobs/partition_setup.sh index d9d32684ee..1ca045dfb3 100644 --- a/scripts/release/templates/noobs/partition_setup.sh +++ b/scripts/release/templates/noobs/partition_setup.sh @@ -6,13 +6,10 @@ set -ex [ -z "${part2}" ] && echo "Error: missing environment variable \${part2}" 1>&2 && exit 1 [ -z "${part3}" ] && echo "Error: missing environment variable \${part3}" 1>&2 && exit 1 -bootPartition="${part1}" # already mounted by NOOBS as `/mnt2` (best name ever!) +bootPartition="${part1}" # already mounted by NOOBS as `/mnt2` (best name ever!) when this script is executed sharePartition="${part2}" overlayPartition="${part3}" -# Since NOOBS does not create partitions like our downloadable image, we have to -# modify our kernel parameters to use a different partition to boot from. This -# is defined in `/cmdline.txt` (from the `rpi-firmware` package in Buildroot, -# that we patch in `custom`) and we set it to the value of the first partition, -# as given by NOOBS as ${part1}. -sed "/mnt2/cmdline.txt" -i -e "s|dev=/dev/[^ ]*|dev=${bootPartition}|" +# We can do any change on any partition here (only the first one is already mounted, though). +# For example, we used to modify `dev=` kernel parameter from `cmdline.txt` on `boot` partition +# (but we don't anymore since we now use `label=`). diff --git a/scripts/release/templates/noobs/partitions.json b/scripts/release/templates/noobs/partitions.json index 7e8e16827e..d6a8c5bb94 100644 --- a/scripts/release/templates/noobs/partitions.json +++ b/scripts/release/templates/noobs/partitions.json @@ -1,14 +1,15 @@ { "partitions": [ { - "label": "boot", + "label": "RECALBOX", "partition_size_nominal": 3072, "filesystem_type": "fat", "mkfs_options": "-F 32", + "tarball": "{{tarballUrl}}", "uncompressed_tarball_size": {{uncompressedTarballSize}} }, { - "label": "share", + "label": "SHARE", "partition_size_nominal": 4096, "want_maximised": true, "partition_type": "07", @@ -16,7 +17,7 @@ "empty_fs": true }, { - "label": "overlay", + "label": "OVERLAY", "partition_size_nominal": 1024, "filesystem_type": "ext4", "empty_fs": true -- GitLab