diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2017-02-09 04:01:36 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-02-09 04:01:57 +0100 |
commit | 571d99e74d42fac830069c2ca2fbd5f505613dc6 (patch) | |
tree | db2700a1dd94b5b6760ee19573ef7395e6e1d901 /package/grub | |
parent | fdfd165799d762acd6cf5871bfcb1493da1359e9 (diff) |
add dual-boot / fwupdate for systems with grub-support
Diffstat (limited to 'package/grub')
-rw-r--r-- | package/grub/Makefile | 20 | ||||
-rw-r--r-- | package/grub/files/grub-dual.cfg | 50 |
2 files changed, 68 insertions, 2 deletions
diff --git a/package/grub/Makefile b/package/grub/Makefile index 0198c5337..1e7a2625f 100644 --- a/package/grub/Makefile +++ b/package/grub/Makefile @@ -91,6 +91,12 @@ GRUB_PLATFORM= efi GRUB_MODULES= boot linux ext2 fat part_msdos part_gpt normal efi_gop endif +ifeq ($(ADK_TARGET_DUAL_BOOT),y) +GRUB_CFG= grub-dual.cfg +else +GRUB_CFG= grub.cfg +endif + HOST_CONFIGURE_ARGS+= --enable-efiemu=no \ --disable-grub-mkfont \ --enable-device-mapper=no \ @@ -102,6 +108,11 @@ CONFIGURE_ARGS+= --disable-grub-mkfont \ --enable-libzfs=no \ --with-platform=$(GRUB_PLATFORM) \ --disable-werror + +ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y) +CONFIGURE_ARGS+= --with-bootdir=/boot/EFI/boot \ + --with-grubdir=/ +endif XAKE_FLAGS+= GCC_HONOUR_COPTS=s grub-install: @@ -120,11 +131,12 @@ endif ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y) ${CP} ${WRKINST}/usr/lib/grub/$(GRUB_ARCH) \ $(FW_DIR)/$(GRUB_DIR) - $(CP) ./files/grub.cfg $(FW_DIR)/$(GRUB_DIR) + $(CP) ./files/$(GRUB_CFG) $(FW_DIR)/$(GRUB_DIR)/grub.cfg + $(SED) "s/@@ROOTDEV@@/$(ADK_TARGET_ROOTDEV)/g" $(FW_DIR)/$(GRUB_DIR)/grub.cfg else ${CP} ${WRKINST}/usr/lib/grub/${GRUB_ARCH} \ $(IDIR_GRUB)/$(GRUB_DIR) - $(CP) ./files/grub.cfg $(IDIR_GRUB)/$(GRUB_DIR) + $(CP) ./files/$(GRUB_CFG) $(IDIR_GRUB)/$(GRUB_DIR)/grub.cfg endif $(STAGING_HOST_DIR)/usr/bin/grub-mkimage \ -d $(WRKINST)/usr/lib/grub/$(GRUB_ARCH) \ @@ -147,6 +159,10 @@ grub-tools-install: $(IDIR_GRUB_TOOLS)/usr/bin ${INSTALL_BIN} ${WRKINST}/usr/bin/grub-mkimage \ $(IDIR_GRUB_TOOLS)/usr/bin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-reboot \ + $(IDIR_GRUB_TOOLS)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-set-default \ + $(IDIR_GRUB_TOOLS)/usr/sbin ${CP} ${WRKINST}/usr/lib/grub \ $(IDIR_GRUB_TOOLS)/usr/lib ${CP} ${WRKINST}/usr/share/grub \ diff --git a/package/grub/files/grub-dual.cfg b/package/grub/files/grub-dual.cfg new file mode 100644 index 000000000..bae2fa414 --- /dev/null +++ b/package/grub/files/grub-dual.cfg @@ -0,0 +1,50 @@ +if [ "x\${timeout}" != "x-1" ]; then + if keystatus; then + if keystatus --shift; then + set timeout=-1 + else + set timeout=0 + fi + else + if sleep --interruptible 2; then + set timeout=0 + fi + fi +fi + +if [ -s $prefix/grubenv ]; then + set have_grubenv=true + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +menuentry "OpenADK1" { + set root=(hd0,2) + linux (hd0,2)/kernel root=/dev/@@ROOTDEV@@2 rootfstype=ext4 rootwait panic=5 +} +menuentry "OpenADK2" { + set root=(hd0,3) + linux (hd0,3)/kernel root=/dev/@@ROOTDEV@@3 rootfstype=ext4 rootwait panic=5 +} + |