1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 17:15:00 +02:00

x86: remove grub-legacy

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33640 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2012-10-07 23:01:56 +00:00
parent 1be0626273
commit 48e426d185
15 changed files with 7 additions and 5188 deletions

View File

@ -82,6 +82,7 @@ menu "Target Images"
bool "iso"
default n
depends on TARGET_x86_generic
depends !TARGET_ROOTFS_INITRAMFS
help
Create some bootable ISO image

View File

@ -1,111 +0,0 @@
#
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=grub
PKG_VERSION:=0.97
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
PKG_BUILD_DEPENDS:= grub/host
PKG_INSTALL:=1
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/grub
SUBMENU:=Boot Loaders
CATEGORY:=Utilities
SECTION:=utils
TITLE:=GRand Unified Bootloader
URL:=http://www.gnu.org/software/grub/
DEPENDS:=@TARGET_x86
endef
MY_CONFIGURE_ARGS += \
--disable-auto-linux-mem-opt \
--disable-hercules \
--without-curses \
MY_CONFIGURE_VARS += \
grub_cv_prog_objcopy_absolute=yes \
CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS)
CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
ifeq ($(HOST_OS),Darwin)
HOST_CFLAGS += $(call host-cc-option,-m32)
HOST_CFLAGS += $(call host-cc-option,-fnested-functions)
endif
ifeq ($(HOST_OS),FreeBSD)
ifeq ($(HOST_ARCH),amd64)
HOST_CFLAGS += $(call host-cc-option,-m32)
HOST_CFLAGS += $(call host-cc-option,-B/usr/lib32)
HOST_CFLAGS += $(call host-cc-option,-L/usr/lib32)
endif
endif
HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector)
HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE)
HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \
--sbindir="$(STAGING_DIR_HOST)/bin" \
--disable-graphics \
HOST_CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
define Host/Configure
(cd $(HOST_BUILD_DIR); aclocal && autoconf && automake)
$(call Host/Configure/Default)
endef
ifeq ($(HOST_OS),Darwin)
define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)/lib
$(MAKE) -C $(HOST_BUILD_DIR)/stage2 libgrub.a
$(MAKE) -C $(HOST_BUILD_DIR)/grub
endef
define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR)/grub install
endef
endif
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/grub $(1)/usr/lib/
endef
define Package/grub/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
endef
ifeq ($(HOST_ARCH),x86_64)
define Require/working-gcc-m32
echo 'int main(int argc, char **argv) { return 0; }' | \
gcc -x c -o $(TMP_DIR)/a.out - -m32 -lc
endef
endif
$(eval $(call Require,working-gcc-m32, \
Please install 32 bit development files. (gcc-multilib on Debian/Ubuntu, gcc.i686, libgcc.i686, and glibc-devel.i686 on CentOS/Fedora/RHEL) \
))
$(eval $(call HostBuild))
$(eval $(call BuildPackage,grub))

View File

@ -1,22 +0,0 @@
--- a/stage1/Makefile.in
+++ b/stage1/Makefile.in
@@ -427,7 +427,7 @@ uninstall-am: uninstall-info-am uninstal
uninstall-nodist_pkglibDATA
.exec:
- $(OBJCOPY) -O binary $< $@
+ $(OBJCOPY) -O binary -R .comment -R .note -R .note.gnu.build-id $< $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
--- a/stage2/Makefile.in
+++ b/stage2/Makefile.in
@@ -3244,7 +3244,7 @@ pxegrub: pxeloader diskless
-rm -f $@
cat $^ > $@
.exec:
- $(OBJCOPY) -O binary $< $@
+ $(OBJCOPY) -O binary -R .comment -R .note -R .note.gnu.build-id $< $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

File diff suppressed because it is too large Load Diff

View File

@ -1,267 +0,0 @@
--- a/stage2/fsys_ext2fs.c
+++ b/stage2/fsys_ext2fs.c
@@ -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,27 @@ 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()
*/
@@ -287,7 +347,6 @@ ext2_rdfsb (int fsblock, int buffer)
static int
ext2fs_block_map (int logical_block)
{
-
#ifdef E2DEBUG
unsigned char *i;
for (i = (unsigned char *) INODE;
@@ -308,82 +367,106 @@ ext2fs_block_map (int logical_block)
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)
+ if (!(INODE->i_flags & EXT4_EXTENTS_FL))
{
-#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;
+ /* 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)];
+ [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))
+ /* 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 */

View File

@ -1,77 +0,0 @@
From 8858927ddc6797489cad322fc2d2134aeae543cd Mon Sep 17 00:00:00 2001
From: Arnaud Lacombe <lacombar@gmail.com>
Date: Sun, 11 Dec 2011 16:44:02 -0500
Subject: [PATCH] add-stage2-ldscripts
---
stage2/Makefile.am | 2 +-
stage2/Makefile.in | 2 +-
stage2/stage2.ldscripts | 30 ++++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 2 deletions(-)
create mode 100644 stage2/stage2.ldscripts
diff --git a/stage2/Makefile.am b/stage2/Makefile.am
index f8e6d42..ea28a4d 100644
--- a/stage2/Makefile.am
+++ b/stage2/Makefile.am
@@ -55,7 +55,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
endif
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
-PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
+PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
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
diff --git a/stage2/Makefile.in b/stage2/Makefile.in
index d0062bd..7bee2d5 100644
--- a/stage2/Makefile.in
+++ b/stage2/Makefile.in
@@ -468,7 +468,7 @@ 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
+PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
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
diff --git a/stage2/stage2.ldscripts b/stage2/stage2.ldscripts
new file mode 100644
index 0000000..2c8b8e1
--- /dev/null
+++ b/stage2/stage2.ldscripts
@@ -0,0 +1,30 @@
+/* Script for -N: mix text and data on same page; don't align data */
+OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x8200;
+ .text :
+ {
+ _start = .;
+ *(.text .text.* )
+ }
+ .rodata : { *(.rodata .rodata.* ) }
+ /* Adjust the address for the data segment. We want to adjust up to
+ the same address within the page on the next page up. */
+ . = .;
+ .data : { *(.data .data.* ) }
+ __bss_start = .;
+ .bss :
+ {
+ *(.bss .bss.* )
+ *(COMMON)
+ . = ALIGN(. != 0 ? 32 / 8 : 1);
+ }
+ . = ALIGN(32 / 8);
+ . = ALIGN(32 / 8);
+ _end = .; PROVIDE (end = .);
+ .comment 0 : { *(.comment) }
+}
--
1.7.6.153.g78432

View File

@ -1,41 +0,0 @@
--- a/stage1/Makefile.am
+++ b/stage1/Makefile.am
@@ -1,7 +1,7 @@
pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
-nodist_pkglib_DATA = stage1
+nodist_pkgdata_DATA = stage1
-CLEANFILES = $(nodist_pkglib_DATA)
+CLEANFILES = $(nodist_pkgdata_DATA)
# We can't use builtins or standard includes.
AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
--- a/stage2/Makefile.am
+++ b/stage2/Makefile.am
@@ -32,7 +32,7 @@ pkglibdir = $(libdir)/$(PACKAGE)/$(host_
EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
if DISKLESS_SUPPORT
-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
nbgrub pxegrub
@@ -43,7 +43,7 @@ noinst_PROGRAMS = pre_stage2.exec start.
reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
else
-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
noinst_DATA = pre_stage2 start start_eltorito
@@ -112,7 +112,7 @@ else
BUILT_SOURCES = stage2_size.h
endif
-CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES)
+CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES)
stage2_size.h: pre_stage2
-rm -f stage2_size.h

View File

@ -1,11 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,8 @@ fi
AC_CHECK_TOOL(CC, gcc)
AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AS
# We need this for older versions of Autoconf.
_AM_DEPENDENCIES(CC)

View File

@ -1,38 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -177,26 +177,22 @@ grub_ASM_ABSOLUTE_WITHOUT_ASTERISK
grub_CHECK_START_SYMBOL
grub_CHECK_USCORE_START_SYMBOL
-if test "x$grub_cv_check_start_symbol" != "xyes" \
- -a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then
- AC_MSG_ERROR([Neither start nor _start is defined])
-fi
grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL
grub_CHECK_USCORE_EDATA_SYMBOL
grub_CHECK_EDATA_SYMBOL
-if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \
- -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \
- -a "x$grub_cv_check_edata_symbol" != "xyes"; then
- AC_MSG_ERROR([None of __bss_start, _edata, edata defined])
-fi
+# if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \
+# -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \
+# -a "x$grub_cv_check_edata_symbol" != "xyes"; then
+# AC_MSG_ERROR([None of __bss_start, _edata, edata defined])
+# fi
grub_CHECK_END_SYMBOL
grub_CHECK_USCORE_END_SYMBOL
-if test "x$grub_cv_check_end_symbol" != "xyes" \
- -a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then
- AC_MSG_ERROR([Neither end nor _end is defined])
-fi
+#if test "x$grub_cv_check_end_symbol" != "xyes" \
+# -a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then
+# AC_MSG_ERROR([Neither end nor _end is defined])
+#fi
# Check for curses libraries.
AC_ARG_WITH(curses,

View File

@ -1,48 +0,0 @@
--- a/stage2/asm.S
+++ b/stage2/asm.S
@@ -95,14 +95,16 @@ VARIABLE(stage2_id)
VARIABLE(force_lba)
.byte 0
VARIABLE(version_string)
- .string VERSION
+ .ascii VERSION
+ .byte 0
VARIABLE(config_file)
#ifndef STAGE1_5
- .string "/boot/grub/menu.lst"
+ .ascii "/boot/grub/menu.lst"
#else /* STAGE1_5 */
.long 0xffffffff
- .string "/boot/grub/stage2"
+ .ascii "/boot/grub/stage2"
#endif /* STAGE1_5 */
+ .byte 0
/*
* Leave some breathing room for the config file name.
@@ -762,7 +764,9 @@ ENTRY(chain_stage1)
call EXT_C(prot_to_real)
.code16
-#ifdef ABSOLUTE_WITHOUT_ASTERISK
+#ifdef __APPLE__
+ DATA32 ADDR32 ljmp offset
+#elif defined(ABSOLUTE_WITHOUT_ASTERISK)
DATA32 ADDR32 ljmp (offset)
#else
DATA32 ADDR32 ljmp *(offset)
--- a/stage2/char_io.c
+++ b/stage2/char_io.c
@@ -1345,5 +1345,12 @@ grub_strcpy (char *dest, const char *src
#ifndef GRUB_UTIL
# undef memcpy
/* GCC emits references to memcpy() for struct copies etc. */
+#ifdef __APPLE__
+void *memcpy (void *dest, const void *src, int n)
+{
+ return grub_memmove(dest, src, n);
+}
+#else
void *memcpy (void *dest, const void *src, int n) __attribute__ ((alias ("grub_memmove")));
#endif
+#endif

View File

@ -1,14 +0,0 @@
--- a/stage2/fsys_iso9660.c
+++ b/stage2/fsys_iso9660.c
@@ -83,10 +83,7 @@ iso9660_devread (int sector, int byte_of
sector += (byte_offset >> sector_size_lg2);
byte_offset &= (buf_geom.sector_size - 1);
- asm volatile ("shl%L0 %1,%0"
- : "=r"(sector)
- : "Ic"((int8_t)(ISO_SECTOR_BITS - sector_size_lg2)),
- "0"(sector));
+ sector <<= ISO_SECTOR_BITS - sector_size_lg2;
#if !defined(STAGE1_5)
if (disk_read_hook && debug)

View File

@ -17,13 +17,8 @@ config X86_GRUB_IMAGES
bool "Build GRUB images (Linux x86 or x86_64 host only)"
depends TARGET_x86 && !TARGET_x86_olpc
depends TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub if !X86_USE_GRUB2
default y
config X86_USE_GRUB2
bool "Use grub2"
depends X86_GRUB_IMAGES
select PACKAGE_grub2
default y
config X86_GRUB_CONSOLE
bool "Use Console Terminal (in addition to Serial)"

View File

@ -28,11 +28,7 @@ ifneq ($(CONFIG_X86_GRUB_SERIAL),)
endif
ifneq ($(GRUB_TERMINALS),)
ifneq ($(CONFIG_X86_USE_GRUB2),)
GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
else
GRUB_TERMINAL_CONFIG := terminal --timeout=2 $(GRUB_TERMINALS)
endif
GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
endif
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
@ -59,38 +55,6 @@ ifneq ($(CONFIG_X86_GRUB_IMAGES),)
block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootwait
endef
define Image/Build/grub
# left here because the image builder doesnt need these
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
$(CP) \
$(KDIR)/stage1 \
$(KDIR)/stage2 \
$(KDIR)/e2fs_stage1_5 \
$(KDIR)/root.grub/boot/grub/
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
sed \
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
PADDING="$(CONFIG_TARGET_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_grub.sh \
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
$(call Image/Build/grub/$(1))
endef
define Image/Prepare/grub
# for the image builder
$(CP) \
$(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage1 \
$(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage2 \
$(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage2_eltorito \
$(STAGING_DIR)/usr/lib/grub/i386-openwrt/e2fs_stage1_5 \
$(KDIR)/
endef
define Image/Build/grub2
# left here because the image builder doesnt need these
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
@ -160,8 +124,7 @@ define Image/Build/squashfs
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
endef
ifdef CONFIG_X86_USE_GRUB2
define Image/Build/iso
define Image/Build/iso
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
grub-mkimage \
@ -182,24 +145,7 @@ ifdef CONFIG_X86_USE_GRUB2
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
endef
else
define Image/Build/iso
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
$(CP) \
$(KDIR)/stage2_eltorito \
$(KDIR)/root.grub/boot/grub/
sed \
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#(hd0,0)#(cd)#g' \
./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub
endef
endif
endef
ifneq ($(CONFIG_X86_VDI_IMAGES),)
define Image/Build/vdi
@ -263,14 +209,14 @@ endef
define Image/Prepare
$(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
$(call Image/Prepare/bootscript)
$(call Image/Prepare/$(if $(CONFIG_X86_USE_GRUB2),grub2,grub))
$(call Image/Prepare/grub2)
endef
define Image/Build
$(call Image/Build/$(1))
$(call Image/Build/bootscript,$(1))
ifneq ($(1),iso)
$(call Image/Build/$(if $(CONFIG_X86_USE_GRUB2),grub2,grub),$(1))
$(call Image/Build/grub2,$(1))
$(call Image/Build/vdi,$(1))
$(call Image/Build/vmdk,$(1))
endif

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
# Copyright (C) 2006-2010 OpenWrt.org
. ./gen_image_generic.sh
which chpax >/dev/null && chpax -zp $(which grub)
grub --batch --no-curses --no-floppy --device-map=/dev/null <<EOF
device (hd0) $OUTPUT
geometry (hd0) $cyl $head $sect
root (hd0,0)
setup (hd0)
quit
EOF

View File

@ -1,15 +0,0 @@
@SERIAL_CONFIG@
@TERMINAL_CONFIG@
default 0
timeout @TIMEOUT@
title OpenWrt
root (hd0,0)
kernel /boot/vmlinuz @CMDLINE@ noinitrd reboot=bios
boot
title OpenWrt (failsafe)
root (hd0,0)
kernel /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd reboot=bios
boot