Compare commits
5 Commits
c8e2823f1e
...
08bde5c0f5
Author | SHA1 | Date |
---|---|---|
David Abdurachmanov | 08bde5c0f5 | |
Javier Martinez Canillas | d3ceae4bfd | |
Javier Martinez Canillas | 897e388763 | |
Javier Martinez Canillas | 7ea6052755 | |
Javier Martinez Canillas | be6e591e0f |
|
@ -0,0 +1,40 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 27 Aug 2019 10:34:24 +0200
|
||||
Subject: [PATCH] Fix build error with the fdt module on risc-v
|
||||
|
||||
The risc-v architecture also uses Device Trees, but the symbols in the
|
||||
fdt header aren't defined for this arch which lead to following error:
|
||||
|
||||
BUILDSTDERR: ../../grub-core/loader/efi/fdt.c: In function 'grub_fdt_load':
|
||||
BUILDSTDERR: ../../grub-core/loader/efi/fdt.c:48:39: warning: implicit declaration of function 'grub_fdt_get_totalsize' [-Wimplicit-function-declaration]
|
||||
BUILDSTDERR: 48 | size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt));
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
include/grub/fdt.h | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
|
||||
index 2041341fd68..3514aa4a5b6 100644
|
||||
--- a/include/grub/fdt.h
|
||||
+++ b/include/grub/fdt.h
|
||||
@@ -19,7 +19,8 @@
|
||||
#ifndef GRUB_FDT_HEADER
|
||||
#define GRUB_FDT_HEADER 1
|
||||
|
||||
-#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__aarch64__))
|
||||
+#if !defined(GRUB_MACHINE_EMU) && \
|
||||
+ (defined(__arm__) || defined(__aarch64__) || defined(__riscv))
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
@@ -146,6 +147,7 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch
|
||||
grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \
|
||||
})
|
||||
|
||||
-#endif /* defined(__arm__) || defined(__aarch64__) */
|
||||
+#endif /* !defined(GRUB_MACHINE_EMU) && \
|
||||
+ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) */
|
||||
|
||||
#endif /* ! GRUB_FDT_HEADER */
|
|
@ -0,0 +1,36 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Wed, 26 Jun 2019 16:50:03 +0200
|
||||
Subject: [PATCH] RISC-V: Fix computation of pc-relative relocation offset
|
||||
|
||||
The offset calculation was missing the relocation addend.
|
||||
|
||||
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
||||
Tested-by: Chester Lin <clin@suse.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
util/grub-mkimagexx.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
|
||||
index bc087c2b57f..d16ec63a16f 100644
|
||||
--- a/util/grub-mkimagexx.c
|
||||
+++ b/util/grub-mkimagexx.c
|
||||
@@ -1232,8 +1232,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd,
|
||||
grub_uint32_t *t32 = (grub_uint32_t *) target;
|
||||
grub_uint16_t *t16 = (grub_uint16_t *) target;
|
||||
grub_uint8_t *t8 = (grub_uint8_t *) target;
|
||||
- grub_int64_t off = (long)sym_addr - target_section_addr - offset
|
||||
- - image_target->vaddr_offset;
|
||||
+ grub_int64_t off;
|
||||
|
||||
/*
|
||||
* Instructions and instruction encoding are documented in the RISC-V
|
||||
@@ -1243,6 +1242,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd,
|
||||
*/
|
||||
|
||||
sym_addr += addend;
|
||||
+ off = sym_addr - target_section_addr - offset - image_target->vaddr_offset;
|
||||
|
||||
switch (ELF_R_TYPE (info))
|
||||
{
|
|
@ -0,0 +1,132 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Sun, 15 Sep 2019 09:37:45 +0200
|
||||
Subject: [PATCH] blscfg: Add support for the devicetree field
|
||||
|
||||
The BootLoaderSpec mentions that a devicetree field can be used to pass a
|
||||
Device Tree (DT) to the kernel, for the platforms that use it to describe
|
||||
information about the hardware.
|
||||
|
||||
Allow the blscfg module to parse this field and call the grub2 devicetree
|
||||
command in that case. If there is a devicetree grub2 environment variable
|
||||
defined, this will be used if the field is not defined in the BLS snippet.
|
||||
|
||||
Resolves: rhbz#1751307
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 60 ++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 57 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 54458b14518..1ec89870483 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -698,6 +698,8 @@ static void create_entry (struct bls_entry *entry)
|
||||
const char *early_initrd = NULL;
|
||||
char **early_initrds = NULL;
|
||||
char *initrd_prefix = NULL;
|
||||
+ char *devicetree = NULL;
|
||||
+ char *dt = NULL;
|
||||
char *id = entry->filename;
|
||||
char *dotconf = id;
|
||||
char *hotkey = NULL;
|
||||
@@ -709,6 +711,7 @@ static void create_entry (struct bls_entry *entry)
|
||||
|
||||
char *src = NULL;
|
||||
int i, index;
|
||||
+ bool add_dt_prefix = false;
|
||||
|
||||
grub_dprintf("blscfg", "%s got here\n", __func__);
|
||||
clinux = bls_get_val (entry, "linux", NULL);
|
||||
@@ -736,6 +739,14 @@ static void create_entry (struct bls_entry *entry)
|
||||
|
||||
initrds = bls_make_list (entry, "initrd", NULL);
|
||||
|
||||
+ devicetree = expand_val (bls_get_val (entry, "devicetree", NULL));
|
||||
+
|
||||
+ if (!devicetree)
|
||||
+ {
|
||||
+ devicetree = expand_val (grub_env_get("devicetree"));
|
||||
+ add_dt_prefix = true;
|
||||
+ }
|
||||
+
|
||||
hotkey = bls_get_val (entry, "grub_hotkey", NULL);
|
||||
users = expand_val (bls_get_val (entry, "grub_users", NULL));
|
||||
classes = bls_make_list (entry, "grub_class", NULL);
|
||||
@@ -801,7 +812,6 @@ static void create_entry (struct bls_entry *entry)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
-
|
||||
tmp = grub_stpcpy(initrd, "initrd");
|
||||
for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++)
|
||||
{
|
||||
@@ -821,21 +831,65 @@ static void create_entry (struct bls_entry *entry)
|
||||
tmp = grub_stpcpy (tmp, "\n");
|
||||
}
|
||||
|
||||
+ if (devicetree)
|
||||
+ {
|
||||
+ char *prefix = NULL;
|
||||
+ int dt_size;
|
||||
+
|
||||
+ if (add_dt_prefix)
|
||||
+ {
|
||||
+ prefix = grub_strrchr (clinux, '/');
|
||||
+ prefix = grub_strndup(clinux, prefix - clinux + 1);
|
||||
+ if (!prefix)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
+ goto finish;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ dt_size = sizeof("devicetree " GRUB_BOOT_DEVICE) + grub_strlen(devicetree) + 1;
|
||||
+
|
||||
+ if (add_dt_prefix)
|
||||
+ {
|
||||
+ dt_size += grub_strlen(prefix);
|
||||
+ }
|
||||
+
|
||||
+ dt = grub_malloc (dt_size);
|
||||
+ if (!dt)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
+ goto finish;
|
||||
+ }
|
||||
+ char *tmp = dt;
|
||||
+ tmp = grub_stpcpy (dt, "devicetree");
|
||||
+ tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE);
|
||||
+ if (add_dt_prefix)
|
||||
+ tmp = grub_stpcpy (tmp, prefix);
|
||||
+ tmp = grub_stpcpy (tmp, devicetree);
|
||||
+ tmp = grub_stpcpy (tmp, "\n");
|
||||
+
|
||||
+ grub_free(prefix);
|
||||
+ }
|
||||
+
|
||||
+ grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id);
|
||||
+
|
||||
src = grub_xasprintf ("load_video\n"
|
||||
"set gfxpayload=keep\n"
|
||||
"insmod gzio\n"
|
||||
"linux %s%s%s%s\n"
|
||||
- "%s",
|
||||
+ "%s%s",
|
||||
GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "",
|
||||
- initrd ? initrd : "");
|
||||
+ initrd ? initrd : "", dt ? dt : "");
|
||||
|
||||
grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry);
|
||||
grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id);
|
||||
|
||||
finish:
|
||||
+ grub_free (dt);
|
||||
grub_free (initrd);
|
||||
grub_free (initrd_prefix);
|
||||
grub_free (early_initrds);
|
||||
+ grub_free (devicetree);
|
||||
grub_free (initrds);
|
||||
grub_free (options);
|
||||
grub_free (classes);
|
|
@ -0,0 +1,38 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Sun, 15 Sep 2019 10:05:29 +0200
|
||||
Subject: [PATCH] Set a devicetree var in a BLS config if GRUB_DEFAULT_DTB is
|
||||
present
|
||||
|
||||
The BootLoaderSpec mentions that a devicetree field can be used to pass a
|
||||
Device Tree (DT) to the kernel, for the platforms that use it to describe
|
||||
information about the hardware.
|
||||
|
||||
The blscfg module supports parsing the field from the BLS snippets but it
|
||||
allows to set a DT for all the entries if a devicetree env var is defined.
|
||||
|
||||
Make the grub2-mkconfig tool to set this variable if GRUB_DEFAULT_DTB was
|
||||
defined in the /etc/default/grub file.
|
||||
|
||||
Resolves: rhbz#1751307
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
util/grub.d/10_linux.in | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 301594a0c9e..1520b7e47c1 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -138,6 +138,10 @@ EOF
|
||||
if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
|
||||
${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
|
||||
fi
|
||||
+
|
||||
+ if [ -n "${GRUB_DEFAULT_DTB}" ]; then
|
||||
+ ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}"
|
||||
+ fi
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,78 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Fri, 4 Oct 2019 16:43:05 +0200
|
||||
Subject: [PATCH] Don't add a class option to menu entries generated for
|
||||
ppc64le
|
||||
|
||||
For ppc64le a grub config file with menuentry commands is still generated
|
||||
even when BLS support is enabled. That's because BLS support was added to
|
||||
Petitboot 1.8.0 and any previous version won't be able to parse BLS files.
|
||||
|
||||
To make the BLS snippets the source of truth, these are used to generate
|
||||
the menuentry commands in the grub config file.
|
||||
|
||||
And to keep it consistent across all ppc64le machines regardless of the
|
||||
firmware used, the grub config file is also generated for machines with
|
||||
OF that use grub2 and would have BLS support.
|
||||
|
||||
The BLS snippets created by the kernel package have fields that are used
|
||||
to specify the generated menuentry command users and class options. These
|
||||
fields are not present in BLS snippets created by OSTree though, so the
|
||||
script generating the menuentry commands will add options with an empty
|
||||
argument which will lead to grub failing to parse them.
|
||||
|
||||
We could check if the field is defined before attempting to add those, but
|
||||
since the grub2 blscfg module also supports setting these to variables, it
|
||||
could lead to an empty argument even if was defined in the BLS snippet if
|
||||
the variable doesn't exist.
|
||||
|
||||
So to make more robust, just don't add a class to the menuentry commands
|
||||
generated by the script. It's better to not have a class for the menuentry
|
||||
than grub2 failing to parse the command and not populating the boot menu.
|
||||
|
||||
Resolves: rhbz#1758225
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
util/grub.d/10_linux_bls.in | 10 +---------
|
||||
1 file changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
|
||||
index 1b7536435f1..68fbedf2129 100644
|
||||
--- a/util/grub.d/10_linux_bls.in
|
||||
+++ b/util/grub.d/10_linux_bls.in
|
||||
@@ -127,9 +127,7 @@ read_config()
|
||||
initrd=""
|
||||
options=""
|
||||
linux=""
|
||||
- grub_users=""
|
||||
grub_arg=""
|
||||
- grub_class=""
|
||||
|
||||
while read -r line
|
||||
do
|
||||
@@ -148,15 +146,9 @@ read_config()
|
||||
"options")
|
||||
options=${value}
|
||||
;;
|
||||
- "grub_users")
|
||||
- grub_users=${value}
|
||||
- ;;
|
||||
"grub_arg")
|
||||
grub_arg=${value}
|
||||
;;
|
||||
- "grub_class")
|
||||
- grub_class=${value}
|
||||
- ;;
|
||||
esac
|
||||
done < ${config_file}
|
||||
}
|
||||
@@ -180,7 +172,7 @@ populate_menu()
|
||||
for bls in "${files[@]}" ; do
|
||||
read_config "${blsdir}/${bls}.conf"
|
||||
|
||||
- menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id=${bls} {\n"
|
||||
+ menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n"
|
||||
menu="${menu}\t linux ${linux} ${options}\n"
|
||||
if [ -n "${initrd}" ] ; then
|
||||
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 15 Oct 2019 09:08:25 +0200
|
||||
Subject: [PATCH] 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set
|
||||
kernelopts
|
||||
|
||||
The GRUB documentation mentions that there are two variables to set the
|
||||
linux kernel cmdline: GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
|
||||
|
||||
The former is added to all the menuentry commands and the latter is not
|
||||
added to the recovery mode menu entries. But the blscfg module doesn't
|
||||
populate recovery entries from the BLS snippets, so the values set in the
|
||||
GRUB_CMDLINE_LINUX_DEFAULT variable should also be included in kernelopts.
|
||||
|
||||
This is needed because the GRUB_CMDLINE_LINUX_DEFAULT option is mentioned
|
||||
in the GRUB documentation so users assume that the kernel cmdline options
|
||||
can be changed by setting this option and running the grub2-mkconfig tool.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
util/grub.d/10_linux.in | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 1520b7e47c1..0471464e68e 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -118,7 +118,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
populate_header_warn
|
||||
|
||||
cat << EOF
|
||||
-set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}"
|
||||
+set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
|
||||
insmod blscfg
|
||||
blscfg
|
||||
@@ -134,7 +134,7 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
- ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}"
|
||||
+ ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
|
||||
${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
|
||||
fi
|
|
@ -0,0 +1,63 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 14 Oct 2019 17:37:26 +0200
|
||||
Subject: [PATCH] blscfg: Don't hardcode an env var as fallback for the BLS
|
||||
options field
|
||||
|
||||
If the BLS fragments don't have an options field or if this was set to an
|
||||
environment variable that was not defined in the grubenv file, the blscfg
|
||||
module searches for an default_kernelopts variable that is defined in the
|
||||
grub.cfg file.
|
||||
|
||||
But the blscfg module shouldn't hardcode fallbacks variables and instead
|
||||
this logic should be handled in the GRUB config file itself.
|
||||
|
||||
Also, add a comment explaining where the kernelopts variable is supposed
|
||||
to be defined and what is the process for the user to change its value.
|
||||
|
||||
Resolves: rhbz#1710483
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 4 ----
|
||||
util/grub.d/10_linux.in | 12 +++++++++++-
|
||||
2 files changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 1ec89870483..471975fd2e5 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -733,10 +733,6 @@ static void create_entry (struct bls_entry *entry)
|
||||
|
||||
title = bls_get_val (entry, "title", NULL);
|
||||
options = expand_val (bls_get_val (entry, "options", NULL));
|
||||
-
|
||||
- if (!options)
|
||||
- options = expand_val (grub_env_get("default_kernelopts"));
|
||||
-
|
||||
initrds = bls_make_list (entry, "initrd", NULL);
|
||||
|
||||
devicetree = expand_val (bls_get_val (entry, "devicetree", NULL));
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index 0471464e68e..21a6915dca3 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -118,7 +118,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
populate_header_warn
|
||||
|
||||
cat << EOF
|
||||
-set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
+# The kernelopts variable should be defined in the grubenv file. But to ensure that menu
|
||||
+# entries populated from BootLoaderSpec files that use this variable work correctly even
|
||||
+# without a grubenv file, define a fallback kernelopts variable if this has not been set.
|
||||
+#
|
||||
+# The kernelopts variable in the grubenv file can be modified using the grubby tool or by
|
||||
+# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX
|
||||
+# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both
|
||||
+# the kernelopts variable in the grubenv file and the fallback kernelopts variable.
|
||||
+if [ -z "\${kernelopts}" ]; then
|
||||
+ set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
+fi
|
||||
|
||||
insmod blscfg
|
||||
blscfg
|
|
@ -43,7 +43,6 @@ version ${kernelver}${debugid}
|
|||
linux /vmlinuz-${kernelver}
|
||||
initrd /initramfs-${kernelver}.img
|
||||
options \$kernelopts
|
||||
id ${ID}-${datetime}-${kernelver}
|
||||
grub_users \$grub_users
|
||||
grub_arg --unrestricted
|
||||
grub_class kernel${flavor}
|
||||
|
|
|
@ -4,10 +4,30 @@ if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
ARCH=$(uname -m)
|
||||
# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support,
|
||||
# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from
|
||||
# 10_linux. So BLS support needs to be disabled for both Xen Dom0 and DomU.
|
||||
if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then
|
||||
RUN_MKCONFIG=true
|
||||
DISABLE_BLS=true
|
||||
fi
|
||||
|
||||
# Is only needed for ppc64* since we can't assume a BLS capable bootloader there
|
||||
if [[ $ARCH != "ppc64" && $ARCH != "ppc64le" ]]; then
|
||||
ARCH=$(uname -m)
|
||||
# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to
|
||||
# be run to generate a GRUB config file that contains menuentry commands.
|
||||
if [[ $ARCH = "ppc64le" ]]; then
|
||||
RUN_MKCONFIG=true
|
||||
fi
|
||||
|
||||
if [[ $DISABLE_BLS = "true" ]]; then
|
||||
if grep -q '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then
|
||||
sed -i 's/^GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/' /etc/default/grub
|
||||
fi
|
||||
fi
|
||||
|
||||
# A traditional grub configuration file needs to be generated only in the case when
|
||||
# the bootloaders are not capable of populating a menu entry from the BLS fragments.
|
||||
if [[ $RUN_MKCONFIG != "true" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
|
@ -176,3 +176,10 @@ Patch0175: 0175-Do-better-in-bootstrap.conf.patch
|
|||
Patch0176: 0176-Use-git-to-apply-gnulib-patches.patch
|
||||
Patch0177: 0177-autogen.sh-use-find-wholename-for-long-path-matches.patch
|
||||
Patch0178: 0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch
|
||||
Patch0179: 0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch
|
||||
Patch0180: 0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch
|
||||
Patch0181: 0181-blscfg-Add-support-for-the-devicetree-field.patch
|
||||
Patch0182: 0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch
|
||||
Patch0183: 0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch
|
||||
Patch0184: 0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch
|
||||
Patch0185: 0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch
|
||||
|
|
27
grub2.spec
27
grub2.spec
|
@ -9,7 +9,7 @@
|
|||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.04
|
||||
Release: 1.0.riscv64%{?dist}
|
||||
Release: 3.0.riscv64%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
|
@ -311,13 +311,6 @@ elif [ -f /etc/grub.d/01_users ] && \
|
|||
fi
|
||||
fi
|
||||
|
||||
%posttrans tools
|
||||
|
||||
if [ -f /etc/default/grub ]; then
|
||||
! grep -q '^GRUB_ENABLE_BLSCFG=.*' /etc/default/grub && \
|
||||
/sbin/grub2-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || :
|
||||
fi
|
||||
|
||||
%triggerun -- grub2 < 1:1.99-4
|
||||
# grub2 < 1.99-4 removed a number of essential files in postun. To fix upgrades
|
||||
# from the affected grub2 packages, we first back up the files in triggerun and
|
||||
|
@ -522,9 +515,25 @@ rm -r /boot/grub2.tmp/ || :
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Aug 23 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> - 2.04-1.0.riscv64
|
||||
* Sat Nov 09 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> - 2.04-3.0.riscv64
|
||||
- Initial attempt at setting grub.macros for RISC-V (riscv64)
|
||||
|
||||
* Thu Oct 17 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.04-3
|
||||
- 20-grub-install: Don't add an id field to generated BLS snippets
|
||||
- 99-grub-mkconfig: Disable BLS usage for Xen machines
|
||||
Resolves: rhbz#1703700
|
||||
- Don't add a class option to menu entries generated for ppc64le
|
||||
Resolves: rhbz#1758225
|
||||
- 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set kernelopts
|
||||
- blscfg: Don't hardcode an env var as fallback for the BLS options field
|
||||
Resolves: rhbz#1710483
|
||||
|
||||
* Wed Sep 18 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.04-2
|
||||
- A couple of RISC-V fixes
|
||||
- Remove grub2-tools %%posttrans scriptlet that migrates to a BLS config
|
||||
- Add blscfg device tree support
|
||||
Resolves: rhbz#1751307
|
||||
|
||||
* Thu Aug 15 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.04-1
|
||||
- Update to 2.04
|
||||
Resolves: rhbz#1727279
|
||||
|
|
Loading…
Reference in New Issue