diff options
11 files changed, 476 insertions, 0 deletions
diff --git a/recipes-bsp/grub/_ignore_grub-efi_2.02.bbappend b/recipes-bsp/grub/_ignore_grub-efi_2.02.bbappend new file mode 100644 index 0000000..630cc68 --- /dev/null +++ b/recipes-bsp/grub/_ignore_grub-efi_2.02.bbappend | |||
@@ -0,0 +1,23 @@ | |||
1 | # because entire grub folder was taken from newer branch(rocko) we are using a separate bbappend | ||
2 | # just to facilitate the move of changes(keep only this file) when switch to new branch | ||
3 | # | ||
4 | # Determine the target arch for the grub modules | ||
5 | python __anonymous_prepend () { | ||
6 | import re | ||
7 | target = d.getVar('TARGET_ARCH') | ||
8 | if target == "x86_64": | ||
9 | grubtarget = 'x86_64' | ||
10 | grubimage = "grub-efi-bootx64.efi" | ||
11 | elif re.match('i.86', target): | ||
12 | grubtarget = 'i386' | ||
13 | grubimage = "grub-efi-bootia32.efi" | ||
14 | elif re.match('aarch64', target): | ||
15 | grubtarget = 'arm64' | ||
16 | grubimage = "grub-efi-bootaa64.efi" | ||
17 | else: | ||
18 | raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) | ||
19 | d.setVar("GRUB_TARGET", grubtarget) | ||
20 | d.setVar("GRUB_IMAGE", grubimage) | ||
21 | } | ||
22 | |||
23 | COMPATIBLE_HOST = "aarch64-enea-linux" | ||
diff --git a/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch b/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch new file mode 100644 index 0000000..ce3238f --- /dev/null +++ b/recipes-bsp/grub/files/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From fb7b827a56b1f92f882d0f5ef130acc968b23293 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 13 Jan 2016 19:17:31 +0000 | ||
4 | Subject: [PATCH] Disable -mfpmath=sse as well when SSE is disabled | ||
5 | |||
6 | Fixes | ||
7 | |||
8 | configure:20574: i586-poky-linux-gcc -m32 -march=core2 -msse3 | ||
9 | -mtune=generic -mfpmath=sse | ||
10 | --sysroot=/usr/local/dev/yocto/grubtest2/build/tmp/sysroots/emenlow -o | ||
11 | conftest -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow | ||
12 | -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g | ||
13 | -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse | ||
14 | -mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -m32 -fno-stack-protector | ||
15 | -mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100 | ||
16 | -Wall -W -I$(top_srcdir)/include -I$(top_builddir)/include | ||
17 | -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -Wl,-O1 | ||
18 | -Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5 | ||
19 | conftest.c:1:0: error: SSE instruction set disabled, using 387 | ||
20 | arithmetics [-Werror] | ||
21 | cc1: all warnings being treated as errors | ||
22 | |||
23 | Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> | ||
24 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
25 | --- | ||
26 | Upstream-Status: Pending | ||
27 | |||
28 | configure.ac | 2 +- | ||
29 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
30 | |||
31 | diff --git a/configure.ac b/configure.ac | ||
32 | index 26d2f33..9ce56de 100644 | ||
33 | --- a/configure.ac | ||
34 | +++ b/configure.ac | ||
35 | @@ -783,7 +783,7 @@ fi | ||
36 | if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then | ||
37 | # Some toolchains enable these features by default, but they need | ||
38 | # registers that aren't set up properly in GRUB. | ||
39 | - TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" | ||
40 | + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387" | ||
41 | fi | ||
42 | |||
43 | # GRUB doesn't use float or doubles at all. Yet some toolchains may decide | ||
44 | -- | ||
45 | 2.7.0 | ||
46 | |||
diff --git a/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch b/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch new file mode 100644 index 0000000..67dc115 --- /dev/null +++ b/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From b9565dc2fe0c4f7daaec91b7e83bc7313dee2f4a Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 13 Apr 2015 17:02:13 -0700 | ||
4 | Subject: [PATCH] Unset need_charset_alias when building for musl | ||
5 | |||
6 | localcharset uses ac_cv_gnu_library_2_1 from glibc21.m4 | ||
7 | which actually shoudl be fixed in gnulib and then all downstream | ||
8 | projects will get it eventually. For now we apply the fix to | ||
9 | coreutils | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | lib/gnulib.mk | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | Index: grub-2.00/grub-core/gnulib/Makefile.am | ||
19 | =================================================================== | ||
20 | --- grub-2.00.orig/grub-core/gnulib/Makefile.am | ||
21 | +++ grub-2.00/grub-core/gnulib/Makefile.am | ||
22 | @@ -410,7 +410,7 @@ install-exec-localcharset: all-local | ||
23 | case '$(host_os)' in \ | ||
24 | darwin[56]*) \ | ||
25 | need_charset_alias=true ;; \ | ||
26 | - darwin* | cygwin* | mingw* | pw32* | cegcc*) \ | ||
27 | + darwin* | cygwin* | mingw* | pw32* | cegcc* | linux-musl*) \ | ||
28 | need_charset_alias=false ;; \ | ||
29 | *) \ | ||
30 | need_charset_alias=true ;; \ | ||
diff --git a/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch b/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch new file mode 100644 index 0000000..d5bfaa1 --- /dev/null +++ b/recipes-bsp/grub/files/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From b512c77222a8b133d7dd71a0dcef081a921d97d4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 13 Jan 2016 19:28:00 +0000 | ||
4 | Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name | ||
5 | |||
6 | Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so | ||
7 | that the grub-mkconfig and grub-install can work correctly. | ||
8 | |||
9 | We only need add the bzImage to util/grub.d/10_linux.in, but also add it | ||
10 | to util/grub.d/20_linux_xen.in to keep compatibility. | ||
11 | |||
12 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | Upstream-Status: Inappropriate [OE specific] | ||
16 | |||
17 | util/grub.d/10_linux.in | 6 +++--- | ||
18 | util/grub.d/20_linux_xen.in | 2 +- | ||
19 | 2 files changed, 4 insertions(+), 4 deletions(-) | ||
20 | |||
21 | diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in | ||
22 | index 859b608..946be5d 100644 | ||
23 | --- a/util/grub.d/10_linux.in | ||
24 | +++ b/util/grub.d/10_linux.in | ||
25 | @@ -148,12 +148,12 @@ machine=`uname -m` | ||
26 | case "x$machine" in | ||
27 | xi?86 | xx86_64) | ||
28 | list= | ||
29 | - for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do | ||
30 | + for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do | ||
31 | if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi | ||
32 | done ;; | ||
33 | - *) | ||
34 | + *) | ||
35 | list= | ||
36 | - for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do | ||
37 | + for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do | ||
38 | if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi | ||
39 | done ;; | ||
40 | esac | ||
41 | diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in | ||
42 | index f532fb9..1994244 100644 | ||
43 | --- a/util/grub.d/20_linux_xen.in | ||
44 | +++ b/util/grub.d/20_linux_xen.in | ||
45 | @@ -138,7 +138,7 @@ EOF | ||
46 | } | ||
47 | |||
48 | linux_list= | ||
49 | -for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do | ||
50 | +for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do | ||
51 | if grub_file_is_not_garbage "$i"; then | ||
52 | basename=$(basename $i) | ||
53 | version=$(echo $basename | sed -e "s,^[^0-9]*-,,g") | ||
54 | -- | ||
55 | 2.7.0 | ||
56 | |||
diff --git a/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch b/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch new file mode 100644 index 0000000..fc5aa4e --- /dev/null +++ b/recipes-bsp/grub/files/autogen.sh-exclude-pc.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From ff8f68cc48fd3c30d55e1d570d51f2e0952c968e Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Sat, 25 Jan 2014 23:49:44 -0500 | ||
4 | Subject: [PATCH] autogen.sh: exclude .pc from po/POTFILES.in | ||
5 | |||
6 | Exclude the .pc from po/POTFILES.in since quilt uses "patch --backup", | ||
7 | which will create the backup file under .pc, this may cause unexpected | ||
8 | errors, for example, on CentOS 5.x, if the backup file is null | ||
9 | (newfile), it's mode will be 000, then we will get errors when xgettext | ||
10 | try to read it. | ||
11 | |||
12 | Upstream-Status: Inappropriate [OE specific] | ||
13 | |||
14 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
15 | --- | ||
16 | autogen.sh | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/autogen.sh b/autogen.sh | ||
20 | index 7424428..843619e 100755 | ||
21 | --- a/autogen.sh | ||
22 | +++ b/autogen.sh | ||
23 | @@ -5,7 +5,7 @@ set -e | ||
24 | export LC_COLLATE=C | ||
25 | unset LC_ALL | ||
26 | |||
27 | -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 | ||
28 | +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 | ||
29 | find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in | ||
30 | |||
31 | echo "Importing unicode..." | ||
32 | -- | ||
33 | 1.7.10.4 | ||
34 | |||
diff --git a/recipes-bsp/grub/files/cfg b/recipes-bsp/grub/files/cfg new file mode 100644 index 0000000..8ca53d2 --- /dev/null +++ b/recipes-bsp/grub/files/cfg | |||
@@ -0,0 +1,2 @@ | |||
1 | search.file ($cmdpath)/EFI/BOOT/grub.cfg root | ||
2 | set prefix=($root)/EFI/BOOT | ||
diff --git a/recipes-bsp/grub/files/fix.build.with.gcc-7.patch b/recipes-bsp/grub/files/fix.build.with.gcc-7.patch new file mode 100644 index 0000000..f35df97 --- /dev/null +++ b/recipes-bsp/grub/files/fix.build.with.gcc-7.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | * e.g. with gentoo gcc-7.1 they define _FORTIFY_SOURCE by default with: | ||
2 | https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup | ||
3 | which results in following error while building grub-efi-native: | ||
4 | ./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined] | ||
5 | || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ | ||
6 | ^~~~~~~~~~~~~~~ | ||
7 | this part comes from gnulib and it's used only for Apple and BSD, | ||
8 | so we can ignore it, but we cannot add -Wno-error=expansion-to-defined | ||
9 | because this warning was introduced only in gcc-7 and older gcc | ||
10 | will fail with: | ||
11 | cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined | ||
12 | use #pragma to work around this | ||
13 | |||
14 | Upstream-Status: Pending (should be fixed in gnulib which is then rarely updated in grub) | ||
15 | |||
16 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
17 | |||
18 | diff -uNr grub-2.02.old/m4/extern-inline.m4 grub-2.02/m4/extern-inline.m4 | ||
19 | --- grub-2.02.old/m4/extern-inline.m4 2016-02-28 15:22:21.000000000 +0100 | ||
20 | +++ grub-2.02/m4/extern-inline.m4 2017-08-22 19:26:45.213637276 +0200 | ||
21 | @@ -39,6 +39,10 @@ | ||
22 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and | ||
23 | for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. | ||
24 | Assume DragonFly and FreeBSD will be similar. */ | ||
25 | +#pragma GCC diagnostic push | ||
26 | +#if __GNUC__ >= 7 | ||
27 | +#pragma GCC diagnostic ignored "-Wexpansion-to-defined" | ||
28 | +#endif | ||
29 | #if (((defined __APPLE__ && defined __MACH__) \ | ||
30 | || defined __DragonFly__ || defined __FreeBSD__) \ | ||
31 | && (defined __header_inline \ | ||
32 | @@ -50,6 +52,7 @@ | ||
33 | && defined __GNUC__ && ! defined __cplusplus)))) | ||
34 | # define _GL_EXTERN_INLINE_STDHEADER_BUG | ||
35 | #endif | ||
36 | +#pragma GCC diagnostic pop | ||
37 | #if ((__GNUC__ \ | ||
38 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | ||
39 | : (199901L <= __STDC_VERSION__ \ | ||
diff --git a/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch b/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch new file mode 100644 index 0000000..935c472 --- /dev/null +++ b/recipes-bsp/grub/files/grub-module-explicitly-keeps-symbole-.module_license.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From 7461a3de38b66edbe2f5593f9bdab9f2704d32bc Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Wed, 17 Aug 2016 04:06:34 -0400 | ||
4 | Subject: [PATCH] grub module explicitly keeps symbole .module_license | ||
5 | |||
6 | While using oe-core toolchain to strip grub module 'all_video.mod', | ||
7 | it stripped symbol table: | ||
8 | -------------- | ||
9 | root@localhost:~# objdump -t all_video.mod | ||
10 | |||
11 | all_video.mod: file format elf64-x86-64 | ||
12 | |||
13 | SYMBOL TABLE: | ||
14 | no symbols | ||
15 | -------------- | ||
16 | |||
17 | It caused grub to load module all_video failed. | ||
18 | -------------- | ||
19 | grub> insmod all_video | ||
20 | error: no symbol table. | ||
21 | -------------- | ||
22 | |||
23 | Tweak strip option to keep symbol .module_license could workaround | ||
24 | the issue. | ||
25 | -------------- | ||
26 | root@localhost:~# objdump -t all_video.mod | ||
27 | |||
28 | all_video.mod: file format elf64-x86-64 | ||
29 | |||
30 | SYMBOL TABLE: | ||
31 | 0000000000000000 l d .text 0000000000000000 .text | ||
32 | 0000000000000000 l d .data 0000000000000000 .data | ||
33 | 0000000000000000 l d .module_license 0000000000000000 .module_license | ||
34 | 0000000000000000 l d .bss 0000000000000000 .bss | ||
35 | 0000000000000000 l d .moddeps 0000000000000000 .moddeps | ||
36 | 0000000000000000 l d .modname 0000000000000000 .modname | ||
37 | -------------- | ||
38 | |||
39 | Upstream-Status: Pending | ||
40 | |||
41 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
42 | --- | ||
43 | grub-core/genmod.sh.in | 2 +- | ||
44 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
45 | |||
46 | diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in | ||
47 | index 76df0bb..39a9cfc 100644 | ||
48 | --- a/grub-core/genmod.sh.in | ||
49 | +++ b/grub-core/genmod.sh.in | ||
50 | @@ -59,7 +59,7 @@ if test x@TARGET_APPLE_CC@ != x1; then | ||
51 | if test x@platform@ != xemu; then | ||
52 | @STRIP@ --strip-unneeded \ | ||
53 | -K grub_mod_init -K grub_mod_fini \ | ||
54 | - -K _grub_mod_init -K _grub_mod_fini \ | ||
55 | + -K _grub_mod_init -K _grub_mod_fini -K .module_license \ | ||
56 | -R .note.gnu.gold-version -R .note.GNU-stack \ | ||
57 | -R .note -R .comment $tmpfile || exit 1 | ||
58 | fi | ||
59 | -- | ||
60 | 2.8.1 | ||
61 | |||
diff --git a/recipes-bsp/grub/grub-efi_2.02.bb b/recipes-bsp/grub/grub-efi_2.02.bb new file mode 100644 index 0000000..13ee220 --- /dev/null +++ b/recipes-bsp/grub/grub-efi_2.02.bb | |||
@@ -0,0 +1,90 @@ | |||
1 | require grub2.inc | ||
2 | |||
3 | GRUBPLATFORM = "efi" | ||
4 | |||
5 | DEPENDS_append_class-target = " grub-efi-native" | ||
6 | RDEPENDS_${PN}_class-target = "diffutils freetype" | ||
7 | |||
8 | SRC_URI += " \ | ||
9 | file://cfg \ | ||
10 | " | ||
11 | |||
12 | S = "${WORKDIR}/grub-${PV}" | ||
13 | |||
14 | # Determine the target arch for the grub modules | ||
15 | python __anonymous () { | ||
16 | import re | ||
17 | target = d.getVar('TARGET_ARCH') | ||
18 | if target == "x86_64": | ||
19 | grubtarget = 'x86_64' | ||
20 | grubimage = "grub-efi-bootx64.efi" | ||
21 | elif re.match('i.86', target): | ||
22 | grubtarget = 'i386' | ||
23 | grubimage = "grub-efi-bootia32.efi" | ||
24 | elif re.match('aarch64', target): | ||
25 | grubtarget = 'arm64' | ||
26 | grubimage = "grub-efi-bootaa64.efi" | ||
27 | else: | ||
28 | raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) | ||
29 | d.setVar("GRUB_TARGET", grubtarget) | ||
30 | d.setVar("GRUB_IMAGE", grubimage) | ||
31 | } | ||
32 | |||
33 | inherit deploy | ||
34 | |||
35 | CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN=" | ||
36 | EXTRA_OECONF += "--enable-efiemu=no" | ||
37 | |||
38 | # ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines] | ||
39 | # and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo) | ||
40 | CFLAGS_append_class-native = " -Wno-error=trampolines" | ||
41 | |||
42 | do_install_class-native() { | ||
43 | install -d ${D}${bindir} | ||
44 | install -m 755 grub-mkimage ${D}${bindir} | ||
45 | } | ||
46 | |||
47 | do_install_append_class-target() { | ||
48 | # Remove build host references... | ||
49 | find "${D}" -name modinfo.sh -type f -exec \ | ||
50 | sed -i \ | ||
51 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ | ||
52 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
53 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
54 | {} + | ||
55 | } | ||
56 | |||
57 | GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \ | ||
58 | efi_gop iso9660 search loadenv test" | ||
59 | |||
60 | |||
61 | do_deploy() { | ||
62 | # Search for the grub.cfg on the local boot media by using the | ||
63 | # built in cfg file provided via this recipe | ||
64 | grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ | ||
65 | -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ | ||
66 | ${GRUB_BUILDIN} | ||
67 | install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} | ||
68 | |||
69 | # generate startup.nsh used by EFI to autoload grub | ||
70 | grubname=`echo ${GRUB_IMAGE} | sed -e "s/^grub-efi-//"` | ||
71 | printf 'FS0:\EFI\BOOT\%s\n' "$grubname" > ${DEPLOYDIR}/startup.nsh | ||
72 | } | ||
73 | |||
74 | do_deploy_class-native() { | ||
75 | : | ||
76 | } | ||
77 | |||
78 | addtask deploy after do_install before do_build | ||
79 | |||
80 | FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \ | ||
81 | ${datadir}/grub \ | ||
82 | " | ||
83 | |||
84 | # 64-bit binaries are expected for the bootloader with an x32 userland | ||
85 | INSANE_SKIP_${PN}_append_linux-gnux32 = " arch" | ||
86 | INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch" | ||
87 | INSANE_SKIP_${PN}_append_linux-muslx32 = " arch" | ||
88 | INSANE_SKIP_${PN}-dbg_append_linux-muslx32 = " arch" | ||
89 | |||
90 | BBCLASSEXTEND = "native" | ||
diff --git a/recipes-bsp/grub/grub2.inc b/recipes-bsp/grub/grub2.inc new file mode 100644 index 0000000..2539a0b --- /dev/null +++ b/recipes-bsp/grub/grub2.inc | |||
@@ -0,0 +1,78 @@ | |||
1 | SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader" | ||
2 | |||
3 | DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \ | ||
4 | intended to unify bootloading across x86 operating systems. In \ | ||
5 | addition to loading the Linux kernel, it implements the Multiboot \ | ||
6 | standard, which allows for flexible loading of multiple boot images." | ||
7 | |||
8 | HOMEPAGE = "http://www.gnu.org/software/grub/" | ||
9 | SECTION = "bootloaders" | ||
10 | |||
11 | LICENSE = "GPLv3" | ||
12 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | ||
13 | |||
14 | SRC_URI = "https://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ | ||
15 | file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \ | ||
16 | file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ | ||
17 | file://autogen.sh-exclude-pc.patch \ | ||
18 | file://grub-module-explicitly-keeps-symbole-.module_license.patch \ | ||
19 | file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \ | ||
20 | file://fix.build.with.gcc-7.patch \ | ||
21 | " | ||
22 | SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d" | ||
23 | SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d" | ||
24 | |||
25 | DEPENDS = "flex-native bison-native" | ||
26 | |||
27 | # COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)' | ||
28 | # COMPATIBLE_HOST_armv7a = 'null' | ||
29 | # COMPATIBLE_HOST_armv7ve = 'null' | ||
30 | |||
31 | # configure.ac has code to set this automagically from the target tuple | ||
32 | # but the OE freeform one (core2-foo-bar-linux) don't work with that. | ||
33 | |||
34 | GRUBPLATFORM_arm = "uboot" | ||
35 | GRUBPLATFORM_aarch64 = "efi" | ||
36 | GRUBPLATFORM ??= "pc" | ||
37 | |||
38 | inherit autotools gettext texinfo | ||
39 | |||
40 | EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \ | ||
41 | --disable-grub-mkfont \ | ||
42 | --program-prefix="" \ | ||
43 | --enable-liblzma=no \ | ||
44 | --enable-libzfs=no \ | ||
45 | --enable-largefile \ | ||
46 | " | ||
47 | |||
48 | PACKAGECONFIG ??= "" | ||
49 | PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse" | ||
50 | PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,lvm2" | ||
51 | |||
52 | # grub2 creates its own set of -nostdinc / -isystem / -ffreestanding CFLAGS and | ||
53 | # OE's default BUILD_CFLAGS (assigned to CFLAGS for native builds) etc, conflict | ||
54 | # with that. Note that since BUILD_CFLAGS etc are not used by grub2 target | ||
55 | # builds, it's safe to clear them unconditionally for both target and native. | ||
56 | BUILD_CPPFLAGS = "" | ||
57 | BUILD_CFLAGS = "" | ||
58 | BUILD_CXXFLAGS = "" | ||
59 | BUILD_LDFLAGS = "" | ||
60 | |||
61 | do_configure_prepend() { | ||
62 | # The grub2 configure script uses variables such as TARGET_CFLAGS etc | ||
63 | # for its own purposes. Remove the OE versions from the environment to | ||
64 | # avoid conflicts. | ||
65 | unset TARGET_CPPFLAGS TARGET_CFLAGS TARGET_CXXFLAGS TARGET_LDFLAGS | ||
66 | ( cd ${S} | ||
67 | ${S}/autogen.sh ) | ||
68 | } | ||
69 | |||
70 | # grub and grub-efi's sysroot/${datadir}/grub/grub-mkconfig_lib are | ||
71 | # conflicted, remove it since no one uses it. | ||
72 | SYSROOT_DIRS_BLACKLIST += "${datadir}/grub/grub-mkconfig_lib" | ||
73 | |||
74 | PACKAGES =+ "${PN}-editenv" | ||
75 | |||
76 | FILES_${PN}-editenv = "${bindir}/grub-editenv" | ||
77 | RDEPENDS_${PN} += "${PN}-editenv" | ||
78 | RDEPENDS_${PN}_class-native = "" | ||
diff --git a/recipes-bsp/grub/grub_2.02.bb b/recipes-bsp/grub/grub_2.02.bb new file mode 100644 index 0000000..3e61f6a --- /dev/null +++ b/recipes-bsp/grub/grub_2.02.bb | |||
@@ -0,0 +1,17 @@ | |||
1 | require grub2.inc | ||
2 | |||
3 | RDEPENDS_${PN} += "diffutils freetype" | ||
4 | |||
5 | do_install_append () { | ||
6 | install -d ${D}${sysconfdir}/grub.d | ||
7 | # Remove build host references... | ||
8 | find "${D}" -name modinfo.sh -type f -exec \ | ||
9 | sed -i \ | ||
10 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ | ||
11 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
12 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
13 | {} + | ||
14 | } | ||
15 | |||
16 | INSANE_SKIP_${PN} = "arch" | ||
17 | INSANE_SKIP_${PN}-dbg = "arch" | ||