3
# Make GRUB rescue floppy
4
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
6
# GRUB is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# GRUB is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
# Initialize some variables.
20
transform="@program_transform_name@"
23
exec_prefix=@exec_prefix@
26
PACKAGE_NAME=@PACKAGE_NAME@
27
PACKAGE_TARNAME=@PACKAGE_TARNAME@
28
PACKAGE_VERSION=@PACKAGE_VERSION@
29
target_cpu=@target_cpu@
31
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
37
Usage: $0 [OPTION] output_image
38
Make GRUB rescue floppy.
40
-h, --help print this message and exit
41
-v, --version print the version information and exit
42
--modules=MODULES pre-load specified modules MODULES
43
--output=FILE save output in FILE
45
$0 generates a bootable rescue floppy.
47
Report bugs to <bug-grub@gnu.org>.
51
input_dir=${pkglibdir}
53
# Check the arguments.
54
for option in "$@"; do
60
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
63
modules=`echo "$option" | sed 's/--modules=//'` ;;
65
output_image=`echo "$option" | sed 's/--output=//'` ;;
67
echo "Unrecognized option \`$option'" 1>&2
72
if test "x$output_image" != x; then
73
echo "Unrecognized option \`$option'" 1>&2
77
output_image="${option}" ;;
81
if test "x$output_image" = x; then
87
mkdir -p ${aux_dir}/boot/grub
89
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
90
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
91
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
92
if test -f "$file"; then
93
cp -f "$file" ${aux_dir}/boot/grub/
97
modules="$(cat ${input_dir}/partmap.lst) ${modules}"
98
for i in ${modules} ; do
100
done > ${aux_dir}/boot/grub/grub.cfg
104
tar -C ${aux_dir} -cf ${memdisk_img} boot
109
grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk
113
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image}