All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Reinauer <stepan@openbios.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Cc: duwe@suse.de
Subject: building grub on AMD64
Date: Sat, 22 Jan 2005 15:32:59 +0100	[thread overview]
Message-ID: <20050122143259.GA19529@openbios.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hi,

with the attached patch grub2 can be built on AMD64 systems. 
It is not completely clean I would say, but it solves the problem with
minimum impact. 
Please dont tare my head off ;-) 

It is necessary to call autoconf before the code can be used.

Since Linux and other 64bit operating systems switch to long mode
themselfes, it is not needed to have grub2 64bit. It can/should stay
32bit for now, unless someone is willing to properly do a lot of cleanup
work in Linux and other places.

Comments welcome

Regards,
Stefan


[-- Attachment #2: grub2-amd64.diff --]
[-- Type: text/plain, Size: 3371 bytes --]

Index: Makefile.in
===================================================================
RCS file: /cvsroot/grub/grub2/Makefile.in,v
retrieving revision 1.8
diff -u -r1.8 Makefile.in
--- Makefile.in	27 Dec 2004 13:46:19 -0000	1.8
+++ Makefile.in	22 Jan 2005 14:24:05 -0000
@@ -34,7 +34,7 @@
 infodir = @infodir@
 mandir = @mandir@
 includedir = @includedir@
-pkgdatadir = $(datadir)/@PACKAGE_TARNAME@/$(host_cpu)-$(host_vendor)
+pkgdatadir = $(datadir)/@PACKAGE_TARNAME@/$(target_cpu)-$(host_vendor)
 pkglibdir = $(libdir)/@PACKAGE_TARNAME@
 
 PACKAGE_NAME = @PACKAGE_NAME@
@@ -43,7 +43,7 @@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 
-host_cpu = @host_cpu@
+host_cpu = @target_cpu@
 host_vendor = @host_vendor@
 
 INSTALL = @INSTALL@
Index: configure.ac
===================================================================
RCS file: /cvsroot/grub/grub2/configure.ac,v
retrieving revision 1.9
diff -u -r1.9 configure.ac
--- configure.ac	4 Apr 2004 13:45:59 -0000	1.9
+++ configure.ac	22 Jan 2005 14:24:14 -0000
@@ -21,18 +21,19 @@
 AC_CANONICAL_HOST
 
 case "$host_cpu" in
-  i[[3456]]86) host_cpu=i386 ;;
-  powerpc) ;;
+  i[[3456]]86) target_cpu=i386 ;;
+  x86_64) target_cpu=i386 ;;
+  powerpc) target_cpu=powerpc;;
   *) AC_MSG_ERROR([unsupported CPU type]) ;;
 esac
 
-case "$host_cpu"-"$host_vendor" in
+case "$target_cpu"-"$host_vendor" in
   i386-*) host_vendor=pc ;;
   powerpc-*) host_vendor=ieee1275 ;;
   *) AC_MSG_ERROR([unsupported machine type]) ;;
 esac
 
-AC_SUBST(host_cpu)
+AC_SUBST(target_cpu)
 AC_SUBST(host_vendor)
 
 # Checks for programs.
@@ -51,6 +52,11 @@
   tmp_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
 		-Wundef -Wstrict-prototypes -g"
 
+  if test "x$host_cpu" = xx86_64; then
+    CC="gcc -m32"
+    LD="ld -melf_i386"
+  fi
+
   # optimization flags.
   AC_CACHE_CHECK([whether optimization for size works], size_flag, [
     CFLAGS=-Os
@@ -63,7 +69,7 @@
   fi
 
   # Force no alignment to save space on i386.
-  if test "x$host_cpu" = xi386; then
+  if test "x$target_cpu" = xi386; then
     AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
       CFLAGS="-falign-loops=1"
       AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
@@ -82,13 +88,13 @@
 
 # Defined in aclocal.m4.
 grub_ASM_USCORE
-if test "x$host_cpu" = xi386; then
+if test "x$target_cpu" = xi386; then
   grub_CHECK_START_SYMBOL
   grub_CHECK_BSS_START_SYMBOL
   grub_CHECK_END_SYMBOL
 fi
 
-if test "x$host_cpu" = xi386; then
+if test "x$target_cpu" = xi386; then
   grub_I386_ASM_PREFIX_REQUIREMENT
   grub_I386_ASM_ADDR32
   grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
@@ -131,7 +137,7 @@
 AC_CHECK_SIZEOF(long)
 
 # Check LZO when compiling for the i386.
-if test "x$host_cpu" = xi386; then
+if test "x$target_cpu" = xi386; then
   AC_CHECK_LIB(lzo, __lzo_init2, ,
 	       AC_MSG_ERROR([LZO library version 1.02 or later is required]))
   AC_CHECK_FUNC(lzo1x_999_compress, , 
@@ -143,8 +149,8 @@
 CPPFLAGS="$tmp_CPPFLAGS"
 
 # Output files.
-AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu
-	include/grub/machine:include/grub/$host_cpu/$host_vendor])
+AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
+	include/grub/machine:include/grub/$target_cpu/$host_vendor])
 AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
 AC_OUTPUT

             reply	other threads:[~2005-01-22 15:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-22 14:32 Stefan Reinauer [this message]
2005-01-22 15:13 ` building grub on AMD64 Marco Gerards
2005-01-22 17:34   ` Yoshinori K. Okuji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050122143259.GA19529@openbios.org \
    --to=stepan@openbios.org \
    --cc=duwe@suse.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.