2008-01-23 Robert Millan <rmh@aybabtu.com>
* kern/i386/pc/init.c (make_install_device): When memdisk image is present, "(memdisk)/boot/grub" becomes the default prefix. * util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus a memdisk tarball with all the modules. Add --overlay=DIR option that allows users to overlay additional files into the image.
This commit is contained in:
parent
dbb475a441
commit
06ab530333
3 changed files with 34 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2008-01-23 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
|
* kern/i386/pc/init.c (make_install_device): When memdisk image is
|
||||||
|
present, "(memdisk)/boot/grub" becomes the default prefix.
|
||||||
|
|
||||||
|
* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus
|
||||||
|
a memdisk tarball with all the modules. Add --overlay=DIR option that
|
||||||
|
allows users to overlay additional files into the image.
|
||||||
|
|
||||||
2008-01-23 Robert Millan <rmh@aybabtu.com>
|
2008-01-23 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add `machine/loader.h'
|
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add `machine/loader.h'
|
||||||
|
|
|
@ -64,7 +64,12 @@ make_install_device (void)
|
||||||
/* XXX: This should be enough. */
|
/* XXX: This should be enough. */
|
||||||
char dev[100];
|
char dev[100];
|
||||||
|
|
||||||
if (grub_install_dos_part != -2)
|
if (grub_memdisk_image_size)
|
||||||
|
{
|
||||||
|
grub_sprintf (dev, "(memdisk)%s", grub_prefix);
|
||||||
|
grub_strcpy (grub_prefix, dev);
|
||||||
|
}
|
||||||
|
else if (grub_install_dos_part != -2)
|
||||||
{
|
{
|
||||||
grub_sprintf (dev, "(%cd%u",
|
grub_sprintf (dev, "(%cd%u",
|
||||||
(grub_boot_drive & 0x80) ? 'h' : 'f',
|
(grub_boot_drive & 0x80) ? 'h' : 'f',
|
||||||
|
|
|
@ -42,6 +42,7 @@ Make GRUB rescue image.
|
||||||
-h, --help print this message and exit
|
-h, --help print this message and exit
|
||||||
-v, --version print the version information and exit
|
-v, --version print the version information and exit
|
||||||
--modules=MODULES pre-load specified modules MODULES
|
--modules=MODULES pre-load specified modules MODULES
|
||||||
|
--overlay=DIR overlay directory DIR in the memdisk image
|
||||||
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
|
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
|
||||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||||
--image-type=TYPE select floppy or cdrom (default)
|
--image-type=TYPE select floppy or cdrom (default)
|
||||||
|
@ -67,6 +68,8 @@ for option in "$@"; do
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
--overlay=*)
|
||||||
|
overlay=`echo "$option" | sed 's/--overlay=//'` ;;
|
||||||
--pkglibdir=*)
|
--pkglibdir=*)
|
||||||
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
|
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
|
@ -99,18 +102,29 @@ if test "x$output_image" = x; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${modules}" = "x" ] ; then
|
|
||||||
modules=`cd ${input_dir}/ && ls *.mod`
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x${image_type}" = "xfloppy" ] ; then
|
if [ "x${image_type}" = "xfloppy" ] ; then
|
||||||
floppy_image=${output_image}
|
floppy_image=${output_image}
|
||||||
else
|
else
|
||||||
floppy_image=`mktemp`
|
floppy_image=`mktemp`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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/
|
||||||
|
|
||||||
|
if test "x$overlay" = x ; then : ; else
|
||||||
|
cp -dpR ${overlay}/* ${memdisk_dir}/
|
||||||
|
fi
|
||||||
|
|
||||||
|
memdisk_img=`mktemp`
|
||||||
|
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
||||||
|
rm -rf ${memdisk_dir}
|
||||||
|
|
||||||
core_img=`mktemp`
|
core_img=`mktemp`
|
||||||
${grub_mkimage} -d ${input_dir}/ -o ${core_img} ${modules}
|
${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
|
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > $floppy_image
|
||||||
rm -f ${core_img}
|
rm -f ${core_img}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue