1From b316ed326bd492106006d78f5bfcd767b49a4f2e Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 17 Aug 2016 04:06:34 -0400
4Subject: [PATCH] grub module explicitly keeps symbole .module_license
5
6While using oe-core toolchain to strip grub module 'all_video.mod',
7it stripped symbol table:
8
9---------------
10root@localhost:~# objdump -t all_video.mod
11
12all_video.mod:     file format elf64-x86-64
13
14SYMBOL TABLE:
15no symbols
16--------------
17
18It caused grub to load module all_video failed.
19--------------
20grub> insmod all_video
21error: no symbol table.
22--------------
23
24Tweak strip option to keep symbol .module_license could workaround
25the issue.
26--------------
27root@localhost:~# objdump -t all_video.mod
28
29all_video.mod:     file format elf64-x86-64
30
31SYMBOL TABLE:
320000000000000000 l    d  .text  0000000000000000 .text
330000000000000000 l    d  .data  0000000000000000 .data
340000000000000000 l    d  .module_license        0000000000000000 .module_license
350000000000000000 l    d  .bss   0000000000000000 .bss
360000000000000000 l    d  .moddeps       0000000000000000 .moddeps
370000000000000000 l    d  .modname       0000000000000000 .modname
38--------------
39
40Upstream-Status: Inappropriate [workaround that needs investigation into @TARGET_STRIP@ behaviour in oe-core vs toolchain used by upstream]
41
42Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
43
44---
45 grub-core/genmod.sh.in | 2 +-
46 1 file changed, 1 insertion(+), 1 deletion(-)
47
48diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in
49index e57c4d9..42bb1ba 100644
50--- a/grub-core/genmod.sh.in
51+++ b/grub-core/genmod.sh.in
52@@ -56,7 +56,7 @@ if test x@TARGET_APPLE_LINKER@ != x1; then
53 	if test x@platform@ != xemu; then
54 	    @TARGET_STRIP@ --strip-unneeded \
55 		-K grub_mod_init -K grub_mod_fini \
56-		-K _grub_mod_init -K _grub_mod_fini \
57+		-K _grub_mod_init -K _grub_mod_fini -K .module_license \
58 		-R .note.gnu.gold-version -R .note.GNU-stack \
59 		-R .gnu.build.attributes \
60 		-R .rel.gnu.build.attributes \
61