diff options
author | Darren Hart <dvhart@linux.intel.com> | 2011-11-21 14:01:26 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-30 22:18:07 +0000 |
commit | fcde2d65a76667a2d925fe5752dcc750b137f99a (patch) | |
tree | ccc3ef34a14df6cf5da96e20311d6aceeae2c5f1 | |
parent | 1098d8d35c8d4432ffd2d580ce9a657c5dd7eeea (diff) | |
download | poky-fcde2d65a76667a2d925fe5752dcc750b137f99a.tar.gz |
grub-efi-native: New recipe to build GRUB EFI images
Add a recipe to build the GRUB efi images. This recipe is written as
a native recipe as the resulting GRUB utils are required to assemble
the final image. Rather than build a native and a target recipe (and
increase build times), this recipe builds the utils for the host and
passes an appropriate --target argument to the GRUB configure script
to build the modules for the target arch. The only output of this
recipe is an EFI image in the deploy directory.
Care is taken to ensure changing targets will force a rebuild of this
native recipe by including the target arch in the PN.
(From OE-Core rev: f9518a368f041ceccb4a36061d91ae64cd4dabd4)
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-bsp/grub/grub-efi-native_1.99.bb | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/grub-efi-native_1.99.bb b/meta/recipes-bsp/grub/grub-efi-native_1.99.bb new file mode 100644 index 0000000000..3c52ec9235 --- /dev/null +++ b/meta/recipes-bsp/grub/grub-efi-native_1.99.bb | |||
@@ -0,0 +1,74 @@ | |||
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 | This recipe builds an EFI binary for the target. It does not install \ | ||
8 | or package anything, it only deploys a target-arch GRUB EFI image." | ||
9 | |||
10 | HOMEPAGE = "http://www.gnu.org/software/grub/" | ||
11 | SECTION = "bootloaders" | ||
12 | PRIORITY = "optional" | ||
13 | |||
14 | LICENSE = "GPLv3" | ||
15 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | ||
16 | |||
17 | # FIXME: We should be able to optionally drop freetype as a dependency | ||
18 | DEPENDS = "help2man-native" | ||
19 | RDEPENDS_${PN} = "diffutils freetype" | ||
20 | PR = "r1" | ||
21 | |||
22 | # Native packages do not normally rebuild when the target changes. | ||
23 | # Ensure this is built once per HOST-TARGET pair. | ||
24 | PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native" | ||
25 | |||
26 | SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz" | ||
27 | |||
28 | SRC_URI[md5sum] = "ca9f2a2d571b57fc5c53212d1d22e2b5" | ||
29 | SRC_URI[sha256sum] = "b91f420f2c51f6155e088e34ff99bea09cc1fb89585cf7c0179644e57abd28ff" | ||
30 | |||
31 | COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)' | ||
32 | |||
33 | S = "${WORKDIR}/grub-${PV}" | ||
34 | |||
35 | # Determine the target arch for the grub modules before the native class | ||
36 | # clobbers TARGET_ARCH. | ||
37 | ORIG_TARGET_ARCH := ${TARGET_ARCH} | ||
38 | python __anonymous () { | ||
39 | import re | ||
40 | target = d.getVar('ORIG_TARGET_ARCH', True) | ||
41 | if target == "x86_64": | ||
42 | grubtarget = 'x86_64' | ||
43 | grubimage = "bootx64.efi" | ||
44 | elif re.match('i.86', target): | ||
45 | grubtarget = 'i386' | ||
46 | grubimage = "bootia32.efi" | ||
47 | else: | ||
48 | raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) | ||
49 | d.setVar("GRUB_TARGET", grubtarget) | ||
50 | d.setVar("GRUB_IMAGE", grubimage) | ||
51 | } | ||
52 | |||
53 | inherit autotools | ||
54 | inherit gettext | ||
55 | inherit native | ||
56 | inherit deploy | ||
57 | |||
58 | EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \ | ||
59 | --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix=''" | ||
60 | |||
61 | do_mkimage() { | ||
62 | ./grub-mkimage -p / -d ./grub-core/ \ | ||
63 | -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ | ||
64 | boot linux fat serial part_msdos normal | ||
65 | } | ||
66 | addtask mkimage after do_compile before do_install | ||
67 | |||
68 | do_deploy() { | ||
69 | install -m 644 ${S}/${GRUB_IMAGE} ${DEPLOYDIR} | ||
70 | } | ||
71 | addtask deploy after do_install before do_build | ||
72 | |||
73 | do_install[noexec] = "1" | ||
74 | do_populate_sysroot[noexec] = "1" | ||