1SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
2
3DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
4intended to unify bootloading across x86 operating systems. In \
5addition to loading the Linux kernel, it implements the Multiboot \
6standard, which allows for flexible loading of multiple boot images."
7
8HOMEPAGE = "http://www.gnu.org/software/grub/"
9SECTION = "bootloaders"
10
11LICENSE = "GPL-3.0-only"
12LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
13
14CVE_PRODUCT = "grub2"
15
16SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
17           file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \
18           file://autogen.sh-exclude-pc.patch \
19           file://grub-module-explicitly-keeps-symbole-.module_license.patch \
20           file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
21           file://0001-RISC-V-Restore-the-typcast-to-long.patch \
22"
23
24SRC_URI[sha256sum] = "b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91"
25
26CVE_STATUS[CVE-2019-14865] = "not-applicable-platform: applies only to RHEL"
27CVE_STATUS[CVE-2021-46705] = "not-applicable-platform: Applies only to SUSE"
28CVE_STATUS[CVE-2023-4001]  = "not-applicable-platform: Applies only to RHEL/Fedora"
29CVE_STATUS[CVE-2024-1048]  = "not-applicable-platform: Applies only to RHEL/Fedora"
30CVE_STATUS[CVE-2023-4692]  = "cpe-incorrect: Fixed in version 2.12 already"
31CVE_STATUS[CVE-2023-4693]  = "cpe-incorrect: Fixed in version 2.12 already"
32
33DEPENDS = "flex-native bison-native gettext-native"
34
35GRUB_COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'
36COMPATIBLE_HOST = "${GRUB_COMPATIBLE_HOST}"
37# Grub doesn't support hard float toolchain and won't be able to forcefully
38# disable it on some of the target CPUs. See 'configure.ac' for
39# supported/unsupported CPUs in hardfp.
40COMPATIBLE_HOST:armv7a = "${@'null' if bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', True, False, d) else d.getVar('GRUB_COMPATIBLE_HOST')}"
41COMPATIBLE_HOST:armv7ve = "${@'null' if bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', True, False, d) else d.getVar('GRUB_COMPATIBLE_HOST')}"
42
43# configure.ac has code to set this automagically from the target tuple
44# but the OE freeform one (core2-foo-bar-linux) don't work with that.
45
46GRUBPLATFORM:arm = "efi"
47GRUBPLATFORM:aarch64 = "efi"
48GRUBPLATFORM:riscv32 = "efi"
49GRUBPLATFORM:riscv64 = "efi"
50GRUBPLATFORM ??= "pc"
51
52inherit autotools gettext texinfo pkgconfig
53
54CFLAGS:remove = "-O2"
55
56EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \
57                --disable-grub-mkfont \
58                --program-prefix="" \
59                --enable-liblzma=no \
60                --enable-libzfs=no \
61                --enable-largefile \
62                --disable-werror \
63"
64
65PACKAGECONFIG ??= ""
66PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse"
67PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,libdevmapper"
68
69# grub2 creates its own set of -nostdinc / -isystem / -ffreestanding CFLAGS and
70# OE's default BUILD_CFLAGS (assigned to CFLAGS for native builds) etc, conflict
71# with that. Note that since BUILD_CFLAGS etc are not used by grub2 target
72# builds, it's safe to clear them unconditionally for both target and native.
73BUILD_CPPFLAGS = ""
74BUILD_CFLAGS = ""
75BUILD_CXXFLAGS = ""
76BUILD_LDFLAGS = ""
77
78export PYTHON = "python3"
79
80do_configure:prepend() {
81	cd ${S}
82
83	# Remove in next version.
84	# See: https://git.savannah.gnu.org/cgit/grub.git/commit/?id=b835601c7639ed1890f2d3db91900a8506011a8e
85	echo "depends bli part_gpt" > ${S}/grub-core/extra_deps.lst
86
87	FROM_BOOTSTRAP=1 ${S}/autogen.sh
88	cd ${B}
89}
90