diff options
authorAlexandru Avadanii <>2020-09-04 13:24:29 (GMT)
committerMartin Borg <>2020-09-14 09:37:41 (GMT)
commit55b49a162cc4e871106f6e57108581a92ae35832 (patch)
parent9f469b481144dfebef413bbb994c97b120a41c6a (diff)
grub: Fix loader link, unify grub.cfg locationstest_branchout_newtest_branchout
1. Fix an obviously broken link created during installation This led to issues creating/editing the grubenv file during NFVA installation calls to `grub-mkconfig`. These errors were not observed before, since stderr was not logged during the installation. Also, the link was fixed later on, so subsequent calls to grub-* utilities no longer complained about it; the error only happened during the NFVA installation. 2. Unify expected locations of grub.cfg Previously, there were 3 possible locations of grub.cfg used throughout the layers/scripts: - /boot/loader/grub.cfg - the proper location, used by NFVA installer components, as well as ostree related tooling; - /boot/grub/grub.cfg - used in some recipes, but not present on the board currently. Also the expected default location of our current grub-* utilites, since we build grub without an explicit `--with-grubdir` configure argument, which defaults (guessing) to the `PACKAGE` name, in our case `grub` (and not `grub2`); - /boot/grub2/grub.cfg - used in OTA image scripts by linking it to /boot/loader/grub.cfg - however the link is later converted into a real file, ending up duplicating the real grub.cfg (although they are identical content-wise, they might confuse the user); To settle this confusion, we will keep only /boot/loader/grub.cfg as the true configuration file and convert /boot/grub2 to a symlink pointing at /boot/loader, while also renaming it to /boot/grub. This has the benefit of "fixing" all grub-* tools which try to write their configuration files to /boot/grub. An alternative for that would be building grub2 with the configure flag `--with-grubdir=loader`, but that might break other things, so a symlink for the traditional /boot/grub is safer. Before creating this link, `grub-editenv list` would not work without explicitly providing the filepath of the `/boot/loader/grubenv` file, which might not be obvious for the end user. Also, before this link, `grub-mkconfig` required explicitly setting the `-p` (prefix) to '/' while running on the target. Both of these issues will be fixed with the new link. Since our ostree version (2018.7) is quite old, it requires one backport for it to also check for /boot/grub/grub.cfg and not only /boot/grub2/grub.cfg. The backport will be handled in the meta-enea-virtualiation layer, hence this change's dependency. Signed-off-by: Alexandru Avadanii <> Depends-on: I6bdc80e08a272e1534dd63717348bfaa50807d93 Change-Id: If8a61c89200414922a3f36e6c8fca58d7d3b6495
2 files changed, 3 insertions, 3 deletions
diff --git a/classes/ b/classes/
index 241afcd..011e27e 100644
--- a/classes/
+++ b/classes/
@@ -124,7 +124,7 @@ IMAGE_CMD_ostree () {
124 124
125 mkdir -p boot/loader.0 125 mkdir -p boot/loader.0
126 mkdir -p boot/loader.1 126 mkdir -p boot/loader.1
127 ln -sf boot/loader.0 boot/loader 127 ln -sf loader.0 boot/loader
128 128
129 checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` 129 checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "`
130 130
diff --git a/classes/ b/classes/
index 17508b2..ded70dd 100644
--- a/classes/
+++ b/classes/
@@ -33,8 +33,8 @@ IMAGE_CMD_otaimg () {
33 ln -s loader.0 ${PHYS_SYSROOT}/boot/loader 33 ln -s loader.0 ${PHYS_SYSROOT}/boot/loader
34 34
35 if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then 35 if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then
36 mkdir -p ${PHYS_SYSROOT}/boot/grub2 36 ln -s loader ${PHYS_SYSROOT}/boot/grub
37 ln -s ../loader/grub.cfg ${PHYS_SYSROOT}/boot/grub2/grub.cfg 37 touch ${PHYS_SYSROOT}/boot/grub/grub.cfg
38 elif [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then 38 elif [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then
39 touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt 39 touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt
40 else 40 else