grub-efi: change to generate EFI image in target package
v3 cover grub-efi: change to generate EFI image in target package
From: Jackie Huang <[email protected]>
v3 comments:
Drop the original solution to generate and deploy EFI image in the -native packae and change to do that in taret package, and the -native one only provides the grub-mkimage binary. No need 3 files anymore, make them in one bb.
--
The following changes since commit 0eb947454e1c92467283e6f1adeca67c7c57698b:
python: Fix ptest not working problems (2013-11-18 13:04:13 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib jhuang0/d_grub-efi_1119_0
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/d_grub-efi_1119_0
Jackie Huang (2):
grub-efi: change to generate EFI image in target package
grub-efi: allow compilation without large model support
meta/classes/grub-efi.bbclass | 4 +-
...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++
.../{grub-efi-native_2.00.bb => grub-efi_2.00.bb} | 44 ++++++++------
3 files changed, 96 insertions(+), 21 deletions(-)
create mode 100644 meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)Signature · 1 line
1.8.3
PATCH v3 1/2 grub-efi: change to generate EFI image in target package
From: Jackie Huang <[email protected]>
It's not a good idea to generate the target EFI image in a native packge, it would be a problem when build a 64bit target on 32bit host. In fact, all we need from grub-efi-native is the grub-mkimage binary, so change the solution to:
* grub-efi-native only install grub-mkimage
* grub-efi compiles target modules, generates EFI image with grub-mkimage and deploy, but install nothing.
---
meta/classes/grub-efi.bbclass | 4 +-
.../{grub-efi-native_2.00.bb => grub-efi_2.00.bb} | 43 ++++++++++++----------
2 files changed, 26 insertions(+), 21 deletions(-)
rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)meta/classes/grub-efi.bbclass +2 -2
@@ -15,8 +15,8 @@ # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional) # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional) -do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" -do_bootdirectdisk[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" +do_bootimg[depends] += "grub-efi:do_deploy" +do_bootdirectdisk[depends] += "grub-efi:do_deploy" GRUB_SERIAL ?= "console=ttyS0,115200" GRUBCFG = "${S}/grub.cfg"
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +24 -19
76 lines not on this page · raw message
Signature · 1 line
1.8.3
Quoted 4 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
It's not a good idea to generate the target EFI image in a native packge,
This was admittedly a hack when I wrote it...
Quoted 2 lines
it would be a problem when build a 64bit
target on 32bit host.
I build 32b on a 64b host regularly, why is it a problem the other way around?
There is infrastructure in place to specify the target architecture for the grub efi binary and the modules. The 32b compiler should be able to do -m64 just as the 64b compiler can do -m32.
Quoted 3 lines
In fact, all we need from grub-efi-native
is the grub-mkimage binary, so change the solution to:
* grub-efi-native only install grub-mkimage
Seems reasonable.
Quoted 2 lines
* grub-efi compiles target modules, generates EFI image with grub-mkimage and deploy, but install nothing.
Also makes sense.
Have you tested the 4 possible combinations?
host target
32 32
64 32
32 64
64 64
Quoted 2 lines
Signed-off-by Jackie Huang <[email protected]>
With verification of testing scope and the the minor comments below, I'm OK with this approach. It's better than the native hack, but I'm not sure it addresses an actual failure - but that's OK.
Quoted 29 lines
--- meta/classes/grub-efi.bbclass | 4 +- .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb} | 43 ++++++++++++---------- 2 files changed, 26 insertions(+), 21 deletions(-) rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)meta/classes/grub-efi.bbclass +2
-2@@ -15,8 +15,8 @@ # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional) # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional) -do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" -do_bootdirectdisk[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" +do_bootimg[depends] += "grub-efi:do_deploy" +do_bootdirectdisk[depends] += "grub-efi:do_deploy" GRUB_SERIAL ?= "console=ttyS0,115200" GRUBCFG = "${S}/grub.cfg"meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +0
-0
meta/recipes-bsp/grub/grub-efi_2.00.bb LICENSE = "GPLv3" · line 18
Quoted 7 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +2
-2@@ -14,14 +14,10 @@ LICENSE = "GPLv3" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" # FIXME: We should be able to optionally drop freetype as a dependency -DEPENDS = "autogen-native" -RDEPENDS_${PN} = "diffutils freetype" +DEPENDS = "autogen-native flex-native bison-native" +DEPENDS_class-target = "grub-efi-native"
So no target DEPENDS are created, correct?
Quoted 58 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +15
-14PR = "r2" -# Native packages do not normally rebuild when the target changes. -# Ensure this is built once per HOST-TARGET pair. -PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native" - SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ file://cfg \ file://grub-2.00-fpmath-sse-387-fix.patch \@@ -39,12 +35,10 @@ COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)' S = "${WORKDIR}/grub-${PV}" -# Determine the target arch for the grub modules before the native class -# clobbers TARGET_ARCH. -ORIG_TARGET_ARCH := "${TARGET_ARCH}" +# Determine the target arch for the grub modules python __anonymous () { import re - target = d.getVar('ORIG_TARGET_ARCH', True) + target = d.getVar('TARGET_ARCH', True) if target == "x86_64": grubtarget = 'x86_64' grubimage = "bootx64.efi"@@ -59,26 +53,37 @@ python __anonymous () { inherit autotools inherit gettext -inherit native inherit deploy EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \ - --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix='' \ + --enable-efiemu=no --program-prefix='' \ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no" -do_mkimage() { +do_install_class-target() { + : +} + +do_install_class-native() { + install -d ${D}${bindir} + install -m 755 grub-mkimage ${D}${bindir} +} + +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/ \ + grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search + install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} } -addtask mkimage after do_compile before do_install -do_deploy() {
meta/recipes-bsp/grub/grub-efi_2.00.bb python __anonymous () { · line 86
Quoted 10 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +4
-3- install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} +do_deploy_class-native() { + : } + addtask deploy after do_install before do_build -do_install[noexec] = "1" -do_populate_sysroot[noexec] = "1" +FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"
Technically this is an independent functional change...
Quoted 3 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +3
-0+ +BBCLASSEXTEND = "native" +ALLOW_EMPTY_${PN} = "1"
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Quoted 11 lines · Darren Hart
Quoted 4 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
It's not a good idea to generate the target EFI image in a native packge,
This was admittedly a hack when I wrote it...
Quoted 2 lines
it would be a problem when build a 64bit
target on 32bit host.
Quoted 6 lines
I build 32b on a 64b host regularly, why is it a problem the other way around?
There is infrastructure in place to specify the target architecture for the grub efi binary and the modules. The 32b compiler should be able to do -m64 just as the 64b compiler can do -m32.
It should be, but for most 32bit linux distributions, gcc is not compiled for supporting 64bit cross compiling.
e.g. on rhel 6.2 32bit:
$ gcc -m64 test.c test.c:1: sorry, unimplemented: 64-bit mode not compiled in $ gcc -m64 -v Using built-in specs. Target: i686-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux Thread model: posix gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
on openSUSE 12.2 32bit:
$ gcc -m64 test.c test.c:1:0: sorry, unimplemented: 64-bit mode not compiled in $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-suse-linux/4.7/lto-wrapper Target: i586-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.7 --enable-ssp --disable-libssp --disable-libitm --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --program-suffix=-4.7 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=i586-suse-linux Thread model: posix gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773] (SUSE Linux)
We may have to ask users to re-compile for the supporting if they are using 32bit hosts. But another problem is, even if we build 64b on 32b host, I don't think we can run the 64b binary "grub-mkimage" on the 32b host.
Quoted 12 lines
Quoted 4 lines
In fact, all we need from grub-efi-native
is the grub-mkimage binary, so change the solution to:
* grub-efi-native only install grub-mkimageSeems reasonable.
Quoted 2 lines
* grub-efi compiles target modules, generates EFI image with grub-mkimage and deploy, but install nothing.
Also makes sense.
Quoted 7 lines
Have you tested the 4 possible combinations?
host target
32 32
64 32
32 64
64 64
Yes, I tested all these possiblities.
Quoted 41 lines
Quoted 5 lines
Signed-off-by Jackie Huang <[email protected]>With verification of testing scope and the the minor comments below, I'm OK with this approach. It's better than the native hack, but I'm not sure it addresses an actual failure - but that's OK.
Quoted 31 lines
--- meta/classes/grub-efi.bbclass | 4 +- .../{grub-efi-native_2.00.bb => grub-efi_2.00.bb} | 43 ++++++++++++---------- 2 files changed, 26 insertions(+), 21 deletions(-)rename meta/recipes-bsp/grub/{grub-efi-native_2.00.bb => grub-efi_2.00.bb} (77%)
meta/classes/grub-efi.bbclass +2
-2@@ -15,8 +15,8 @@ # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional) # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional) -do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" -do_bootdirectdisk[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" +do_bootimg[depends] += "grub-efi:do_deploy" +do_bootdirectdisk[depends] += "grub-efi:do_deploy" GRUB_SERIAL ?= "console=ttyS0,115200" GRUBCFG = "${S}/grub.cfg"meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +0
-0@@ -14,14 +14,10 @@ LICENSE = "GPLv3" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
Quoted 7 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb LICENSE = "GPLv3" · line 18
Quoted 5 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +2
-2# FIXME: We should be able to optionally drop freetype as a dependency -DEPENDS = "autogen-native" -RDEPENDS_${PN} = "diffutils freetype" +DEPENDS = "autogen-native flex-native bison-native" +DEPENDS_class-target = "grub-efi-native"So no target DEPENDS are created, correct?
You mean RDEPENDS, right? Yes, because the target package grub-efi installs nothing on the rootfs, it only deploy the efi image, I don't think it need any RDEPENDS.
Quoted 66 lines
Quoted 66 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +18
-15PR = "r2" -# Native packages do not normally rebuild when the target changes. -# Ensure this is built once per HOST-TARGET pair. -PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native" - SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ file://cfg \ file://grub-2.00-fpmath-sse-387-fix.patch \@@ -39,12 +35,10 @@ COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)' S = "${WORKDIR}/grub-${PV}" -# Determine the target arch for the grub modules before the native class -# clobbers TARGET_ARCH. -ORIG_TARGET_ARCH := "${TARGET_ARCH}" +# Determine the target arch for the grub modules python __anonymous () { import re - target = d.getVar('ORIG_TARGET_ARCH', True) + target = d.getVar('TARGET_ARCH', True) if target == "x86_64": grubtarget = 'x86_64' grubimage = "bootx64.efi"@@ -59,26 +53,37 @@ python __anonymous () { inherit autotools inherit gettext -inherit native inherit deploy EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \ - --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix='' \ + --enable-efiemu=no --program-prefix='' \ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no" -do_mkimage() { +do_install_class-target() { + : +} + +do_install_class-native() { + install -d ${D}${bindir} + install -m 755 grub-mkimage ${D}${bindir} +} + +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/ \ + grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search + install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} } -addtask mkimage after do_compile before do_install -do_deploy() { - install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} +do_deploy_class-native() { + : } + addtask deploy after do_install before do_build
Quoted 5 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb python __anonymous () { · line 86
Quoted 3 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +1
-2-do_install[noexec] = "1" -do_populate_sysroot[noexec] = "1" +FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"Technically this is an independent functional change...
You mean it should be in a separate commit?
Thanks,
Jackie
Quoted 5 lines
Quoted 4 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +3
-0+ +BBCLASSEXTEND = "native" +ALLOW_EMPTY_${PN} = "1"
Signature · 5 lines
Jackie Huang WIND RIVER | China Development Center MSN:[email protected] Tel: +86 8477 8594 Mobile: +86 138 1027 4745
Quoted 16 lines · On Fri, 2013-11-22 at 12:49 +0800, jhuang0 wrote:
Quoted 14 lines · Darren Hart
Quoted 4 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
It's not a good idea to generate the target EFI image in a native packge,
This was admittedly a hack when I wrote it...
Quoted 2 lines
it would be a problem when build a 64bit
target on 32bit host.I build 32b on a 64b host regularly, why is it a problem the other way around?
Quoted 6 lines
Quoted 3 lines
There is infrastructure in place to specify the target architecture for the grub efi binary and the modules. The 32b compiler should be able to do -m64 just as the 64b compiler can do -m32.
It should be, but for most 32bit linux distributions, gcc is not compiled for supporting 64bit cross compiling.
Thanks for the detail - including this information in the justification would be a good idea so anyone looking at the commit log can understand why it was necessary.
Quoted 7 lines
Quoted 5 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb python __anonymous () { · line 86
Quoted 3 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +1
-2-do_install[noexec] = "1" -do_populate_sysroot[noexec] = "1" +FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"Technically this is an independent functional change...
You mean it should be in a separate commit?
I was thinking so, but I see Saul raised it as an issue with V2, so please disregard this comment, it's fine.
I'd like to see a blurb added to the commit message stating the bit about gcc not having support in some distributions (debian/ubuntu do have it for example, but later versions require the compat package or some such). The fact that some don't is enough though, and your solution is cleaner and more consistent with bitbake recipe conventions anyway.
Thanks for keeping at it, this is a good improvement.
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Quoted 37 lines · Darren Hart
Quoted 16 lines · On Fri, 2013-11-22 at 12:49 +0800, jhuang0 wrote:
Quoted 14 lines · Darren Hart
Quoted 4 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
It's not a good idea to generate the target EFI image in a native packge,
This was admittedly a hack when I wrote it...
Quoted 2 lines
it would be a problem when build a 64bit
target on 32bit host.I build 32b on a 64b host regularly, why is it a problem the other way around?
Quoted 6 lines
Quoted 3 lines
There is infrastructure in place to specify the target architecture for the grub efi binary and the modules. The 32b compiler should be able to do -m64 just as the 64b compiler can do -m32.
It should be, but for most 32bit linux distributions, gcc is not compiled for supporting 64bit cross compiling.
Thanks for the detail - including this information in the justification would be a good idea so anyone looking at the commit log can understand why it was necessary.
Quoted 7 lines
Quoted 5 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb python __anonymous () { · line 86
Quoted 3 lines
meta/recipes-bsp/grub/grub-efi_2.00.bb renamed from meta/recipes-bsp/grub/grub-efi-native_2.00.bb +1
-2-do_install[noexec] = "1" -do_populate_sysroot[noexec] = "1" +FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"Technically this is an independent functional change...
You mean it should be in a separate commit?
Quoted 8 lines
I was thinking so, but I see Saul raised it as an issue with V2, so please disregard this comment, it's fine.
I'd like to see a blurb added to the commit message stating the bit about gcc not having support in some distributions (debian/ubuntu do have it for example, but later versions require the compat package or some such). The fact that some don't is enough though, and your solution is cleaner and more consistent with bitbake recipe conventions anyway.
I will add these information to the commit log in v4.
Thanks,
Jackie
Quoted 3 lines
Thanks for keeping at it, this is a good improvement.
Signature · 5 lines
Jackie Huang WIND RIVER | China Development Center MSN:[email protected] Tel: +86 8477 8594 Mobile: +86 138 1027 4745
PATCH v3 2/2 grub-efi: allow compilation without large model support
In reply to [email protected]From: Jackie Huang <[email protected]>
-mcmodel=large is not supported by gcc with version lower than 4.4, but we don't need to use memory over 4GiB, so add a patch to allow compilation without large model support.
--- ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi_2.00.bb | 1 + 2 files changed, 70 insertions(+) create mode 100644 meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +69 -0
@@ -0,0 +1,69 @@ +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001 +From: Jackie Huang <[email protected]> +Date: Tue, 5 Nov 2013 07:23:32 -0500 +Subject: [PATCH] Allow a compilation without -mcmodel=large + +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB + when compiled without -mcmodel=large + (filter_memory_map): remove memory post 4 GiB when compiled + without -mcmodel=large +* configure.ac: add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when + -mcmodel=large isn't supported + +Upstream-Status: Inappropriate [configuration] + +Signed-off-by: Jackie Huang <[email protected]> +--- + configure.ac | 4 +++- + grub-core/kern/efi/mm.c | 6 +++--- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 319d063..ee72fee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -567,7 +567,9 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then + [grub_cv_cc_mcmodel=no]) + ]) + if test "x$grub_cv_cc_mcmodel" = xno; then +- AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) ++ CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1" ++ TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1" ++ AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc.]) + else + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" + fi +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index a2edc84..c67dd13 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -62,7 +62,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address, + return 0; + #endif + +-#if 1 ++#if defined (MCMODEL_SMALL) + if (address == 0) + { + type = GRUB_EFI_ALLOCATE_MAX_ADDRESS; +@@ -305,7 +305,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) + { + if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY +-#if 1 ++#if defined (MCMODEL_SMALL) + && desc->physical_start <= 0xffffffff + #endif + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + desc->physical_start = 0x100000; + } + +-#if 1 ++#if defined (MCMODEL_SMALL) + if (BYTES_TO_PAGES (filtered_desc->physical_start) + + filtered_desc->num_pages + > BYTES_TO_PAGES (0x100000000LL)) +-- +1.7.1 +
meta/recipes-bsp/grub/grub-efi_2.00.bb +1 -0
@@ -27,6 +27,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ file://grub-no-unused-result.patch \ file://grub-2.00-ignore-gnulib-gets-stupidity.patch \ file://fix-issue-with-flex-2.5.37.patch \ + file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \ " SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c" SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
Signature · 1 line
1.8.3
Re: [PATCH 2/2] grub-efi: allow compilation without large model support
Quoted 22 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
-mcmodel=large is not supported by gcc with version lower than 4.4, but we don't need to use memory over 4GiB, so add a patch to allow compilation without large model support.
Signed-off-by Jackie Huang <[email protected]>--- ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi_2.00.bb | 1 + 2 files changed, 70 insertions(+) create mode 100644 meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patchmeta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +3
-0@@ -0,0 +1,69 @@ +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001 +From: Jackie Huang <[email protected]> +Date: Tue, 5 Nov 2013 07:23:32 -0500
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch line 13
Quoted 10 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +10
-0+Subject: [PATCH] Allow a compilation without -mcmodel=large + +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB + when compiled without -mcmodel=large + (filter_memory_map): remove memory post 4 GiB when compiled + without -mcmodel=large +* configure.ac: add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when + -mcmodel=large isn't supported + +Upstream-Status: Inappropriate [configuration]
Nice try ;-) This is compatibility, not configuration. If grub-efi maintainers refuse to accept the patch that's up to them, but we need to work upstream first. Please prepare a patch for upstream and submit it for review.
--
Darren
Quoted 68 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +56
-0+ +Signed-off-by: Jackie Huang <[email protected]> +--- + configure.ac | 4 +++- + grub-core/kern/efi/mm.c | 6 +++--- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 319d063..ee72fee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -567,7 +567,9 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then + [grub_cv_cc_mcmodel=no]) + ]) + if test "x$grub_cv_cc_mcmodel" = xno; then +- AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) ++ CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1" ++ TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1" ++ AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc.]) + else + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" + fi +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index a2edc84..c67dd13 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -62,7 +62,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address, + return 0; + #endif + +-#if 1 ++#if defined (MCMODEL_SMALL) + if (address == 0) + { + type = GRUB_EFI_ALLOCATE_MAX_ADDRESS; +@@ -305,7 +305,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) + { + if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY +-#if 1 ++#if defined (MCMODEL_SMALL) + && desc->physical_start <= 0xffffffff + #endif + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + desc->physical_start = 0x100000; + } + +-#if 1 ++#if defined (MCMODEL_SMALL) + if (BYTES_TO_PAGES (filtered_desc->physical_start) + + filtered_desc->num_pages + > BYTES_TO_PAGES (0x100000000LL)) +-- +1.7.1 +meta/recipes-bsp/grub/grub-efi_2.00.bb +1
-0@@ -27,6 +27,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ file://grub-no-unused-result.patch \ file://grub-2.00-ignore-gnulib-gets-stupidity.patch \ file://fix-issue-with-flex-2.5.37.patch \ + file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \ " SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c" SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Re: [PATCH 2/2] grub-efi: allow compilation without large model support
Quoted 28 lines · Darren Hart
Quoted 27 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
-mcmodel=large is not supported by gcc with version lower than 4.4, but we don't need to use memory over 4GiB, so add a patch to allow compilation without large model support.
Signed-off-by Jackie Huang <[email protected]>--- ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi_2.00.bb | 1 + 2 files changed, 70 insertions(+)create mode 100644
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patchmeta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +8
-0@@ -0,0 +1,69 @@ +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001 +From: Jackie Huang <[email protected]> +Date: Tue, 5 Nov 2013 07:23:32 -0500 +Subject: [PATCH] Allow a compilation without -mcmodel=large + +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB + when compiled without -mcmodel=large + (filter_memory_map): remove memory post 4 GiB when compiled
Quoted 8 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch line 13
Quoted 5 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +5
-0+ without -mcmodel=large +* configure.ac: add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when + -mcmodel=large isn't supported + +Upstream-Status: Inappropriate [configuration]Nice try ;-) This is compatibility, not configuration. If grub-efi maintainers refuse to accept the patch that's up to them, but we need to
Actually it's ported from old version of grub which means that they allowed the comilation without large model support before, but not now. From the Changelog, it was added in 2009:
2009-06-04 Vladimir Serbinenko <[email protected]>
Allow a compilation without -mcmodel=large
* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB when compiled without -mcmodel=large (filter_memory_map): remove memory post 4 GiB when compiled without -mcmodel=large
* configure.ac: fail gracefully and add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when -mcmodel=large isn't supported
but it was removed in 2010:
2010-04-21 Vladimir Serbinenko <[email protected]>
* configure.ac: Refuse to compile for x86_64-efi is mcmodel=large is not supported.
So I think they may not accept this patch again.
Thanks,
Jackie
Quoted 75 lines
work upstream first. Please prepare a patch for upstream and submit it for review.
--
DarrenQuoted 68 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +56
-0+ +Signed-off-by: Jackie Huang <[email protected]> +--- + configure.ac | 4 +++- + grub-core/kern/efi/mm.c | 6 +++--- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 319d063..ee72fee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -567,7 +567,9 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then + [grub_cv_cc_mcmodel=no]) + ]) + if test "x$grub_cv_cc_mcmodel" = xno; then +- AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) ++ CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1" ++ TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1" ++ AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc.]) + else + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" + fi +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index a2edc84..c67dd13 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -62,7 +62,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address, + return 0; + #endif + +-#if 1 ++#if defined (MCMODEL_SMALL) + if (address == 0) + { + type = GRUB_EFI_ALLOCATE_MAX_ADDRESS; +@@ -305,7 +305,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) + { + if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY +-#if 1 ++#if defined (MCMODEL_SMALL) + && desc->physical_start <= 0xffffffff + #endif + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + desc->physical_start = 0x100000; + } + +-#if 1 ++#if defined (MCMODEL_SMALL) + if (BYTES_TO_PAGES (filtered_desc->physical_start) + + filtered_desc->num_pages + > BYTES_TO_PAGES (0x100000000LL)) +-- +1.7.1 +meta/recipes-bsp/grub/grub-efi_2.00.bb +1
-0@@ -27,6 +27,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ file://grub-no-unused-result.patch \ file://grub-2.00-ignore-gnulib-gets-stupidity.patch \ file://fix-issue-with-flex-2.5.37.patch \ + file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \ " SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c" SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
Signature · 5 lines
Jackie Huang WIND RIVER | China Development Center MSN:[email protected] Tel: +86 8477 8594 Mobile: +86 138 1027 4745
Re: [PATCH 2/2] grub-efi: allow compilation without large model support
Quoted 54 lines · On Fri, 2013-11-22 at 11:37 +0800, jhuang0 wrote:
Quoted 28 lines · Darren Hart
Quoted 27 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
-mcmodel=large is not supported by gcc with version lower than 4.4, but we don't need to use memory over 4GiB, so add a patch to allow compilation without large model support.
Signed-off-by Jackie Huang <[email protected]>--- ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi_2.00.bb | 1 + 2 files changed, 70 insertions(+)create mode 100644
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patchmeta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +8
-0@@ -0,0 +1,69 @@ +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001 +From: Jackie Huang <[email protected]> +Date: Tue, 5 Nov 2013 07:23:32 -0500 +Subject: [PATCH] Allow a compilation without -mcmodel=large + +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB + when compiled without -mcmodel=large + (filter_memory_map): remove memory post 4 GiB when compiledQuoted 8 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch line 13
Quoted 5 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +5
-0+ without -mcmodel=large +* configure.ac: add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when + -mcmodel=large isn't supported + +Upstream-Status: Inappropriate [configuration]Nice try ;-) This is compatibility, not configuration. If grub-efi maintainers refuse to accept the patch that's up to them, but we need to
Actually it's ported from old version of grub which means that they allowed the comilation without large model support before, but not now.
From the Changelog, it was added in 2009:2009-06-04 Vladimir Serbinenko <[email protected]>
Allow a compilation without -mcmodel=large
*
kern/efi/mm.c(grub_efi_allocate_pages): don't allocate >4GiB when compiled without -mcmodel=large (filter_memory_map): remove memory post 4 GiB when compiled without -mcmodel=large
* configure.ac: fail gracefully and add -DMCMODEL_SMALL=1 toTARGET_CFLAGSwhen -mcmodel=large isn't supported
Quoted 7 lines
but it was removed in 2010:
2010-04-21 Vladimir Serbinenko <[email protected]>* configure.ac: Refuse to compile for x86_64-efi is mcmodel=large is not supported.
So I think they may not accept this patch again.
It does appear to be a deliverate removale, fortunatley, you know exactly who to Cc on the list now :-) It's worth shooting it off to the list to see what they say. Either way, it is definitely not a configuration patch.
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
Re: [PATCH 2/2] grub-efi: allow compilation without large model support
Quoted 61 lines · Darren Hart
Quoted 60 lines · On Fri, 2013-11-22 at 11:37 +0800, jhuang0 wrote:
Quoted 28 lines · Darren Hart
Quoted 27 lines · On Wed, 2013-11-20 at 09:40 +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
-mcmodel=large is not supported by gcc with version lower than 4.4, but we don't need to use memory over 4GiB, so add a patch to allow compilation without large model support.
Signed-off-by Jackie Huang <[email protected]>--- ...allow-a-compilation-without-mcmodel-large.patch | 69 ++++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi_2.00.bb | 1 + 2 files changed, 70 insertions(+)create mode 100644
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patchmeta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +8
-0@@ -0,0 +1,69 @@ +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001 +From: Jackie Huang <[email protected]> +Date: Tue, 5 Nov 2013 07:23:32 -0500 +Subject: [PATCH] Allow a compilation without -mcmodel=large + +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB + when compiled without -mcmodel=large + (filter_memory_map): remove memory post 4 GiB when compiledQuoted 8 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch line 13
Quoted 5 lines
meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch new file +5
-0+ without -mcmodel=large +* configure.ac: add -DMCMODEL_SMALL=1 to TARGET_CFLAGS when + -mcmodel=large isn't supported + +Upstream-Status: Inappropriate [configuration]Nice try ;-) This is compatibility, not configuration. If grub-efi maintainers refuse to accept the patch that's up to them, but we need to
Actually it's ported from old version of grub which means that they allowed the comilation without large model support before, but not now.
From the Changelog, it was added in 2009:2009-06-04 Vladimir Serbinenko <[email protected]>
Allow a compilation without -mcmodel=large
*
kern/efi/mm.c(grub_efi_allocate_pages): don't allocate >4GiB when compiled without -mcmodel=large (filter_memory_map): remove memory post 4 GiB when compiled without -mcmodel=large
* configure.ac: fail gracefully and add -DMCMODEL_SMALL=1 toTARGET_CFLAGSwhen -mcmodel=large isn't supportedbut it was removed in 2010:
2010-04-21 Vladimir Serbinenko <[email protected]>* configure.ac: Refuse to compile for x86_64-efi is mcmodel=large is not supported.
Quoted 6 lines
Quoted 1 line
So I think they may not accept this patch again.
It does appear to be a deliverate removale, fortunatley, you know exactly who to Cc on the list now :-) It's worth shooting it off to the list to see what they say. Either way, it is definitely not a configuration patch.
Yes, I will change to compatibility in v4 and add Vladimir in cc list.
Thanks,
Jackie
Quoted 9 lines
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
Signature · 5 lines
Jackie Huang WIND RIVER | China Development Center MSN:[email protected] Tel: +86 8477 8594 Mobile: +86 138 1027 4745