From ba413c9b25da07888bd42cde06aa1d75574913c2 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 8 Apr 2023 23:02:48 +0200 Subject: [PATCH] `bcm2711`/`grub`: add `busybox` (for initrd grep/sed) so `initramfs-growroot` works again on Debian - bcm2711: bomb early when `RELEASE` is set and not supported --- config/sources/families/bcm2711.conf | 32 +++++++++++++--------------- extensions/grub-riscv64.sh | 2 +- extensions/grub.sh | 4 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/config/sources/families/bcm2711.conf b/config/sources/families/bcm2711.conf index f0c11cd74..c50455861 100644 --- a/config/sources/families/bcm2711.conf +++ b/config/sources/families/bcm2711.conf @@ -72,27 +72,25 @@ extension_prepare_config__prepare_rpi_flash_kernel() { display_alert "Preparing bcm2711" "${RELEASE}, distro kernel?: ${RASPI_DISTRO_KERNEL}" "info" declare -g RASPI_DISTRO_KERNEL="${RASPI_DISTRO_KERNEL:-no}" # Include a distro-built kernel? declare -g SERIALCON="${RASPI_SERIALCON:-tty1}" # HDMI etc, not serial. most people don't have UART on rpi + local usable_releases="jammy|kinetic|lunar" - if [[ "$RELEASE" =~ ^(${usable_releases})$ ]]; then - declare -g FK__EXTRA_PACKAGES="rpi-eeprom linux-firmware linux-firmware-raspi pi-bluetooth libraspberrypi-bin cloud-initramfs-growroot" + # if RELEASE is set, make sure it is one of the ones we support. + if [[ -n "${RELEASE}" ]]; then + if [[ "$RELEASE" =~ ^(${usable_releases})$ ]]; then + declare -g FK__EXTRA_PACKAGES="rpi-eeprom linux-firmware linux-firmware-raspi pi-bluetooth libraspberrypi-bin cloud-initramfs-growroot busybox" + FK__EXTRA_PACKAGES="${FK__EXTRA_PACKAGES} raspi-config" # Add raspi-config for those releases that have it; it might be useful. - if [[ "$RELEASE" =~ ^(jammy|kinetic)$ ]]; then # Add raspi-config for those releases that have it; it might be useful. - declare -g FK__EXTRA_PACKAGES="${FK__EXTRA_PACKAGES} raspi-config" - fi - - if [[ "${RASPI_DISTRO_KERNEL}" == "yes" ]]; then # and firmware. - unset KERNELSOURCE # Make sure Armbian will not try to compile from source. - declare -g FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-tools-raspi linux-raspi linux-image-raspi " - # Ubuntu Impish+ split the kernel modules, add the extra ones too. - if [[ "$RELEASE" =~ ^(jammy|kinetic)$ ]]; then - declare -g FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-modules-extra-raspi" + if [[ "${RASPI_DISTRO_KERNEL}" == "yes" ]]; then # and firmware. + unset KERNELSOURCE # Make sure Armbian will not try to compile from source. + declare -g FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-tools-raspi linux-raspi linux-image-raspi " + # Ubuntu Impish+ split the kernel modules, add the extra ones too. + if [[ "$RELEASE" =~ ^(jammy|kinetic)$ ]]; then + declare -g FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-modules-extra-raspi" + fi fi - fi - else - if [[ "${BUILDING_IMAGE}" == "yes" ]]; then - display_alert "Can't use release for ${BOARD}. Try: ${usable_releases}" "${RELEASE}" "err" - exit 27 + else + exit_with_error "Can't use release '${RELEASE}' for ${BOARD}. Try: '${usable_releases}'" "'${RELEASE}' not supported" fi fi } diff --git a/extensions/grub-riscv64.sh b/extensions/grub-riscv64.sh index 6fd505be0..28b427649 100644 --- a/extensions/grub-riscv64.sh +++ b/extensions/grub-riscv64.sh @@ -23,7 +23,7 @@ function extension_prepare_config__prepare_grub-riscv64() { exit_with_error "${DISTRIBUTION} is not supported yet" fi - add_packages_to_image efibootmgr efivar cloud-initramfs-growroot os-prober "grub-efi-${ARCH}-bin" "grub-efi-${ARCH}" + add_packages_to_image efibootmgr efivar cloud-initramfs-growroot busybox os-prober "grub-efi-${ARCH}-bin" "grub-efi-${ARCH}" display_alert "Activating" "GRUB with SERIALCON=${SERIALCON}; timeout ${UEFI_GRUB_TIMEOUT}; target=${UEFI_GRUB_TARGET}" "" } diff --git a/extensions/grub.sh b/extensions/grub.sh index f16d2d3b6..46d26108b 100644 --- a/extensions/grub.sh +++ b/extensions/grub.sh @@ -25,8 +25,8 @@ function extension_prepare_config__prepare_grub_standard() { declare -g EXTRA_BSP_NAME="${EXTRA_BSP_NAME}-grub" # Unique bsp name. declare -g UEFI_GRUB_TARGET_BIOS="" # Target for BIOS GRUB install, set to i386-pc when UEFI_ENABLE_BIOS_AMD64=yes and target is amd64 - packages+=(efibootmgr efivar cloud-initramfs-growroot) # Use growroot, add some efi-related packages - packages+=(os-prober "grub-efi-${ARCH}-bin") # This works for Ubuntu and Debian, by sheer luck; common for EFI and BIOS + packages+=(efibootmgr efivar cloud-initramfs-growroot busybox) # Use growroot(+busybox for it to work on Bookworm), add some efi-related packages + packages+=(os-prober "grub-efi-${ARCH}-bin") # This works for Ubuntu and Debian, by sheer luck; common for EFI and BIOS # BIOS-compatibility for amd64 if [[ "${ARCH}" == "amd64" ]]; then