All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] use cdboot.img in grub-mkrescue
Date: Sun, 3 Feb 2008 14:33:40 +0100	[thread overview]
Message-ID: <20080203133340.GA6151@thorin> (raw)

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]


Thanks to Bean's latest effort (and to Alex Roman, I assume), grub-mkrescue can
be made a bit cleaner by using cdboot.img instead of the floppy emulation hack.

See attached patch.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)

[-- Attachment #2: cdboot.diff --]
[-- Type: text/x-diff, Size: 2770 bytes --]


	* util/i386/pc/grub-mkrescue.in: Rewrite most of image generation to
	use `cdboot.img' for cdrom images.

diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/i386/pc/grub-mkrescue.in ./util/i386/pc/grub-mkrescue.in
--- ../grub2/util/i386/pc/grub-mkrescue.in	2008-01-23 12:25:52.000000000 +0100
+++ ./util/i386/pc/grub-mkrescue.in	2008-02-03 14:15:19.000000000 +0100
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # Make GRUB rescue image
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -102,41 +102,45 @@ if test "x$output_image" = x; then
   exit 1
 fi
 
-if [ "x${image_type}" = "xfloppy" ] ; then
-  floppy_image=${output_image}
-else
-  floppy_image=`mktemp`
-fi
+aux_dir=`mktemp -d`
+mkdir -p ${aux_dir}/boot/grub
 
-memdisk_dir=`mktemp -d`
-mkdir -p ${memdisk_dir}/boot/grub
 cp ${input_dir}/*.mod \
   ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
-  ${memdisk_dir}/boot/grub/
+  ${aux_dir}/boot/grub/
 
 if test "x$overlay" = x ; then : ; else
-  cp -dpR ${overlay}/* ${memdisk_dir}/
+  cp -dpR ${overlay}/* ${aux_dir}/
 fi
 
-memdisk_img=`mktemp`
-tar -C ${memdisk_dir} -cf ${memdisk_img} boot
-rm -rf ${memdisk_dir}
-
-core_img=`mktemp`
-${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk cpio biosdisk ${modules}
-rm -f ${memdisk_img}
-cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > $floppy_image
-rm -f ${core_img}
-
 if [ "x${image_type}" = "xfloppy" ] ; then
-  exit 0
+  # build memdisk
+  memdisk_img=`mktemp`
+  tar -C ${aux_dir} -cf ${memdisk_img} boot
+  rm -rf ${aux_dir}
+
+  # build core.img
+  core_img=`mktemp`
+  ${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk cpio biosdisk ${modules}
+  rm -f ${memdisk_img}
+
+  # build floppy image
+  cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > $output_image
+  rm -f ${core_img}
+else
+  # build core.img
+  core_img=`mktemp`
+  ${grub_mkimage} -d ${input_dir}/ -o ${core_img} biosdisk iso9660 ${modules}
+
+  # build grub_eltorito image
+  cat ${input_dir}/cdboot.img ${core_img} > ${aux_dir}/boot/grub/grub_eltorito
+  rm -f ${core_img}
+
+  # build iso image
+  genisoimage -b boot/grub/grub_eltorito \
+    -no-emul-boot -boot-load-size 4 -boot-info-table \
+    -o ${output_image} -r ${aux_dir}
+  rm -rf ${aux_dir}
 fi
 
-iso_dir=`mktemp -d`
-cp $floppy_image ${iso_dir}/floppy.img
-genisoimage -b floppy.img -o ${output_image} -r ${iso_dir}
-rm -rf ${iso_dir}
-
-rm -f ${floppy_image}
-
 exit 0

             reply	other threads:[~2008-02-03 13:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 13:33 Robert Millan [this message]
2008-02-03 18:30 ` [PATCH] use cdboot.img in grub-mkrescue Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080203133340.GA6151@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.