Cross-compilation enablement.
PATCH 1/4 Cross-compilation enablement.
changeset: 6334:28c822457019 user: [email protected] date: Mon Aug 29 18:48:06 2005 -0400 summary: Fixes for cross-compilation; ensure that toolchain is selected by Config.mk
tools/console/Makefile +1 -2
@@ -9,8 +9,7 @@ INSTALL_PROG = $(INSTALL) -m0755 INSTALL_DIR = $(INSTALL) -d -m0755 -CC = gcc -CFLAGS = -Wall -Werror -g3 +CFLAGS += -Wall -Werror -g3 CFLAGS += -I $(XEN_XCS) CFLAGS += -I $(XEN_LIBXC)
tools/examples/Makefile +3 -0
@@ -1,3 +1,6 @@ +XEN_ROOT = ../../ +include $(XEN_ROOT)/tools/Rules.mk + INSTALL = install INSTALL_DIR = $(INSTALL) -d -m0755 INSTALL_PROG = $(INSTALL) -m0755
tools/xcutils/Makefile +0 -2
@@ -18,8 +18,6 @@ PROGRAMS_INSTALL_DIR = /usr/libexec/xen INCLUDES += -I $(XEN_LIBXC) - -CC := gcc CFLAGS += -Wall -Werror -O3 -fno-strict-aliasing CFLAGS += $(INCLUDES)
tools/xenstat/Makefile +4 -0
@@ -3,7 +3,11 @@ SUBDIRS := SUBDIRS += libxenstat + +# This doesn't cross-compile (cross-compile environments rarely have curses) +ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH)) SUBDIRS += xentop +endif .PHONY: all install clean
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 2/4 Cross-compilation enablement.
changeset: 6335:b8dfe20a5b9d user: [email protected] date: Mon Aug 29 18:52:56 2005 -0400 summary: Make mbootpack work on big-endian systems.
tools/misc/mbootpack/Makefile +8 -7
@@ -20,11 +20,10 @@ INCS := -I. -I- DEFS := LDFLAGS := -CC := gcc CFLAGS := -Wall -Wpointer-arith -Wcast-qual -Wno-unused -Wno-format CFLAGS += -Wmissing-prototypes -#CFLAGS += -pipe -g -O0 -Wcast-align -CFLAGS += -pipe -O3 +CFLAGS += -pipe -g -O0 -Wcast-align +#CFLAGS += -pipe -O3 # What object files need building for the program OBJS := mbootpack.o buildimage.o
@@ -34,7 +33,7 @@ DEPS = .*.d mbootpack: $(OBJS) - $(CC) -o $@ $(filter-out %.a, $^) $(LDFLAGS) + $(HOSTCC) -o $@ $(filter-out %.a, $^) $(LDFLAGS) clean: $(RM) mbootpack *.o $(DEPS) bootsect setup bzimage_header.c bin2c
@@ -48,20 +47,22 @@ $(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary setup.o -o $@ bin2c: bin2c.o - $(CC) -o $@ $^ + $(HOSTCC) -o $@ $^ bzimage_header.c: bootsect setup bin2c ./bin2c -n 8 -b1 -a bzimage_bootsect bootsect > bzimage_header.c ./bin2c -n 8 -b1 -a bzimage_setup setup >> bzimage_header.c + buildimage.c: bzimage_header.c @ %.o: %.S - $(CC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@ + $(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@ %.o: %.c - $(CC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@ + $(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@ + .PHONY: all clean gdb .PRECIOUS: $(OBJS) $(OBJS:.o=.c) $(DEPS)
tools/misc/mbootpack/buildimage.c +3 -2
@@ -42,6 +42,7 @@#include "mbootpack.h" #include "mb_header.h" +/* We will build an image that a bzImage-capable bootloader will load like * this:
@@ -105,8 +106,8 @@section_t *s;/* Patch the kernel and mbi addresses into the setup code */ - *(address_t *)(bzimage_setup +BZ_ENTRY_OFFSET ) = entry; - *(address_t *)(bzimage_setup +BZ_MBI_OFFSET ) = mbi; + *(address_t *)(bzimage_setup +BZ_ENTRY_OFFSET ) =eswap (entry); + *(address_t *)(bzimage_setup +BZ_MBI_OFFSET ) =eswap (mbi);if (!quiet)printf ("Kernel entry is %p, MBI is %p.\n" , entry, mbi);/* Write out header and trampoline */
tools/misc/mbootpack/mbootpack.c +41 -38
190 lines not on this page · raw message
tools/misc/mbootpack/mbootpack.h +18 -0
@@ -31,6 +31,24 @@#undef NDEBUG#include <stdio.h> + +#include <endian.h> +#include <byteswap.h> +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define eswap (x) (x) +#else +#define eswap (x) \ + ({ \ + typeof(x) y = (x); \ + switch(sizeof(y)) \ + { \ + case 2: y = __bswap_16(y); break; \ + case 4: y = __bswap_32(y); break; \ + case 8: y = __bswap_64(y); break; \ + } \ + y; \ + }) +#endif /* Flags */ extern int quiet;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 3/4 Cross-compilation enablement.
In reply to Michal Ostrowskichangeset: 6468:f22c08b57c9a user: [email protected] date: Mon Aug 29 19:45:28 2005 -0400 summary: Fixes for cross-compilation.
tools/Makefile +6 -2
@@ -7,14 +7,18 @@ SUBDIRS += misc SUBDIRS += examples SUBDIRS += xentrace -SUBDIRS += python SUBDIRS += xcs SUBDIRS += xcutils -#SUBDIRS += pygrub SUBDIRS += firmware SUBDIRS += security SUBDIRS += console SUBDIRS += xenstat + +# These don't cross-compile +ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH)) +SUBDIRS += python +#SUBDIRS += pygrub +endif .PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 4/4 Cross-compilation enablement.
In reply to Michal Ostrowskichangeset: 6474:b6a82de711aa user: [email protected] date: Tue Aug 30 08:01:02 2005 -0400 summary: Cross-compilation fixes. CC comes from Config.mk
tools/xcs/Makefile +1 -2
@@ -10,8 +10,7 @@ INSTALL_PROG = $(INSTALL) -m0755 INSTALL_DIR = $(INSTALL) -d -m0755 -CC = gcc -CFLAGS = -Wall -Werror -g3 -D _XOPEN_SOURCE=600 +CFLAGS += -Wall -Werror -g3 -D _XOPEN_SOURCE=600 CFLAGS += -I $(XEN_XC) CFLAGS += -I $(XEN_LIBXC)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Every one of the five patches that you just mailed were chewed by your mail client. Please resend them as attachments (just send a single multi-attachment email).
Also, if you cannot cross-compile all the tool chain (including important Python-based components), what is the point in cross-compiling any of them? I guess most of your patches are cleanups, and mbootpack is executed on the compile host, but still I wonder. :-)
-- Keir
Quoted 1 line · Keir Fraser
Every one of the five patches that you just mailed were chewed by your mail client. Please resend them as attachments (just send a single multi-attachment email).
Actually they're fine, just mime encoded. My bad.
-- Keir
Quoted 7 lines · On Tue, 30 Aug 2005 14:08:40 +0100 Keir Fraser <[email protected]> wrote:
Also, if you cannot cross-compile all the tool chain (including important Python-based components), what is the point in cross-compiling any of them? I guess most of your patches are cleanups, and mbootpack is executed on the compile host, but still I wonder. :-)
a) The python cross-compilation problems stem from the fact that python facilities are being used to build your python-binding libraries. I don't see an easy way to tell those tools that they should be cross-compiling. Setting CC and CFLAGS and the like is not enough; the python tools need to realize that they must build using a python installation that is not the installation that is being used to run the build.
Cross-compilation environments also tend to be fairly poor in terms of the libraries that are present and my experience has been that higher-level libraries and tools tend to be less cross-compilation friendly.
b) I'm not assuming I can fix everything in one shot.
c) I can cross-compile vm-tools.
Signature · 1 line
Michal Ostrowski
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel