All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub-install for EFI
@ 2007-05-11 16:03 Robert Millan
  2007-05-11 16:11 ` Robert Millan
  2007-05-15 20:16 ` [PATCH] grub-install for EFI Yoshinori K. Okuji
  0 siblings, 2 replies; 18+ messages in thread
From: Robert Millan @ 2007-05-11 16:03 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]


Hi,

Please have a look at this patch that adds grub-install for EFI and tell me
what you think.  I have some doubts/comments myself, and I'll reply to my own
message to use the patch context.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: efi_grub_install.diff --]
[-- Type: text/x-diff, Size: 8916 bytes --]

diff -Nur grub2-1.95+20070507.old/conf/i386-efi.rmk grub2-1.95+20070507/conf/i386-efi.rmk
--- grub2-1.95+20070507.old/conf/i386-efi.rmk	2007-05-11 17:45:18.000000000 +0200
+++ grub2-1.95+20070507/conf/i386-efi.rmk	2007-05-11 17:57:19.000000000 +0200
@@ -6,7 +6,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-#sbin_UTILITIES = grub-setup grub-mkdevicemap grub-probe
+sbin_UTILITIES = grub-mkdevicemap grub-probe
 #ifeq ($(enable_grub_emu), yes)
 #sbin_UTILITIES += grub-emu
 #endif
@@ -24,15 +24,16 @@
 #	kern/fs.c kern/env.c fs/fshelp.c
 
 # For grub-mkdevicemap.
-#grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
+grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
 # For grub-probe.
-#grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
-#	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
-#	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
-#	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
-#	fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c 	\
-#	fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c
+grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
+	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
+	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
+	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c		\
+	partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c	\
+	kern/env.c fs/fshelp.c fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c	\
+	disk/lvm.c disk/raid.c
 
 # For grub-emu.
 grub_emu_DEPENDENCIES = grub_script.tab.c grub_script.tab.h		\
diff -Nur grub2-1.95+20070507.old/util/i386/efi/grub-install.in grub2-1.95+20070507/util/i386/efi/grub-install.in
--- grub2-1.95+20070507.old/util/i386/efi/grub-install.in	1970-01-01 01:00:00.000000000 +0100
+++ grub2-1.95+20070507/util/i386/efi/grub-install.in	2007-05-11 18:00:44.000000000 +0200
@@ -0,0 +1,206 @@
+#! /bin/sh
+
+# Install GRUB on your EFI partition.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA.
+
+# Initialize some variables.
+transform="@program_transform_name@"
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+sbindir=@sbindir@
+bindir=@bindir@
+libdir=@libdir@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_TARNAME=@PACKAGE_TARNAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+target_cpu=@target_cpu@
+platform=@platform@
+pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+
+grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
+grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
+modules=
+
+install_directory=
+no_floppy=
+force_lba=
+recheck=no
+debug=no
+
+# Usage: usage
+# Print the usage.
+usage () {
+    cat <<EOF
+Usage: grub-install [OPTION] install_directory
+Install GRUB on your EFI partition.
+
+  -h, --help              print this message and exit
+  -v, --version           print the version information and exit
+  --modules=MODULES       pre-load specified modules MODULES
+  --grub-mkimage=FILE     use FILE as grub-mkimage
+  --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
+  --grub-probe=FILE       use FILE as grub-probe
+  --no-floppy             do not probe any floppy drive
+  --recheck               probe a device map even if it already exists
+
+INSTALL_DIRECTORY has to be the directory your EFI partition is mounted on.
+
+grub-install copies GRUB images into INSTALL_DIRECTORY.
+
+Report bugs to <bug-grub@gnu.org>.
+EOF
+}
+
+# Check the arguments.
+for option in "$@"; do
+    case "$option" in
+    -h | --help)
+	usage
+	exit 0 ;;
+    -v | --version)
+	echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
+	exit 0 ;;
+    --modules=*)
+	modules=`echo "$option" | sed 's/--modules=//'` ;;
+    --grub-mkimage=*)
+	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
+    --grub-mkdevicemap=*)
+	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
+    --grub-probe=*)
+	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
+    --no-floppy)
+	no_floppy="--no-floppy" ;;
+    --recheck)
+	recheck=yes ;;
+    # This is an undocumented feature...
+    --debug)
+	debug=yes ;;
+    -*)
+	echo "Unrecognized option \`$option'" 1>&2
+	usage
+	exit 1
+	;;
+    *)
+	if test "x$install_directory" != x; then
+	    echo "More than one install_directories?" 1>&2
+	    usage
+	    exit 1
+	fi
+	install_directory="${option}" ;;
+    esac
+done
+
+if test "x$install_directory" = x; then
+    echo "install_directory not specified." 1>&2
+    usage
+    exit 1
+fi
+
+# If the debugging feature is enabled, print commands.
+if test $debug = yes; then
+    set -x
+fi
+
+grubdir=${install_directory}
+device_map=${grubdir}/device.map
+
+# Check if GRUB is installed.
+set $grub_mkimage dummy
+if test -f "$1"; then
+    :
+else
+    echo "$1: Not found." 1>&2
+    exit 1
+fi
+
+set $grub_mkdevicemap dummy
+if test -f "$1"; then
+    :
+else
+    echo "$1: Not found." 1>&2
+    exit 1
+fi
+
+# Create the GRUB directory if it is not present.
+test -d "$grubdir" || mkdir "$grubdir" || exit 1
+
+# If --recheck is specified, remove the device map, if present.
+if test $recheck = yes; then
+    rm -f $device_map
+fi
+
+# Create the device map file if it is not present.
+if test -f "$device_map"; then
+    :
+else
+    # Create a safe temporary file.
+    test -n "$mklog" && log_file=`$mklog`
+
+    $grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
+fi
+
+# Make sure that there is no duplicated entry.
+tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
+    | sort | uniq -d | sed -n 1p`
+if test -n "$tmp"; then
+    echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
+    exit 1
+fi
+
+# Copy the GRUB images to the GRUB directory.
+for file in ${grubdir}/*.mod ${grubdir}/*.lst; do
+    if test -f $file && [ "`basename $file`" != menu.lst ]; then
+	rm -f $file || exit 1
+    fi
+done
+for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
+    cp -f $file ${grubdir} || exit 1
+done
+
+# Create the core image. First, auto-detect the filesystem module.
+fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
+if test "x$fs_module" = xfat; then :; else
+    echo "${grubdir} doesn't look like an EFI partition." 1>&2
+    exit 1
+fi
+
+# Then the partition map module.
+partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
+if test "x$partmap_module" = x -a "x$modules" = x; then
+    echo "Auto-detection of a partition map module failed." 1>&2
+    echo "Please specify the module with the option \`--modules' explicitly." 1>&2
+    exit 1
+fi
+
+# _chain is often useful
+modules="$modules $fs_module $partmap_module _chain"
+
+$grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
+
+# Prompt the user to check if the device map is correct.
+echo "Installation finished. No error reported."
+echo "This is the contents of the device map $device_map."
+echo "Check if this is correct or not. If any of the lines is incorrect,"
+echo "fix it and re-run the script \`grub-install'."
+echo
+
+cat $device_map
+
+# Bye.
+exit 0
diff -Nur grub2-1.95+20070507.old/util/i386/pc/biosdisk.c grub2-1.95+20070507/util/i386/pc/biosdisk.c
--- grub2-1.95+20070507.old/util/i386/pc/biosdisk.c	2007-05-11 17:45:18.000000000 +0200
+++ grub2-1.95+20070507/util/i386/pc/biosdisk.c	2007-05-11 17:57:19.000000000 +0200
@@ -18,7 +18,7 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <grub/machine/biosdisk.h>
+#include <grub/i386/pc/biosdisk.h>
 #include <grub/disk.h>
 #include <grub/partition.h>
 #include <grub/pc_partition.h>
diff -Nur grub2-1.95+20070507.old/util/i386/pc/grub-probe.c grub2-1.95+20070507/util/i386/pc/grub-probe.c
--- grub2-1.95+20070507.old/util/i386/pc/grub-probe.c	2007-05-11 17:45:18.000000000 +0200
+++ grub2-1.95+20070507/util/i386/pc/grub-probe.c	2007-05-11 17:57:19.000000000 +0200
@@ -26,7 +26,7 @@
 #include <grub/fs.h>
 #include <grub/partition.h>
 #include <grub/pc_partition.h>
-#include <grub/machine/util/biosdisk.h>
+#include <grub/i386/pc/util/biosdisk.h>
 #include <grub/util/getroot.h>
 #include <grub/term.h>
 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-11 16:03 [PATCH] grub-install for EFI Robert Millan
@ 2007-05-11 16:11 ` Robert Millan
  2007-05-11 16:21   ` Robert Millan
  2007-05-15 20:20   ` Yoshinori K. Okuji
  2007-05-15 20:16 ` [PATCH] grub-install for EFI Yoshinori K. Okuji
  1 sibling, 2 replies; 18+ messages in thread
From: Robert Millan @ 2007-05-11 16:11 UTC (permalink / raw)
  To: grub-devel

On Fri, May 11, 2007 at 06:03:14PM +0200, Robert Millan wrote:
> diff -Nur grub2-1.95+20070507.old/conf/i386-efi.rmk grub2-1.95+20070507/conf/i386-efi.rmk
> --- grub2-1.95+20070507.old/conf/i386-efi.rmk	2007-05-11 17:45:18.000000000 +0200
> +++ grub2-1.95+20070507/conf/i386-efi.rmk	2007-05-11 17:57:19.000000000 +0200
> @@ -6,7 +6,7 @@
>  
>  # Utilities.
>  bin_UTILITIES = grub-mkimage
> -#sbin_UTILITIES = grub-setup grub-mkdevicemap grub-probe
> +sbin_UTILITIES = grub-mkdevicemap grub-probe

grub-probe is needed to check partmap (so we don't have to assume gpt).

grub-mkdevicemap is needed to create device.map, without which grub-probe
won't work.

> diff -Nur grub2-1.95+20070507.old/util/i386/efi/grub-install.in grub2-1.95+20070507/util/i386/efi/grub-install.in
> --- grub2-1.95+20070507.old/util/i386/efi/grub-install.in	1970-01-01 01:00:00.000000000 +0100
> +++ grub2-1.95+20070507/util/i386/efi/grub-install.in	2007-05-11 18:00:44.000000000 +0200

Note: this grub-install.in is based on the i386/pc version.  I tried to keep
changes minimal, so if you diff them it'll produce readable output.

One thing that I'm not sure about is the CLI inconsistency.  Perhaps it
shouldn't take the directory as a standalone parameter, and instead use
--root-directory?

> diff -Nur grub2-1.95+20070507.old/util/i386/pc/biosdisk.c grub2-1.95+20070507/util/i386/pc/biosdisk.c
> --- grub2-1.95+20070507.old/util/i386/pc/biosdisk.c	2007-05-11 17:45:18.000000000 +0200
> +++ grub2-1.95+20070507/util/i386/pc/biosdisk.c	2007-05-11 17:57:19.000000000 +0200
> @@ -18,7 +18,7 @@
>   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  
> -#include <grub/machine/biosdisk.h>
> +#include <grub/i386/pc/biosdisk.h>
>  #include <grub/disk.h>
>  #include <grub/partition.h>
>  #include <grub/pc_partition.h>
> diff -Nur grub2-1.95+20070507.old/util/i386/pc/grub-probe.c grub2-1.95+20070507/util/i386/pc/grub-probe.c
> --- grub2-1.95+20070507.old/util/i386/pc/grub-probe.c	2007-05-11 17:45:18.000000000 +0200
> +++ grub2-1.95+20070507/util/i386/pc/grub-probe.c	2007-05-11 17:57:19.000000000 +0200
> @@ -26,7 +26,7 @@
>  #include <grub/fs.h>
>  #include <grub/partition.h>
>  #include <grub/pc_partition.h>
> -#include <grub/machine/util/biosdisk.h>
> +#include <grub/i386/pc/util/biosdisk.h>
>  #include <grub/util/getroot.h>
>  #include <grub/term.h>

Not really sure about these.  Seems ugly, but biosdisk.h has the
grub_util_biosdisk_get_grub_dev definition, which is not really
i386/pc-specific.  Also, note that powerpc needs them as well if we
want update-grub to work there (haven't submitted this part, because it
grub-probe on powerpc has other issues that I cannot debug).

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-11 16:11 ` Robert Millan
@ 2007-05-11 16:21   ` Robert Millan
  2007-05-15 18:23     ` new patch Robert Millan
  2007-05-15 20:22     ` [PATCH] grub-install for EFI Yoshinori K. Okuji
  2007-05-15 20:20   ` Yoshinori K. Okuji
  1 sibling, 2 replies; 18+ messages in thread
From: Robert Millan @ 2007-05-11 16:21 UTC (permalink / raw)
  To: grub-devel

On Fri, May 11, 2007 at 06:11:34PM +0200, Robert Millan wrote:
> 
> One thing that I'm not sure about is the CLI inconsistency.  Perhaps it
> shouldn't take the directory as a standalone parameter, and instead use
> --root-directory?

Or perhaps it should do like powerpc and check that /boot/grub is a mount
point?

# Find the partition at the right mount point.
install_device=`awk '$2 == '"\"$grubdir\""' { print $1 }' < /proc/mounts`
if test "x$install_device" = x; then
    echo "$grubdir must be a mount point."
    exit 1
fi

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* new patch
  2007-05-11 16:21   ` Robert Millan
@ 2007-05-15 18:23     ` Robert Millan
  2007-05-15 20:22     ` [PATCH] grub-install for EFI Yoshinori K. Okuji
  1 sibling, 0 replies; 18+ messages in thread
From: Robert Millan @ 2007-05-15 18:23 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]


New patch.  Fixed a few errors, enabled grub-install in sbin_SCRIPTS, and made
the CLI consistent with the other grub-installs.

The patch works in my qemu environment [1], so I've added it in Debian already.
If nobody objects, or reports that the patch is wrong whatsoever, I'll add it
to CVS in a few days.

Btw, since my new grub-install is based on the PC version and they're very
similar, I've also attached a diff between both versions so you can't check
more easily.

[1] Still, grub boots but can't access my filesystems.  But this seems
completely unrelated to grub-install, and probably caused by firmware bugs.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: efi.diff --]
[-- Type: text/x-diff, Size: 9607 bytes --]

diff -Nur grub2-1.95+20070507.old/conf/i386-efi.rmk grub2-1.95+20070507/conf/i386-efi.rmk
--- grub2-1.95+20070507.old/conf/i386-efi.rmk	2007-05-15 19:45:29.000000000 +0200
+++ grub2-1.95+20070507/conf/i386-efi.rmk	2007-05-15 19:45:48.000000000 +0200
@@ -6,7 +6,7 @@
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-#sbin_UTILITIES = grub-setup grub-mkdevicemap grub-probe
+sbin_UTILITIES = grub-mkdevicemap grub-probe
 #ifeq ($(enable_grub_emu), yes)
 #sbin_UTILITIES += grub-emu
 #endif
@@ -24,15 +24,16 @@
 #	kern/fs.c kern/env.c fs/fshelp.c
 
 # For grub-mkdevicemap.
-#grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
+grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
 
 # For grub-probe.
-#grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
-#	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
-#	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
-#	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c 	\
-#	fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c 	\
-#	fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c
+grub_probe_SOURCES = util/i386/pc/grub-probe.c	\
+	util/i386/pc/biosdisk.c	util/misc.c util/i386/pc/getroot.c	\
+	kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c	\
+	fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c		\
+	partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c	\
+	kern/env.c fs/fshelp.c fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c	\
+	disk/lvm.c disk/raid.c
 
 # For grub-emu.
 grub_emu_DEPENDENCIES = grub_script.tab.c grub_script.tab.h		\
@@ -63,10 +64,10 @@
 grub_emu_LDFLAGS = $(LIBCURSES)
 
 # Scripts.
-#sbin_SCRIPTS = grub-install
+sbin_SCRIPTS = grub-install
 
 # For grub-install.
-#grub_install_SOURCES = util/efi/pc/grub-install.in
+grub_install_SOURCES = util/i386/efi/grub-install.in
 
 # Modules.
 pkgdata_MODULES = kernel.mod normal.mod _chain.mod chain.mod \
diff -Nur grub2-1.95+20070507.old/util/i386/efi/grub-install.in grub2-1.95+20070507/util/i386/efi/grub-install.in
--- grub2-1.95+20070507.old/util/i386/efi/grub-install.in	1970-01-01 01:00:00.000000000 +0100
+++ grub2-1.95+20070507/util/i386/efi/grub-install.in	2007-05-15 19:45:40.000000000 +0200
@@ -0,0 +1,212 @@
+#! /bin/sh
+
+# Install GRUB on your EFI partition.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA.
+
+# Initialize some variables.
+transform="@program_transform_name@"
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+sbindir=@sbindir@
+bindir=@bindir@
+libdir=@libdir@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_TARNAME=@PACKAGE_TARNAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+target_cpu=@target_cpu@
+platform=@platform@
+pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+
+grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
+grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
+rootdir=
+grub_prefix=`echo /boot/grub | sed ${transform}`
+modules=
+
+no_floppy=
+force_lba=
+recheck=no
+debug=no
+
+# Usage: usage
+# Print the usage.
+usage () {
+    cat <<EOF
+Usage: grub-install [OPTION]
+Install GRUB on your EFI partition.
+
+  -h, --help              print this message and exit
+  -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
+  --grub-mkimage=FILE     use FILE as grub-mkimage
+  --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
+  --grub-probe=FILE       use FILE as grub-probe
+  --no-floppy             do not probe any floppy drive
+  --recheck               probe a device map even if it already exists
+
+grub-install copies GRUB images into the DIR/boot directory specfied by
+--root-directory.
+
+Report bugs to <bug-grub@gnu.org>.
+EOF
+}
+
+# Check the arguments.
+for option in "$@"; do
+    case "$option" in
+    -h | --help)
+	usage
+	exit 0 ;;
+    -v | --version)
+	echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
+	exit 0 ;;
+    --modules=*)
+	modules=`echo "$option" | sed 's/--modules=//'` ;;
+    --root-directory=*)
+	rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
+    --grub-mkimage=*)
+	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
+    --grub-mkdevicemap=*)
+	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
+    --grub-probe=*)
+	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
+    --no-floppy)
+	no_floppy="--no-floppy" ;;
+    --recheck)
+	recheck=yes ;;
+    # This is an undocumented feature...
+    --debug)
+	debug=yes ;;
+    *)
+	echo "Unrecognized option \`$option'" 1>&2
+	usage
+	exit 1
+	;;
+    esac
+done
+
+# If the debugging feature is enabled, print commands.
+if test $debug = yes; then
+    set -x
+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}`
+device_map=${grubdir}/device.map
+
+# Check if GRUB is installed.
+set $grub_mkimage dummy
+if test -f "$1"; then
+    :
+else
+    echo "$1: Not found." 1>&2
+    exit 1
+fi
+
+set $grub_mkdevicemap dummy
+if test -f "$1"; then
+    :
+else
+    echo "$1: Not found." 1>&2
+    exit 1
+fi
+
+# Create the GRUB directory if it is not present.
+test -d "$bootdir" || mkdir "$bootdir" || exit 1
+test -d "$grubdir" || mkdir "$grubdir" || exit 1
+
+# If --recheck is specified, remove the device map, if present.
+if test $recheck = yes; then
+    rm -f $device_map
+fi
+
+# Create the device map file if it is not present.
+if test -f "$device_map"; then
+    :
+else
+    # Create a safe temporary file.
+    test -n "$mklog" && log_file=`$mklog`
+
+    $grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
+fi
+
+# Make sure that there is no duplicated entry.
+tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
+    | sort | uniq -d | sed -n 1p`
+if test -n "$tmp"; then
+    echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
+    exit 1
+fi
+
+# Copy the GRUB images to the GRUB directory.
+for file in ${grubdir}/*.mod ${grubdir}/*.lst; do
+    if test -f $file && [ "`basename $file`" != menu.lst ]; then
+	rm -f $file || exit 1
+    fi
+done
+for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
+    cp -f $file ${grubdir} || exit 1
+done
+
+# Create the core image. First, auto-detect the filesystem module.
+fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
+if test "x$fs_module" = xfat; then :; else
+    echo "${grubdir} doesn't look like an EFI partition." 1>&2
+    exit 1
+fi
+
+# Then the partition map module.
+partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
+if test "x$partmap_module" = x -a "x$modules" = x; then
+    echo "Auto-detection of a partition map module failed." 1>&2
+    echo "Please specify the module with the option \`--modules' explicitly." 1>&2
+    exit 1
+fi
+
+# _chain is often useful
+modules="$modules $fs_module $partmap_module _chain"
+
+$grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
+
+# Prompt the user to check if the device map is correct.
+echo "Installation finished. No error reported."
+echo "This is the contents of the device map $device_map."
+echo "Check if this is correct or not. If any of the lines is incorrect,"
+echo "fix it and re-run the script \`grub-install'."
+echo
+
+cat $device_map
+
+# Bye.
+exit 0
diff -Nur grub2-1.95+20070507.old/util/i386/pc/biosdisk.c grub2-1.95+20070507/util/i386/pc/biosdisk.c
--- grub2-1.95+20070507.old/util/i386/pc/biosdisk.c	2007-05-15 19:45:19.000000000 +0200
+++ grub2-1.95+20070507/util/i386/pc/biosdisk.c	2007-05-15 19:45:40.000000000 +0200
@@ -18,7 +18,7 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <grub/machine/biosdisk.h>
+#include <grub/i386/pc/biosdisk.h>
 #include <grub/disk.h>
 #include <grub/partition.h>
 #include <grub/pc_partition.h>
diff -Nur grub2-1.95+20070507.old/util/i386/pc/grub-probe.c grub2-1.95+20070507/util/i386/pc/grub-probe.c
--- grub2-1.95+20070507.old/util/i386/pc/grub-probe.c	2007-05-15 19:45:19.000000000 +0200
+++ grub2-1.95+20070507/util/i386/pc/grub-probe.c	2007-05-15 19:45:40.000000000 +0200
@@ -26,7 +26,7 @@
 #include <grub/fs.h>
 #include <grub/partition.h>
 #include <grub/pc_partition.h>
-#include <grub/machine/util/biosdisk.h>
+#include <grub/i386/pc/util/biosdisk.h>
 #include <grub/util/getroot.h>
 #include <grub/term.h>
 

[-- Attachment #3: diff_between_pc_and_efi.diff --]
[-- Type: text/x-diff, Size: 4646 bytes --]

--- util/i386/pc/grub-install.in	2007-05-07 21:54:46.000000000 +0200
+++ util/i386/efi/grub-install.in	2007-05-15 20:22:05.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Install GRUB on your drive.
+# Install GRUB on your EFI partition.
 # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 platform=@platform@
 pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
 
-grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
 grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
 grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
 grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
@@ -40,7 +39,6 @@
 grub_prefix=`echo /boot/grub | sed ${transform}`
 modules=
 
-install_device=
 no_floppy=
 force_lba=
 recheck=no
@@ -50,26 +48,22 @@
 # Print the usage.
 usage () {
     cat <<EOF
-Usage: grub-install [OPTION] install_device
-Install GRUB on your drive.
+Usage: grub-install [OPTION]
+Install GRUB on your EFI partition.
 
   -h, --help              print this message and exit
   -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
-  --grub-setup=FILE       use FILE as grub-setup
   --grub-mkimage=FILE     use FILE as grub-mkimage
   --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
   --grub-probe=FILE       use FILE as grub-probe
   --no-floppy             do not probe any floppy drive
   --recheck               probe a device map even if it already exists
 
-INSTALL_DEVICE can be a GRUB device name or a system device filename.
-
 grub-install copies GRUB images into the DIR/boot directory specfied by
---root-directory, and uses grub-setup to install grub into the boot
-sector.
+--root-directory.
 
 Report bugs to <bug-grub@gnu.org>.
 EOF
@@ -88,8 +82,6 @@
 	modules=`echo "$option" | sed 's/--modules=//'` ;;
     --root-directory=*)
 	rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
-    --grub-setup=*)
-	grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
     --grub-mkimage=*)
 	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
     --grub-mkdevicemap=*)
@@ -103,27 +95,14 @@
     # This is an undocumented feature...
     --debug)
 	debug=yes ;;
-    -*)
+    *)
 	echo "Unrecognized option \`$option'" 1>&2
 	usage
 	exit 1
 	;;
-    *)
-	if test "x$install_device" != x; then
-	    echo "More than one install_devices?" 1>&2
-	    usage
-	    exit 1
-	fi
-	install_device="${option}" ;;
     esac
 done
 
-if test "x$install_device" = x; then
-    echo "install_device not specified." 1>&2
-    usage
-    exit 1
-fi
-
 # If the debugging feature is enabled, print commands.
 if test $debug = yes; then
     set -x
@@ -147,14 +126,6 @@
 device_map=${grubdir}/device.map
 
 # Check if GRUB is installed.
-set $grub_setup dummy
-if test -f "$1"; then
-    :
-else
-    echo "$1: Not found." 1>&2
-    exit 1
-fi
-
 set $grub_mkimage dummy
 if test -f "$1"; then
     :
@@ -199,20 +170,19 @@
 fi
 
 # Copy the GRUB images to the GRUB directory.
-for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
+for file in ${grubdir}/*.mod ${grubdir}/*.lst; do
     if test -f $file && [ "`basename $file`" != menu.lst ]; then
 	rm -f $file || exit 1
     fi
 done
-for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do
+for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
     cp -f $file ${grubdir} || exit 1
 done
 
 # Create the core image. First, auto-detect the filesystem module.
 fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
-if test "x$fs_module" = x -a "x$modules" = x; then
-    echo "Auto-detection of a filesystem module failed." 1>&2
-    echo "Please specify the module with the option \`--modules' explicitly." 1>&2
+if test "x$fs_module" = xfat; then :; else
+    echo "${grubdir} doesn't look like an EFI partition." 1>&2
     exit 1
 fi
 
@@ -227,11 +197,7 @@
 # _chain is often useful
 modules="$modules $fs_module $partmap_module _chain"
 
-$grub_mkimage --output=${grubdir}/core.img $modules || exit 1
-
-# Now perform the installation.
-$grub_setup --directory=${grubdir} --device-map=${device_map} \
-    ${install_device} || exit 1
+$grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
 
 # Prompt the user to check if the device map is correct.
 echo "Installation finished. No error reported."

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-11 16:03 [PATCH] grub-install for EFI Robert Millan
  2007-05-11 16:11 ` Robert Millan
@ 2007-05-15 20:16 ` Yoshinori K. Okuji
  2007-05-16  6:25   ` Robert Millan
  1 sibling, 1 reply; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-15 20:16 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 11 May 2007 18:03, Robert Millan wrote:
> Please have a look at this patch that adds grub-install for EFI and tell me
> what you think.  I have some doubts/comments myself, and I'll reply to my
> own message to use the patch context.

In my opinion, grub-install is not very useful without grub-setup. As I 
haven't reverse-engineered "bless" yet, I don't know how to implement it. I 
guess it just modifies some bytes in a superblock or somewhere, though.

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-11 16:11 ` Robert Millan
  2007-05-11 16:21   ` Robert Millan
@ 2007-05-15 20:20   ` Yoshinori K. Okuji
  2007-05-16  6:31     ` Robert Millan
  1 sibling, 1 reply; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-15 20:20 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 11 May 2007 18:11, Robert Millan wrote:
> grub-probe is needed to check partmap (so we don't have to assume gpt).

Yes.

> grub-mkdevicemap is needed to create device.map, without which grub-probe
> won't work.

Right.

> Note: this grub-install.in is based on the i386/pc version.  I tried to
> keep changes minimal, so if you diff them it'll produce readable output.
>
> One thing that I'm not sure about is the CLI inconsistency.  Perhaps it
> shouldn't take the directory as a standalone parameter, and instead use
> --root-directory?

Consistency is important, but it is not a must, as long as the user can easily 
guess the difference. In principle, you should respect consistency, but 
should not blindly believe in it. So if you think it is reasonable to make 
difference, you can. Otherwise, don't.

> Not really sure about these.  Seems ugly, but biosdisk.h has the
> grub_util_biosdisk_get_grub_dev definition, which is not really
> i386/pc-specific.  Also, note that powerpc needs them as well if we
> want update-grub to work there (haven't submitted this part, because it
> grub-probe on powerpc has other issues that I cannot debug).

If it is not specific to i386-pc, it should be moved to somewhere else.

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-11 16:21   ` Robert Millan
  2007-05-15 18:23     ` new patch Robert Millan
@ 2007-05-15 20:22     ` Yoshinori K. Okuji
  2007-05-16  6:17       ` Robert Millan
  1 sibling, 1 reply; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-15 20:22 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 11 May 2007 18:21, Robert Millan wrote:
> On Fri, May 11, 2007 at 06:11:34PM +0200, Robert Millan wrote:
> > One thing that I'm not sure about is the CLI inconsistency.  Perhaps it
> > shouldn't take the directory as a standalone parameter, and instead use
> > --root-directory?
>
> Or perhaps it should do like powerpc and check that /boot/grub is a mount
> point?
>
> # Find the partition at the right mount point.
> install_device=`awk '$2 == '"\"$grubdir\""' { print $1 }' < /proc/mounts`
> if test "x$install_device" = x; then
>     echo "$grubdir must be a mount point."
>     exit 1
> fi

It is a bad idea to use /proc, at least without checking the operating system. 
This makes the script unportable among host operating systems.

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-15 20:22     ` [PATCH] grub-install for EFI Yoshinori K. Okuji
@ 2007-05-16  6:17       ` Robert Millan
  2007-05-17 19:17         ` Yoshinori K. Okuji
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Millan @ 2007-05-16  6:17 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, May 15, 2007 at 10:22:06PM +0200, Yoshinori K. Okuji wrote:
> > Or perhaps it should do like powerpc and check that /boot/grub is a mount
> > point?
> >
> > # Find the partition at the right mount point.
> > install_device=`awk '$2 == '"\"$grubdir\""' { print $1 }' < /proc/mounts`
> > if test "x$install_device" = x; then
> >     echo "$grubdir must be a mount point."
> >     exit 1
> > fi
> 
> It is a bad idea to use /proc, at least without checking the operating system. 
> This makes the script unportable among host operating systems.

Note that this code is in powerpc/../grub-install.in already, and in my version
of i386/efi/grub-install.in it didn't made in.  Instead, sanity check there is:

  fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
  if test "x$fs_module" = xfat; then :; else
      echo "${grubdir} doesn't look like an EFI partition." 1>&2
      exit 1
  fi

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-15 20:16 ` [PATCH] grub-install for EFI Yoshinori K. Okuji
@ 2007-05-16  6:25   ` Robert Millan
  2007-05-17 19:18     ` Yoshinori K. Okuji
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Millan @ 2007-05-16  6:25 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, May 15, 2007 at 10:16:11PM +0200, Yoshinori K. Okuji wrote:
> On Friday 11 May 2007 18:03, Robert Millan wrote:
> > Please have a look at this patch that adds grub-install for EFI and tell me
> > what you think.  I have some doubts/comments myself, and I'll reply to my
> > own message to use the patch context.
> 
> In my opinion, grub-install is not very useful without grub-setup.

It saves a pair of things to the user (figuring out which modules are needed,
and what to do with the resulting grub.efi image).  From Debian POV, it's very
important so that grub installs can be automated from debian-installer (without
duplicating code, that is).

> As I 
> haven't reverse-engineered "bless" yet, I don't know how to implement it. I 
> guess it just modifies some bytes in a superblock or somewhere, though.

What is bless needed for?  In my environment (Debian GNU/Linux on a qemu
sandbox with EFI firmware), it was not necessary to get grub.efi booting
(although later it had issues accessing filesystems other than the EFI
partition, but I suppose this might be a qemu/firmware bug).

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-15 20:20   ` Yoshinori K. Okuji
@ 2007-05-16  6:31     ` Robert Millan
  2007-05-16 15:38       ` grub-install for EFI (please test) Robert Millan
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Millan @ 2007-05-16  6:31 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, May 15, 2007 at 10:20:41PM +0200, Yoshinori K. Okuji wrote:
> >
> > One thing that I'm not sure about is the CLI inconsistency.  Perhaps it
> > shouldn't take the directory as a standalone parameter, and instead use
> > --root-directory?
> 
> Consistency is important, but it is not a must, as long as the user can easily 
> guess the difference. In principle, you should respect consistency, but 
> should not blindly believe in it. So if you think it is reasonable to make 
> difference, you can. Otherwise, don't.

Ok.  My last version is mostly consistent (/boot/grub path is a default, and
can be overriden the same way), the difference being that it doesn't take any
non-flag argument.  But I think this difference is reasonable, specially
considering that i386/pc/grub-install and powerpc/grub-install already differ
on this part.

> > Not really sure about these.  Seems ugly, but biosdisk.h has the
> > grub_util_biosdisk_get_grub_dev definition, which is not really
> > i386/pc-specific.  Also, note that powerpc needs them as well if we
> > want update-grub to work there (haven't submitted this part, because it
> > grub-probe on powerpc has other issues that I cannot debug).
> 
> If it is not specific to i386-pc, it should be moved to somewhere else.

Will do.

Thanks,

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* grub-install for EFI (please test)
  2007-05-16  6:31     ` Robert Millan
@ 2007-05-16 15:38       ` Robert Millan
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Millan @ 2007-05-16 15:38 UTC (permalink / raw)
  To: The development of GRUB 2


My grub-install for EFI is in CVS now.  I would appreciate if someone can
test it on real hardware, since it's only known to work in qemu. :-)

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-16  6:17       ` Robert Millan
@ 2007-05-17 19:17         ` Yoshinori K. Okuji
  0 siblings, 0 replies; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-17 19:17 UTC (permalink / raw)
  To: The development of GRUB 2

On Wednesday 16 May 2007 08:17, Robert Millan wrote:
> Note that this code is in powerpc/../grub-install.in already, and in my
> version of i386/efi/grub-install.in it didn't made in.  Instead, sanity
> check there is:

This means that I was not careful enough to review the powerpc-specific code. 
This must be fixed.

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-16  6:25   ` Robert Millan
@ 2007-05-17 19:18     ` Yoshinori K. Okuji
  2007-05-18  6:37       ` Robert Millan
  0 siblings, 1 reply; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-17 19:18 UTC (permalink / raw)
  To: The development of GRUB 2

On Wednesday 16 May 2007 08:25, Robert Millan wrote:
> On Tue, May 15, 2007 at 10:16:11PM +0200, Yoshinori K. Okuji wrote:
> > On Friday 11 May 2007 18:03, Robert Millan wrote:
> > > Please have a look at this patch that adds grub-install for EFI and
> > > tell me what you think.  I have some doubts/comments myself, and I'll
> > > reply to my own message to use the patch context.
> >
> > In my opinion, grub-install is not very useful without grub-setup.
>
> It saves a pair of things to the user (figuring out which modules are
> needed, and what to do with the resulting grub.efi image).  From Debian
> POV, it's very important so that grub installs can be automated from
> debian-installer (without duplicating code, that is).

Providing a rudimentary tool rather harms the user.

>
> > As I
> > haven't reverse-engineered "bless" yet, I don't know how to implement it.
> > I guess it just modifies some bytes in a superblock or somewhere, though.
>
> What is bless needed for?  In my environment (Debian GNU/Linux on a qemu
> sandbox with EFI firmware), it was not necessary to get grub.efi booting
> (although later it had issues accessing filesystems other than the EFI
> partition, but I suppose this might be a qemu/firmware bug).

http://www.hmug.org/man/8/bless.php

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-17 19:18     ` Yoshinori K. Okuji
@ 2007-05-18  6:37       ` Robert Millan
  2007-05-18 18:27         ` Yoshinori K. Okuji
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Millan @ 2007-05-18  6:37 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, May 17, 2007 at 09:18:41PM +0200, Yoshinori K. Okuji wrote:
> On Wednesday 16 May 2007 08:25, Robert Millan wrote:
> > On Tue, May 15, 2007 at 10:16:11PM +0200, Yoshinori K. Okuji wrote:
> > > On Friday 11 May 2007 18:03, Robert Millan wrote:
> > > > Please have a look at this patch that adds grub-install for EFI and
> > > > tell me what you think.  I have some doubts/comments myself, and I'll
> > > > reply to my own message to use the patch context.
> > >
> > > In my opinion, grub-install is not very useful without grub-setup.
> >
> > It saves a pair of things to the user (figuring out which modules are
> > needed, and what to do with the resulting grub.efi image).  From Debian
> > POV, it's very important so that grub installs can be automated from
> > debian-installer (without duplicating code, that is).
> 
> Providing a rudimentary tool rather harms the user.

What do you mean?  It's almost the same that the powerpc version does.

> > > As I
> > > haven't reverse-engineered "bless" yet, I don't know how to implement it.
> > > I guess it just modifies some bytes in a superblock or somewhere, though.
> >
> > What is bless needed for?  In my environment (Debian GNU/Linux on a qemu
> > sandbox with EFI firmware), it was not necessary to get grub.efi booting
> > (although later it had issues accessing filesystems other than the EFI
> > partition, but I suppose this might be a qemu/firmware bug).
> 
> http://www.hmug.org/man/8/bless.php

I see.. but user still can boot grub.efi manualy via EFI shell, right?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-18  6:37       ` Robert Millan
@ 2007-05-18 18:27         ` Yoshinori K. Okuji
  2007-05-19  9:43           ` Robert Millan
  0 siblings, 1 reply; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-18 18:27 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 18 May 2007 08:37, Robert Millan wrote:
> > Providing a rudimentary tool rather harms the user.
>
> What do you mean?  It's almost the same that the powerpc version does.

The powerpc version is not a good reference. From my point of view, it is far 
from user-friendly. When the user invokes grub-install, she expects that she 
can "install" GRUB, as the name stands for.

The best reference in GRUB is still the i386-pc version. The others should 
follow it as much as possible.

> > http://www.hmug.org/man/8/bless.php
>
> I see.. but user still can boot grub.efi manualy via EFI shell, right?

If an EFI shell is available, yes. On Intel Mac, the shell is not available by 
default, because of the graphics mode. For now, the only way to boot GRUB is 
to start Mac OS X and bless a boot image, or use a small program to switch to 
text mode and boot GRUB from a shell.

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-18 18:27         ` Yoshinori K. Okuji
@ 2007-05-19  9:43           ` Robert Millan
  2007-05-19 17:21             ` Yoshinori K. Okuji
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Millan @ 2007-05-19  9:43 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, May 18, 2007 at 08:27:57PM +0200, Yoshinori K. Okuji wrote:
> On Friday 18 May 2007 08:37, Robert Millan wrote:
> > > Providing a rudimentary tool rather harms the user.
> >
> > What do you mean?  It's almost the same that the powerpc version does.
> 
> The powerpc version is not a good reference. From my point of view, it is far 
> from user-friendly. When the user invokes grub-install, she expects that she 
> can "install" GRUB, as the name stands for.
> 
> The best reference in GRUB is still the i386-pc version. The others should 
> follow it as much as possible.

Ok.  So, what interface we should provide to the user?  I've been told that the
files shouldn't be in the root of EFI partition, but in a subdirectory like
/efi/grub.  Should this directory be specified by the user?  We could make it
something like:

  $ sudo grub-install /something/efi/grub
  doesn't look like an EFI partition.
  $ mount /dev/sda1 /something
  $ sudo grub-install /something/efi/grub

OTOH, making it like:

  $ sudo grub-install "(hd0)"
  # /efi/grub being implicit here

forces us to mount/umount and opens a can of worms wrt portability.

What do you think?

> > > http://www.hmug.org/man/8/bless.php
> >
> > I see.. but user still can boot grub.efi manualy via EFI shell, right?
> 
> If an EFI shell is available, yes. On Intel Mac, the shell is not available by 
> default, because of the graphics mode. For now, the only way to boot GRUB is 
> to start Mac OS X and bless a boot image, or use a small program to switch to 
> text mode and boot GRUB from a shell.

Perhaps we should look at the refit source and see how bless-like functionality
is implemented?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-19  9:43           ` Robert Millan
@ 2007-05-19 17:21             ` Yoshinori K. Okuji
  2007-05-20  7:19               ` Robert Millan
  0 siblings, 1 reply; 18+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-19 17:21 UTC (permalink / raw)
  To: The development of GRUB 2

On Saturday 19 May 2007 11:43, Robert Millan wrote:
> Ok.  So, what interface we should provide to the user?  I've been told that
> the files shouldn't be in the root of EFI partition, but in a subdirectory
> like /efi/grub.  Should this directory be specified by the user?  We could
> make it something like:
>
>   $ sudo grub-install /something/efi/grub
>   doesn't look like an EFI partition.
>   $ mount /dev/sda1 /something
>   $ sudo grub-install /something/efi/grub
>
> OTOH, making it like:
>
>   $ sudo grub-install "(hd0)"
>   # /efi/grub being implicit here
>
> forces us to mount/umount and opens a can of worms wrt portability.
>
> What do you think?

Not bad. The prefix can be anything. It can be even /boot/grub. On EFI, the 
prefix is dynamically passed to GRUB, so the decision is very flexible.

> Perhaps we should look at the refit source and see how bless-like
> functionality is implemented?

When I looked at it at the last time, the documentation only said that you 
would write it to somewhere, and execute bless on Mac OS X. Things might have 
changed, but I don't know.

Okuji



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] grub-install for EFI
  2007-05-19 17:21             ` Yoshinori K. Okuji
@ 2007-05-20  7:19               ` Robert Millan
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Millan @ 2007-05-20  7:19 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, May 19, 2007 at 07:21:24PM +0200, Yoshinori K. Okuji wrote:
> On Saturday 19 May 2007 11:43, Robert Millan wrote:
> > Ok.  So, what interface we should provide to the user?  I've been told that
> > the files shouldn't be in the root of EFI partition, but in a subdirectory
> > like /efi/grub.  Should this directory be specified by the user?  We could
> > make it something like:
> >
> >   $ sudo grub-install /something/efi/grub
> >   doesn't look like an EFI partition.
> >   $ mount /dev/sda1 /something
> >   $ sudo grub-install /something/efi/grub
> >
> > OTOH, making it like:
> >
> >   $ sudo grub-install "(hd0)"
> >   # /efi/grub being implicit here
> >
> > forces us to mount/umount and opens a can of worms wrt portability.
> >
> > What do you think?
> 
> Not bad. The prefix can be anything. It can be even /boot/grub. On EFI, the 
> prefix is dynamically passed to GRUB, so the decision is very flexible.

You mean the first one?  Note that in the current version (i.e. no arguments),
--root-directory still works, so it's still possible to override this path.

> > Perhaps we should look at the refit source and see how bless-like
> > functionality is implemented?
> 
> When I looked at it at the last time, the documentation only said that you 
> would write it to somewhere, and execute bless on Mac OS X. Things might have 
> changed, but I don't know.

I'll have a look later..

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2007-05-20  7:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11 16:03 [PATCH] grub-install for EFI Robert Millan
2007-05-11 16:11 ` Robert Millan
2007-05-11 16:21   ` Robert Millan
2007-05-15 18:23     ` new patch Robert Millan
2007-05-15 20:22     ` [PATCH] grub-install for EFI Yoshinori K. Okuji
2007-05-16  6:17       ` Robert Millan
2007-05-17 19:17         ` Yoshinori K. Okuji
2007-05-15 20:20   ` Yoshinori K. Okuji
2007-05-16  6:31     ` Robert Millan
2007-05-16 15:38       ` grub-install for EFI (please test) Robert Millan
2007-05-15 20:16 ` [PATCH] grub-install for EFI Yoshinori K. Okuji
2007-05-16  6:25   ` Robert Millan
2007-05-17 19:18     ` Yoshinori K. Okuji
2007-05-18  6:37       ` Robert Millan
2007-05-18 18:27         ` Yoshinori K. Okuji
2007-05-19  9:43           ` Robert Millan
2007-05-19 17:21             ` Yoshinori K. Okuji
2007-05-20  7:19               ` 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.