summaryrefslogtreecommitdiffstats
path: root/abs/core/grub
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/grub')
-rw-r--r--abs/core/grub/PKGBUILD40
-rw-r--r--abs/core/grub/ext4.patch263
-rw-r--r--abs/core/grub/grub.install22
-rw-r--r--[-rwxr-xr-x]abs/core/grub/install-grub676
-rwxr-xr-xabs/core/grub/install-grub.orig187
-rw-r--r--abs/core/grub/menu.lst10
6 files changed, 1011 insertions, 187 deletions
diff --git a/abs/core/grub/PKGBUILD b/abs/core/grub/PKGBUILD
index 398d782..38c6a28 100644
--- a/abs/core/grub/PKGBUILD
+++ b/abs/core/grub/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
-# Maintainer: judd <jvinet@zeroflux.org>
+# $Id: PKGBUILD 22874 2008-12-29 18:25:08Z tpowa $
+# Maintainer: Ronald van Haren <ronald.archlinux.org>
pkgname=grub
pkgver=0.97
-pkgrel=21
+pkgrel=31
pkgdesc="A GNU multiboot boot loader"
arch=('i686' 'x86_64')
license=('GPL')
@@ -20,27 +20,16 @@ source=(ftp://alpha.gnu.org/gnu/grub/grub-$pkgver.tar.gz
more-raid.patch
intelmac.patch
grub-inode-size.patch
- grub-0.97-gpt.patch)
+ ext4.patch)
backup=('boot/grub/menu.lst')
-md5sums=('cd3f3eb54446be6003156158d51f4884'
- 'cce52ae9ee1f8686cd700b3c967e78f9'
- '3182c4ae4963a16930bc772bba89dacf'
- 'eb9d69c46af3a0667c1f651817d7f075'
- 'ccd2d757e79e3a03dc19ede7391ed328'
- '826fdbf446067f9861baf9f6a69a4583'
- '49f6d4bcced0bc8bbcff273f3254bbfa'
- 'f41f702014a064918d7afc6fc23baa6e'
- '175dc6b9f4ab94e8056c3afb3e34460a'
- 'ada26cbc681907823cc4ff2a55b97866'
- '52cd09a6966f12961d11f7b3b7e76bd2')
+install=grub.install
build() {
- cd $startdir/src/$pkgname-$pkgver
+ cd $srcdir/$pkgname-$pkgver
#set destination architecture here
DESTARCH="i686"
#DESTARCH="x86_64"
-
# optimizations break the build -- disable them
# adding special devices to grub, patches are from fedora
patch -Np1 -i ../special-devices.patch || return 1
@@ -49,9 +38,9 @@ build() {
patch -Np1 -i ../intelmac.patch || return 1
# Add support for bigger inode size to e2fs_stage1_5
patch -Np1 -i ../grub-inode-size.patch || return 1
- # Add gpt support
- # http://bugs.archlinux.org/task/9864
- patch -Np1 -i ../grub-0.97-gpt.patch || return 1
+ # Add ext4 support
+ # http://www.mail-archive.com/bug-grub@gnu.org/msg11458.html
+ patch -Np1 -i ../ext4.patch || return 1
#arch64 fixes for static build
if [ "$CARCH" = "x86_64" ]; then
@@ -63,16 +52,21 @@ build() {
patch -Np1 -i ../040_all_grub-0.96-nxstack.patch || return 1
# patch from frugalware to make it boot when more than 2GB ram installed
patch -Np1 -i ../05-grub-0.97-initrdaddr.diff || return 1
- CFLAGS="-static" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin
+ CFLAGS="-static" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
+ --mandir=/usr/share/man --infodir=/usr/share/info
else
- CFLAGS= ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin
+ CFLAGS= ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
+ --mandir=/usr/share/man --infodir=/usr/share/info
fi
fi
CFLAGS= make || return 1
- make DESTDIR=$startdir/pkg install
+ make DESTDIR=$pkgdir install || return 1
install -D -m644 ../menu.lst $startdir/pkg/boot/grub/menu.lst
install -D -m755 ../install-grub $startdir/pkg/sbin/install-grub
+
+ rm -f $pkgdir/usr/share/info/dir || return 1
+ gzip /$pkgdir/usr/share/info/*
if [ "$DESTARCH" = "x86_64" ]; then
# fool makepkg into building a x86_64 package
diff --git a/abs/core/grub/ext4.patch b/abs/core/grub/ext4.patch
new file mode 100644
index 0000000..8a2f9bd
--- /dev/null
+++ b/abs/core/grub/ext4.patch
@@ -0,0 +1,263 @@
+diff -ruNp grub-0.97/stage2/fsys_ext2fs.c grub-0.97-patch/stage2/fsys_ext2fs.c
+--- grub-0.97/stage2/fsys_ext2fs.c 2004-08-08 20:19:18.000000000 +0200
++++ grub-0.97-patch/stage2/fsys_ext2fs.c 2007-12-29 16:25:19.000000000
++0100
+@@ -51,6 +51,9 @@ typedef unsigned int __u32;
+ #define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
+ #define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
+
++/* Inode flags */
++#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
++
+ /* include/linux/ext2_fs.h */
+ struct ext2_super_block
+ {
+@@ -191,6 +194,42 @@ struct ext2_dir_entry
+ #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
+ ~EXT2_DIR_ROUND)
+
++/* linux/ext4_fs_extents.h */
++/*
++ * This is the extent on-disk structure.
++ * It's used at the bottom of the tree.
++ */
++struct ext4_extent {
++ __u32 ee_block; /* first logical block extent covers */
++ __u16 ee_len; /* number of blocks covered by extent */
++ __u16 ee_start_hi; /* high 16 bits of physical block */
++ __u32 ee_start; /* low 32 bits of physical block */
++};
++
++/*
++ * This is index on-disk structure.
++ * It's used at all the levels except the bottom.
++ */
++struct ext4_extent_idx {
++ __u32 ei_block; /* index covers logical blocks from 'block' */
++ __u32 ei_leaf; /* pointer to the physical block of the next *
++ * level. leaf or next index could be there */
++ __u16 ei_leaf_hi; /* high 16 bits of physical block */
++ __u16 ei_unused;
++};
++
++/*
++ * Each block (leaves and indexes), even inode-stored has header.
++ */
++struct ext4_extent_header {
++ __u16 eh_magic; /* probably will support different formats */
++ __u16 eh_entries; /* number of valid entries */
++ __u16 eh_max; /* capacity of store in entries */
++ __u16 eh_depth; /* has tree real underlying blocks? */
++ __u32 eh_generation; /* generation of the tree */
++};
++
++#define EXT4_EXT_MAGIC 0xf30a
+
+ /* ext2/super.c */
+ #define log2(n) ffz(~(n))
+@@ -279,6 +318,26 @@ ext2_rdfsb (int fsblock, int buffer)
+ EXT2_BLOCK_SIZE (SUPERBLOCK), (char *) buffer);
+ }
+
++/* Walk through extents index tree to find the good leaf */
++static struct ext4_extent_header *
++ext4_recurse_extent_index(struct ext4_extent_header *extent_block, int logical_block)
++{
++ int i;
++ struct ext4_extent_idx *index = (struct ext4_extent_idx *) (extent_block + 1);
++ if (extent_block->eh_magic != EXT4_EXT_MAGIC)
++ return NULL;
++ if (extent_block->eh_depth == 0)
++ return extent_block;
++ for (i = 0; i < extent_block->eh_entries; i++)
++ {
++ if (logical_block < index[i].ei_block)
++ break;
++ }
++ if (i == 0 || !ext2_rdfsb(index[i-1].ei_leaf, DATABLOCK1))
++ return NULL;
++ return (ext4_recurse_extent_index((struct ext4_extent_header *) DATABLOCK1, logical_block));
++}
++
+ /* from
+ ext2/inode.c:ext2_bmap()
+ */
+--- grub-0.97/stage2/fsys_ext2fs.c~ 2008-12-28 20:19:00.000000000 +0100
++++ grub-0.97/stage2/fsys_ext2fs.c 2008-12-28 20:19:00.000000000 +0100
+@@ -366,83 +366,106 @@
+ }
+ printf ("logical block %d\n", logical_block);
+ #endif /* E2DEBUG */
+-
+- /* if it is directly pointed to by the inode, return that physical addr */
+- if (logical_block < EXT2_NDIR_BLOCKS)
+- {
+-#ifdef E2DEBUG
+- printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block]));
+- printf ("returning %d\n", INODE->i_block[logical_block]);
+-#endif /* E2DEBUG */
+- return INODE->i_block[logical_block];
+- }
+- /* else */
+- logical_block -= EXT2_NDIR_BLOCKS;
+- /* try the indirect block */
+- if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK))
++ /* standard ext2 inode */
++ if (!(INODE->i_flags & EXT4_EXTENTS_FL))
+ {
+- if (mapblock1 != 1
+- && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1))
+- {
+- errnum = ERR_FSYS_CORRUPT;
+- return -1;
+- }
+- mapblock1 = 1;
+- return ((__u32 *) DATABLOCK1)[logical_block];
+- }
+- /* else */
+- logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK);
+- /* now try the double indirect block */
+- if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)))
+- {
+- int bnum;
+- if (mapblock1 != 2
+- && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1))
+- {
+- errnum = ERR_FSYS_CORRUPT;
+- return -1;
+- }
+- mapblock1 = 2;
+- if ((bnum = (((__u32 *) DATABLOCK1)
+- [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)]))
+- != mapblock2
+- && !ext2_rdfsb (bnum, DATABLOCK2))
+- {
+- errnum = ERR_FSYS_CORRUPT;
+- return -1;
+- }
+- mapblock2 = bnum;
++ /* if it is directly pointed to by the inode, return that physical addr */
++ if (logical_block < EXT2_NDIR_BLOCKS)
++ {
++#ifdef E2DEBUG
++ printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block]));
++ printf ("returning %d\n", INODE->i_block[logical_block]);
++#endif /* E2DEBUG */
++ return INODE->i_block[logical_block];
++ }
++ /* else */
++ logical_block -= EXT2_NDIR_BLOCKS;
++ /* try the indirect block */
++ if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK))
++ {
++ if (mapblock1 != 1
++ && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1))
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
++ mapblock1 = 1;
++ return ((__u32 *) DATABLOCK1)[logical_block];
++ }
++ /* else */
++ logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK);
++ /* now try the double indirect block */
++ if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)))
++ {
++ int bnum;
++ if (mapblock1 != 2
++ && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1))
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
++ mapblock1 = 2;
++ if ((bnum = (((__u32 *) DATABLOCK1)
++ [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)]))
++ != mapblock2
++ && !ext2_rdfsb (bnum, DATABLOCK2))
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
++ mapblock2 = bnum;
++ return ((__u32 *) DATABLOCK2)
++ [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
++ }
++ /* else */
++ mapblock2 = -1;
++ logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2));
++ if (mapblock1 != 3
++ && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1))
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
++ mapblock1 = 3;
++ if (!ext2_rdfsb (((__u32 *) DATABLOCK1)
++ [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)
++ * 2)],
++ DATABLOCK2))
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
++ if (!ext2_rdfsb (((__u32 *) DATABLOCK2)
++ [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK))
++ & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)],
++ DATABLOCK2))
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
+ return ((__u32 *) DATABLOCK2)
+- [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
+- }
+- /* else */
+- mapblock2 = -1;
+- logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2));
+- if (mapblock1 != 3
+- && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1))
+- {
+- errnum = ERR_FSYS_CORRUPT;
+- return -1;
++ [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
+ }
+- mapblock1 = 3;
+- if (!ext2_rdfsb (((__u32 *) DATABLOCK1)
+- [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)
+- * 2)],
+- DATABLOCK2))
+- {
+- errnum = ERR_FSYS_CORRUPT;
+- return -1;
+- }
+- if (!ext2_rdfsb (((__u32 *) DATABLOCK2)
+- [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK))
+- & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)],
+- DATABLOCK2))
++ /* inode is in extents format */
++ else
+ {
++ int i;
++ struct ext4_extent_header *extent_hdr = ext4_recurse_extent_index((struct ext4_extent_header *) INODE->i_block, logical_block);
++ struct ext4_extent *extent = (struct ext4_extent *) (extent_hdr + 1);
++ if ( extent_hdr == NULL || extent_hdr->eh_magic != EXT4_EXT_MAGIC)
++ {
++ errnum = ERR_FSYS_CORRUPT;
++ return -1;
++ }
++ for (i = 0; i<extent_hdr->eh_entries; i++)
++ {
++ if (extent[i].ee_block <= logical_block && logical_block < extent[i].ee_block + extent[i].ee_len && !(extent[i].ee_len>>15))
++ return (logical_block - extent[i].ee_block + extent[i].ee_start);
++ }
++ /* We should not arrive here */
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+- return ((__u32 *) DATABLOCK2)
+- [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
+ }
+
+ /* preconditions: all preconds of ext2fs_block_map */
diff --git a/abs/core/grub/grub.install b/abs/core/grub/grub.install
new file mode 100644
index 0000000..bf52382
--- /dev/null
+++ b/abs/core/grub/grub.install
@@ -0,0 +1,22 @@
+info_dir=/usr/share/info
+info_files=(grub.info multiboot.info)
+
+post_install() {
+ for f in ${info_files[@]}; do
+ install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ for f in ${info_files[@]}; do
+ install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
+ done
+}
+
+
+
+
diff --git a/abs/core/grub/install-grub b/abs/core/grub/install-grub
index 3eb7ce5..0015a31 100755..100644
--- a/abs/core/grub/install-grub
+++ b/abs/core/grub/install-grub
@@ -1,187 +1,543 @@
-#!/bin/bash
+#! /bin/sh
+# Install GRUB on your drive.
+# Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
#
-# This is a little helper script that tries to convert linux-style device
-# names to grub-style. It's not very smart, so it
-# probably won't work for more complicated setups.
+# 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.
#
-# If it doesn't work for you, try installing grub manually:
-#
-# # mkdir -p /boot/grub
-# # cp /usr/lib/grub/i386-pc/* /boot/grub/
-#
-# Then start up the 'grub' shell and run something like the following:
-#
-# grub> root(hd0,0)
-# grub> setup(hd0)
-#
-# The "root" line should point to the partition your kernel is located on,
-# /boot if you have a separate boot partition, otherwise your root (/).
-#
-# The "setup" line tells grub which disc/partition to install the
-# bootloader to. In the example above, it will install to the MBR of the
-# primary master hard drive.
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Initialize some variables.
+prefix=/
+exec_prefix=${prefix}
+sbindir=${exec_prefix}/sbin
+libdir=${exec_prefix}/lib
+PACKAGE=grub
+VERSION=0.95
+host_cpu=i386
+host_os=linux-gnu
+host_vendor=pc
+pkglibdir=${libdir}/${PACKAGE}/${host_cpu}-${host_vendor}
+
+grub_shell=${sbindir}/grub
+log_file=/tmp/grub-install.log.$$
+img_file=/tmp/grub-install.img.$$
+rootdir=
+grub_prefix=/boot/grub
+
+install_device=
+no_floppy=
+force_lba=
+recheck=no
+sync_sleep=20
+debug=no
+
+# look for secure tempfile creation wrappers on this platform
+if test -x /bin/tempfile; then
+ mklog="/bin/tempfile --prefix=grub"
+ mkimg="/bin/tempfile --prefix=grub"
+elif test -x /bin/mktemp; then
+ mklog="/bin/mktemp /tmp/grub-install.log.XXXXXX"
+ mkimg="/bin/mktemp /tmp/grub-install.img.XXXXXX"
+else
+ mklog=""
+ mkimg=""
+fi
+
+# Usage: usage
+# Print the usage.
+usage () {
+ cat <<EOF
+Usage: grub-install [OPTION] install_device
+Install GRUB on your drive.
+
+ -h, --help print this message and exit
+ -v, --version print the version information and exit
+ --root-directory=DIR install GRUB images under the directory DIR
+ instead of the root directory
+ --grub-shell=FILE use FILE as the grub shell
+ --no-floppy do not probe any floppy drive
+ --force-lba force GRUB to use LBA mode even for a buggy
+ BIOS
+ --recheck probe a device map even if it already exists
+ --sync-sleep number of seconds to sleep while trying to
+ sync XFS
+
+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 the grub shell to install grub into the boot
+sector.
+
+Report bugs to <bug-grub@gnu.org>.
+EOF
+}
+
+# Usage: getraid_mdadm mddevice
+# Routine to find a physical device from an md device
+# If found, the first grub BIOS device (from device.map) is returned
+# If no BIOS drives match the RAID devices, the first device returned
+# from mdadm -D is returned
+getraid_mdadm() {
+ device=$1
+ mdadm=$(mdadm -D "$device") || {
+ echo "$PROG: mdadm -D $device failed" >&2
+ exit 1
+ }
+ eval "$(
+ echo "$mdadm" | awk '
+ $1 == "Number" && $2 == "Major" { start = 1; next }
+ $1 == "UUID" { print "uuid=" $3; start = 0; next }
+ !start { next }
+ $2 == 0 && $3 == 0 { next }
+ { devices = devices "\n" $NF }
+ END { print "devices='\''" devices "'\''" }
+ '
+ )"
+
+ # Convert RAID devices list into a list of disks
+ tmp_disks=`echo "$devices" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
+ -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
+ -e 's%\(fd[0-9]*\)$%\1%' \
+ -e 's%/part[0-9]*$%/disc%' \
+ -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
+ -e '/^$/d' |
+ sed -n '1h;2,$H;${g;s/\n/|/g;p}'`
+
+ # Find first BIOS disk that's a member of the RAID array
+ # Default to first RAID member if no tmp_disks are BIOS devices
+ set -- `egrep $tmp_disks $device_map | \
+ sort | \
+ sed -n 1p `
+ device=${2:-${tmp_disks%%|*}}
+
+ # Return first partition on BIOS disk that's part of the RAID
+ echo "$devices" | \
+ sed -n "\:${device}:p" | \
+ sed -n 1p
+}
+
+# Usage: xfs_hack
+# Routine to flush xfs filesystem log (sync doesn't do this)
+# sleep is needed to give time for the log to be flushed
+xfs_hack () {
+ sync
+ if which xfs_freeze >/dev/null ; then
+ echo "Trying to sync filesystem, do not interrupt until complete."
+ xfs_freeze -f ${grubdir} 2>/dev/null
+ sleep $sync_sleep
+ xfs_freeze -u ${grubdir} 2>/dev/null
+ echo "Trying to sync filesystem is complete."
+ fi
+}
-usage() {
- echo "usage: install-grub <install_device> [boot_device]"
- echo
- echo "where <install_device> is the device where Grub will be installed"
- echo "and [boot_device] is the partition that contains the /boot"
- echo "directory (auto-detected if omitted)"
- echo
- echo "examples: install-grub /dev/hda"
- echo " install-grub /dev/hda /dev/hda1"
- echo
- exit 0
+# Usage: convert os_device
+# Convert an OS device to the corresponding GRUB drive.
+# This part is OS-specific.
+convert () {
+ # First, check if the device file exists.
+ if test -e "$1"; then
+ :
+ else
+ echo "$1: Not found or not a block device." 1>&2
+ exit 1
+ fi
+
+ # Break the device name into the disk part and the partition part.
+ case "$host_os" in
+ linux*)
+ # Find an actual physical device if we're passed a RAID device
+ case $1 in
+ /dev/md*) set -- `getraid_mdadm $1`
+ esac
+ tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
+ -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
+ -e 's%\(fd[0-9]*\)$%\1%' \
+ -e 's%/part[0-9]*$%/disc%' \
+ -e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
+ tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
+ -e 's%.*d[0-9]*p*%%' \
+ -e 's%.*/fd[0-9]*$%%' \
+ -e 's%.*/floppy/[0-9]*$%%' \
+ -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
+ -e 's%.*c[0-7]d[0-9]*p*%%'`
+ ;;
+ gnu*)
+ tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
+ tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
+ freebsd*)
+ tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \
+ | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'`
+ tmp_part=`echo "$1" \
+ | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
+ | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"`
+ ;;
+ netbsd*)
+ tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' \
+ | sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'`
+ tmp_part=`echo "$1" \
+ | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"`
+ ;;
+ *)
+ echo "grub-install does not support your OS yet." 1>&2
+ exit 1 ;;
+ esac
+
+ # Get the drive name.
+ tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \
+ | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'`
+
+ # If not found, print an error message and exit.
+ if test "x$tmp_drive" = x; then
+ echo "$1 does not have any corresponding BIOS drive." 1>&2
+ exit 1
+ fi
+
+ if test "x$tmp_part" != x; then
+ # If a partition is specified, we need to translate it into the
+ # GRUB's syntax.
+ case "$host_os" in
+ linux*)
+ echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;;
+ gnu*)
+ if echo $tmp_part | grep "^s" >/dev/null; then
+ tmp_pc_slice=`echo $tmp_part \
+ | sed "s%s\([0-9]*\)[a-g]*$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
+ fi
+ if echo $tmp_part | grep "[a-g]$" >/dev/null; then
+ tmp_bsd_partition=`echo "$tmp_part" \
+ | sed "s%[^a-g]*\([a-g]\)$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,$tmp_bsd_partition)%"`
+ fi
+ echo "$tmp_drive" ;;
+ freebsd*)
+ if echo $tmp_part | grep "^s" >/dev/null; then
+ tmp_pc_slice=`echo $tmp_part \
+ | sed "s%s\([0-9]*\)[a-h]*$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
+ fi
+ if echo $tmp_part | grep "[a-h]$" >/dev/null; then
+ tmp_bsd_partition=`echo "$tmp_part" \
+ | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,$tmp_bsd_partition)%"`
+ fi
+ echo "$tmp_drive" ;;
+ netbsd*)
+ if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then
+ tmp_bsd_partition=`echo "$tmp_part" \
+ | sed "s%\([a-p]\)$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,$tmp_bsd_partition)%"`
+ fi
+ echo "$tmp_drive" ;;
+ esac
+ else
+ # If no partition is specified, just print the drive name.
+ echo "$tmp_drive"
+ fi
}
-## new install-grub, code was taken from setup script
-ROOTDEV=$1
-PART_ROOT=$2
-VMLINUZ=vmlinuz26
+# Usage: resolve_symlink file
+# Find the real file/device that file points at
+resolve_symlink () {
+ tmp_fname=$1
+ # Resolve symlinks
+ while test -L $tmp_fname; do
+ tmp_new_fname=`ls -al $tmp_fname | sed -n 's%.*-> \(.*\)%\1%p'`
+ if test -z "$tmp_new_fname"; then
+ echo "Unrecognized ls output" 2>&1
+ exit 1
+ fi
+
+ # Convert relative symlinks
+ case $tmp_new_fname in
+ /*) tmp_fname="$tmp_new_fname"
+ ;;
+ *) tmp_fname="`echo $tmp_fname | sed 's%/[^/]*$%%'`/$tmp_new_fname"
+ ;;
+ esac
+ done
+ echo "$tmp_fname"
+}
+
+# Usage: find_device file
+# Find block device on which the file resides.
+find_device () {
+ # For now, this uses the program `df' to get the device name, but is
+ # this really portable?
+ tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^ ]*\).*%\1%p'`
+
+ if test -z "$tmp_fname"; then
+ echo "Could not find device for $1" 2>&1
+ exit 1
+ fi
+
+ tmp_fname=`resolve_symlink $tmp_fname`
-if [ "$ROOTDEV" = "" ]; then
+ echo "$tmp_fname"
+}
+
+# Check the arguments.
+for option in "$@"; do
+ case "$option" in
+ -h | --help)
+ usage
+ exit 0 ;;
+ -v | --version)
+ echo "grub-install (GNU GRUB ${VERSION})"
+ exit 0 ;;
+ --root-directory=*)
+ rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
+ --grub-shell=*)
+ grub_shell=`echo "$option" | sed 's/--grub-shell=//'` ;;
+ --no-floppy)
+ no_floppy="--no-floppy" ;;
+ --force-lba)
+ force_lba="--force-lba" ;;
+ --recheck)
+ recheck=yes ;;
+ --sync-sleep=*)
+ sync_sleep=`echo "$option" | sed 's/--sync-sleep=//'` ;;
+ # 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 [ "$PART_ROOT" = "" ]; then
- PART_ROOT=$(mount | grep "on /boot type" | cut -d' ' -f 1)
+
+# If the debugging feature is enabled, print commands.
+if test $debug = yes; then
+ set -x
fi
-if [ "$PART_ROOT" = "" ]; then
- PART_ROOT=$(mount | grep "on / type" | cut -d' ' -f 1)
+
+# Initialize these directories here, since ROOTDIR was initialized.
+case "$host_os" in
+netbsd*)
+ # Because /boot is used for the boot block in NetBSD, use /grub
+ # instead of /boot/grub.
+ grub_prefix=/grub
+ bootdir=${rootdir}
+ ;;
+*)
+ # Use /boot/grub by default.
+ bootdir=${rootdir}/boot
+ ;;
+esac
+
+grubdir=${bootdir}/grub
+device_map=${grubdir}/device.map
+
+# Check if GRUB is installed.
+# This is necessary, because the user can specify "grub --read-only".
+set $grub_shell dummy
+if test -f "$1"; then
+ :
+else
+ echo "$1: Not found." 1>&2
+ exit 1
fi
-if [ "$PART_ROOT" = "" ]; then
- echo "error: could not determine BOOT_DEVICE, please specify manually" >&2
- exit 1
+
+if test -f "$pkglibdir/stage1"; then
+ :
+else
+ echo "${pkglibdir}/stage1: Not found." 1>&2
+ exit 1
fi
+if test -f "$pkglibdir/stage2"; then
+ :
+else
+ echo "${pkglibdir}/stage2: Not found." 1>&2
+ exit 1
+fi
+
+# Don't check for *stage1_5, because it is not fatal even if any
+# Stage 1.5 does not exist.
-get_grub_map() {
- [ -e /tmp/dev.map ] && rm /tmp/dev.map
- /sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF
+# 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`
+
+ xfs_hack
+ $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
quit
EOF
-}
+ if grep "Error [0-9]*: " $log_file >/dev/null; then
+ cat $log_file 1>&2
+ exit 1
+ fi
-mapdev() {
- partition_flag=0
- device_found=0
- devs=$(cat /tmp/dev.map | grep -v fd | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g')
- linuxdevice=$(echo $1 | cut -b1-8)
- if [ "$(echo $1 | egrep '[0-9]$')" ]; then
- # /dev/hdXY
- pnum=$(echo $1 | cut -b9-)
- pnum=$(($pnum-1))
- partition_flag=1
- fi
- for dev in $devs
- do
- if [ "(" = $(echo $dev | cut -b1) ]; then
- grubdevice="$dev"
- else
- if [ "$dev" = "$linuxdevice" ]; then
- device_found=1
- break
- fi
- fi
- done
- if [ "$device_found" = "1" ]; then
- if [ "$partition_flag" = "0" ]; then
- echo "$grubdevice"
- else
- grubdevice_stringlen=${#grubdevice}
- let grubdevice_stringlen--
- grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen)
- echo "$grubdevice,$pnum)"
- fi
- else
- echo " DEVICE NOT FOUND"
- fi
-}
+ rm -f $log_file
+fi
-dogrub() {
- get_grub_map
- if [ ! -f /boot/grub/menu.lst ]; then
- echo "Error: Couldn't find /boot/grub/menu.lst. Is GRUB installed?"
- exit 1
- fi
- # try to auto-configure GRUB...
- if [ "$PART_ROOT" != "" -a "$S_GRUB" != "1" ]; then
- grubdev=$(mapdev $PART_ROOT)
- # look for a separately-mounted /boot partition
- bootdev=$(mount | grep /boot | cut -d' ' -f 1)
- if [ "$grubdev" != "" -o "$bootdev" != "" ]; then
- cp /boot/grub/menu.lst /tmp/.menu.lst
- # remove the default entries by truncating the file at our little tag (#-*)
- head -n $(cat /tmp/.menu.lst | grep -n '#-\*' | cut -d: -f 1) /tmp/.menu.lst >/boot/grub/menu.lst
- rm -f /tmp/.menu.lst
- echo "" >>/boot/grub/menu.lst
- echo "# (0) Arch Linux" >>/boot/grub/menu.lst
- echo "title Arch Linux" >>/boot/grub/menu.lst
- subdir=
- if [ "$bootdev" != "" ]; then
- grubdev=$(mapdev $bootdev)
- else
- subdir="/boot"
- fi
- echo "root $grubdev" >>/boot/grub/menu.lst
- echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst
- if [ "$VMLINUZ" = "vmlinuz26" ]; then
- echo "initrd $subdir/kernel26.img" >>/boot/grub/menu.lst
- fi
- echo "" >>/boot/grub/menu.lst
- # adding fallback/full image
- echo "# (1) Arch Linux" >>/boot/grub/menu.lst
- echo "title Arch Linux Fallback" >>/boot/grub/menu.lst
- echo "root $grubdev" >>/boot/grub/menu.lst
- echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst
- if [ "$VMLINUZ" = "vmlinuz26" ]; then
- echo "initrd $subdir/kernel26-fallback.img" >>/boot/grub/menu.lst
- fi
- echo "" >>/boot/grub/menu.lst
- fi
- 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
- echo "Installing the GRUB bootloader..."
- cp -a /usr/lib/grub/i386-pc/* /boot/grub/
- sync
- # freeze xfs filesystems to enable grub installation on xfs filesystems
- if [ -x /usr/sbin/xfs_freeze ]; then
- /usr/sbin/xfs_freeze -f /boot > /dev/null 2>&1
- /usr/sbin/xfs_freeze -f / > /dev/null 2>&1
- fi
- # look for a separately-mounted /boot partition
- bootpart=$(mount | grep /boot | cut -d' ' -f 1)
- if [ "$bootpart" = "" ]; then
- bootpart=$PART_ROOT
- fi
- bootpart=$(mapdev $bootpart)
- bootdev=$(mapdev $ROOTDEV)
- if [ "$bootpart" = "" ]; then
- echo "Error: Missing/Invalid root device: $bootpart"
- exit 1
- fi
- /sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF
-root $bootpart
-setup $bootdev
+# Check for INSTALL_DEVICE.
+case "$install_device" in
+/dev/*)
+ install_device=`resolve_symlink "$install_device"`
+ install_drive=`convert "$install_device"`
+ # I don't know why, but some shells wouldn't die if exit is
+ # called in a function.
+ if test "x$install_drive" = x; then
+ exit 1
+ fi ;;
+\([hf]d[0-9]*\))
+ install_drive="$install_device" ;;
+[hf]d[0-9]*)
+ # The GRUB format with no parenthesis.
+ install_drive="($install_device)" ;;
+*)
+ echo "Format of install_device not recognized." 1>&2
+ usage
+ exit 1 ;;
+esac
+
+# Get the root drive.
+root_device=`find_device ${rootdir}`
+bootdir_device=`find_device ${bootdir}`
+
+# Check if the boot directory is in the same device as the root directory.
+if test "x$root_device" != "x$bootdir_device"; then
+ # Perhaps the user has a separate boot partition.
+ root_device=$bootdir_device
+ grub_prefix="/grub"
+fi
+
+# Convert the root device to a GRUB drive.
+root_drive=`convert "$root_device"`
+if test "x$root_drive" = x; then
+ exit 1
+fi
+
+# Check if the root directory exists in the same device as the grub
+# directory.
+grubdir_device=`find_device ${grubdir}`
+
+if test "x$grubdir_device" != "x$root_device"; then
+ # For now, cannot deal with this situation.
+ cat <<EOF 1>&2
+You must set the root directory by the option --root-directory, because
+$grubdir does not exist in the root device $root_device.
+EOF
+ exit 1
+fi
+
+# Copy the GRUB images to the GRUB directory.
+for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
+ rm -f $file || exit 1
+done
+for file in \
+ ${pkglibdir}/stage1 ${pkglibdir}/stage2 ${pkglibdir}/*stage1_5; do
+ cp -f $file ${grubdir} || exit 1
+done
+xfs_hack
+
+# Make sure that GRUB reads the same images as the host OS.
+test -n "$mkimg" && img_file=`$mkimg`
+test -n "$mklog" && log_file=`$mklog`
+
+for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
+ count=5
+ tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"`
+ while test $count -gt 0; do
+ $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
+dump ${root_drive}${tmp} ${img_file}
quit
EOF
-cat /tmp/grub.log
- # unfreeze xfs filesystems
- if [ -x /usr/sbin/xfs_freeze ]; then
- /usr/sbin/xfs_freeze -u /boot > /dev/null 2>&1
- /usr/sbin/xfs_freeze -u / > /dev/null 2>&1
+ if grep "Error [0-9]*: " $log_file >/dev/null; then
+ :
+ elif cmp $file $img_file >/dev/null; then
+ break
fi
+ sleep 1
+ count=`expr $count - 1`
+ done
+ if test $count -eq 0; then
+ echo "The file $file not read correctly." 1>&2
+ exit 1
+ fi
+done
- if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then
- echo "Error installing GRUB. (see /tmp/grub.log for output)"
- exit 1
- fi
- echo "GRUB was successfully installed."
+rm -f $img_file
+rm -f $log_file
-rm -f /tmp/grub.log
+# Create a safe temporary file.
+test -n "$mklog" && log_file=`$mklog`
-exit 0
-}
+# Now perform the installation.
+xfs_hack
+$grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
+root $root_drive
+setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $install_drive
+quit
+EOF
-dogrub \ No newline at end of file
+if grep "Error [0-9]*: " $log_file >/dev/null || test $debug = yes; then
+ cat $log_file 1>&2
+ exit 1
+fi
+
+rm -f $log_file
+
+# 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 --git a/abs/core/grub/install-grub.orig b/abs/core/grub/install-grub.orig
new file mode 100755
index 0000000..3eb7ce5
--- /dev/null
+++ b/abs/core/grub/install-grub.orig
@@ -0,0 +1,187 @@
+#!/bin/bash
+
+#
+# This is a little helper script that tries to convert linux-style device
+# names to grub-style. It's not very smart, so it
+# probably won't work for more complicated setups.
+#
+# If it doesn't work for you, try installing grub manually:
+#
+# # mkdir -p /boot/grub
+# # cp /usr/lib/grub/i386-pc/* /boot/grub/
+#
+# Then start up the 'grub' shell and run something like the following:
+#
+# grub> root(hd0,0)
+# grub> setup(hd0)
+#
+# The "root" line should point to the partition your kernel is located on,
+# /boot if you have a separate boot partition, otherwise your root (/).
+#
+# The "setup" line tells grub which disc/partition to install the
+# bootloader to. In the example above, it will install to the MBR of the
+# primary master hard drive.
+#
+
+usage() {
+ echo "usage: install-grub <install_device> [boot_device]"
+ echo
+ echo "where <install_device> is the device where Grub will be installed"
+ echo "and [boot_device] is the partition that contains the /boot"
+ echo "directory (auto-detected if omitted)"
+ echo
+ echo "examples: install-grub /dev/hda"
+ echo " install-grub /dev/hda /dev/hda1"
+ echo
+ exit 0
+}
+
+## new install-grub, code was taken from setup script
+ROOTDEV=$1
+PART_ROOT=$2
+VMLINUZ=vmlinuz26
+
+if [ "$ROOTDEV" = "" ]; then
+ usage
+fi
+if [ "$PART_ROOT" = "" ]; then
+ PART_ROOT=$(mount | grep "on /boot type" | cut -d' ' -f 1)
+fi
+if [ "$PART_ROOT" = "" ]; then
+ PART_ROOT=$(mount | grep "on / type" | cut -d' ' -f 1)
+fi
+if [ "$PART_ROOT" = "" ]; then
+ echo "error: could not determine BOOT_DEVICE, please specify manually" >&2
+ exit 1
+fi
+
+
+get_grub_map() {
+ [ -e /tmp/dev.map ] && rm /tmp/dev.map
+ /sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF
+quit
+EOF
+}
+
+mapdev() {
+ partition_flag=0
+ device_found=0
+ devs=$(cat /tmp/dev.map | grep -v fd | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g')
+ linuxdevice=$(echo $1 | cut -b1-8)
+ if [ "$(echo $1 | egrep '[0-9]$')" ]; then
+ # /dev/hdXY
+ pnum=$(echo $1 | cut -b9-)
+ pnum=$(($pnum-1))
+ partition_flag=1
+ fi
+ for dev in $devs
+ do
+ if [ "(" = $(echo $dev | cut -b1) ]; then
+ grubdevice="$dev"
+ else
+ if [ "$dev" = "$linuxdevice" ]; then
+ device_found=1
+ break
+ fi
+ fi
+ done
+ if [ "$device_found" = "1" ]; then
+ if [ "$partition_flag" = "0" ]; then
+ echo "$grubdevice"
+ else
+ grubdevice_stringlen=${#grubdevice}
+ let grubdevice_stringlen--
+ grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen)
+ echo "$grubdevice,$pnum)"
+ fi
+ else
+ echo " DEVICE NOT FOUND"
+ fi
+}
+
+dogrub() {
+ get_grub_map
+ if [ ! -f /boot/grub/menu.lst ]; then
+ echo "Error: Couldn't find /boot/grub/menu.lst. Is GRUB installed?"
+ exit 1
+ fi
+ # try to auto-configure GRUB...
+ if [ "$PART_ROOT" != "" -a "$S_GRUB" != "1" ]; then
+ grubdev=$(mapdev $PART_ROOT)
+ # look for a separately-mounted /boot partition
+ bootdev=$(mount | grep /boot | cut -d' ' -f 1)
+ if [ "$grubdev" != "" -o "$bootdev" != "" ]; then
+ cp /boot/grub/menu.lst /tmp/.menu.lst
+ # remove the default entries by truncating the file at our little tag (#-*)
+ head -n $(cat /tmp/.menu.lst | grep -n '#-\*' | cut -d: -f 1) /tmp/.menu.lst >/boot/grub/menu.lst
+ rm -f /tmp/.menu.lst
+ echo "" >>/boot/grub/menu.lst
+ echo "# (0) Arch Linux" >>/boot/grub/menu.lst
+ echo "title Arch Linux" >>/boot/grub/menu.lst
+ subdir=
+ if [ "$bootdev" != "" ]; then
+ grubdev=$(mapdev $bootdev)
+ else
+ subdir="/boot"
+ fi
+ echo "root $grubdev" >>/boot/grub/menu.lst
+ echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst
+ if [ "$VMLINUZ" = "vmlinuz26" ]; then
+ echo "initrd $subdir/kernel26.img" >>/boot/grub/menu.lst
+ fi
+ echo "" >>/boot/grub/menu.lst
+ # adding fallback/full image
+ echo "# (1) Arch Linux" >>/boot/grub/menu.lst
+ echo "title Arch Linux Fallback" >>/boot/grub/menu.lst
+ echo "root $grubdev" >>/boot/grub/menu.lst
+ echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst
+ if [ "$VMLINUZ" = "vmlinuz26" ]; then
+ echo "initrd $subdir/kernel26-fallback.img" >>/boot/grub/menu.lst
+ fi
+ echo "" >>/boot/grub/menu.lst
+ fi
+ fi
+
+ echo "Installing the GRUB bootloader..."
+ cp -a /usr/lib/grub/i386-pc/* /boot/grub/
+ sync
+ # freeze xfs filesystems to enable grub installation on xfs filesystems
+ if [ -x /usr/sbin/xfs_freeze ]; then
+ /usr/sbin/xfs_freeze -f /boot > /dev/null 2>&1
+ /usr/sbin/xfs_freeze -f / > /dev/null 2>&1
+ fi
+ # look for a separately-mounted /boot partition
+ bootpart=$(mount | grep /boot | cut -d' ' -f 1)
+ if [ "$bootpart" = "" ]; then
+ bootpart=$PART_ROOT
+ fi
+ bootpart=$(mapdev $bootpart)
+ bootdev=$(mapdev $ROOTDEV)
+ if [ "$bootpart" = "" ]; then
+ echo "Error: Missing/Invalid root device: $bootpart"
+ exit 1
+ fi
+ /sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF
+root $bootpart
+setup $bootdev
+quit
+EOF
+cat /tmp/grub.log
+ # unfreeze xfs filesystems
+ if [ -x /usr/sbin/xfs_freeze ]; then
+ /usr/sbin/xfs_freeze -u /boot > /dev/null 2>&1
+ /usr/sbin/xfs_freeze -u / > /dev/null 2>&1
+ fi
+
+ if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then
+ echo "Error installing GRUB. (see /tmp/grub.log for output)"
+ exit 1
+ fi
+ echo "GRUB was successfully installed."
+
+rm -f /tmp/grub.log
+
+exit 0
+}
+
+dogrub \ No newline at end of file
diff --git a/abs/core/grub/menu.lst b/abs/core/grub/menu.lst
index 57fcf0d..1c19f8a 100644
--- a/abs/core/grub/menu.lst
+++ b/abs/core/grub/menu.lst
@@ -6,9 +6,9 @@
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
-# /dev/hda (hd0)
-# /dev/hdb2 (hd1,1)
-# /dev/hda3 (hd0,2)
+# /dev/sda (hd0)
+# /dev/sdb2 (hd1,1)
+# /dev/sda3 (hd0,2)
#
# FRAMEBUFFER RESOLUTION SETTINGS
@@ -20,6 +20,8 @@
# 64K | 0x311=785 0x314=788 0x317=791 0x31A=794
# 16M | 0x312=786 0x315=789 0x318=792 0x31B=795
# +-------------------------------------------------+
+# for more details and different resolutions see
+# http://wiki.archlinux.org/index.php/GRUB#Framebuffer_Resolution
# general configuration:
timeout 5
@@ -36,7 +38,7 @@ color light-blue/black light-cyan/blue
# (0) Arch Linux
title Arch Linux [/boot/vmlinuz26]
root (hd0,0)
-kernel /vmlinuz26 root=/dev/hda3 ro
+kernel /vmlinuz26 root=/dev/sda3 ro
initrd /kernel26.img
# (1) Windows