All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Supporting building on x86-64 host as 32-bit UML
@ 2005-03-19 18:04 Blaisorblade
  2005-03-20 15:03 ` [uml-devel] " Gerd Knorr
  0 siblings, 1 reply; 5+ messages in thread
From: Blaisorblade @ 2005-03-19 18:04 UTC (permalink / raw)
  To: user-mode-linux-devel, Gerd Knorr

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

It is really difficult for the end-user (and tricky for a developer) to build 
a 32-bit UML on a 64-bit host box...

I would like to address this, but I've not definite ideas.

The problems are:

1) how the user must choose what he wants (SUBARCH=i386 can be useful, maybe a 
Kconfig option would be nice - we need to choose the default depending on the 
host arch).

2) using the proper options for the tools (addressed partially by the patch 
below)

3) using the proper headers (asm-i386 instead of asm-x86_64)... Fedora (I 
don't know about SuSE and my Gentoo is 32-bit still) uses some smart headers 
that select the correct version, basing on some macros defined by GCC:

#ifndef __ASM_STUB_SYSTEM_H__
# define __ASM_STUB_SYSTEM_H__
# if defined __x86_64__
#  include <asm-x86_64/system.h>
# endif
# if defined __i386__
#  include <asm-i386/system.h>
# endif
#endif

The problem is that we explicitly refuse to define these macros, like this:

CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH)

(from arch/um/Makefile-i386) for which I don't find a valid reason... I first 
thought this was 

diff -puN arch/um/Makefile~uml-build-on-x86_64_as_i386 arch/um/Makefile
--- linux-2.6.9-current/arch/um/Makefile~uml-build-on-x86_64_as_i386    
2004-09-26 19:51:43.000000000 +0200
+++ linux-2.6.9-current-paolo/arch/um/Makefile  2004-09-26 19:59:17.000000000 
+0200
@@ -34,6 +34,13 @@ endif
 ARCH_INCLUDE   := -I$(ARCH_DIR)/include
 SYS_DIR                := $(ARCH_DIR)/include/sysdep-$(SUBARCH)

+AFLAGS         += -m32
+CFLAGS         += -m32
+LDFLAGS                += -melf_i386
+HOSTCFLAGS     += -m32
+HOSTLDFLAGS    += -m32
+export HOSTLDFLAGS
+
 include $(ARCH_DIR)/Makefile-$(SUBARCH)
 include $(ARCH_DIR)/Makefile-os-$(OS)

-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade

[-- Attachment #2: uml-build-on-x86_64_as_i386.patch --]
[-- Type: text/x-diff, Size: 758 bytes --]



Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
---

 linux-2.6.9-current-paolo/arch/um/Makefile |    7 +++++++
 1 files changed, 7 insertions(+)

diff -puN arch/um/Makefile~uml-build-on-x86_64_as_i386 arch/um/Makefile
--- linux-2.6.9-current/arch/um/Makefile~uml-build-on-x86_64_as_i386	2004-09-26 19:51:43.000000000 +0200
+++ linux-2.6.9-current-paolo/arch/um/Makefile	2004-09-26 19:59:17.000000000 +0200
@@ -34,6 +34,13 @@ endif
 ARCH_INCLUDE	:= -I$(ARCH_DIR)/include
 SYS_DIR		:= $(ARCH_DIR)/include/sysdep-$(SUBARCH)
 
+AFLAGS		+= -m32
+CFLAGS		+= -m32
+LDFLAGS		+= -melf_i386
+HOSTCFLAGS	+= -m32
+HOSTLDFLAGS	+= -m32
+export HOSTLDFLAGS
+
 include $(ARCH_DIR)/Makefile-$(SUBARCH)
 include $(ARCH_DIR)/Makefile-os-$(OS)
 
_

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

end of thread, other threads:[~2005-03-22 20:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19 18:04 [uml-devel] Supporting building on x86-64 host as 32-bit UML Blaisorblade
2005-03-20 15:03 ` [uml-devel] " Gerd Knorr
2005-03-22 17:53   ` Blaisorblade
2005-03-22 19:07     ` Gerd Knorr
2005-03-22 20:02       ` Blaisorblade

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.