grub: build for host
PATCH 1/2 grub: build for host
Build Grub for host system. It provides grub binary, which is useful for installing bootloader to removable media when cross-compiling.
--- boot/grub/grub.mk | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-)
boot/grub/grub.mk +15 -5
@@ -8,6 +8,7 @@ GRUB_VERSION = 0.97 GRUB_SOURCE = grub_$(GRUB_VERSION).orig.tar.gz GRUB_PATCH = grub_$(GRUB_VERSION)-35.diff.gz GRUB_SITE = http://snapshot.debian.org/archive/debian/20080329T000000Z/pool/main/g/grub/ +GRUB_DEPENDENCIES = host-grub GRUB_CFLAGS=-DSUPPORT_LOOPDEV ifeq ($(BR2_LARGEFILE),)
@@ -46,6 +47,7 @@ define GRUB_DEBIAN_PATCHES endef GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES +HOST_GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES GRUB_CONF_ENV = \ CFLAGS="$(TARGET_CFLAGS) $(GRUB_CFLAGS)"
@@ -54,9 +56,12 @@ GRUB_CONF_OPT = \ --disable-auto-linux-mem-opt \ $(GRUB_CONFIG-y) -define GRUB_INSTALL_STAGING_CMDS - install -m 0755 -D $(@D)/grub/grub $(STAGING_DIR)/sbin/grub -endef +HOST_GRUB_CONF_ENV = \ + CFLAGS="$(GRUB_CFLAGS) -fno-stack-protector" \ + grub_cv_prog_objcopy_absolute=yes + +HOST_GRUB_CONF_OPT = \ + --disable-auto-linux-mem-opt ifeq ($(BR2_TARGET_GRUB_SPLASH),y) define GRUB_INSTALL_SPLASH
@@ -73,8 +78,12 @@ define GRUB_INSTALL_TARGET_CMDS $(GRUB_INSTALL_SPLASH) endef -define GRUB_UNINSTALL_STAGING_CMDS - rm -f $(STAGING_DIR)/sbin/grub +define HOST_GRUB_INSTALL_CMDS + install -m 0755 -D $(@D)/grub/grub $(HOST_DIR)/sbin/grub +endef + +define HOST_GRUB_UNINSTALL_CMDS + rm -f $(HOST_DIR)/sbin/grub endef define GRUB_UNINSTALL_TARGET_CMDS
@@ -83,3 +92,4 @@ define GRUB_UNINSTALL_TARGET_CMDS endef $(eval $(call AUTOTARGETS,boot,grub)) +$(eval $(call AUTOTARGETS,boot,grub,host))
PATCH 1/2 grub: build for host
Quoted 3 lines · Darius Augulis
Build Grub for host system. It provides grub binary, which is useful for installing bootloader to removable media when cross-compiling.
Hi all,
please review this patch and merge if it's ok.
Thanks.
Darius A.
Quoted 62 lines
Signed-off-by Darius Augulis<[email protected]>--- boot/grub/grub.mk | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-)boot/grub/grub.mk +15
-5@@ -8,6 +8,7 @@ GRUB_VERSION = 0.97 GRUB_SOURCE = grub_$(GRUB_VERSION).orig.tar.gz GRUB_PATCH = grub_$(GRUB_VERSION)-35.diff.gz GRUB_SITE = http://snapshot.debian.org/archive/debian/20080329T000000Z/pool/main/g/grub/ +GRUB_DEPENDENCIES = host-grub GRUB_CFLAGS=-DSUPPORT_LOOPDEV ifeq ($(BR2_LARGEFILE),)@@ -46,6 +47,7 @@ define GRUB_DEBIAN_PATCHES endef GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES +HOST_GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES GRUB_CONF_ENV = \ CFLAGS="$(TARGET_CFLAGS) $(GRUB_CFLAGS)"@@ -54,9 +56,12 @@ GRUB_CONF_OPT = \ --disable-auto-linux-mem-opt \ $(GRUB_CONFIG-y) -define GRUB_INSTALL_STAGING_CMDS - install -m 0755 -D $(@D)/grub/grub $(STAGING_DIR)/sbin/grub -endef +HOST_GRUB_CONF_ENV = \ + CFLAGS="$(GRUB_CFLAGS) -fno-stack-protector" \ + grub_cv_prog_objcopy_absolute=yes + +HOST_GRUB_CONF_OPT = \ + --disable-auto-linux-mem-opt ifeq ($(BR2_TARGET_GRUB_SPLASH),y) define GRUB_INSTALL_SPLASH@@ -73,8 +78,12 @@ define GRUB_INSTALL_TARGET_CMDS $(GRUB_INSTALL_SPLASH) endef -define GRUB_UNINSTALL_STAGING_CMDS - rm -f $(STAGING_DIR)/sbin/grub +define HOST_GRUB_INSTALL_CMDS + install -m 0755 -D $(@D)/grub/grub $(HOST_DIR)/sbin/grub +endef + +define HOST_GRUB_UNINSTALL_CMDS + rm -f $(HOST_DIR)/sbin/grub endef define GRUB_UNINSTALL_TARGET_CMDS@@ -83,3 +92,4 @@ define GRUB_UNINSTALL_TARGET_CMDS endef $(eval $(call AUTOTARGETS,boot,grub)) +$(eval $(call AUTOTARGETS,boot,grub,host))
PATCH 1/2 grub: build for host
In reply to Darius AugulisHello,
Le Sun, 21 Aug 2011 19:51:54 +0300,
Darius Augulis <[email protected]> a ?crit :
Quoted 1 line
+GRUB_DEPENDENCIES = host-grub
This raises a question similar to the one I asked for syslinux, but in the opposite side. I don't think host-grub is a build dependency of the target grub (i.e the target grub *can* be compiled without host-grub being compiled), even though host-grub might be useful when grub is enabled.
What should we do in this case? At least we should have a consistent decision between syslinux (patches by Arnout) and grub (patches by Darius).
I think we should create in the documentation a "Package specific comments" part, in which we could detail some subtleties of various packages.
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/2 grub: build for host
Quoted 4 lines · Thomas Petazzoni
Hello,
Le Sun, 21 Aug 2011 19:51:54 +0300,
Quoted 8 lines
Darius Augulis <[email protected]> a ?crit :
Quoted 1 line
+GRUB_DEPENDENCIES = host-grub
This raises a question similar to the one I asked for syslinux, but in the opposite side. I don't think host-grub is a build dependency of the target grub (i.e the target grub *can* be compiled without host-grub being compiled), even though host-grub might be useful when grub is enabled.
In the case of grub, the dependency is in fact the inverse: you need staging-
grub to have properly cross-compiled stageXXX files. (Well, actually, that didn't work for me at all so I just installed grub-legacy on my build machine; but I hope that is fixed with Darius' patches.)
Quoted 4 lines
What should we do in this case? At least we should have a consistent decision between syslinux (patches by Arnout) and grub (patches by Darius).
Actually it's a bit similar to host-gdb: it's not used by buildroot itself,
it's supposed to be used by the developer. So it probably should be a configuration option to build host-bootloader-installers.
Quoted 3 lines
I think we should create in the documentation a "Package specific comments" part, in which we could detail some subtleties of various packages.
Yep. After the asciidoc conversion :-)
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 31BB CF53 8660 6F88 345D 54CC A836 5879 20D7 CF43