summaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-05-28 19:48:05 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-05-28 19:48:05 +0000
commitfff3269970f2013f339b0fe926bf6c0cbc305f0f (patch)
tree3e1cb426fa794aa7859458147c097f33a595cbc6 /package
parent47cea815ee4856c8c67cd77099e78c36237cf948 (diff)
grub: compile fixes for Mac OS X (based on patches by Jukka Ylitalo)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21608 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/grub/Makefile21
-rw-r--r--package/grub/patches/100-add_configure_macros.patch11
-rw-r--r--package/grub/patches/110-remove_configure_errors.patch38
-rw-r--r--package/grub/patches/200-darwin_fixes.patch48
4 files changed, 118 insertions, 0 deletions
diff --git a/package/grub/Makefile b/package/grub/Makefile
index 221269ba4..5fd2a2308 100644
--- a/package/grub/Makefile
+++ b/package/grub/Makefile
@@ -44,6 +44,11 @@ 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
+
HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector)
HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE)
@@ -53,6 +58,22 @@ HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \
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/
diff --git a/package/grub/patches/100-add_configure_macros.patch b/package/grub/patches/100-add_configure_macros.patch
new file mode 100644
index 000000000..476f778bc
--- /dev/null
+++ b/package/grub/patches/100-add_configure_macros.patch
@@ -0,0 +1,11 @@
+--- 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)
+
diff --git a/package/grub/patches/110-remove_configure_errors.patch b/package/grub/patches/110-remove_configure_errors.patch
new file mode 100644
index 000000000..f090aa975
--- /dev/null
+++ b/package/grub/patches/110-remove_configure_errors.patch
@@ -0,0 +1,38 @@
+--- 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,
diff --git a/package/grub/patches/200-darwin_fixes.patch b/package/grub/patches/200-darwin_fixes.patch
new file mode 100644
index 000000000..c5c55a918
--- /dev/null
+++ b/package/grub/patches/200-darwin_fixes.patch
@@ -0,0 +1,48 @@
+--- 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