From 13709006bdcef20cdb32241a26e338759f78803f Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Thu, 4 Jun 2009 17:56:39 +0200 Subject: [PATCH] Fix jumping back from the bsd4grml loader (ldbsd.com) to GNU GRUB MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Formerly, we hard-coded jumping to either grub1 (grub-legacy) or grub2 in the menu option #6, and offered the macros “grub1” and “grub2” in boot.cfg (the text mode boot prompt / ldbsd.com command line), with an alias from “grml” to “grub2” (normally). Now we use the grml-live framework to patching the ldbsd.com con- figuration files at image creation time to allow for either grub2, grub1 with stage2, or grub1 with stage2_eltorito to be found. Note that grub2 will be taken as default iff it exists, because it supports manifold-boot™ images, which grub-legacy doesn’t. Signed-off-by: Thorsten Glaser --- grml-live | 21 +++++++++++++++++++++ templates/boot/addons/bsd4grml/boot.6 | 10 ++++------ templates/boot/addons/bsd4grml/boot.cfg | 5 ++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/grml-live b/grml-live index 150615b..17222ba 100755 --- a/grml-live +++ b/grml-live @@ -625,6 +625,27 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then sed -i "s/%GRML_NAME_SQUASHFS%/$GRML_NAME_SQUASHFS/" "$BUILD_OUTPUT"/boot/isolinux/f4 sed -i "s/%GRML_NAME_SQUASHFS%/$GRML_NAME_SQUASHFS/" "$BUILD_OUTPUT"/boot/isolinux/f5 + # jump back to grub from bsd4grml: + if [ -e "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 ]; then + if [ -e "$BUILD_OUTPUT"/boot/grub/core.img ]; then + GRUB_VERSION=2 + else + GRUB_VERSION=1 + fi + if [ -e "$BUILD_OUTPUT"/boot/grub/stage2 ]; then + GRUB_LEGACY=stage2 + else + GRUB_LEGACY=stage2_eltorito + fi + + # why not ed(1)? + for file in "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 \ + "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.cfg; do + sed -i -e "s!%GRUB_VERSION%!$GRUB_VERSION!g" \ + -e "s!%GRUB_LEGACY%!$GRUB_LEGACY!g" "$file" + done + fi + # autostart for Windows: if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/ diff --git a/templates/boot/addons/bsd4grml/boot.6 b/templates/boot/addons/bsd4grml/boot.6 index c1f6d9b..6131727 100644 --- a/templates/boot/addons/bsd4grml/boot.6 +++ b/templates/boot/addons/bsd4grml/boot.6 @@ -1,8 +1,6 @@ -#echo -#echo Switching to GNU GRUB-legacy -#echo -#machine exec grub /boot/grub/stage2 echo -echo Switching to GNU GRUB 2 +echo Switching to GNU GRUB %GRUB_VERSION% echo -machine exec grub /boot/grub/core.img +macro grub1 machine exec grub /boot/grub/%GRUB_LEGACY% +macro grub2 machine exec grub /boot/grub/core.img +grub%GRUB_VERSION% diff --git a/templates/boot/addons/bsd4grml/boot.cfg b/templates/boot/addons/bsd4grml/boot.cfg index 7030d00..d121c65 100644 --- a/templates/boot/addons/bsd4grml/boot.cfg +++ b/templates/boot/addons/bsd4grml/boot.cfg @@ -1,9 +1,8 @@ set image /boot/addons/bsd4grml/bsd.rd set timeout 12 -#macro grml machine exec grub /boot/grub/stage2_eltorito -macro grml machine exec grub /boot/grub/core.img -macro grub1 machine exec grub /boot/grub/stage2 +macro grub1 machine exec grub /boot/grub/%GRUB_LEGACY% macro grub2 machine exec grub /boot/grub/core.img +macro grml grub%GRUB_VERSION% echo echo ================================================================== echo # MirOS BSD #10-current [grml] | (c) 2002-2009 The MirOS Project # -- 2.1.4