]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Provide grub-install on coreboot.
authorrobertmh <robertmh@localhost>
Fri, 28 Nov 2008 20:06:55 +0000 (20:06 +0000)
committerrobertmh <robertmh@localhost>
Fri, 28 Nov 2008 20:06:55 +0000 (20:06 +0000)
        * conf/i386-coreboot.rmk (sbin_SCRIPTS): Add `grub-install'.
        (grub_install_SOURCES): New variable.
        * util/i386/pc/grub-install.in: Add a few condition checks to make it
        usable on coreboot.

ChangeLog
conf/i386-coreboot.mk
conf/i386-coreboot.rmk
util/i386/pc/grub-install.in

index 6e474ee67e430a654fbb9d01ec8652030803905c..47c523ac542667def7e261aff7f71b36f3dd7d32 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,12 @@
        `kern/ieee1275/mmap.c'.
        * include/grub/powerpc/ieee1275/memory.h: New file.
 
+       Provide grub-install on coreboot.
+       * conf/i386-coreboot.rmk (sbin_SCRIPTS): Add `grub-install'.
+       (grub_install_SOURCES): New variable.
+       * util/i386/pc/grub-install.in: Add a few condition checks to make it
+       usable on coreboot.
+
 2008-11-25  Felix Zielcke  <fzielcke@z-51.de>
 
        * util/grub-fstest.c (grub_term_get_current_input): Change return type
index 4c087293edd473d778564b269fda83434fdb4761..1689f6d785ae959011332c8d327cfcd09d89c16e 100644 (file)
@@ -565,6 +565,15 @@ grub_emu-grub_emu_init.o: grub_emu_init.c $(grub_emu_init.c_DEPENDENCIES)
 
 grub_emu_LDFLAGS = $(LIBCURSES)
 
+sbin_SCRIPTS += grub-install
+grub_install_SOURCES = util/i386/pc/grub-install.in
+CLEANFILES += grub-install
+
+grub-install: util/i386/pc/grub-install.in $(util/i386/pc/grub-install.in_DEPENDENCIES) config.status
+       ./config.status --file=grub-install:util/i386/pc/grub-install.in
+       chmod +x $@
+
+
 # Modules.
 pkglib_MODULES = _linux.mod linux.mod normal.mod       \
        _multiboot.mod multiboot.mod aout.mod           \
index 0635378b10b9f336877260dfceaa23e7803f201e..ac9ea8f747a19bcf543ead6e546cff8ddb1bec59 100644 (file)
@@ -90,6 +90,9 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c      \
 
 grub_emu_LDFLAGS = $(LIBCURSES)
 
+sbin_SCRIPTS += grub-install
+grub_install_SOURCES = util/i386/pc/grub-install.in
+
 # Modules.
 pkglib_MODULES = _linux.mod linux.mod normal.mod       \
        _multiboot.mod multiboot.mod aout.mod           \
index 4b39cbfdd61f344dcda1ff8f0f20425a4cf1ced1..ff1ed1e755f9e72bca1d4b869150623ad9220713 100644 (file)
@@ -32,7 +32,11 @@ 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}`
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+    grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+else
+    grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
+fi
 grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
 grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
 rootdir=
@@ -153,12 +157,14 @@ device_map=${grubdir}/device.map
 grub_probe="${grub_probe} --device-map=${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
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+    set $grub_setup dummy
+    if test -f "$1"; then
+        :
+    else
+        echo "$1: Not found." 1>&2
+        exit 1
+    fi
 fi
 
 set $grub_mkimage dummy
@@ -210,9 +216,14 @@ for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
        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
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+    for file in ${pkglibdir}/*.img; do
+        cp -f $file ${grubdir} || exit 1
+    done
+fi
 
 # Write device to a variable so we don't have to traverse /dev every time.
 grub_device=`$grub_probe --target=device ${grubdir}`
@@ -234,7 +245,12 @@ partmap_module=`$grub_probe --target=partmap --device ${grub_device} 2> /dev/nul
 devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
 
 # The order in this list is critical.  Be careful when modifying it.
-modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+    modules="$modules biosdisk"
+else
+    modules="$modules ata"
+fi
+modules="$modules $fs_module $partmap_module $devabstraction_module"
 
 prefix_drive=
 if [ "x${devabstraction_module}" = "x" ] ; then
@@ -248,7 +264,16 @@ if [ "x${devabstraction_module}" = "x" ] ; then
     # Strip partition number
     install_drive="`echo ${install_drive} | sed -e s/,[0-9]*//g`"
     grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*//g`"
-    if [ "x${grub_drive}" != "x${install_drive}" ] ; then
+    if [ "${target_cpu}-${platform}" != "i386-pc" ] ; then
+        # generic method (used on coreboot)
+        uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
+        if [ "x${uuid}" = "x" ] ; then
+          echo "UUID needed on this platform, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
+          exit 1
+        fi
+        prefix_drive="(UUID=${uuid})"
+        modules="$modules fs_uuid"
+    elif [ "x${grub_drive}" != "x${install_drive}" ] ; then
         uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
         if [ "x${uuid}" = "x" ] ; then
           echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
@@ -266,11 +291,15 @@ if [ "x${relative_grubdir}" = "x" ] ; then
     relative_grubdir=/
 fi
 
-$grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+    $grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
 
-# Now perform the installation.
-$grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
-    ${install_device} || exit 1
+    # Now perform the installation.
+    $grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
+        ${install_device} || exit 1
+else
+    $grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
+fi
 
 # Prompt the user to check if the device map is correct.
 echo "Installation finished. No error reported."