From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NN3JK-0003na-Uc for mharc-grub-devel@gnu.org; Tue, 22 Dec 2009 06:53:54 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NN3JI-0003lG-Du for grub-devel@gnu.org; Tue, 22 Dec 2009 06:53:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NN3JD-0003hW-IC for grub-devel@gnu.org; Tue, 22 Dec 2009 06:53:51 -0500 Received: from [199.232.76.173] (port=40319 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NN3JD-0003hT-FS for grub-devel@gnu.org; Tue, 22 Dec 2009 06:53:47 -0500 Received: from iona.labri.fr ([147.210.8.143]:45647) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NN3JD-0006WS-1d for grub-devel@gnu.org; Tue, 22 Dec 2009 06:53:47 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by iona.labri.fr (Postfix) with ESMTP id DD3C536B82 for ; Tue, 22 Dec 2009 12:53:43 +0100 (CET) X-Virus-Scanned: amavisd-new at labri.fr Received: from iona.labri.fr ([127.0.0.1]) by localhost (iona.labri.fr [127.0.0.1]) (amavisd-new, port 10027) with LMTP id Rdq-llAok+jI for ; Tue, 22 Dec 2009 12:53:43 +0100 (CET) Received: from [192.168.1.50] (c2433-1-88-160-112-182.fbx.proxad.net [88.160.112.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by iona.labri.fr (Postfix) with ESMTP id 9FB6636B75 for ; Tue, 22 Dec 2009 12:53:43 +0100 (CET) Message-ID: <4B30B34A.6030600@labri.fr> Date: Tue, 22 Dec 2009 12:53:46 +0100 From: =?ISO-8859-1?Q?Gr=E9goire_Sutre?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: boot directory prefix in grub-install (even with --root-directory) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 11:53:52 -0000 Hi, grub-install copies GRUB images into ${rootdir}/boot/grub (where=20 ${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=20 must specify a non-empty --root-directory, and grub files are then=20 copied into /DIR/boot/grub. Or one could mount the partition on a mount=20 point of the form DIR/boot and specify --root-directory=3DDIR to force=20 installation into the /grub directory of the partition. Both solutions=20 are not completely satisfactory. Is there a better one? The problem arises e.g. with NetBSD which uses /boot for its own=20 bootloader. The script util/grub-install.in contains lines to take care=20 of that situation (lines 160-172), but these lines rely on a variable=20 ${host_os} that is not set. This might be deprecated code from GRUB=20 Legacy's grub-install, where ${host_os} is set by a configure substitutio= n. An alternative solution would be to have grub-install install in=20 ${rootdir}/grub, with ${rootdir} equal to /boot by default. The default=20 behavior (with no --root-directory) would be the same. The following patch implements this alternative. Thanks for your time, Gr=E9goire --- 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=3D${sbindir}/`echo grub-mkdevicemap | sed ${transform}= ` grub_probe=3D${sbindir}/`echo grub-probe | sed ${transform}` -rootdir=3D -grub_prefix=3D`echo /boot/grub | sed ${transform}` +rootdir=3D/boot modules=3D install_device=3D @@ -66,7 +65,7 @@ -v, --version print the version information and exit --modules=3DMODULES pre-load specified modules MODULES --root-directory=3DDIR install GRUB images under the directory DIR - instead of the root directory + instead of ${rootdir} --grub-setup=3DFILE use FILE as grub-setup --grub-mkimage=3DFILE use FILE as grub-mkimage --grub-mkdevicemap=3DFILE 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=20 ${transform}` directory specified by --root-directory, and uses grub-setup to install grub into the boot sector. @@ -157,21 +156,7 @@ setup_verbose=3D"--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,=20 use /grub - # instead of /boot/grub. - grub_prefix=3D`echo /grub | sed ${transform}` - bootdir=3D${rootdir} - ;; -*) - # Use /boot/grub by default. - bootdir=3D${rootdir}/boot - ;; -esac - -grubdir=3D${bootdir}/`echo grub | sed ${transform}` +grubdir=3D${rootdir}/`echo grub | sed ${transform}` device_map=3D${grubdir}/device.map grub_probe=3D"${grub_probe} --device-map=3D${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 =3D yes; then