From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JLf0g-000807-0h for mharc-grub-devel@gnu.org; Sun, 03 Feb 2008 08:35:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JLf0d-0007zn-Kj for grub-devel@gnu.org; Sun, 03 Feb 2008 08:35:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JLf0c-0007zT-6s for grub-devel@gnu.org; Sun, 03 Feb 2008 08:35:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLf0c-0007zQ-1z for grub-devel@gnu.org; Sun, 03 Feb 2008 08:35:46 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JLf0b-0000Lu-LT for grub-devel@gnu.org; Sun, 03 Feb 2008 08:35:45 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JLf0S-0001xS-TL for grub-devel@gnu.org; Sun, 03 Feb 2008 14:35:37 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JLeya-0001bc-7M for grub-devel@gnu.org; Sun, 03 Feb 2008 14:33:40 +0100 Date: Sun, 3 Feb 2008 14:33:40 +0100 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080203133340.GA6151@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline Content-Transfer-Encoding: 8bit Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] use cdboot.img in grub-mkrescue X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2008 13:35:48 -0000 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="cdboot.diff" * 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 --+HP7ph2BbKc20aGI--