From c0d3c22c26ebb6b16b2a3376bd80a75a2b5210ce Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Mon, 10 Jun 2024 20:12:59 +0200 Subject: [PATCH] 20-grub.install: Add variable for per-kernel devicetree setting In the old days before BLS, setting the GRUB_DEFAULT_DTB variable would create a devicetree entry for each kernel, which would be prepended by /dtb-${kernelver}, so it was possible to test a different dtb per installed kernel. In the transition to BLS, the variable was kept but the functionality is now slightly different. The value of GRUB_DEFAULT_DTB goes to the grubenv and that dtb is loaded from the /dtb symlink instead, which may change with kernel installs. This patch introduces a different variable which restores the previous behavior, and adds the devicetree entry to each BLS entry, if set. This variable is not set by default in an install, so it does not affect users with default settings. It is useful for developers and users of boards with not yet stable upstream support, where changes to the dtb may cause behavior difference. In these cases, it is desirable to not pick the dtb of just the latest installed kernel, but keep previous kernel+dtb choices unaffected as a fallback. Signed-off-by: Erico Nunes --- 20-grub.install | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/20-grub.install b/20-grub.install index afc706d..d9d1d1d 100755 --- a/20-grub.install +++ b/20-grub.install @@ -32,6 +32,7 @@ mkbls() { local debugname="" local debugid="" local flavor="" + local devicetree_entry="" if [[ "$kernelver" == *\+* ]] ; then local flavor=-"${kernelver##*+}" @@ -41,6 +42,12 @@ mkbls() { fi fi + # Define devicetree_entry if the user defined GRUB_DEVICETREE + # in /etc/default/grub, otherwise leave it empty + if [ -n "$GRUB_DEVICETREE" ] ; then + local devicetree_entry="devicetree /dtb-${kernelver}/$GRUB_DEVICETREE" + fi + cat <