* boot directory prefix in grub-install (even with --root-directory)
@ 2009-12-22 11:53 Grégoire Sutre
2009-12-22 12:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-24 22:24 ` Robert Millan
0 siblings, 2 replies; 5+ messages in thread
From: Grégoire Sutre @ 2009-12-22 11:53 UTC (permalink / raw)
To: grub-devel
Hi,
grub-install copies GRUB images into ${rootdir}/boot/grub (where
${rootdir} is empty by default and can be changed with --root-directory).
To install GRUB files on a partition that contains a /boot file, one
must specify a non-empty --root-directory, and grub files are then
copied into /DIR/boot/grub. Or one could mount the partition on a mount
point of the form DIR/boot and specify --root-directory=DIR to force
installation into the /grub directory of the partition. Both solutions
are not completely satisfactory. Is there a better one?
The problem arises e.g. with NetBSD which uses /boot for its own
bootloader. The script util/grub-install.in contains lines to take care
of that situation (lines 160-172), but these lines rely on a variable
${host_os} that is not set. This might be deprecated code from GRUB
Legacy's grub-install, where ${host_os} is set by a configure substitution.
An alternative solution would be to have grub-install install in
${rootdir}/grub, with ${rootdir} equal to /boot by default. The default
behavior (with no --root-directory) would be the same.
The following patch implements this alternative.
Thanks for your time,
Grégoire
--- util/grub-install.in.orig 2009-12-22 11:26:01.538833717 +0100
+++ util/grub-install.in 2009-12-22 12:48:55.979476412 +0100
@@ -39,8 +39,7 @@
fi
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
-rootdir=
-grub_prefix=`echo /boot/grub | sed ${transform}`
+rootdir=/boot
modules=
install_device=
@@ -66,7 +65,7 @@
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--root-directory=DIR install GRUB images under the directory DIR
- instead of the root directory
+ instead of ${rootdir}
--grub-setup=FILE use FILE as grub-setup
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
@@ -84,7 +83,7 @@
INSTALL_DEVICE can be a GRUB device name or a system device filename.
-grub-install copies GRUB images into the DIR/boot directory specified by
+grub-install copies GRUB images into the DIR/`echo grub | sed
${transform}` directory specified by
--root-directory, and uses grub-setup to install grub into the boot
sector.
@@ -157,21 +156,7 @@
setup_verbose="--verbose"
fi
-# Initialize these directories here, since ROOTDIR was initialized.
-case "$host_os" in
-netbsd* | openbsd*)
- # Because /boot is used for the boot block in NetBSD and OpenBSD,
use /grub
- # instead of /boot/grub.
- grub_prefix=`echo /grub | sed ${transform}`
- bootdir=${rootdir}
- ;;
-*)
- # Use /boot/grub by default.
- bootdir=${rootdir}/boot
- ;;
-esac
-
-grubdir=${bootdir}/`echo grub | sed ${transform}`
+grubdir=${rootdir}/`echo grub | sed ${transform}`
device_map=${grubdir}/device.map
grub_probe="${grub_probe} --device-map=${device_map}"
@@ -204,8 +189,7 @@
fi
# Create the GRUB directory if it is not present.
-test -d "$bootdir" || mkdir "$bootdir" || exit 1
-test -d "$grubdir" || mkdir "$grubdir" || exit 1
+mkdir -p "$grubdir" || exit 1
# If --recheck is specified, remove the device map, if present.
if test $recheck = yes; then
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: boot directory prefix in grub-install (even with --root-directory)
2009-12-22 11:53 boot directory prefix in grub-install (even with --root-directory) Grégoire Sutre
@ 2009-12-22 12:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-22 12:30 ` Grégoire Sutre
2009-12-24 22:27 ` Robert Millan
2009-12-24 22:24 ` Robert Millan
1 sibling, 2 replies; 5+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2009-12-22 12:18 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 4068 bytes --]
Grégoire Sutre wrote:
> Hi,
>
> grub-install copies GRUB images into ${rootdir}/boot/grub (where
> ${rootdir} is empty by default and can be changed with --root-directory).
>
> To install GRUB files on a partition that contains a /boot file, one
> must specify a non-empty --root-directory, and grub files are then
> copied into /DIR/boot/grub. Or one could mount the partition on a
> mount point of the form DIR/boot and specify --root-directory=DIR to
> force installation into the /grub directory of the partition. Both
> solutions are not completely satisfactory. Is there a better one?
>
> The problem arises e.g. with NetBSD which uses /boot for its own
> bootloader. The script util/grub-install.in contains lines to take
> care of that situation (lines 160-172), but these lines rely on a
> variable ${host_os} that is not set. This might be deprecated code
> from GRUB Legacy's grub-install, where ${host_os} is set by a
> configure substitution.
>
> An alternative solution would be to have grub-install install in
> ${rootdir}/grub, with ${rootdir} equal to /boot by default. The
> default behavior (with no --root-directory) would be the same.
The main problem is with scripts already using --root-directory and
relying on existing behaviour. I propose add a new option
--grub-directory=DIR
which defaults to ROOTDIR/boot/grub
What do you think about this?
>
> The following patch implements this alternative.
>
> Thanks for your time,
>
> Grégoire
>
> --- util/grub-install.in.orig 2009-12-22 11:26:01.538833717 +0100
> +++ util/grub-install.in 2009-12-22 12:48:55.979476412 +0100
> @@ -39,8 +39,7 @@
> fi
> grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
> grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
> -rootdir=
> -grub_prefix=`echo /boot/grub | sed ${transform}`
> +rootdir=/boot
> modules=
>
> install_device=
> @@ -66,7 +65,7 @@
> -v, --version print the version information and exit
> --modules=MODULES pre-load specified modules MODULES
> --root-directory=DIR install GRUB images under the directory DIR
> - instead of the root directory
> + instead of ${rootdir}
> --grub-setup=FILE use FILE as grub-setup
> --grub-mkimage=FILE use FILE as grub-mkimage
> --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
> @@ -84,7 +83,7 @@
>
> INSTALL_DEVICE can be a GRUB device name or a system device filename.
>
> -grub-install copies GRUB images into the DIR/boot directory specified by
> +grub-install copies GRUB images into the DIR/`echo grub | sed
> ${transform}` directory specified by
> --root-directory, and uses grub-setup to install grub into the boot
> sector.
>
> @@ -157,21 +156,7 @@
> setup_verbose="--verbose"
> fi
>
> -# Initialize these directories here, since ROOTDIR was initialized.
> -case "$host_os" in
> -netbsd* | openbsd*)
> - # Because /boot is used for the boot block in NetBSD and OpenBSD,
> use /grub
> - # instead of /boot/grub.
> - grub_prefix=`echo /grub | sed ${transform}`
> - bootdir=${rootdir}
> - ;;
> -*)
> - # Use /boot/grub by default.
> - bootdir=${rootdir}/boot
> - ;;
> -esac
> -
> -grubdir=${bootdir}/`echo grub | sed ${transform}`
> +grubdir=${rootdir}/`echo grub | sed ${transform}`
> device_map=${grubdir}/device.map
>
> grub_probe="${grub_probe} --device-map=${device_map}"
> @@ -204,8 +189,7 @@
> fi
>
> # Create the GRUB directory if it is not present.
> -test -d "$bootdir" || mkdir "$bootdir" || exit 1
> -test -d "$grubdir" || mkdir "$grubdir" || exit 1
> +mkdir -p "$grubdir" || exit 1
>
> # If --recheck is specified, remove the device map, if present.
> if test $recheck = yes; then
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: boot directory prefix in grub-install (even with --root-directory)
2009-12-22 12:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2009-12-22 12:30 ` Grégoire Sutre
2009-12-24 22:27 ` Robert Millan
1 sibling, 0 replies; 5+ messages in thread
From: Grégoire Sutre @ 2009-12-22 12:30 UTC (permalink / raw)
To: The development of GNU GRUB
Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> The main problem is with scripts already using --root-directory and
> relying on existing behaviour.
Yes, you're right.
> I propose add a new option
> --grub-directory=DIR
> which defaults to ROOTDIR/boot/grub
> What do you think about this?
Nice, I'm looking forward to it. Thanks :-)
Grégoire
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: boot directory prefix in grub-install (even with --root-directory)
2009-12-22 12:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-22 12:30 ` Grégoire Sutre
@ 2009-12-24 22:27 ` Robert Millan
1 sibling, 0 replies; 5+ messages in thread
From: Robert Millan @ 2009-12-24 22:27 UTC (permalink / raw)
To: The development of GNU GRUB
On Tue, Dec 22, 2009 at 01:18:42PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Grégoire Sutre wrote:
> > Hi,
> >
> > grub-install copies GRUB images into ${rootdir}/boot/grub (where
> > ${rootdir} is empty by default and can be changed with --root-directory).
> >
> > To install GRUB files on a partition that contains a /boot file, one
> > must specify a non-empty --root-directory, and grub files are then
> > copied into /DIR/boot/grub. Or one could mount the partition on a
> > mount point of the form DIR/boot and specify --root-directory=DIR to
> > force installation into the /grub directory of the partition. Both
> > solutions are not completely satisfactory. Is there a better one?
> >
> > The problem arises e.g. with NetBSD which uses /boot for its own
> > bootloader. The script util/grub-install.in contains lines to take
> > care of that situation (lines 160-172), but these lines rely on a
> > variable ${host_os} that is not set. This might be deprecated code
> > from GRUB Legacy's grub-install, where ${host_os} is set by a
> > configure substitution.
> >
> > An alternative solution would be to have grub-install install in
> > ${rootdir}/grub, with ${rootdir} equal to /boot by default. The
> > default behavior (with no --root-directory) would be the same.
> The main problem is with scripts already using --root-directory and
> relying on existing behaviour. I propose add a new option
> --grub-directory=DIR
> which defaults to ROOTDIR/boot/grub
> What do you think about this?
If we do this, I'd just replace the old option completely. But a standalone
--grub-directory is a bit more complex.
It seems to me that the current scheme is laid out this way because we didn't
have grub-mkrelpath / make_path_relative_to_its_root() when designing it. A
proper solution would be to accept --grub-directory, then extract the relative
prefix from it.
--
Robert Millan
"Be the change you want to see in the world" -- Gandhi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: boot directory prefix in grub-install (even with --root-directory)
2009-12-22 11:53 boot directory prefix in grub-install (even with --root-directory) Grégoire Sutre
2009-12-22 12:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2009-12-24 22:24 ` Robert Millan
1 sibling, 0 replies; 5+ messages in thread
From: Robert Millan @ 2009-12-24 22:24 UTC (permalink / raw)
To: The development of GNU GRUB
On Tue, Dec 22, 2009 at 12:53:46PM +0100, Grégoire Sutre wrote:
> The problem arises e.g. with NetBSD which uses /boot for its own
> bootloader. The script util/grub-install.in contains lines to take care
> of that situation (lines 160-172), but these lines rely on a variable
> ${host_os} that is not set. This might be deprecated code from GRUB
> Legacy's grub-install, where ${host_os} is set by a configure
> substitution.
It derives from GRUB Legacy, but it's not deprecated. I just fixed $host_os
initialization (in Bazaar trunk).
--
Robert Millan
"Be the change you want to see in the world" -- Gandhi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-12-24 22:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-22 11:53 boot directory prefix in grub-install (even with --root-directory) Grégoire Sutre
2009-12-22 12:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-22 12:30 ` Grégoire Sutre
2009-12-24 22:27 ` Robert Millan
2009-12-24 22:24 ` Robert Millan
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.