All of lore.kernel.org
 help / color / mirror / Atom feed
* building grub on AMD64
@ 2005-01-22 14:32 Stefan Reinauer
  2005-01-22 15:13 ` Marco Gerards
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Reinauer @ 2005-01-22 14:32 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: duwe

[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: building grub on AMD64
  2005-01-22 14:32 building grub on AMD64 Stefan Reinauer
@ 2005-01-22 15:13 ` Marco Gerards
  2005-01-22 17:34   ` Yoshinori K. Okuji
  0 siblings, 1 reply; 3+ messages in thread
From: Marco Gerards @ 2005-01-22 15:13 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: duwe

Stefan Reinauer <stepan@openbios.org> writes:

> 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.

Cool.  It looks fine to me, but I have little knowledge of the build
process, unfortunately.  I hope someone with more clue about autoconf
have a look.

Thanks,
Marco




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: building grub on AMD64
  2005-01-22 15:13 ` Marco Gerards
@ 2005-01-22 17:34   ` Yoshinori K. Okuji
  0 siblings, 0 replies; 3+ messages in thread
From: Yoshinori K. Okuji @ 2005-01-22 17:34 UTC (permalink / raw)
  To: The development of GRUB 2

On Saturday 22 January 2005 16:13, Marco Gerards wrote:
> Stefan Reinauer <stepan@openbios.org> writes:
> > 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.
>
> Cool.  It looks fine to me, but I have little knowledge of the build
> process, unfortunately.  I hope someone with more clue about autoconf
> have a look.

It looks not fine to me. Why is host_cpu set to target_cpu? They must be 
distinguished correctly.

Okuji



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-22 18:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-22 14:32 building grub on AMD64 Stefan Reinauer
2005-01-22 15:13 ` Marco Gerards
2005-01-22 17:34   ` Yoshinori K. Okuji

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.