Commit 689f0983 authored by Manuel's avatar Manuel

Remove grub

parent 69d6f0b5
This diff is collapsed.
--- grub-0.96/stage2/boot.c
+++ grub-0.96/stage2/boot.c
@@ -824,8 +824,11 @@
moveto = (mbi.mem_upper + 0x400) << 10;
moveto = (moveto - len) & 0xfffff000;
- max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
- ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
+ max_addr = LINUX_INITRD_MAX_ADDRESS;
+ if (lh->header == LINUX_MAGIC_SIGNATURE &&
+ lh->version >= 0x0203 &&
+ lh->initrd_addr_max < max_addr)
+ max_addr = lh->initrd_addr_max;
if (moveto + len >= max_addr)
moveto = (max_addr - len) & 0xfffff000;
#
# Chakra Packages for Chakra, part of chakra-project.org
#
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
pkgname=grub
pkgver=0.97
pkgrel=18
pkgdesc="A GNU multiboot boot loader"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.gnu.org/software/grub/"
depends=('ncurses' 'diffutils' 'sed')
optdepends=('xfsprogs: freezing of xfs /boot in install-grub script')
source=(ftp://alpha.gnu.org/gnu/grub/grub-$pkgver.tar.gz
menu.lst
install-grub
040_all_grub-0.96-nxstack.patch
05-grub-0.97-initrdaddr.diff
i2o.patch
special-devices.patch
more-raid.patch
intelmac.patch
grub-inode-size.patch
ext4.patch
grub-0.97-ldflags-objcopy-remove-build-id.patch)
backup=('boot/grub/menu.lst')
install=grub.install
sha1sums=('2580626c4579bd99336d3af4482c346c95dac4fb'
'33d43d48000b2027f9baec8fc99d33e0c4500c96'
'60e8f7e4c113b85165fd5d9cd724e8413a337a12'
'157b81dbad3576536b08642242accfa1aeb093a9'
'adbb4685c98797ffb4dc83561ec75698991dddbd'
'f2e0dff29a7c8a45e90aa07298a1b2a9a9d29afc'
'c5e2c94ed0e759590b9eb38c9d979f075d19d7c0'
'45fe668a3779664fb292591f426976b6c784d6c8'
'066d7ab1ae442f88e94c9e4f1867ac6682965d06'
'0436aa6fa0b6f768289172f983a3f4b69384629e'
'a36f34e51efed540f1ddafd78e9c9f6d83e4c8d4'
'61c4b58d2eaa3c1561d8e9d8fc41341ce8882869')
#set destination architecture here
DESTARCH="$_arch"
#DESTARCH="x86_64"
build() {
cd $srcdir/$pkgname-$pkgver
# optimizations break the build -- disable them
# adding special devices to grub, patches are from fedora
patch -Np1 -i ../special-devices.patch
patch -Np1 -i ../i2o.patch
patch -Np1 -i ../more-raid.patch
patch -Np1 -i ../intelmac.patch
# Add support for bigger inode size to e2fs_stage1_5
patch -Np1 -i ../grub-inode-size.patch
# Add ext4 support
# http://www.mail-archive.com/bug-grub@gnu.org/msg11458.html
patch -Np1 -i ../ext4.patch
# binutils fix
patch -Np1 -i ../grub-0.97-ldflags-objcopy-remove-build-id.patch
sed -e'/^AC_PROG_CC/ a\AM_PROG_CC_C_O\ ' -i "${srcdir}/${pkgname}-${pkgver}/configure.ac"
sed -e'/^AC_PROG_CC/ a\AM_PROG_AS\ ' -i "${srcdir}/${pkgname}-${pkgver}/configure.ac"
## recreate ./configure script with the required changes in LDFLAGS and objcopy
aclocal
autoconf
autoreconf
automake
#arch64 fixes for static build
if [ "$CARCH" = "x86_64" ]; then ## correcting problems for new wersion of autotools
echo "this package has to be built on i686, won't compile on x86_64"
sleep 5
else
if [ "$DESTARCH" = "x86_64" ]; then
# patch from gentoo for fixing a segfault
patch -Np1 -i ../040_all_grub-0.96-nxstack.patch
# patch from frugalware to make it boot when more than 2GB ram installed
patch -Np1 -i ../05-grub-0.97-initrdaddr.diff
CFLAGS="-static -fno-strict-aliasing" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info
else
CFLAGS="-fno-strict-aliasing" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info
fi
fi
}
package() {
cd $srcdir/$pkgname-$pkgver
CFLAGS= make
make DESTDIR=$pkgdir install
install -D -m644 ../menu.lst $pkgdir/boot/grub/menu.lst
install -D -m755 ../install-grub $pkgdir/sbin/install-grub
if [ "$DESTARCH" = "x86_64" ]; then
# fool makepkg into building a x86_64 package
export CARCH="x86_64"
fi
}
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 */
This diff is collapsed.
diff --git a/Makefile.in b/Makefile.in
index 6652366..ba058eb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -112,6 +112,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff --git a/acinclude.m4 b/acinclude.m4
index 368839c..32b3fa6 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -57,7 +57,7 @@ else
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do
- if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
+ if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr -Wl,--build-id=none conftest.o -o conftest.exec]); then :
else
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
fi
diff --git a/configure.ac b/configure.ac
index bb9e1d9..9ac5c9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,9 @@ if test "x$ac_cv_prog_gcc" = xyes; then
fi
fi
+LOADER_LDFLAGS="-Wl,--build-id=none"
+AC_SUBST(LOADER_LDFLAGS)
+
AC_SUBST(STAGE1_CFLAGS)
AC_SUBST(STAGE2_CFLAGS)
AC_SUBST(GRUB_CFLAGS)
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 3e2de4b..7b2c94d 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -131,6 +131,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff --git a/grub/Makefile.in b/grub/Makefile.in
index 136c38f..7c23ebe 100644
--- a/grub/Makefile.in
+++ b/grub/Makefile.in
@@ -108,6 +108,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 3dae206..449e126 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -107,6 +107,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff --git a/netboot/Makefile.in b/netboot/Makefile.in
index 75ac299..0275768 100644
--- a/netboot/Makefile.in
+++ b/netboot/Makefile.in
@@ -108,6 +108,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff --git a/stage1/Makefile.am b/stage1/Makefile.am
index 0afc285..3d83356 100644
--- a/stage1/Makefile.am
+++ b/stage1/Makefile.am
@@ -5,7 +5,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
# We can't use builtins or standard includes.
AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
-LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
+LDFLAGS = $(LOADER_LDFLAGS) -nostdlib -Wl,-N,-Ttext,7C00
noinst_PROGRAMS = stage1.exec
stage1_exec_SOURCES = stage1.S stage1.h
diff --git a/stage1/Makefile.in b/stage1/Makefile.in
index 7134bdf..ee4477f 100644
--- a/stage1/Makefile.in
+++ b/stage1/Makefile.in
@@ -110,9 +110,10 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
+LDFLAGS = $(LOADER_LDFLAGS) -nostdlib -Wl,-N,-Ttext,7C00
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff --git a/stage2/Makefile.am b/stage2/Makefile.am
index f8e6d42..ff6f347 100644
--- a/stage2/Makefile.am
+++ b/stage2/Makefile.am
@@ -55,11 +55,11 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
endif
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
-PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
-START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
-NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
-PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
-START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
+PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 $(LOADER_LDFLAGS)
+START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 $(LOADER_LDFLAGS)
+NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 $(LOADER_LDFLAGS)
+PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 $(LOADER_LDFLAGS)
+START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 $(LOADER_LDFLAGS)
if NETBOOT_SUPPORT
NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
@@ -82,7 +82,7 @@ endif
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
-STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
+STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 $(LOADER_LDFLAGS)
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
# For stage2 target.
diff --git a/stage2/Makefile.in b/stage2/Makefile.in
index d0062bd..88b2038 100644
--- a/stage2/Makefile.in
+++ b/stage2/Makefile.in
@@ -355,6 +355,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
@@ -468,11 +469,11 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
@DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start start_eltorito
@DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
-PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
-START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
-NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
-PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
-START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
+PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 $(LOADER_LDFLAGS)
+START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 $(LOADER_LDFLAGS)
+NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 $(LOADER_LDFLAGS)
+PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 $(LOADER_LDFLAGS)
+START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 $(LOADER_LDFLAGS)
@NETBOOT_SUPPORT_FALSE@NETBOOT_FLAGS =
@NETBOOT_SUPPORT_TRUE@NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
@SERIAL_SUPPORT_FALSE@SERIAL_FLAGS =
@@ -482,7 +483,7 @@ START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
-STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
+STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 $(LOADER_LDFLAGS)
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
# For stage2 target.
diff --git a/util/Makefile.in b/util/Makefile.in
index e700cf7..cd3bf51 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -113,6 +113,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LOADER_LDFLAGS = @LOADER_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c
--- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600
+++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600
@@ -79,7 +79,52 @@
__u32 s_rev_level; /* Revision level */
__u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
- __u32 s_reserved[235]; /* Padding to the end of the block */
+ /*
+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
+ *
+ * Note: the difference between the compatible feature set and
+ * the incompatible feature set is that if there is a bit set
+ * in the incompatible feature set that the kernel doesn't
+ * know about, it should refuse to mount the filesystem.
+ *
+ * e2fsck's requirements are more strict; if it doesn't know
+ * about a feature in either the compatible or incompatible
+ * feature set, it must abort and not try to meddle with
+ * things it doesn't understand...
+ */
+ __u32 s_first_ino; /* First non-reserved inode */
+ __u16 s_inode_size; /* size of inode structure */
+ __u16 s_block_group_nr; /* block group # of this superblock */
+ __u32 s_feature_compat; /* compatible feature set */
+ __u32 s_feature_incompat; /* incompatible feature set */
+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
+ __u8 s_uuid[16]; /* 128-bit uuid for volume */
+ char s_volume_name[16]; /* volume name */
+ char s_last_mounted[64]; /* directory where last mounted */
+ __u32 s_algorithm_usage_bitmap; /* For compression */
+ /*
+ * Performance hints. Directory preallocation should only
+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
+ */
+ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
+ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
+ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
+ /*
+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
+ */
+ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
+ __u32 s_journal_inum; /* inode number of journal file */
+ __u32 s_journal_dev; /* device number of journal file */
+ __u32 s_last_orphan; /* start of list of inodes to delete */
+ __u32 s_hash_seed[4]; /* HTREE hash seed */
+ __u8 s_def_hash_version; /* Default hash version to use */
+ __u8 s_jnl_backup_type; /* Default type of journal backup */
+ __u16 s_reserved_word_pad;
+ __u32 s_default_mount_opts;
+ __u32 s_first_meta_bg; /* First metablock group */
+ __u32 s_mkfs_time; /* When the filesystem was created */
+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
+ __u32 s_reserved[172]; /* Padding to the end of the block */
};
struct ext2_group_desc
@@ -218,6 +263,14 @@
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
#define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
+#define EXT2_GOOD_OLD_INODE_SIZE 128
+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
+ EXT2_GOOD_OLD_INODE_SIZE : \
+ (s)->s_inode_size)
+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
+
/* linux/ext2_fs.h */
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
/* kind of from ext2/super.c */
@@ -553,7 +606,7 @@
gdp = GROUP_DESC;
ino_blk = gdp[desc].bg_inode_table +
(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))