grub: Remove native version of grub-efi
RFC PATCH 1/1 grub: Remove native version of grub-efi
The native version of grub-efi only installs the tools
/usr/bin/grub-editenv
/usr/bin/grub-mkimage
to sysroots-components/, but equivalent tools are already provided by grub-native, the difference on x86_64 being 4 hardwired paths in grub-mkimage (values taken from grub-native):
LOCALEDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share/locale GRUB_DATADIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share GRUB_LIBDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/lib
GRUB_SYSCONFDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/etc
If grub-native and grub-efi-native are built with the following patch
configure.ac +4 -4
@@ -1980,10 +1980,10 @@ grub_libdir="$(eval echo "$libdir")" grub_localedir="$(eval echo "$localedir")" grub_datadir="$(eval echo "$datadir")" grub_sysconfdir="$(eval echo "$sysconfdir")" -AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir]) -AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir]) -AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir]) -AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir]) +AC_DEFINE_UNQUOTED(LOCALEDIR, "/non-existent", [Locale dir]) +AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "/non-existent", [Library dir]) +AC_DEFINE_UNQUOTED(GRUB_DATADIR, "/non-existent", [Data dir]) +AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "/non-existent", [Configuration dir])
the produced grub-editenv/grub-mkimage binaries become binary equivalent, assuming reproducible builds is active. Since the unpatched values of LOCALEDIR/GRUB_DATADIR/GRUB_LIBDIR/GRUB_SYSCONFDIR point to directories that are not expected to exist at runtime, they can be ignored.
Therefore:
* remove grub-efi-native and instead rely on the same tools from grub-native
* replace references to grub-efi-native with grub-native
* remove unused grub-efi-native security flags overrides
--- meta/conf/distro/include/security_flags.inc | 4 --- meta/recipes-bsp/grub/grub-efi_2.04.bb | 28 +++++---------------- meta/recipes-bsp/grub/grub2.inc | 4 --- meta/recipes-bsp/grub/grub_2.04.bb | 5 ++++ meta/recipes-core/meta/wic-tools.bb | 2 +- 5 files changed, 12 insertions(+), 31 deletions(-)
meta/conf/distro/include/security_flags.inc +0 -4
@@ -40,10 +40,6 @@ SECURITY_CFLAGS_pn-glibc-testsuite = "" SECURITY_CFLAGS_pn-gcc-runtime = "" SECURITY_CFLAGS_pn-grub = "" SECURITY_CFLAGS_pn-grub-efi = "" -SECURITY_CFLAGS_pn-grub-efi-native = "" -SECURITY_CFLAGS_pn-grub-efi-x86-native = "" -SECURITY_CFLAGS_pn-grub-efi-i586-native = "" -SECURITY_CFLAGS_pn-grub-efi-x86-64-native = "" SECURITY_CFLAGS_pn-mkelfimage_x86 = "" SECURITY_CFLAGS_pn-valgrind = "${SECURITY_NOPIE_CFLAGS}"
meta/recipes-bsp/grub/grub-efi_2.04.bb +6 -22
@@ -4,8 +4,8 @@ require conf/image-uefi.conf GRUBPLATFORM = "efi" -DEPENDS_append_class-target = " grub-efi-native" -RDEPENDS_${PN}_class-target = "grub-common virtual/grub-bootconf" +DEPENDS_append = " grub-native" +RDEPENDS_${PN} = "grub-common virtual/grub-bootconf" SRC_URI += " \ file://cfg \
@@ -51,22 +51,7 @@ do_mkimage() { addtask mkimage before do_install after do_compile -do_mkimage_class-native() { - : -} - -do_install_append_class-target() { - install -d ${D}${EFI_FILES_PATH} - install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${GRUB_IMAGE} -} - -do_install_class-native() { - install -d ${D}${bindir} - install -m 755 grub-mkimage ${D}${bindir} - install -m 755 grub-editenv ${D}${bindir} -} - -do_install_class-target() { +do_install() { oe_runmake 'DESTDIR=${D}' -C grub-core install # Remove build host references...
@@ -76,6 +61,9 @@ do_install_class-target() { -e 's|${DEBUG_PREFIX_MAP}||g' \ -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ {} + + + install -d ${D}${EFI_FILES_PATH} + install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${GRUB_IMAGE} } do_install_append_aarch64() {
@@ -89,10 +77,6 @@ do_deploy() { install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${DEPLOYDIR} } -do_deploy_class-native() { - : -} - addtask deploy after do_install before do_build FILES_${PN} = "${libdir}/grub/${GRUB_TARGET}-efi \
meta/recipes-bsp/grub/grub2.inc +0 -4
@@ -64,7 +64,3 @@ do_configure_prepend() { FROM_BOOTSTRAP=1 ${S}/autogen.sh cd ${B} } - -RDEPENDS_${PN}_class-native = "" - -BBCLASSEXTEND = "native"
meta/recipes-bsp/grub/grub_2.04.bb +5 -0
@@ -2,9 +2,12 @@ require grub2.inc RDEPENDS_${PN}-common += "${PN}-editenv" RDEPENDS_${PN} += "${PN}-common" +RDEPENDS_${PN}_class-native = "" RPROVIDES_${PN}-editenv += "${PN}-efi-editenv" +PROVIDES_append_class-native = " grub-efi-native" + PACKAGES =+ "${PN}-editenv ${PN}-common" FILES_${PN}-editenv = "${bindir}/grub-editenv" FILES_${PN}-common = " \
@@ -31,3 +34,5 @@ do_install_append () { INSANE_SKIP_${PN} = "arch" INSANE_SKIP_${PN}-dbg = "arch" + +BBCLASSEXTEND = "native"
meta/recipes-core/meta/wic-tools.bb +1 -1
@@ -4,7 +4,7 @@ LICENSE = "MIT" DEPENDS = "\ parted-native syslinux-native gptfdisk-native dosfstools-native \ - mtools-native bmap-tools-native grub-efi-native cdrtools-native \ + mtools-native bmap-tools-native grub-native cdrtools-native \ btrfs-tools-native squashfs-tools-native pseudo-native \ e2fsprogs-native util-linux-native tar-native\ "
configure.ac
Quoted 18 lines · Jacob Kroon
The native version of grub-efi only installs the tools
/usr/bin/grub-editenv
/usr/bin/grub-mkimageto sysroots-components/, but equivalent tools are already provided by grub-native, the difference on
x86_64being 4 hardwired paths in grub-mkimage (values taken from grub-native):LOCALEDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share/locale GRUB_DATADIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share GRUB_LIBDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/lib
GRUB_SYSCONFDIR= $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/etcIf grub-native and grub-efi-native are built with the following patch
configure.ac +0
-0
For the record, embedding the two lines above in the commit message was probably a bad idea since it seems to confuse "git am".
Jacob
Quoted 21 lines · Jacob Kroon
Quoted 20 lines · Jacob Kroon
The native version of grub-efi only installs the tools
/usr/bin/grub-editenv
/usr/bin/grub-mkimageto sysroots-components/, but equivalent tools are already provided by
grub-native, the difference onx86_64being 4 hardwired paths in grub-mkimage
(values taken from grub-native):LOCALEDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share/locale
GRUB_DATADIR= $TMPDIR/work/x86_64-linux/grub-native/2.04-
r0/recipe-sysroot-native/usr/share
GRUB_LIBDIR= $TMPDIR/work/x86_64-linux/grub-native/2.04-
r0/recipe-sysroot-native/usr/lib
GRUB_SYSCONFDIR= $TMPDIR/work/x86_64-linux/grub-native/2.04-
r0/recipe-sysroot-native/etc
Quoted 8 lines
configure.ac
Quoted 5 lines
If grub-native and grub-efi-native are built with the following patch
configure.ac +0
-0For the record, embedding the two lines above in the commit message was probably a bad idea since it seems to confuse "git am".
I did notice, I have scripts which help me handle that case as I've hit it before. The easiest fix is to add a whitespace before the +++ and --
- :)
Cheers,
Richard