* [patch] Fix for building correct code on i386-pc (CVS-HEAD)
@ 2006-05-30 21:08 Vesa Jääskeläinen
2006-05-30 21:15 ` Hollis Blanchard
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Vesa Jääskeläinen @ 2006-05-30 21:08 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
Hi,
... thanks.
Attached patch fixes problems for compiling correct code on i386-pc...
other platforms needs to be modified similarly too...
Thanks,
Vesa Jääskeläinen
[-- Attachment #2: grub2-compilation-fix.diff --]
[-- Type: text/plain, Size: 10788 bytes --]
Index: conf/common.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/common.rmk,v
retrieving revision 1.7
diff -u -r1.7 common.rmk
--- conf/common.rmk 27 May 2006 21:09:25 -0000 1.7
+++ conf/common.rmk 30 May 2006 21:00:02 -0000
@@ -27,61 +27,73 @@
# For fshelp.mod.
fshelp_mod_SOURCES = fs/fshelp.c
fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
+fshelp_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
fshelp_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For fat.mod.
fat_mod_SOURCES = fs/fat.c
fat_mod_CFLAGS = $(COMMON_CFLAGS)
+fat_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
fat_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ufs.mod.
ufs_mod_SOURCES = fs/ufs.c
ufs_mod_CFLAGS = $(COMMON_CFLAGS)
+ufs_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
ufs_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ext2.mod.
ext2_mod_SOURCES = fs/ext2.c
ext2_mod_CFLAGS = $(COMMON_CFLAGS)
+ext2_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
ext2_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For minix.mod.
minix_mod_SOURCES = fs/minix.c
minix_mod_CFLAGS = $(COMMON_CFLAGS)
+minix_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For hfs.mod.
hfs_mod_SOURCES = fs/hfs.c
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
+hfs_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
hfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For jfs.mod.
jfs_mod_SOURCES = fs/jfs.c
jfs_mod_CFLAGS = $(COMMON_CFLAGS)
+jfs_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
jfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For iso9660.mod.
iso9660_mod_SOURCES = fs/iso9660.c
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
+iso9660_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
iso9660_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For xfs.mod.
xfs_mod_SOURCES = fs/xfs.c
xfs_mod_CFLAGS = $(COMMON_CFLAGS)
+xfs_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
xfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For affs.mod.
affs_mod_SOURCES = fs/affs.c
affs_mod_CFLAGS = $(COMMON_CFLAGS)
+affs_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
affs_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For sfs.mod.
sfs_mod_SOURCES = fs/sfs.c
sfs_mod_CFLAGS = $(COMMON_CFLAGS)
+sfs_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
sfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For hfsplus.mod.
hfsplus_mod_SOURCES = fs/hfsplus.c
hfsplus_mod_CFLAGS = $(COMMON_CFLAGS)
+hfsplus_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
hfsplus_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Partition maps.
@@ -90,31 +102,37 @@
# For amiga.mod
amiga_mod_SOURCES = partmap/amiga.c
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
+amiga_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
amiga_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For apple.mod
apple_mod_SOURCES = partmap/apple.c
apple_mod_CFLAGS = $(COMMON_CFLAGS)
+apple_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
apple_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pc.mod
pc_mod_SOURCES = partmap/pc.c
pc_mod_CFLAGS = $(COMMON_CFLAGS)
+pc_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
pc_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For sun.mod
sun_mod_SOURCES = partmap/sun.c
sun_mod_CFLAGS = $(COMMON_CFLAGS)
+sun_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
sun_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For acorn.mod
acorn_mod_SOURCES = partmap/acorn.c
acorn_mod_CFLAGS = $(COMMON_CFLAGS)
+acorn_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
acorn_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For gpt.mod
gpt_mod_SOURCES = partmap/gpt.c
gpt_mod_CFLAGS = $(COMMON_CFLAGS)
+gpt_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
@@ -127,71 +145,85 @@
# For hello.mod.
hello_mod_SOURCES = hello/hello.c
hello_mod_CFLAGS = $(COMMON_CFLAGS)
+hello_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
hello_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For boot.mod.
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
+boot_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For terminal.mod.
terminal_mod_SOURCES = commands/terminal.c
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
+terminal_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
terminal_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ls.mod.
ls_mod_SOURCES = commands/ls.c
ls_mod_CFLAGS = $(COMMON_CFLAGS)
+ls_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
ls_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For cmp.mod.
cmp_mod_SOURCES = commands/cmp.c
cmp_mod_CFLAGS = $(COMMON_CFLAGS)
+cmp_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
cmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For cat.mod.
cat_mod_SOURCES = commands/cat.c
cat_mod_CFLAGS = $(COMMON_CFLAGS)
+cat_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
cat_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For help.mod.
help_mod_SOURCES = commands/help.c
help_mod_CFLAGS = $(COMMON_CFLAGS)
+help_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
help_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For font.mod.
font_mod_SOURCES = font/manager.c
font_mod_CFLAGS = $(COMMON_CFLAGS)
+font_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
font_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_mod_SOURCES = commands/search.c
search_mod_CFLAGS = $(COMMON_CFLAGS)
+search_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
search_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For test.mod.
test_mod_SOURCES = commands/test.c
test_mod_CFLAGS = $(COMMON_CFLAGS)
+test_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
test_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For loopback.mod
loopback_mod_SOURCES = disk/loopback.c
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
+loopback_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For configfile.mod
configfile_mod_SOURCES = commands/configfile.c
configfile_mod_CFLAGS = $(COMMON_CFLAGS)
+configfile_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
configfile_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For terminfo.mod.
terminfo_mod_SOURCES = term/terminfo.c term/tparm.c
terminfo_mod_CFLAGS = $(COMMON_CFLAGS)
+terminfo_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
terminfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For blocklist.mod.
blocklist_mod_SOURCES = commands/blocklist.c
blocklist_mod_CFLAGS = $(COMMON_CFLAGS)
+blocklist_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
blocklist_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Misc.
@@ -200,6 +232,7 @@
# For gzio.mod.
gzio_mod_SOURCES = io/gzio.c
gzio_mod_CFLAGS = $(COMMON_CFLAGS)
+gzio_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
gzio_mod_LDFLAGS = $(COMMON_LDFLAGS)
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.65
diff -u -r1.65 i386-pc.rmk
--- conf/i386-pc.rmk 28 May 2006 23:01:43 -0000 1.65
+++ conf/i386-pc.rmk 30 May 2006 21:00:02 -0000
@@ -2,6 +2,7 @@
COMMON_ASFLAGS = -nostdinc -fno-builtin
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
+COMMON_TARGET_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
COMMON_LDFLAGS = -melf_i386 -nostdlib
# Images.
@@ -37,6 +38,7 @@
machine/memory.h machine/loader.h machine/time.h machine/vga.h \
machine/vbe.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
+kernel_img_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200 $(COMMON_CFLAGS)
@@ -117,21 +119,25 @@
# For _chain.mod.
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
_chain_mod_CFLAGS = $(COMMON_CFLAGS)
+_chain_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
_chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For chain.mod.
chain_mod_SOURCES = loader/i386/pc/chainloader_normal.c
chain_mod_CFLAGS = $(COMMON_CFLAGS)
+chain_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For _linux.mod.
_linux_mod_SOURCES = loader/i386/pc/linux.c
_linux_mod_CFLAGS = $(COMMON_CFLAGS)
+_linux_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
_linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/pc/linux_normal.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
+linux_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For normal.mod.
@@ -141,68 +147,81 @@
normal/menu_entry.c normal/misc.c grub_script.tab.c \
normal/script.c normal/i386/setjmp.S
normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
normal_mod_ASFLAGS = $(COMMON_ASFLAGS) -m32
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/i386/pc/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
+reboot_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/i386/pc/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
+halt_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
+serial_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For _multiboot.mod.
_multiboot_mod_SOURCES = loader/i386/pc/multiboot.c
_multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
+_multiboot_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
_multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For multiboot.mod.
multiboot_mod_SOURCES = loader/i386/pc/multiboot_normal.c
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
+multiboot_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vbe.mod.
vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \
video/i386/pc/vbefill.c
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
+vbe_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vbeinfo.mod.
vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c
vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS)
+vbeinfo_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vbetest.mod.
vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
+vbetest_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For play.mod.
play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
+play_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For video.mod.
video_mod_SOURCES = video/video.c
video_mod_CFLAGS = $(COMMON_CFLAGS)
+video_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
video_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For gfxterm.mod.
gfxterm_mod_SOURCES = term/gfxterm.c
gfxterm_mod_CFLAGS = $(COMMON_CFLAGS)
+gfxterm_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For videotest.mod.
videotest_mod_SOURCES = commands/videotest.c
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
+videotest_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/common.mk
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)
2006-05-30 21:08 [patch] Fix for building correct code on i386-pc (CVS-HEAD) Vesa Jääskeläinen
@ 2006-05-30 21:15 ` Hollis Blanchard
2006-05-31 3:59 ` Harley D. Eades III
2006-05-30 22:10 ` [patch] Fix for building correct code on i386-pc (CVS-HEAD) Marco Gerards
2006-05-31 0:28 ` Yoshinori K. Okuji
2 siblings, 1 reply; 11+ messages in thread
From: Hollis Blanchard @ 2006-05-30 21:15 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, 2006-05-31 at 00:08 +0300, Vesa Jääskeläinen wrote:
> Attached patch fixes problems for compiling correct code on i386-pc...
> other platforms needs to be modified similarly too...
I'm confused by this; could you explain? If _TARGET_CFLAGS is used for
everything to be run on the target, perhaps we should just rename
_CFLAGS to _TARGET_CFLAGS.
Also, in the future, could you please supply best-guess code for other
architectures? It's ok if you don't know, but in this case it seems it
would be easy enough to duplicate your i386-pc.mk changes for the
other .mk files.
> Index: conf/common.rmk
> ===================================================================
> RCS file: /sources/grub/grub2/conf/common.rmk,v
> retrieving revision 1.7
> diff -u -r1.7 common.rmk
> --- conf/common.rmk 27 May 2006 21:09:25 -0000 1.7
> +++ conf/common.rmk 30 May 2006 21:00:02 -0000
> @@ -27,61 +27,73 @@
> # For fshelp.mod.
> fshelp_mod_SOURCES = fs/fshelp.c
> fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
> +fshelp_mod_TARGET_CFLAGS = $(COMMON_TARGET_CFLAGS)
> fshelp_mod_LDFLAGS = $(COMMON_LDFLAGS)
...
> --- conf/i386-pc.rmk 28 May 2006 23:01:43 -0000 1.65
> +++ conf/i386-pc.rmk 30 May 2006 21:00:02 -0000
> @@ -2,6 +2,7 @@
>
> COMMON_ASFLAGS = -nostdinc -fno-builtin
> COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
> +COMMON_TARGET_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
> COMMON_LDFLAGS = -melf_i386 -nostdlib
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)
2006-05-30 21:15 ` Hollis Blanchard
@ 2006-05-31 3:59 ` Harley D. Eades III
2006-05-30 22:00 ` Hollis Blanchard
0 siblings, 1 reply; 11+ messages in thread
From: Harley D. Eades III @ 2006-05-31 3:59 UTC (permalink / raw)
To: The development of GRUB 2
Hollis Blanchard <hollis@penguinppc.org> writes:
> On Wed, 2006-05-31 at 00:08 +0300, Vesa Jääskeläinen wrote:
> > Attached patch fixes problems for compiling correct code on i386-pc...
> > other platforms needs to be modified similarly too...
>
> I'm confused by this; could you explain? If _TARGET_CFLAGS is used for
> everything to be run on the target, perhaps we should just rename
> _CFLAGS to _TARGET_CFLAGS.
>
> Also, in the future, could you please supply best-guess code for other
> architectures? It's ok if you don't know, but in this case it seems it
> would be easy enough to duplicate your i386-pc.mk changes for the
> other .mk files.
I am also confused. Is this keeping to the changes presented by
Okuji? I don't think it is best to move from CFLAGS to something
different, this would make it odd when porting to other OS, it also
seems off convention.
Okuji's post:
http://lists.gnu.org/archive/html/grub-devel/2006-05/msg00106.html
Cheers
Harley
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)
2006-05-31 3:59 ` Harley D. Eades III
@ 2006-05-30 22:00 ` Hollis Blanchard
2006-05-31 0:31 ` Yoshinori K. Okuji
0 siblings, 1 reply; 11+ messages in thread
From: Hollis Blanchard @ 2006-05-30 22:00 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2006-05-30 at 22:59 -0500, Harley D. Eades III wrote:
>
> http://lists.gnu.org/archive/html/grub-devel/2006-05/msg00106.html
"host" and "target" are unclear to me here. For example, grub-emu would
be compiled for the "host", but grub itself would be for the "target"?
When would you ever want to build things differently like that?
Or is this just so you can specify "host" build flags which are totally
separate from "target" flags (since the target is built as a
freestanding executable)?
In that case, in Vesa's patch, CFLAGS shouldn't need any of these,
right? -fno-builtin -mrtd -mregparm=3
-Hollis
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)
2006-05-30 22:00 ` Hollis Blanchard
@ 2006-05-31 0:31 ` Yoshinori K. Okuji
2006-05-31 21:00 ` [PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)) Jeroen Dekkers
0 siblings, 1 reply; 11+ messages in thread
From: Yoshinori K. Okuji @ 2006-05-31 0:31 UTC (permalink / raw)
To: The development of GRUB 2
On Wednesday 31 May 2006 00:00, Hollis Blanchard wrote:
> On Tue, 2006-05-30 at 22:59 -0500, Harley D. Eades III wrote:
> > http://lists.gnu.org/archive/html/grub-devel/2006-05/msg00106.html
>
> "host" and "target" are unclear to me here. For example, grub-emu would
> be compiled for the "host", but grub itself would be for the "target"?
> When would you ever want to build things differently like that?
This is one of the requested features for GRUB. In GRUB Legacy, some group
developed GRUB on Sparc, but for PC by cross-compiling (actually, this was
Alcatel). It is a good thing that you can install GRUB for an architecture on
another.
Okuji
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD))
2006-05-31 0:31 ` Yoshinori K. Okuji
@ 2006-05-31 21:00 ` Jeroen Dekkers
2006-06-01 15:39 ` Yoshinori K. Okuji
0 siblings, 1 reply; 11+ messages in thread
From: Jeroen Dekkers @ 2006-05-31 21:00 UTC (permalink / raw)
To: The development of GRUB 2
At Wed, 31 May 2006 02:31:49 +0200,
Yoshinori K. Okuji wrote:
>
> On Wednesday 31 May 2006 00:00, Hollis Blanchard wrote:
> > On Tue, 2006-05-30 at 22:59 -0500, Harley D. Eades III wrote:
> > > http://lists.gnu.org/archive/html/grub-devel/2006-05/msg00106.html
> >
> > "host" and "target" are unclear to me here. For example, grub-emu would
> > be compiled for the "host", but grub itself would be for the "target"?
> > When would you ever want to build things differently like that?
>
> This is one of the requested features for GRUB. In GRUB Legacy, some group
> developed GRUB on Sparc, but for PC by cross-compiling (actually, this was
> Alcatel). It is a good thing that you can install GRUB for an architecture on
> another.
It's actually a necessary feature for GRUB on amd64. On amd64 you have
64-bit executables but GRUB will run in 32-bit mode.
When trying to compile on amd64 I already ran into some problems
related to that. First of all on amd64 all binaries are run in 64-bit
mode, so the host CFLAGS variable shouldn't have -m32. Secondly LIBS
is for the host only and shouldn't be defined when running target
tests. As last we set CFLAGS, CC, etc. to the TARGET_*, then we run
some checks and change the TARGET_* flags without updating CC, CFLAGS,
etc to the new version.
The attached patch should fix those problems. I've tested it on i386-pc
and x86_64.
2006-05-31 Jeroen Dekkers <jeroen@dekkers.cx>
* configure.ac: Don't set host_m32 for x86_64. Also reset LIBS
for the target-specific tests. Make sure that we also have the
up-to-date target variables for those tests.
Index: configure.ac
===================================================================
RCS file: /cvsroot/grub/grub2/configure.ac,v
retrieving revision 1.29
diff -u -p -r1.29 configure.ac
--- configure.ac 30 May 2006 00:32:29 -0000 1.29
+++ configure.ac 31 May 2006 19:51:10 -0000
@@ -41,7 +41,6 @@ AC_CANONICAL_HOST
AC_CANONICAL_TARGET
case "$host_cpu" in
- x86_64) host_m32=1 ;;
powerpc64) host_m32=1 ;;
esac
@@ -186,10 +185,12 @@ tmp_CC="$CC"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
+tmp_LIBS="$LIBS"
CC="$TARGET_CC"
CFLAGS="$TARGET_CFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
+LIBS=""
if test "x$TARGET_CFLAGS" = x; then
# debug flags.
@@ -232,6 +233,12 @@ AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_LDFLAGS)
+# Set them to their new values for the tests below.
+CC="$TARGET_CC"
+CFLAGS="$TARGET_CFLAGS"
+CPPFLAGS="$TARGET_CPPFLAGS"
+LDFLAGS="$TARGET_LDFLAGS"
+
# Defined in aclocal.m4.
grub_PROG_OBJCOPY_ABSOLUTE
grub_ASM_USCORE
@@ -252,6 +259,7 @@ CC="$tmp_CC"
CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
LDFLAGS="$tmp_LDFLAGS"
+LIBS="$tmp_LIBS"
# Check for options.
AC_ARG_ENABLE([mm-debug],
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD))
2006-05-31 21:00 ` [PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)) Jeroen Dekkers
@ 2006-06-01 15:39 ` Yoshinori K. Okuji
2006-06-07 11:16 ` [PATCH] Another fix for x86_64 Jeroen Dekkers
0 siblings, 1 reply; 11+ messages in thread
From: Yoshinori K. Okuji @ 2006-06-01 15:39 UTC (permalink / raw)
To: The development of GRUB 2
On Wednesday 31 May 2006 23:00, Jeroen Dekkers wrote:
> It's actually a necessary feature for GRUB on amd64. On amd64 you have
> 64-bit executables but GRUB will run in 32-bit mode.
>
> When trying to compile on amd64 I already ran into some problems
> related to that. First of all on amd64 all binaries are run in 64-bit
> mode, so the host CFLAGS variable shouldn't have -m32. Secondly LIBS
> is for the host only and shouldn't be defined when running target
> tests. As last we set CFLAGS, CC, etc. to the TARGET_*, then we run
> some checks and change the TARGET_* flags without updating CC, CFLAGS,
> etc to the new version.
>
> The attached patch should fix those problems. I've tested it on i386-pc
> and x86_64.
It looks good. Please check it in.
Thanks,
Okuji
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Another fix for x86_64
2006-06-01 15:39 ` Yoshinori K. Okuji
@ 2006-06-07 11:16 ` Jeroen Dekkers
2006-06-07 15:55 ` Marco Gerards
0 siblings, 1 reply; 11+ messages in thread
From: Jeroen Dekkers @ 2006-06-07 11:16 UTC (permalink / raw)
To: The development of GRUB 2
At Thu, 1 Jun 2006 17:39:13 +0200,
Yoshinori K. Okuji wrote:
>
> On Wednesday 31 May 2006 23:00, Jeroen Dekkers wrote:
> > It's actually a necessary feature for GRUB on amd64. On amd64 you have
> > 64-bit executables but GRUB will run in 32-bit mode.
> >
> > When trying to compile on amd64 I already ran into some problems
> > related to that. First of all on amd64 all binaries are run in 64-bit
> > mode, so the host CFLAGS variable shouldn't have -m32. Secondly LIBS
> > is for the host only and shouldn't be defined when running target
> > tests. As last we set CFLAGS, CC, etc. to the TARGET_*, then we run
> > some checks and change the TARGET_* flags without updating CC, CFLAGS,
> > etc to the new version.
> >
> > The attached patch should fix those problems. I've tested it on i386-pc
> > and x86_64.
>
> It looks good. Please check it in.
Now I actually booted GRUB 2 in qemu, I found another bug. :-) We are
still using grub_host_* types in grub/kernel.h, but the types of those
changed. We should use grub_target_* types there. As I didn't see any
other use of grub_host_* types, I just renamed those to grub_target_*
and changed the #ifdef. See the patch below.
Jeroen Dekkers
2006-06-07 Jeroen Dekkers <jeroen@dekkers.cx>
* include/grub/types.h (grub_host_addr_t): Rename to
grub_target_addr_t.
(grub_host_off_t): Rename to grub_target_off_t.
(grub_host_size_t): Rename to grub_target_size_t.
(grub_host_ssize_t): Rename to grub_target_ssize_t.
Refer to GRUB_TARGET_SIZEOF_VOID_P to define those variables.
* include/grub/kernel.h (struct grub_module_header): Change type
of OFFSET to grub_target_off_t and type of SIZE to grub_target_size_t.
(grub_module_info): Likewise.
Index: include/grub/kernel.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/kernel.h,v
retrieving revision 1.8
diff -u -p -r1.8 kernel.h
--- include/grub/kernel.h 25 Apr 2006 20:08:31 -0000 1.8
+++ include/grub/kernel.h 7 Jun 2006 11:12:39 -0000
@@ -26,9 +26,9 @@
struct grub_module_header
{
/* The offset of object code. */
- grub_host_off_t offset;
+ grub_target_off_t offset;
/* The size of object code plus this header. */
- grub_host_size_t size;
+ grub_target_size_t size;
};
/* "gmim" (GRUB Module Info Magic). */
@@ -39,9 +39,9 @@ struct grub_module_info
/* Magic number so we know we have modules present. */
grub_uint32_t magic;
/* The offset of the modules. */
- grub_host_off_t offset;
+ grub_target_off_t offset;
/* The size of all modules plus this header. */
- grub_host_size_t size;
+ grub_target_size_t size;
};
extern grub_addr_t grub_arch_modules_addr (void);
Index: include/grub/types.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/types.h,v
retrieving revision 1.9
diff -u -p -r1.9 types.h
--- include/grub/types.h 4 Jun 2006 15:56:54 -0000 1.9
+++ include/grub/types.h 7 Jun 2006 11:12:39 -0000
@@ -69,16 +69,16 @@ typedef unsigned long long grub_uint64_t
#endif
/* Misc types. */
-#if SIZEOF_VOID_P == 8
-typedef grub_uint64_t grub_host_addr_t;
-typedef grub_uint64_t grub_host_off_t;
-typedef grub_uint64_t grub_host_size_t;
-typedef grub_int64_t grub_host_ssize_t;
+#if GRUB_TARGET_SIZEOF_VOID_P == 8
+typedef grub_uint64_t grub_target_addr_t;
+typedef grub_uint64_t grub_target_off_t;
+typedef grub_uint64_t grub_target_size_t;
+typedef grub_int64_t grub_target_ssize_t;
#else
-typedef grub_uint32_t grub_host_addr_t;
-typedef grub_uint32_t grub_host_off_t;
-typedef grub_uint32_t grub_host_size_t;
-typedef grub_int32_t grub_host_ssize_t;
+typedef grub_uint32_t grub_target_addr_t;
+typedef grub_uint32_t grub_target_off_t;
+typedef grub_uint32_t grub_target_size_t;
+typedef grub_int32_t grub_target_ssize_t;
#endif
#if GRUB_CPU_SIZEOF_VOID_P == 8
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)
2006-05-30 21:08 [patch] Fix for building correct code on i386-pc (CVS-HEAD) Vesa Jääskeläinen
2006-05-30 21:15 ` Hollis Blanchard
@ 2006-05-30 22:10 ` Marco Gerards
2006-05-31 0:28 ` Yoshinori K. Okuji
2 siblings, 0 replies; 11+ messages in thread
From: Marco Gerards @ 2006-05-30 22:10 UTC (permalink / raw)
To: The development of GRUB 2
Vesa Jääskeläinen <chaac@nic.fi> writes:
Hi Vesa,
> Attached patch fixes problems for compiling correct code on i386-pc...
> other platforms needs to be modified similarly too...
Isn't this also required for the kernel? How about replacing the
module specific CLFAGs, instead of adding TARGET_CFLAG? I assume the
old one isn't used anymore...
--
Marco
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)
2006-05-30 21:08 [patch] Fix for building correct code on i386-pc (CVS-HEAD) Vesa Jääskeläinen
2006-05-30 21:15 ` Hollis Blanchard
2006-05-30 22:10 ` [patch] Fix for building correct code on i386-pc (CVS-HEAD) Marco Gerards
@ 2006-05-31 0:28 ` Yoshinori K. Okuji
2 siblings, 0 replies; 11+ messages in thread
From: Yoshinori K. Okuji @ 2006-05-31 0:28 UTC (permalink / raw)
To: The development of GRUB 2
On Tuesday 30 May 2006 23:08, Vesa Jääskeläinen wrote:
> Attached patch fixes problems for compiling correct code on i386-pc...
> other platforms needs to be modified similarly too...
Sorry. This is my mistake. I've fixed it differently right now.
Okuji
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-06-07 15:52 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-30 21:08 [patch] Fix for building correct code on i386-pc (CVS-HEAD) Vesa Jääskeläinen
2006-05-30 21:15 ` Hollis Blanchard
2006-05-31 3:59 ` Harley D. Eades III
2006-05-30 22:00 ` Hollis Blanchard
2006-05-31 0:31 ` Yoshinori K. Okuji
2006-05-31 21:00 ` [PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD)) Jeroen Dekkers
2006-06-01 15:39 ` Yoshinori K. Okuji
2006-06-07 11:16 ` [PATCH] Another fix for x86_64 Jeroen Dekkers
2006-06-07 15:55 ` Marco Gerards
2006-05-30 22:10 ` [patch] Fix for building correct code on i386-pc (CVS-HEAD) Marco Gerards
2006-05-31 0:28 ` 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.