grub-with-dtb: accept GRUB_FDT_FILE if BOOT_FDT_FILE is unset

- some boards have u-boot auto-detect the board variant, and thus we unset `BOOT_FDT_FILE`
- but grub needs to know...
- so introduce a `GRUB_FDT_FILE` that is checked in case `BOOT_FDT_FILE` is not set
- this way we can keep u-boot autodetecting and grub happy
- preserve BOOT_FDT_FILE into GRUB_FDT_FILE for `nanopct6`/`nanopct6-lts`
This commit is contained in:
Ricardo Pardini
2025-03-18 22:59:25 -03:00
committed by Igor
parent 288e5216bc
commit 15cc3d3f1e
3 changed files with 6 additions and 4 deletions

View File

@@ -15,8 +15,8 @@ enable_extension "grub"
# Ensure config is sufficient for operation
function extension_prepare_config__prepare_grub_with_dtb() {
# Make sure BOOT_FDT_FILE is set and not empty
[[ -n "${BOOT_FDT_FILE}" ]] || exit_with_error "BOOT_FDT_FILE is not set, required for grub-with-dtb"
# Make sure BOOT_FDT_FILE, or GRUB_FDT_FILE is set and not empty
[[ -n "${BOOT_FDT_FILE:-"${GRUB_FDT_FILE}"}" ]] || exit_with_error "BOOT_FDT_FILE/GRUB_FDT_FILE is not set, required for grub-with-dtb"
display_alert "Extension: ${EXTENSION}: Initializing config" "${BOARD}" "info"
}
@@ -30,7 +30,7 @@ function post_family_tweaks_bsp__add_grub_with_dtb_config_file() {
display_alert "Extension: ${EXTENSION}: Adding grub-with-dtb config file" "${BOARD}" "info"
# maybe add this to conffiles?
cat <<- EOD > "${destination}"/etc/armbian-grub-with-dtb
BOOT_FDT_FILE="${BOOT_FDT_FILE}"
BOOT_FDT_FILE="${BOOT_FDT_FILE:-"${GRUB_FDT_FILE}"}"
EOD
}