diff options
Diffstat (limited to 'meta/recipes-bsp/grub')
13 files changed, 290 insertions, 234 deletions
diff --git a/meta/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch b/meta/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch index ce3238f3a1..05a4697a73 100644 --- a/meta/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch +++ b/meta/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch @@ -1,4 +1,4 @@ -From fb7b827a56b1f92f882d0f5ef130acc968b23293 Mon Sep 17 00:00:00 2001 +From 006799e9c4babe8a8340a24501b253e759614a2d Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 13 Jan 2016 19:17:31 +0000 Subject: [PATCH] Disable -mfpmath=sse as well when SSE is disabled @@ -22,17 +22,18 @@ cc1: all warnings being treated as errors Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- + Upstream-Status: Pending +--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 26d2f33..9ce56de 100644 +index cd667a2..8263876 100644 --- a/configure.ac +++ b/configure.ac -@@ -783,7 +783,7 @@ fi +@@ -846,7 +846,7 @@ fi if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then # Some toolchains enable these features by default, but they need # registers that aren't set up properly in GRUB. @@ -40,7 +41,4 @@ index 26d2f33..9ce56de 100644 + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387" fi - # GRUB doesn't use float or doubles at all. Yet some toolchains may decide --- -2.7.0 - + if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ); then diff --git a/meta/recipes-bsp/grub/files/0001-RISC-V-Restore-the-typcast-to-long.patch b/meta/recipes-bsp/grub/files/0001-RISC-V-Restore-the-typcast-to-long.patch new file mode 100644 index 0000000000..cafa711731 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0001-RISC-V-Restore-the-typcast-to-long.patch @@ -0,0 +1,37 @@ +From b47029e8e582d17c6874d2622fe1a5b834377dbb Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 26 Mar 2021 11:59:43 -0700 +Subject: [PATCH] RISC-V: Restore the typcast to 64bit type + +this makes the type promotions clear and explicit +It was already typecasted to long but was accidentally dropped in [1] +which stated to cause failures on riscv32 as reported in [2] + +[1] https://git.savannah.gnu.org/cgit/grub.git/commit/?id=2bf40e9e5be9808b17852e688eead87acff14420 +[2] https://savannah.gnu.org/bugs/index.php?60283 + +Upstream-Status: Submitted +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Cc: Andreas Schwab <schwab@suse.de> +Cc: Daniel Kiper <daniel.kiper@oracle.com> +Cc: Chester Lin <clin@suse.com> +Cc: Nikita Ermakov <arei@altlinux.org> +Cc: Alistair Francis <alistair.francis@wdc.com> + +--- + util/grub-mkimagexx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index e50b295..2f09255 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -1310,7 +1310,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; ++ off = (grub_int64_t)sym_addr - target_section_addr - offset - image_target->vaddr_offset; + + switch (ELF_R_TYPE (info)) + { diff --git a/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch b/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch deleted file mode 100644 index 67dc115491..0000000000 --- a/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b9565dc2fe0c4f7daaec91b7e83bc7313dee2f4a Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 13 Apr 2015 17:02:13 -0700 -Subject: [PATCH] Unset need_charset_alias when building for musl - -localcharset uses ac_cv_gnu_library_2_1 from glibc21.m4 -which actually shoudl be fixed in gnulib and then all downstream -projects will get it eventually. For now we apply the fix to -coreutils - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - lib/gnulib.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: grub-2.00/grub-core/gnulib/Makefile.am -=================================================================== ---- grub-2.00.orig/grub-core/gnulib/Makefile.am -+++ grub-2.00/grub-core/gnulib/Makefile.am -@@ -410,7 +410,7 @@ install-exec-localcharset: all-local - case '$(host_os)' in \ - darwin[56]*) \ - need_charset_alias=true ;; \ -- darwin* | cygwin* | mingw* | pw32* | cegcc*) \ -+ darwin* | cygwin* | mingw* | pw32* | cegcc* | linux-musl*) \ - need_charset_alias=false ;; \ - *) \ - need_charset_alias=true ;; \ diff --git a/meta/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch b/meta/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch index d5bfaa177a..69dec7695a 100644 --- a/meta/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch +++ b/meta/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch @@ -1,4 +1,4 @@ -From b512c77222a8b133d7dd71a0dcef081a921d97d4 Mon Sep 17 00:00:00 2001 +From a80592e20f6c4b928a22862f52f268ab9d9908b2 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 13 Jan 2016 19:28:00 +0000 Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name @@ -11,18 +11,19 @@ to util/grub.d/20_linux_xen.in to keep compatibility. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- + Upstream-Status: Inappropriate [OE specific] +--- util/grub.d/10_linux.in | 6 +++--- util/grub.d/20_linux_xen.in | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 859b608..946be5d 100644 +index cc393be..8545cb6 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -148,12 +148,12 @@ machine=`uname -m` +@@ -166,12 +166,12 @@ machine=`uname -m` case "x$machine" in xi?86 | xx86_64) list= @@ -39,10 +40,10 @@ index 859b608..946be5d 100644 done ;; esac diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index f532fb9..1994244 100644 +index 94dd8be..36cd554 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in -@@ -138,7 +138,7 @@ EOF +@@ -181,7 +181,7 @@ EOF } linux_list= @@ -51,6 +52,3 @@ index f532fb9..1994244 100644 if grub_file_is_not_garbage "$i"; then basename=$(basename $i) version=$(echo $basename | sed -e "s,^[^0-9]*-,,g") --- -2.7.0 - diff --git a/meta/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch b/meta/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch index fc5aa4e313..f8dfda90ab 100644 --- a/meta/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch +++ b/meta/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch @@ -1,6 +1,6 @@ -From ff8f68cc48fd3c30d55e1d570d51f2e0952c968e Mon Sep 17 00:00:00 2001 -From: Robert Yang <liezhi.yang@windriver.com> -Date: Sat, 25 Jan 2014 23:49:44 -0500 +From 14c1d0459fb3561e627d3a5f6e91a0d2f7b4aa45 Mon Sep 17 00:00:00 2001 +From: Naveen Saini <naveen.kumar.saini@intel.com> +Date: Mon, 15 Mar 2021 14:44:15 +0800 Subject: [PATCH] autogen.sh: exclude .pc from po/POTFILES.in Exclude the .pc from po/POTFILES.in since quilt uses "patch --backup", @@ -12,23 +12,23 @@ try to read it. Upstream-Status: Inappropriate [OE specific] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> +Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> + --- - autogen.sh | 2 +- + autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh -index 7424428..843619e 100755 +index 195daa5..773b7b4 100755 --- a/autogen.sh +++ b/autogen.sh -@@ -5,7 +5,7 @@ set -e +@@ -26,7 +26,7 @@ fi export LC_COLLATE=C unset LC_ALL --find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in -+find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -path './.pc/*' | sort > po/POTFILES.in +-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -ipath './grub-core/lib/gnulib/*' |sort > po/POTFILES.in ++find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -ipath './grub-core/lib/gnulib/*' ! -path './.pc/*' |sort > po/POTFILES.in find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in echo "Importing unicode..." --- -1.7.10.4 - diff --git a/meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch b/meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch deleted file mode 100644 index f35df97bfc..0000000000 --- a/meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch +++ /dev/null @@ -1,39 +0,0 @@ -* e.g. with gentoo gcc-7.1 they define _FORTIFY_SOURCE by default with: - https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup - which results in following error while building grub-efi-native: - ./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined] - || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ - ^~~~~~~~~~~~~~~ - this part comes from gnulib and it's used only for Apple and BSD, - so we can ignore it, but we cannot add -Wno-error=expansion-to-defined - because this warning was introduced only in gcc-7 and older gcc - will fail with: - cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined - use #pragma to work around this - -Upstream-Status: Pending (should be fixed in gnulib which is then rarely updated in grub) - -Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> - -diff -uNr grub-2.02.old/m4/extern-inline.m4 grub-2.02/m4/extern-inline.m4 ---- grub-2.02.old/m4/extern-inline.m4 2016-02-28 15:22:21.000000000 +0100 -+++ grub-2.02/m4/extern-inline.m4 2017-08-22 19:26:45.213637276 +0200 -@@ -39,6 +39,10 @@ - OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and - for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. - Assume DragonFly and FreeBSD will be similar. */ -+#pragma GCC diagnostic push -+#if __GNUC__ >= 7 -+#pragma GCC diagnostic ignored "-Wexpansion-to-defined" -+#endif - #if (((defined __APPLE__ && defined __MACH__) \ - || defined __DragonFly__ || defined __FreeBSD__) \ - && (defined __header_inline \ -@@ -50,6 +52,7 @@ - && defined __GNUC__ && ! defined __cplusplus)))) - # define _GL_EXTERN_INLINE_STDHEADER_BUG - #endif -+#pragma GCC diagnostic pop - #if ((__GNUC__ \ - ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ - : (199901L <= __STDC_VERSION__ \ diff --git a/meta/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch b/meta/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch index 935c472cf8..d9012d1dd6 100644 --- a/meta/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch +++ b/meta/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch @@ -1,11 +1,12 @@ -From 7461a3de38b66edbe2f5593f9bdab9f2704d32bc Mon Sep 17 00:00:00 2001 +From b316ed326bd492106006d78f5bfcd767b49a4f2e Mon Sep 17 00:00:00 2001 From: Hongxu Jia <hongxu.jia@windriver.com> Date: Wed, 17 Aug 2016 04:06:34 -0400 Subject: [PATCH] grub module explicitly keeps symbole .module_license While using oe-core toolchain to strip grub module 'all_video.mod', it stripped symbol table: --------------- + +--------------- root@localhost:~# objdump -t all_video.mod all_video.mod: file format elf64-x86-64 @@ -39,23 +40,21 @@ SYMBOL TABLE: Upstream-Status: Pending Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> + --- grub-core/genmod.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in -index 76df0bb..39a9cfc 100644 +index e57c4d9..42bb1ba 100644 --- a/grub-core/genmod.sh.in +++ b/grub-core/genmod.sh.in -@@ -59,7 +59,7 @@ if test x@TARGET_APPLE_CC@ != x1; then +@@ -56,7 +56,7 @@ if test x@TARGET_APPLE_LINKER@ != x1; then if test x@platform@ != xemu; then - @STRIP@ --strip-unneeded \ + @TARGET_STRIP@ --strip-unneeded \ -K grub_mod_init -K grub_mod_fini \ - -K _grub_mod_init -K _grub_mod_fini \ + -K _grub_mod_init -K _grub_mod_fini -K .module_license \ -R .note.gnu.gold-version -R .note.GNU-stack \ - -R .note -R .comment $tmpfile || exit 1 - fi --- -2.8.1 - + -R .gnu.build.attributes \ + -R .rel.gnu.build.attributes \ diff --git a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb new file mode 100644 index 0000000000..783e30bf38 --- /dev/null +++ b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb @@ -0,0 +1,32 @@ +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +SUMMARY = "Basic grub.cfg for use in EFI systems" +DESCRIPTION = "Grub might require different configuration file for \ +different machines." +HOMEPAGE = "https://www.gnu.org/software/grub/manual/grub/grub.html#Configuration" + +RPROVIDES:${PN} += "virtual-grub-bootconf" + +inherit grub-efi-cfg + +require conf/image-uefi.conf + +S = "${WORKDIR}" + +GRUB_CFG = "${S}/grub-bootconf" +LABELS = "boot" + +ROOT ?= "root=/dev/sda2" + +python do_configure() { + bb.build.exec_func('build_efi_cfg', d) +} + +do_configure[vardeps] += "APPEND ROOT" + +do_install() { + install -d ${D}${EFI_FILES_PATH} + install grub-bootconf ${D}${EFI_FILES_PATH}/grub.cfg +} + +FILES:${PN} = "${EFI_FILES_PATH}/grub.cfg" diff --git a/meta/recipes-bsp/grub/grub-efi_2.02.bb b/meta/recipes-bsp/grub/grub-efi_2.02.bb deleted file mode 100644 index 44e32a88f1..0000000000 --- a/meta/recipes-bsp/grub/grub-efi_2.02.bb +++ /dev/null @@ -1,81 +0,0 @@ -require grub2.inc - -GRUBPLATFORM = "efi" - -DEPENDS_class-target = "grub-efi-native" -RDEPENDS_${PN}_class-target = "diffutils freetype" - -SRC_URI += " \ - file://cfg \ - " - -S = "${WORKDIR}/grub-${PV}" - -# Determine the target arch for the grub modules -python __anonymous () { - import re - target = d.getVar('TARGET_ARCH') - if target == "x86_64": - grubtarget = 'x86_64' - grubimage = "grub-efi-bootx64.efi" - elif re.match('i.86', target): - grubtarget = 'i386' - grubimage = "grub-efi-bootia32.efi" - else: - raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) - d.setVar("GRUB_TARGET", grubtarget) - d.setVar("GRUB_IMAGE", grubimage) -} - -inherit deploy - -CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN=" -EXTRA_OECONF += "--enable-efiemu=no" - -# ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines] -# and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo) -CFLAGS_append_class-native = " -Wno-error=trampolines" - -do_install_class-native() { - install -d ${D}${bindir} - install -m 755 grub-mkimage ${D}${bindir} -} - -do_install_append_class-target() { - # Remove build host references... - find "${D}" -name modinfo.sh -type f -exec \ - sed -i \ - -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ - {} + -} - -GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search" - -do_deploy() { - # Search for the grub.cfg on the local boot media by using the - # built in cfg file provided via this recipe - grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ - -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ - ${GRUB_BUILDIN} - install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} -} - -do_deploy_class-native() { - : -} - -addtask deploy after do_install before do_build - -FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \ - ${datadir}/grub \ - " - -# 64-bit binaries are expected for the bootloader with an x32 userland -INSANE_SKIP_${PN}_append_linux-gnux32 = " arch" -INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch" -INSANE_SKIP_${PN}_append_linux-muslx32 = " arch" -INSANE_SKIP_${PN}-dbg_append_linux-muslx32 = " arch" - -BBCLASSEXTEND = "native" diff --git a/meta/recipes-bsp/grub/grub-efi_2.12.bb b/meta/recipes-bsp/grub/grub-efi_2.12.bb new file mode 100644 index 0000000000..9857e8e036 --- /dev/null +++ b/meta/recipes-bsp/grub/grub-efi_2.12.bb @@ -0,0 +1,105 @@ +require grub2.inc + +require conf/image-uefi.conf + +GRUBPLATFORM = "efi" + +DEPENDS:append = " grub-native" +RDEPENDS:${PN} = "grub-common virtual-grub-bootconf" + +SRC_URI += " \ + file://cfg \ + " + +S = "${WORKDIR}/grub-${PV}" + +# Determine the target arch for the grub modules +python __anonymous () { + import re + target = d.getVar('TARGET_ARCH') + prefix = "" if d.getVar('EFI_PROVIDER') == "grub-efi" else "grub-efi-" + if target == "x86_64": + grubtarget = 'x86_64' + elif re.match('i.86', target): + grubtarget = 'i386' + elif re.match('aarch64', target): + grubtarget = 'arm64' + elif re.match('arm', target): + grubtarget = 'arm' + elif re.match('riscv64', target): + grubtarget = 'riscv64' + elif re.match('riscv32', target): + grubtarget = 'riscv32' + else: + raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target) + grubimage = prefix + d.getVar("EFI_BOOT_IMAGE") + d.setVar("GRUB_TARGET", grubtarget) + d.setVar("GRUB_IMAGE", grubimage) + prefix = "grub-efi-" if prefix == "" else "" + d.setVar("GRUB_IMAGE_PREFIX", prefix) +} + +inherit deploy + +CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN=" +EXTRA_OECONF += "--enable-efiemu=no" + +do_mkimage() { + cd ${B} + + GRUB_MKIMAGE_MODULES="${GRUB_BUILDIN}" + + # If 'all' is included in GRUB_BUILDIN we will include all available grub2 modules + if [ "${@ bb.utils.contains('GRUB_BUILDIN', 'all', 'True', 'False', d)}" = "True" ]; then + bbdebug 1 "Including all available modules" + # Get the list of all .mod files in grub-core build directory + GRUB_MKIMAGE_MODULES=$(find ${B}/grub-core/ -type f -name "*.mod" -exec basename {} .mod \;) + fi + + # Search for the grub.cfg on the local boot media by using the + # built in cfg file provided via this recipe + grub-mkimage -v -c ../cfg -p ${EFIDIR} -d ./grub-core/ \ + -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} \ + ${GRUB_MKIMAGE_MODULES} +} + +addtask mkimage before do_install after do_compile + +do_install() { + oe_runmake 'DESTDIR=${D}' -C grub-core install + + # Remove build host references... + find "${D}" -name modinfo.sh -type f -exec \ + sed -i \ + -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ + {} + + + install -d ${D}${EFI_FILES_PATH} + install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${GRUB_IMAGE} +} + +# To include all available modules, add 'all' to GRUB_BUILDIN +GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \ + efi_gop iso9660 configfile search loadenv test" + +# 'xen_boot' is a module valid only for aarch64 +GRUB_BUILDIN:append:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' xen_boot', '', d)}" + +do_deploy() { + install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${DEPLOYDIR} +} + +addtask deploy after do_install before do_build + +FILES:${PN} = "${libdir}/grub/${GRUB_TARGET}-efi \ + ${datadir}/grub \ + ${EFI_FILES_PATH}/${GRUB_IMAGE} \ + " + +# 64-bit binaries are expected for the bootloader with an x32 userland +INSANE_SKIP:${PN}:append:linux-gnux32 = " arch" +INSANE_SKIP:${PN}-dbg:append:linux-gnux32 = " arch" +INSANE_SKIP:${PN}:append:linux-muslx32 = " arch" +INSANE_SKIP:${PN}-dbg:append:linux-muslx32 = " arch" diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index a56fbe7bf8..bb9aacb478 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc @@ -8,34 +8,50 @@ standard, which allows for flexible loading of multiple boot images." HOMEPAGE = "http://www.gnu.org/software/grub/" SECTION = "bootloaders" -LICENSE = "GPLv3" +LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" -SRC_URI = "https://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ +CVE_PRODUCT = "grub2" + +SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \ - file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ file://autogen.sh-exclude-pc.patch \ file://grub-module-explicitly-keeps-symbole-.module_license.patch \ file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \ - file://fix.build.with.gcc-7.patch \ + file://0001-RISC-V-Restore-the-typcast-to-long.patch \ " -SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d" -SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d" -DEPENDS = "flex-native bison-native" +SRC_URI[sha256sum] = "b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91" + +CVE_STATUS[CVE-2019-14865] = "not-applicable-platform: applies only to RHEL" +CVE_STATUS[CVE-2021-46705] = "not-applicable-platform: Applies only to SUSE" +CVE_STATUS[CVE-2023-4001] = "not-applicable-platform: Applies only to RHEL/Fedora" +CVE_STATUS[CVE-2024-1048] = "not-applicable-platform: Applies only to RHEL/Fedora" +CVE_STATUS[CVE-2023-4692] = "cpe-incorrect: Fixed in version 2.12 already" +CVE_STATUS[CVE-2023-4693] = "cpe-incorrect: Fixed in version 2.12 already" -COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)' -COMPATIBLE_HOST_armv7a = 'null' -COMPATIBLE_HOST_armv7ve = 'null' +DEPENDS = "flex-native bison-native gettext-native" + +GRUB_COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)' +COMPATIBLE_HOST = "${GRUB_COMPATIBLE_HOST}" +# Grub doesn't support hard float toolchain and won't be able to forcefully +# disable it on some of the target CPUs. See 'configure.ac' for +# supported/unsupported CPUs in hardfp. +COMPATIBLE_HOST:armv7a = "${@'null' if bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', True, False, d) else d.getVar('GRUB_COMPATIBLE_HOST')}" +COMPATIBLE_HOST:armv7ve = "${@'null' if bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', True, False, d) else d.getVar('GRUB_COMPATIBLE_HOST')}" # configure.ac has code to set this automagically from the target tuple # but the OE freeform one (core2-foo-bar-linux) don't work with that. -GRUBPLATFORM_arm = "uboot" -GRUBPLATFORM_aarch64 = "efi" +GRUBPLATFORM:arm = "efi" +GRUBPLATFORM:aarch64 = "efi" +GRUBPLATFORM:riscv32 = "efi" +GRUBPLATFORM:riscv64 = "efi" GRUBPLATFORM ??= "pc" -inherit autotools gettext texinfo +inherit autotools gettext texinfo pkgconfig + +CFLAGS:remove = "-O2" EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \ --disable-grub-mkfont \ @@ -43,11 +59,12 @@ EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \ --enable-liblzma=no \ --enable-libzfs=no \ --enable-largefile \ + --disable-werror \ " PACKAGECONFIG ??= "" PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse" -PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,lvm2" +PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,libdevmapper" # grub2 creates its own set of -nostdinc / -isystem / -ffreestanding CFLAGS and # OE's default BUILD_CFLAGS (assigned to CFLAGS for native builds) etc, conflict @@ -58,15 +75,15 @@ BUILD_CFLAGS = "" BUILD_CXXFLAGS = "" BUILD_LDFLAGS = "" -do_configure_prepend() { - # The grub2 configure script uses variables such as TARGET_CFLAGS etc - # for its own purposes. Remove the OE versions from the environment to - # avoid conflicts. - unset TARGET_CPPFLAGS TARGET_CFLAGS TARGET_CXXFLAGS TARGET_LDFLAGS - ( cd ${S} - ${S}/autogen.sh ) -} +export PYTHON = "python3" + +do_configure:prepend() { + cd ${S} -# grub and grub-efi's sysroot/${datadir}/grub/grub-mkconfig_lib are -# conflicted, remove it since no one uses it. -SYSROOT_DIRS_BLACKLIST += "${datadir}/grub/grub-mkconfig_lib" + # Remove in next version. + # See: https://git.savannah.gnu.org/cgit/grub.git/commit/?id=b835601c7639ed1890f2d3db91900a8506011a8e + echo "depends bli part_gpt" > ${S}/grub-core/extra_deps.lst + + FROM_BOOTSTRAP=1 ${S}/autogen.sh + cd ${B} +} diff --git a/meta/recipes-bsp/grub/grub_2.02.bb b/meta/recipes-bsp/grub/grub_2.02.bb deleted file mode 100644 index b8055e7537..0000000000 --- a/meta/recipes-bsp/grub/grub_2.02.bb +++ /dev/null @@ -1,21 +0,0 @@ -require grub2.inc - -RDEPENDS_${PN} = "diffutils freetype grub-editenv" - -PACKAGES =+ "grub-editenv" - -FILES_grub-editenv = "${bindir}/grub-editenv" - -do_install_append () { - install -d ${D}${sysconfdir}/grub.d - # Remove build host references... - find "${D}" -name modinfo.sh -type f -exec \ - sed -i \ - -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ - {} + -} - -INSANE_SKIP_${PN} = "arch" -INSANE_SKIP_${PN}-dbg = "arch" diff --git a/meta/recipes-bsp/grub/grub_2.12.bb b/meta/recipes-bsp/grub/grub_2.12.bb new file mode 100644 index 0000000000..05d462785c --- /dev/null +++ b/meta/recipes-bsp/grub/grub_2.12.bb @@ -0,0 +1,41 @@ +require grub2.inc + +RDEPENDS:${PN}-common += "${PN}-editenv" +RDEPENDS:${PN} += "${PN}-common" +RDEPENDS:${PN}:class-native = "" + +RPROVIDES:${PN}-editenv += "${PN}-efi-editenv" + +PROVIDES:append:class-native = " grub-efi-native" + +PACKAGES =+ "${PN}-editenv ${PN}-common" +FILES:${PN}-editenv = "${bindir}/grub-editenv" +FILES:${PN}-common = " \ + ${bindir} \ + ${sysconfdir} \ + ${sbindir} \ + ${datadir}/grub \ +" +ALLOW_EMPTY:${PN} = "1" + +do_install:append () { + # Avoid conflicts with the EFI package for systems such as arm64 where we + # need to build grub and grub-efi but only EFI is supported by removing EFI + # from this package. + rm -rf ${D}${libdir}/grub/*-efi/ + rmdir --ignore-fail-on-non-empty ${D}${libdir}/grub ${D}${libdir} + + install -d ${D}${sysconfdir}/grub.d + # Remove build host references... + find "${D}" -name modinfo.sh -type f -exec \ + sed -i \ + -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ + {} + +} + +INSANE_SKIP:${PN} = "arch" +INSANE_SKIP:${PN}-dbg = "arch" + +BBCLASSEXTEND = "native nativesdk" |