building grub on AMD64
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
Index: Makefile.in
===================================================================
RCS file: /cvsroot/grub/grub2/Makefile.in,v
retrieving revision 1.8
Makefile.in +2 -2
@@ -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
configure.ac +16 -10
@@ -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
Quoted 6 lines · Stefan Reinauer
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
Quoted 11 lines · Marco Gerards
Quoted 6 lines · Stefan Reinauer
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