grub-efi: change to generate EFI image in target package

To generate the target EFI image in a native package, it requires
the host gcc have the ability to do -m32/-m64 compiling, but gcc
doesn't have that support on the 32bit version of some distributions
(e.g. rehl, suse), it would fail when build a 64bit target on these
32bit hosts.

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.

(From OE-Core rev: 53d3f1273983dfce2a907b39768978afe99aab1a)

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jackie Huang 2013-11-18 20:29:07 +08:00 committed by Richard Purdie
parent 8275e0f725
commit 40b73e4660
2 changed files with 28 additions and 23 deletions

View File

@ -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"

View File

@ -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"
PR = "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() {
# 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} \
boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search
do_install_class-target() {
:
}
do_install_class-native() {
install -d ${D}${bindir}
install -m 755 grub-mkimage ${D}${bindir}
}
addtask mkimage after do_compile before do_install
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} \
boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search
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"
BBCLASSEXTEND = "native"
ALLOW_EMPTY_${PN} = "1"