1N/A# grub-image - Create a GRUB boot filesystem image and tarball 1N/A# Gordon Matzigkeit <gord@fig.org>, 2000-07-25 1N/A# Copyright (C) 2000, 2002 Free Software Foundation, Inc. 1N/A# This file is free software; you can redistribute it and/or modify it 1N/A# under the terms of the GNU General Public License as published by 1N/A# the Free Software Foundation; either version 2 of the License, or 1N/A# (at your option) any later version. 1N/A# This program is distributed in the hope that it will be useful, but 1N/A# WITHOUT ANY WARRANTY; without even the implied warranty of 1N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1N/A# General Public License for more details. 1N/A# You should have received a copy of the GNU General Public License 1N/A# along with this program; if not, write to the Free Software 1N/A# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1N/A# See if we were invoked from within the build directory, and if so, 1N/A# use the built files rather than the installed ones. 1N/A# Get GRUB's version from the Grub shell, since we use the 1N/A# Create the tarball. 1N/A# Create a new filesystem image of the specified size. 1N/A # Add about 30% (20% overhead plus 10% breathing room), and convert 1N/A # to kilobytes. This factor was determined empirically. 1N/A# Attempt to mount the image. 1N/A # This requires running as root, and using the loop device. 1N/A # Silly losetup doesn't report an error! 1N/A# Extract our tarball into the image, then unmount it. 1N/A# Use the GRUB shell to properly set up GRUB on the image. 1N/Acat <<EOF
| $grub_shell --batch --device-map=/dev/null 1N/Ainstall /boot/grub/stage1 (fd0) /boot/grub/stage2