Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/8] Use --target for target architecture specification
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 7/8] removed partially duplicated system headers Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 1/8] Enable building a 32 bit binary for ppc64 platforms Jeremy Kerr
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

Instead of using a combination of ARCH and --host, use --target.

It's possible to have host != target. For example, building a ppc
kexec binary for a ppc64 kernel. In this case, the kexec binary is
compiled for 32-bit, while the purgatory object is 64-bit.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 configure.ac |   40 +++++++++++++++-------------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac
index bcfbc58..032d9de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,50 +14,40 @@ dnl as there are only a small number of targets that kexec
 dnl can support on a given host system.  If it stops making
 dnl sense compile support for all possible targets a given
 dnl host can support AC_CANONICAL_TARGET may help
-dnl AC_CANONICAL_TARGET
+AC_CANONICAL_TARGET
 
 
-dnl Compute host cpu
-case $host_cpu in 
-	i?86 )	
-		host_cpu="i386"
+dnl Compute ARCH from target cpu info
+case $target_cpu in
+	i?86 )
+		ARCH="i386"
 		;;
 	powerpc )
-		host_cpu="ppc"
+		ARCH="ppc"
 		;;
 	powerpc64 )
-		host_cpu="ppc64"
+		ARCH="ppc64"
 		;;
-	s390x )
-		host_cpu="s390"
+	s390x|s390 )
+		ARCH="s390"
 		;;
-	sh4|sh4a|sh3 )
-		host_cpu="sh"
+	sh4|sh4a|sh3|sh )
+		ARCH="sh"
 		;;
-	* ) 
-		host_cpu="$host_cpu"
-		;;
-esac
-case $host_cpu in
-	i386|ppc|x86_64|alpha|ppc64|ia64|s390|sh)
+	ia64|x86_64|alpha )
+		ARCH="$target_cpu"
 		;;
 	* )
-		AC_MSG_ERROR([ unsupported architecture $host_cpu])
+		AC_MSG_ERROR([unsupported architecture $target_cpu])
 		;;
 esac
 
-dnl Try to guess the kernel ARCH based on the autoconf host_cpu variable.
-
-if ! test "${ARCH}" ; then
-	ARCH=$host_cpu
-fi
-
 dnl ---Options
 
 OBJDIR=`pwd`/objdir
 if test "${host_alias}" ; then
 	OBJDIR="$OBJDIR-${host_alias}"
-fi 
+fi
 
 EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing -Wstrict-prototypes $(CPPFLAGS) $(EXTRA_CPPFLAGS)'
 BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)'

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 8/8] Don't assume we can re-make Makefile
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (3 preceding siblings ...)
  2007-12-18  8:47 ` [PATCH 3/8] Consolidate BOOTLOADER defines Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 5/8] Add gamecube to config.h defines Jeremy Kerr
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

We currently assume that we can recreate the Makefile by running
./configure, but we don't have the args available, so it's likely that
the Makefile will be generated incorrectly.

This change depends on config.status instead. We won't get the
configure re-run if configure.ac is updated, but we still have the
Makefile.in dependency.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 Makefile.in |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index fdbb7c2..2cc1c30 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -172,8 +172,8 @@ SRCS:= AUTHORS COPYING News TODO Makefile.in configure.ac \
 PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
 PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
 
-Makefile: Makefile.in configure
-	$(srcdir)/configure
+Makefile: Makefile.in config.status
+	./config.status
 
 configure: configure.ac
 	cd $(srcdir) && autoheader && autoconf && rm -rf autom4te.cache

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing
@ 2007-12-18  8:47 Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 7/8] removed partially duplicated system headers Jeremy Kerr
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

Hi all,

This series of patches is aimed at simplifying the kexec build system,
mainly in order to make cross-compilation much easier.

As well as cross-compiling, this makes it possible to separate the
'host' architecture (ie, the arch of the kexec binary built), and the
'target' architecture (ie, the arch of the kernel that we're kexecing).
We can specify these with the standard --host and --target arguments
to configure.

This allows us to kexec a powerpc64 kernel from a powerpc userspace.
x86{,_64} users might find this handy too, but I don't have hardware
to test.

Any comments are most welcome - if you're able to test on your
arch, that would be great too.

Cheers,


Jeremy

---
David Woodhouse (1):
      Enable building a 32 bit binary for ppc64 platforms.

Jeremy Kerr (6):
      Use --target for target architecture specification
      Consolidate BOOTLOADER defines
      Use config.h for defines
      Add gamecube to config.h defines
      Build system simplification/standardisation
      Don't assume we can re-make Makefile

Simon Horman (1):
      removed partially duplicated system headers


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 4/8] Use config.h for defines
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (5 preceding siblings ...)
  2007-12-18  8:47 ` [PATCH 5/8] Add gamecube to config.h defines Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 6/8] Build system simplification/standardisation Jeremy Kerr
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

Instead of putting a heap of -D directives in CPPFLAGS, use a config.h
header.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 Makefile                |    8 ++------
 Makefile.conf.in        |    1 -
 configure.ac            |   17 ++++++++++++-----
 kexec/crashdump-xen.c   |    6 ++++--
 kexec/kexec.c           |    5 ++++-
 kexec/kexec.h           |    4 +++-
 kexec_test/kexec_test.S |    4 +++-
 7 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index 0a56615..73ff2f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,5 @@
 # Hey Emacs this is a -*- makefile-*-
 include Makefile.conf
-VERSION=20071030-git
-DATE=30th October 2007
-PACKAGE=kexec-tools-testing
 
 pkgdatadir = $(datadir)/$(PACKAGE)
 pkglibdir = $(libdir)/$(PACKAGE)
@@ -13,9 +10,7 @@ pkgincludedir = $(includedir)/$(PACKAGE)
 # Useful for building binary packages
 DESTDIR =
 
-EXTRA_CPPFLAGS:= -I./include -I./util_lib/include \
-	-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"' \
-	-DPACKAGE='"$(PACKAGE)"' $(DEFS) $(EXTRA_CFLAGS)
+EXTRA_CPPFLAGS:= -I./include -I./util_lib/include $(DEFS) $(EXTRA_CFLAGS)
 
 PREFIX:=$(OBJDIR)/build
 SBINDIR=$(PREFIX)/sbin
@@ -109,6 +104,7 @@ Makefile.conf: Makefile.conf.in configure
 	/bin/sh ./configure
 
 configure: configure.ac
+	autoheader
 	autoconf
 	$(RM) -rf autom4te.cache
 
diff --git a/Makefile.conf.in b/Makefile.conf.in
index 40111b2..b5418e0 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -15,7 +15,6 @@ infodir=@infodir@
 mandir=@mandir@
 includedir=@includedir@
 
-DEFS=@DEFS@
 LIBS=@LIBS@
 
 # The target architecture
diff --git a/configure.ac b/configure.ac
index 032d9de..d036ba1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,8 +4,13 @@ dnl
 dnl 
 
 dnl ---Required
-AC_INIT(Makefile.conf.in)
+AC_INIT(kexec-tools-testing, 20071030-git)
 AC_CONFIG_AUX_DIR(./config)
+AC_CONFIG_HEADERS([include/config.h])
+
+AC_DEFINE_UNQUOTED(PACKAGE_DATE, "30th October 2007",
+		[Define to the release date of this package])
+
 
 dnl -- Compilation platform configuration
 AC_CANONICAL_HOST
@@ -108,13 +113,16 @@ AC_CHECK_PROG([DIRNAME],  dirname,  dirname,  "no", [$PATH])
 
 dnl See if I have a usable copy of zlib available
 if test "$with_zlib" = yes ; then
-	AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, inflateInit_, [AC_DEFINE(HAVE_ZLIB_H, 1) LIBS="$LIBS -lz"]))
+	AC_CHECK_HEADER(zlib.h,
+		AC_CHECK_LIB(z, inflateInit_, ,
+		AC_MSG_NOTICE([zlib support disabled])))
 fi
 
 dnl find Xen control stack libraries
 if test "$with_xen" = yes ; then
-	AC_CHECK_HEADER(xenctrl.h, AC_CHECK_LIB(xenctrl, xc_version,
-		[AC_DEFINE(HAVE_XENCTRL_H, 1) LIBS="$LIBS -lxenctrl"]))
+	AC_CHECK_HEADER(xenctrl.h,
+		AC_CHECK_LIB(xenctrl, xc_version, ,
+		AC_MSG_NOTICE([Xen support disabled])))
 fi
 
 dnl ---Sanity checks
@@ -137,7 +145,6 @@ if test "$XARGS"   = "no"; then AC_MSG_ERROR([ xargs not found]) fi
 if test "$DIRNAME" = "no"; then AC_MSG_ERROR([ dirname not found]) fi 
 
 dnl ---Output variables...
-
 AC_SUBST([BUILD_CC])
 AC_SUBST([BUILD_CFLAGS])
 
diff --git a/kexec/crashdump-xen.c b/kexec/crashdump-xen.c
index 4d6a25d..1fdaf05 100644
--- a/kexec/crashdump-xen.c
+++ b/kexec/crashdump-xen.c
@@ -14,7 +14,9 @@
 #include "crashdump.h"
 #include "kexec-syscall.h"
 
-#ifdef HAVE_XENCTRL_H
+#include "config.h"
+
+#ifdef HAVE_LIBXENCTRL
 #include <xenctrl.h>
 #endif
 
@@ -36,7 +38,7 @@ int xen_present(void)
 unsigned long xen_architecture(struct crash_elf_info *elf_info)
 {
 	unsigned long machine = elf_info->machine;
-#ifdef HAVE_XENCTRL_H
+#ifdef HAVE_LIBXENCTRL
 	int xc, rc;
 	xen_capabilities_info_t capabilities;
 
diff --git a/kexec/kexec.c b/kexec/kexec.c
index fe29dad..abc1cce 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -29,6 +29,9 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <getopt.h>
+
+#include "config.h"
+
 #ifdef HAVE_ZLIB_H
 #include <zlib.h>
 #endif
@@ -718,7 +721,7 @@ static int my_exec(void)
 
 static void version(void)
 {
-	printf(PACKAGE " " VERSION " released " RELEASE_DATE "\n");
+	printf(PACKAGE_STRING " released " PACKAGE_DATE "\n");
 }
 
 void usage(void)
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 2ee48c4..2384c53 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -1,6 +1,8 @@
 #ifndef KEXEC_H
 #define KEXEC_H
 
+#include "config.h"
+
 #include <sys/types.h>
 #include <stdint.h>
 #define USE_BSD
@@ -197,7 +199,7 @@ extern unsigned char purgatory[];
 extern size_t purgatory_size;
 
 #define BOOTLOADER "kexec"
-#define BOOTLOADER_VERSION VERSION
+#define BOOTLOADER_VERSION PACKAGE_VERSION
 
 void arch_usage(void);
 int arch_process_options(int argc, char **argv);
diff --git a/kexec_test/kexec_test.S b/kexec_test/kexec_test.S
index 5106c5c..ad081bc 100644
--- a/kexec_test/kexec_test.S
+++ b/kexec_test/kexec_test.S
@@ -17,6 +17,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include "config.h"
+
 	.equ	PROT_CODE_SEG, pmcs - gdt
 	.equ	REAL_CODE_SEG, rmcs - gdt
  	.equ	PROT_DATA_SEG, pmds - gdt
@@ -419,7 +421,7 @@ gdt_end:
 	
 s_hello:
 	.ascii	"kexec_test "
-	.ascii VERSION
+	.ascii PACKAGE_VERSION
 	.asciz " starting...\r\n"
 s_switching_descriptors:
 	.asciz	"Switching descriptors.\r\n"

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 3/8] Consolidate BOOTLOADER defines
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (2 preceding siblings ...)
  2007-12-18  8:47 ` [PATCH 1/8] Enable building a 32 bit binary for ppc64 platforms Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 8/8] Don't assume we can re-make Makefile Jeremy Kerr
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

The BOOTLOADER and BOOTLOADER_VERSION #defines are repeated in multiple
files. This change removes the unnecessary definition of these, and
keeps the kexec/kexec.h as the main source.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 kexec/arch/i386/kexec-multiboot-x86.c |    2 --
 kexec/arch/ppc/kexec-dol-ppc.c        |    2 --
 kexec/arch/ppc/kexec-elf-ppc.c        |    2 --
 kexec/arch/ppc64/kexec-elf-ppc64.c    |    3 ---
 4 files changed, 9 deletions(-)

diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
index 8ec8bba..5ad279a 100644
--- a/kexec/arch/i386/kexec-multiboot-x86.c
+++ b/kexec/arch/i386/kexec-multiboot-x86.c
@@ -61,8 +61,6 @@
 static char headerbuf[MULTIBOOT_SEARCH];
 static struct multiboot_header *mbh = NULL;
 
-#define BOOTLOADER "kexec"
-#define BOOTLOADER_VERSION VERSION
 #define MIN(_x,_y) (((_x)<=(_y))?(_x):(_y))
 
 
diff --git a/kexec/arch/ppc/kexec-dol-ppc.c b/kexec/arch/ppc/kexec-dol-ppc.c
index 1b34f2a..5e7e078 100644
--- a/kexec/arch/ppc/kexec-dol-ppc.c
+++ b/kexec/arch/ppc/kexec-dol-ppc.c
@@ -90,8 +90,6 @@ typedef struct {
 #define PAGE_MASK		(~((1 << PAGE_SHIFT) - 1))
 #define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
 
-#define BOOTLOADER         "kexec"
-#define BOOTLOADER_VERSION VERSION
 #define MAX_COMMAND_LINE   256
 
 #define UPSZ(X) ((sizeof(X) + 3) & ~3)
diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
index e5e5ebd..241c803 100644
--- a/kexec/arch/ppc/kexec-elf-ppc.c
+++ b/kexec/arch/ppc/kexec-elf-ppc.c
@@ -27,8 +27,6 @@
 
 static const int probe_debug = 0;
 
-#define BOOTLOADER         "kexec"
-#define BOOTLOADER_VERSION VERSION
 #define MAX_COMMAND_LINE   256
 
 #define UPSZ(X) ((sizeof(X) + 3) & ~3)
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
index 165a0f6..a8df885 100644
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
@@ -39,9 +39,6 @@
 #include "crashdump-ppc64.h"
 #include <arch/options.h>
 
-#define BOOTLOADER         "kexec"
-#define BOOTLOADER_VERSION VERSION
-
 uint64_t initrd_base, initrd_size;
 unsigned char reuse_initrd = 0;
 const char *ramdisk;

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 5/8] Add gamecube to config.h defines
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (4 preceding siblings ...)
  2007-12-18  8:47 ` [PATCH 8/8] Don't assume we can re-make Makefile Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 4/8] Use config.h for defines Jeremy Kerr
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

.. instead of messing with CFLAGS.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 configure.ac                   |    6 ++++--
 kexec/arch/ppc/kexec-elf-ppc.c |    4 +++-
 kexec/arch/ppc/kexec-ppc.c     |    4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index d036ba1..8574bc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,8 +70,10 @@ fi;
 AC_ARG_WITH([objdir], AC_HELP_STRING([--with-objdir=<dir>],[select directory for object files]),
 	[ OBJDIR="$withval" ], [ OBJDIR="$OBJDIR" ])
 
-AC_ARG_WITH([gamecube], AC_HELP_STRING([--with-gamecube],[enable gamecube support]),
-	[ EXTRA_CFLAGS="$EXTRA_CFLAGS -DCONFIG_GAMECUBE=1" ])
+AC_ARG_WITH([gamecube],
+		AC_HELP_STRING([--with-gamecube],[enable gamecube support]),
+		AC_DEFINE(WITH_GAMECUBE, 1,
+			[Define to include gamecube support]))
 
 AC_ARG_WITH([zlib], AC_HELP_STRING([--without-zlib],[disable zlib support]),
 	[ with_zlib="$withval"], [ with_zlib=yes ] )
diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
index 241c803..571349d 100644
--- a/kexec/arch/ppc/kexec-elf-ppc.c
+++ b/kexec/arch/ppc/kexec-elf-ppc.c
@@ -25,6 +25,8 @@
 #include "kexec-ppc.h"
 #include <arch/options.h>
 
+#include "config.h"
+
 static const int probe_debug = 0;
 
 #define MAX_COMMAND_LINE   256
@@ -135,7 +137,7 @@ int elf_ppc_load(int argc, char **argv,	const char *buf, off_t len,
 	unsigned char *setup_start;
 	uint32_t setup_size;
 	int result;
-#ifdef CONFIG_GAMECUBE
+#ifdef WITH_GAMECUBE
 	int target_is_gamecube = 1;
 #else
 	int target_is_gamecube = 0;
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index df05212..9a88f9c 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -18,6 +18,8 @@
 #include "kexec-ppc.h"
 #include <arch/options.h>
 
+#include "config.h"
+
 #define MAX_MEMORY_RANGES  64
 static struct memory_range memory_range[MAX_MEMORY_RANGES];
 
@@ -26,7 +28,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
 					unsigned long kexec_flags)
 {
 	int memory_ranges = 0;
-#ifdef CONFIG_GAMECUBE
+#ifdef WITH_GAMECUBE
 	/* RAM - lowmem used by DOLs - framebuffer */
 	memory_range[memory_ranges].start = 0x00003000;
 	memory_range[memory_ranges].end = 0x0174bfff;

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 7/8] removed partially duplicated system headers
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 2/8] Use --target for target architecture specification Jeremy Kerr
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

From: Simon Horman <horms@verge.net.au>

Purgatory seems to partially duplicate system headers.
It seems a log cleaner not to do so.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 purgatory/arch/alpha/include/limits.h    |   57 -----------------------------
 purgatory/arch/alpha/include/stdint.h    |   16 --------
 purgatory/arch/i386/console-x86.c        |    3 +
 purgatory/arch/i386/include/limits.h     |   58 ------------------------------
 purgatory/arch/i386/include/stdint.h     |   16 --------
 purgatory/arch/i386/pic.c                |    2 -
 purgatory/arch/i386/purgatory-x86.c      |    2 -
 purgatory/arch/i386/timer.c              |    1 
 purgatory/arch/i386/vga.c                |    2 -
 purgatory/arch/ia64/include/limits.h     |   57 -----------------------------
 purgatory/arch/ia64/include/stdint.h     |   16 --------
 purgatory/arch/ppc/include/limits.h      |   58 ------------------------------
 purgatory/arch/ppc/include/stdint.h      |   16 --------
 purgatory/arch/ppc64/include/limits.h    |   57 -----------------------------
 purgatory/arch/ppc64/include/stdint.h    |   16 --------
 purgatory/arch/s390/include/limits.h     |   54 ----------------------------
 purgatory/arch/s390/include/stdint.h     |   24 ------------
 purgatory/arch/sh/include/limits.h       |   58 ------------------------------
 purgatory/arch/sh/include/stdint.h       |   16 --------
 purgatory/arch/x86_64/include/arch/io.h  |   59 -------------------------------
 purgatory/arch/x86_64/include/limits.h   |   57 -----------------------------
 purgatory/arch/x86_64/include/stdint.h   |   16 --------
 purgatory/arch/x86_64/purgatory-x86_64.c |    2 -
 util_lib/include/sha256.h                |    1 
 24 files changed, 7 insertions(+), 657 deletions(-)

diff --git a/purgatory/arch/alpha/include/limits.h b/purgatory/arch/alpha/include/limits.h
deleted file mode 100644
index 0c6f21f..0000000
--- a/purgatory/arch/alpha/include/limits.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	9223372036854775807L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	18446744073709551615UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/alpha/include/stdint.h b/purgatory/arch/alpha/include/stdint.h
deleted file mode 100644
index 2f9c592..0000000
--- a/purgatory/arch/alpha/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long      uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long        int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/i386/console-x86.c b/purgatory/arch/i386/console-x86.c
index 128f202..68f5daf 100644
--- a/purgatory/arch/i386/console-x86.c
+++ b/purgatory/arch/i386/console-x86.c
@@ -1,4 +1,5 @@
-#include <arch/io.h>
+#include <stdint.h>
+#include <sys/io.h>
 #include <purgatory.h>
 
 /*
diff --git a/purgatory/arch/i386/include/limits.h b/purgatory/arch/i386/include/limits.h
deleted file mode 100644
index d5a5a02..0000000
--- a/purgatory/arch/i386/include/limits.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	2147483647L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	4294967295UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/i386/include/stdint.h b/purgatory/arch/i386/include/stdint.h
deleted file mode 100644
index 79262c2..0000000
--- a/purgatory/arch/i386/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long long   int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/i386/pic.c b/purgatory/arch/i386/pic.c
index 1b73ea9..c23c459 100644
--- a/purgatory/arch/i386/pic.c
+++ b/purgatory/arch/i386/pic.c
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#include <arch/io.h>
+#include <sys/io.h>
 #include <purgatory.h>
 #include "purgatory-x86.h"
 
diff --git a/purgatory/arch/i386/purgatory-x86.c b/purgatory/arch/i386/purgatory-x86.c
index 5ad0740..4d2c5c7 100644
--- a/purgatory/arch/i386/purgatory-x86.c
+++ b/purgatory/arch/i386/purgatory-x86.c
@@ -1,4 +1,4 @@
-#include <arch/io.h>
+#include <stdint.h>
 #include <purgatory.h>
 #include "purgatory-x86.h"
 
diff --git a/purgatory/arch/i386/timer.c b/purgatory/arch/i386/timer.c
index dec5938..7a4bdaa 100644
--- a/purgatory/arch/i386/timer.c
+++ b/purgatory/arch/i386/timer.c
@@ -1,4 +1,3 @@
-#include <arch/io.h>
 #include <purgatory.h>
 #include "purgatory-x86.h"
 
diff --git a/purgatory/arch/i386/vga.c b/purgatory/arch/i386/vga.c
index effa8ff..e65976c 100644
--- a/purgatory/arch/i386/vga.c
+++ b/purgatory/arch/i386/vga.c
@@ -1,4 +1,4 @@
-#include <arch/io.h>
+#include <sys/io.h>
 #include <purgatory.h>
 #include "purgatory-x86.h"
 
diff --git a/purgatory/arch/ia64/include/limits.h b/purgatory/arch/ia64/include/limits.h
deleted file mode 100644
index 0c6f21f..0000000
--- a/purgatory/arch/ia64/include/limits.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	9223372036854775807L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	18446744073709551615UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/ia64/include/stdint.h b/purgatory/arch/ia64/include/stdint.h
deleted file mode 100644
index 2f9c592..0000000
--- a/purgatory/arch/ia64/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long      uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long        int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/ppc/include/limits.h b/purgatory/arch/ppc/include/limits.h
deleted file mode 100644
index d5a5a02..0000000
--- a/purgatory/arch/ppc/include/limits.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	2147483647L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	4294967295UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/ppc/include/stdint.h b/purgatory/arch/ppc/include/stdint.h
deleted file mode 100644
index 79262c2..0000000
--- a/purgatory/arch/ppc/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long long   int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/ppc64/include/limits.h b/purgatory/arch/ppc64/include/limits.h
deleted file mode 100644
index 0c6f21f..0000000
--- a/purgatory/arch/ppc64/include/limits.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	9223372036854775807L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	18446744073709551615UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/ppc64/include/stdint.h b/purgatory/arch/ppc64/include/stdint.h
deleted file mode 100644
index 2f9c592..0000000
--- a/purgatory/arch/ppc64/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long      uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long        int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/s390/include/limits.h b/purgatory/arch/s390/include/limits.h
deleted file mode 100644
index 3424298..0000000
--- a/purgatory/arch/s390/include/limits.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef _LIMITS_H_
-#define _LIMITS_H_
-
-/* Number of bits in a `char'.	*/
-#  define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold.  */
-#  define SCHAR_MIN	(-128)
-#  define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold.  (Minimum is 0.)  */
-#  define UCHAR_MAX	255
-
-#  define CHAR_MIN	SCHAR_MIN
-#  define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold.  */
-#  define SHRT_MIN	(-32768)
-#  define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short int' can hold.  (Minimum is 0.)  */
-#  define USHRT_MAX	65535
-
-/* Minimum and maximum values a `signed int' can hold.  */
-#  define INT_MIN	(-INT_MAX - 1)
-#  define INT_MAX	2147483647
-
-/* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
-#  define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long int' can hold.  */
-#ifdef __s390x__
-#   define LONG_MAX	9223372036854775807L
-#else
-#   define LONG_MAX	2147483647L
-#endif
-
-#  define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
-#ifdef __s390x__
-#   define ULONG_MAX	18446744073709551615UL
-#else
-#   define ULONG_MAX	4294967295UL
-#endif
-
-/* Minimum and maximum values a `signed long long int' can hold.  */
-#   define LLONG_MAX	9223372036854775807LL
-#   define LLONG_MIN	(-LLONG_MAX - 1LL)
-
-/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0.)  */
-#   define ULLONG_MAX	18446744073709551615ULL
-
-#endif	/* !_LIMITS_H_ */
diff --git a/purgatory/arch/s390/include/stdint.h b/purgatory/arch/s390/include/stdint.h
deleted file mode 100644
index a713cf5..0000000
--- a/purgatory/arch/s390/include/stdint.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _STDINT_H
-#define _STDINT_H
-
-typedef unsigned long		size_t;
-
-typedef unsigned char		uint8_t;
-typedef unsigned short		uint16_t;
-typedef unsigned int		uint32_t;
-#ifdef __s390x__
-typedef unsigned long		uint64_t;
-#else
-typedef unsigned long long	uint64_t;
-#endif
-
-typedef signed char 		int8_t;
-typedef short 			int16_t;
-typedef int 			int32_t;
-#ifdef __s390x__
-typedef long			int64_t;
-#else
-typedef long long		int64_t;
-#endif
-
-#endif
diff --git a/purgatory/arch/sh/include/limits.h b/purgatory/arch/sh/include/limits.h
deleted file mode 100644
index d5a5a02..0000000
--- a/purgatory/arch/sh/include/limits.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	2147483647L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	4294967295UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/sh/include/stdint.h b/purgatory/arch/sh/include/stdint.h
deleted file mode 100644
index 79262c2..0000000
--- a/purgatory/arch/sh/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long long   int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/x86_64/include/arch/io.h b/purgatory/arch/x86_64/include/arch/io.h
index 13ad887..dcd01bf 100644
--- a/purgatory/arch/x86_64/include/arch/io.h
+++ b/purgatory/arch/x86_64/include/arch/io.h
@@ -2,65 +2,6 @@
 #define ARCH_IO_H
 
 #include <stdint.h>
-/* Helper functions for directly doing I/O */
-
-extern inline uint8_t inb(uint16_t port)
-{
-	uint8_t result;
-
-	__asm__ __volatile__ (
-		"inb %w1,%0"
-		:"=a" (result)
-		:"Nd" (port));
-	return result;
-}
-
-extern inline uint16_t inw(uint16_t port)
-{
-	uint16_t result;
-
-	__asm__ __volatile__ (
-		"inw %w1,%0"
-		:"=a" (result)
-		:"Nd" (port));
-	return result;
-}
-
-extern inline uint32_t inl(uint32_t port)
-{
-	uint32_t result;
-
-	__asm__ __volatile__ (
-		"inl %w1,%0"
-		:"=a" (result)
-		:"Nd" (port));
-	return result;
-}
-
-extern inline void outb (uint8_t value, uint16_t port)
-{
-	__asm__ __volatile__ (
-		"outb %b0,%w1"
-		:
-		:"a" (value), "Nd" (port));
-}
-
-extern inline void outw (uint16_t value, uint16_t port)
-{
-	__asm__ __volatile__ (
-		"outw %w0,%w1"
-		:
-		:"a" (value), "Nd" (port));
-}
-
-extern inline void outl (uint32_t value, uint16_t port)
-{
-	__asm__ __volatile__ (
-		"outl %0,%w1"
-		:
-		:"a" (value), "Nd" (port));
-}
-
 
 /*
  * readX/writeX() are used to access memory mapped devices. On some
diff --git a/purgatory/arch/x86_64/include/limits.h b/purgatory/arch/x86_64/include/limits.h
deleted file mode 100644
index 0c6f21f..0000000
--- a/purgatory/arch/x86_64/include/limits.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef LIMITS_H
-#define LIMITS_H	1
-
-/* Number of bits in a `char' */
-#define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold */
-#define SCHAR_MIN	(-128)
-#define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold */
-#define CHAR_MIN	SCHAR_MIN
-#define CHAR_MAX	SCHAR_MAX
-
-/* Minimum and maximum values a `signed short int' can hold */
-#define SHRT_MIN	(-32768)
-#define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
-#define USHRT_MAX	65535
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-
-/* Minimum and maximum values a `signed int' can hold */
-#define INT_MIN		(-INT_MAX - 1)
-#define INT_MAX		2147483647
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long' can hold */
-#define LONG_MAX	9223372036854775807L
-#define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
-#define ULONG_MAX	18446744073709551615UL
-
-/* Minimum and maximum values a `signed long long' can hold */
-#define LLONG_MAX	9223372036854775807LL
-#define LLONG_MIN	(-LONG_MAX - 1LL)
-
-
-/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
-#define ULLONG_MAX	18446744073709551615ULL
-
-
-#endif /* LIMITS_H */
diff --git a/purgatory/arch/x86_64/include/stdint.h b/purgatory/arch/x86_64/include/stdint.h
deleted file mode 100644
index 2f9c592..0000000
--- a/purgatory/arch/x86_64/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef STDINT_H
-#define STDINT_H
-
-typedef unsigned long      size_t;
-
-typedef unsigned char      uint8_t;
-typedef unsigned short     uint16_t;
-typedef unsigned int       uint32_t;
-typedef unsigned long      uint64_t;
-
-typedef signed char        int8_t;
-typedef signed short       int16_t;
-typedef signed int         int32_t;
-typedef signed long        int64_t;
-
-#endif /* STDINT_H */
diff --git a/purgatory/arch/x86_64/purgatory-x86_64.c b/purgatory/arch/x86_64/purgatory-x86_64.c
index b159ed3..374b554 100644
--- a/purgatory/arch/x86_64/purgatory-x86_64.c
+++ b/purgatory/arch/x86_64/purgatory-x86_64.c
@@ -1,4 +1,4 @@
-#include <arch/io.h>
+#include <stdint.h>
 #include <purgatory.h>
 #include "purgatory-x86_64.h"
 
diff --git a/util_lib/include/sha256.h b/util_lib/include/sha256.h
index b8278a1..467fb22 100644
--- a/util_lib/include/sha256.h
+++ b/util_lib/include/sha256.h
@@ -1,6 +1,7 @@
 #ifndef SHA256_H
 #define SHA256_H
 
+#include <sys/types.h>
 #include <stdint.h>
 
 typedef struct

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 1/8] Enable building a 32 bit binary for ppc64 platforms.
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 7/8] removed partially duplicated system headers Jeremy Kerr
  2007-12-18  8:47 ` [PATCH 2/8] Use --target for target architecture specification Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-19  6:02   ` Geoff Levand
  2007-12-18  8:47 ` [PATCH 3/8] Consolidate BOOTLOADER defines Jeremy Kerr
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

From: David Woodhouse <dwmw2@infradead.org>

Based on
http://cvs.fedora.redhat.com/viewcvs/rpms/kexec-tools/devel/kexec-tools-1.101-ppc-boots-ppc64.patch?rev=1.2&view=auto

64 bit: OK
32 bit: purgatory build fails

Work-in-progress-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 kexec/arch/ppc64/crashdump-ppc64.h     |    4 ++--
 kexec/arch/ppc64/kexec-elf-ppc64.c     |   26 +++++++++++++-------------
 kexec/arch/ppc64/kexec-elf-rel-ppc64.c |    4 ++--
 kexec/arch/ppc64/kexec-ppc64.c         |   20 ++++++++++----------
 kexec/arch/ppc64/kexec-ppc64.h         |    2 +-
 kexec/kexec-sha256.h                   |    4 ++--
 purgatory/arch/ppc64/Makefile          |    2 ++
 purgatory/purgatory.c                  |    2 ++
 8 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/kexec/arch/ppc64/crashdump-ppc64.h b/kexec/arch/ppc64/crashdump-ppc64.h
index 583338a..0ce9c46 100644
--- a/kexec/arch/ppc64/crashdump-ppc64.h
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
@@ -23,8 +23,8 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size);
 #define _ALIGN_UP(addr,size)	(((addr)+((size)-1))&(~((size)-1)))
 #define _ALIGN_DOWN(addr,size)	((addr)&(~((size)-1)))
 
-extern unsigned long long crash_base;
-extern unsigned long long crash_size;
+extern uint64_t crash_base;
+extern uint64_t crash_size;
 extern unsigned int rtas_base;
 extern unsigned int rtas_size;
 
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
index 65f289b..165a0f6 100644
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
@@ -42,7 +42,7 @@
 #define BOOTLOADER         "kexec"
 #define BOOTLOADER_VERSION VERSION
 
-unsigned long initrd_base, initrd_size;
+uint64_t initrd_base, initrd_size;
 unsigned char reuse_initrd = 0;
 const char *ramdisk;
 
@@ -83,19 +83,19 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
 	char *cmdline, *modified_cmdline;
 	const char *devicetreeblob;
 	int cmdline_len, modified_cmdline_len;
-	unsigned long long max_addr, hole_addr;
+	uint64_t max_addr, hole_addr;
 	unsigned char *seg_buf = NULL;
 	off_t seg_size = 0;
 	struct mem_phdr *phdr;
 	size_t size;
-	unsigned long long *rsvmap_ptr;
+	uint64_t *rsvmap_ptr;
 	struct bootblock *bb_ptr;
 	unsigned int nr_segments, i;
 	int result, opt;
-	unsigned long my_kernel, my_dt_offset;
+	uint64_t my_kernel, my_dt_offset;
 	unsigned int my_panic_kernel;
-	unsigned long my_stack, my_backup_start;
-	unsigned long toc_addr;
+	uint64_t my_stack, my_backup_start;
+	uint64_t toc_addr;
 	unsigned int slave_code[256/sizeof (unsigned int)], master_entry;
 
 #define OPT_APPEND     (OPT_ARCH_MAX+0)
@@ -237,10 +237,10 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
 		}
 		seg_buf = (unsigned char *)slurp_file(ramdisk, &seg_size);
 		add_buffer(info, seg_buf, seg_size, seg_size, 0, 0, max_addr, 1);
-		hole_addr = (unsigned long long)
+		hole_addr = (uint64_t)
 			info->segment[info->nr_segments-1].mem;
 		initrd_base = hole_addr;
-		initrd_size = (unsigned long long)
+		initrd_size = (uint64_t)
 			info->segment[info->nr_segments-1].memsz;
 	} /* ramdisk */
 
@@ -270,25 +270,25 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
 	 */
 	bb_ptr = (struct bootblock *)(
 		(unsigned char *)info->segment[(info->nr_segments)-1].buf);
-	rsvmap_ptr = (unsigned long long *)(
+	rsvmap_ptr = (uint64_t *)(
 		(unsigned char *)info->segment[(info->nr_segments)-1].buf +
 		bb_ptr->off_mem_rsvmap);
 	while (*rsvmap_ptr || *(rsvmap_ptr+1))
 		rsvmap_ptr += 2;
 	rsvmap_ptr -= 2;
-	*rsvmap_ptr = (unsigned long long)(
+	*rsvmap_ptr = (uint64_t)(
 		info->segment[(info->nr_segments)-1].mem);
 	rsvmap_ptr++;
-	*rsvmap_ptr = (unsigned long long)bb_ptr->totalsize;
+	*rsvmap_ptr = (uint64_t)bb_ptr->totalsize;
 
 	nr_segments = info->nr_segments;
 
 	/* Set kernel */
-	my_kernel = (unsigned long )info->segment[0].mem;
+	my_kernel = (uint64_t)info->segment[0].mem;
 	elf_rel_set_symbol(&info->rhdr, "kernel", &my_kernel, sizeof(my_kernel));
 
 	/* Set dt_offset */
-	my_dt_offset = (unsigned long )info->segment[nr_segments-1].mem;
+	my_dt_offset = (uint64_t)info->segment[nr_segments-1].mem;
 	elf_rel_set_symbol(&info->rhdr, "dt_offset", &my_dt_offset,
 				sizeof(my_dt_offset));
 
diff --git a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
index c5fd561..1c9fce5 100644
--- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
@@ -101,10 +101,10 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
 		break;
 
 	case R_PPC64_ADDR16_HIGHEST:
-		*(uint16_t *)location = ((value>>48)  & 0xffff);
+		*(uint16_t *)location = (((uint64_t)value>>48)  & 0xffff);
 		break;
 	case R_PPC64_ADDR16_HIGHER:
-		*(uint16_t *)location = ((value>>32)  & 0xffff);
+		*(uint16_t *)location = (((uint64_t)value>>32)  & 0xffff);
 		break;
 
 	default:
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index 3d233cf..9333f29 100644
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -41,7 +41,7 @@ static struct memory_range *base_memory_range = NULL;
 static unsigned long long rmo_top;
 unsigned long long memory_max = 0;
 static int nr_memory_ranges, nr_exclude_ranges;
-unsigned long long crash_base, crash_size;
+uint64_t crash_base, crash_size;
 unsigned int rtas_base, rtas_size;
 int max_memory_ranges;
 
@@ -203,10 +203,10 @@ static int get_base_ranges(void)
 				break;
 			}
 			base_memory_range[local_memory_ranges].start =
-				((unsigned long long *)buf)[0];
+				((uint64_t *)buf)[0];
 			base_memory_range[local_memory_ranges].end  =
 				base_memory_range[local_memory_ranges].start +
-				((unsigned long long *)buf)[1];
+				((uint64_t *)buf)[1];
 			base_memory_range[local_memory_ranges].type = RANGE_RAM;
 			local_memory_ranges++;
 			dbgprintf("%016llx-%016llx : %x\n",
@@ -231,7 +231,7 @@ static int get_base_ranges(void)
 static int sort_ranges(void)
 {
 	int i, j;
-	unsigned long long tstart, tend;
+	uint64_t tstart, tend;
 	for (i = 0; i < nr_exclude_ranges - 1; i++) {
 		for (j = 0; j < nr_exclude_ranges - i - 1; j++) {
 			if (exclude_range[j].start > exclude_range[j+1].start) {
@@ -292,7 +292,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 				perror(fname);
 				goto error_opencdir;
 			}
-			if (fread(&kernel_end, sizeof(unsigned long), 1, file) != 1) {
+			if (fread(&kernel_end, sizeof(uint64_t), 1, file) != 1) {
 				perror(fname);
 				goto error_openfile;
 			}
@@ -312,7 +312,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 					perror(fname);
 					goto error_opencdir;
 				}
-				if (fread(&crash_base, sizeof(unsigned long), 1,
+				if (fread(&crash_base, sizeof(uint64_t), 1,
 						file) != 1) {
 					perror(fname);
 					goto error_openfile;
@@ -327,7 +327,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 					perror(fname);
 					goto error_opencdir;
 				}
-				if (fread(&crash_size, sizeof(unsigned long), 1,
+				if (fread(&crash_size, sizeof(uint64_t), 1,
 						file) != 1) {
 					perror(fname);
 					goto error_openfile;
@@ -356,7 +356,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 				perror(fname);
 				goto error_opendir;
 			}
-			if (fread(&htab_base, sizeof(unsigned long), 1, file) != 1) {
+			if (fread(&htab_base, sizeof(uint64_t), 1, file) != 1) {
 				perror(fname);
 				goto error_openfile;
 			}
@@ -368,7 +368,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 				perror(fname);
 				goto error_opencdir;
 			}
-			if (fread(&htab_size, sizeof(unsigned long), 1, file) != 1) {
+			if (fread(&htab_size, sizeof(uint64_t), 1, file) != 1) {
 				perror(fname);
 				goto error_openfile;
 			}
@@ -487,7 +487,7 @@ static int get_devtree_details(unsigned long kexec_flags)
 				perror(fname);
 				goto error_opendir;
 			}
-			if (fread(&tce_base, sizeof(unsigned long), 1, file) != 1) {
+			if (fread(&tce_base, sizeof(uint64_t), 1, file) != 1) {
 				perror(fname);
 				goto error_openfile;
 				return -1;
diff --git a/kexec/arch/ppc64/kexec-ppc64.h b/kexec/arch/ppc64/kexec-ppc64.h
index 26c70ba..242947b 100644
--- a/kexec/arch/ppc64/kexec-ppc64.h
+++ b/kexec/arch/ppc64/kexec-ppc64.h
@@ -14,7 +14,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
 void elf_ppc64_usage(void);
 void reserve(unsigned long long where, unsigned long long length);
 
-extern unsigned long initrd_base, initrd_size;
+extern uint64_t initrd_base, initrd_size;
 extern int max_memory_ranges;
 extern unsigned char reuse_initrd;
 
diff --git a/kexec/kexec-sha256.h b/kexec/kexec-sha256.h
index d414ec5..b4bb856 100644
--- a/kexec/kexec-sha256.h
+++ b/kexec/kexec-sha256.h
@@ -2,8 +2,8 @@
 #define KEXEC_SHA256_H
 
 struct sha256_region {
-	const void *start;
-	unsigned long len;
+	uint64_t start;
+	uint64_t len;
 };
 
 #define SHA256_REGIONS 16
diff --git a/purgatory/arch/ppc64/Makefile b/purgatory/arch/ppc64/Makefile
index 82b1654..0406278 100644
--- a/purgatory/arch/ppc64/Makefile
+++ b/purgatory/arch/ppc64/Makefile
@@ -6,3 +6,5 @@ PURGATORY_S_SRCS+= purgatory/arch/ppc64/v2wrap.S
 PURGATORY_C_SRCS += purgatory/arch/ppc64/purgatory-ppc64.c
 PURGATORY_C_SRCS += purgatory/arch/ppc64/console-ppc64.c
 PURGATORY_C_SRCS += purgatory/arch/ppc64/crashdump_backup.c
+
+PCFLAGS += -m64 -mcall-aixdesc
diff --git a/purgatory/purgatory.c b/purgatory/purgatory.c
index ad0cac2..aacbb3b 100644
--- a/purgatory/purgatory.c
+++ b/purgatory/purgatory.c
@@ -46,3 +46,5 @@ void purgatory(void)
 	verify_sha256_digest();
 	post_verification_setup_arch();
 }
+
+#include "../util_lib/sha256.c"

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 6/8] Build system simplification/standardisation
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (6 preceding siblings ...)
  2007-12-18  8:47 ` [PATCH 4/8] Use config.h for defines Jeremy Kerr
@ 2007-12-18  8:47 ` Jeremy Kerr
  2007-12-18 23:25 ` [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Vivek Goyal
  2007-12-19  6:04 ` Simon Horman
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-18  8:47 UTC (permalink / raw)
  To: kexec

This change makes kexec-tools work more like a standard configure-make-
make-install-type project:

* Remove $(OBJDIR) stuff. To do an out-of-tree build, just configure
from a different directory.

* Use the implicit Makefile rules more, and just edit the compiler
flags for specific targets.

* Simplify compiler/linker flags - no need for EXTRA_*

* Add TARGET_CC, and improve checks for BUILD_CC too.

* Set arch-specific flags in arch-specific makefiles, not conditional
on $(ARCH).

* Use combined _SRCS and _OBJS instead of splitting into .S and .c
components

* Use a $(clean) variable to store items to be removed on 'make clean'

* Generate dependency files in the main compile, rather than as a
separate step.

* Don't #include sha256.c, but re-build it into the purgatory.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 Makefile                       |  251 --------------------------------
 Makefile.conf.in               |   51 ------
 Makefile.in                    |  319 +++++++++++++++++++++++++++++++++++++++++
 configure.ac                   |   38 ++--
 kdump/Makefile                 |   27 +--
 kexec/Makefile                 |   91 +++--------
 kexec/arch/i386/Makefile       |   18 +-
 kexec/arch/ia64/Makefile       |   10 -
 kexec/arch/ppc/Makefile        |   12 -
 kexec/arch/ppc64/Makefile      |   14 -
 kexec/arch/s390/Makefile       |    6 
 kexec/arch/sh/Makefile         |   10 -
 kexec/arch/x86_64/Makefile     |   20 +-
 kexec_test/Makefile            |   35 +---
 purgatory/Makefile             |   81 +++-------
 purgatory/arch/alpha/Makefile  |    3 
 purgatory/arch/i386/Makefile   |   22 +-
 purgatory/arch/ia64/Makefile   |   11 -
 purgatory/arch/ppc/Makefile    |    6 
 purgatory/arch/ppc64/Makefile  |   12 -
 purgatory/arch/s390/Makefile   |    4 
 purgatory/arch/sh/Makefile     |    4 
 purgatory/arch/x86_64/Makefile |   23 +-
 purgatory/include/string.h     |    2 
 purgatory/purgatory.c          |    4 
 util/Makefile                  |   14 +
 util_lib/Makefile              |   28 +--
 27 files changed, 525 insertions(+), 591 deletions(-)

diff --git a/Makefile b/Makefile
deleted file mode 100644
index 73ff2f1..0000000
--- a/Makefile
+++ /dev/null
@@ -1,251 +0,0 @@
-# Hey Emacs this is a -*- makefile-*-
-include Makefile.conf
-
-pkgdatadir = $(datadir)/$(PACKAGE)
-pkglibdir = $(libdir)/$(PACKAGE)
-pkgincludedir = $(includedir)/$(PACKAGE)
-
-# You can specify DESTDIR on the command line to do a add
-# a prefix to the install so it doesn't really happen
-# Useful for building binary packages
-DESTDIR =
-
-EXTRA_CPPFLAGS:= -I./include -I./util_lib/include $(DEFS) $(EXTRA_CFLAGS)
-
-PREFIX:=$(OBJDIR)/build
-SBINDIR=$(PREFIX)/sbin
-BINDIR=$(PREFIX)/bin
-LIBEXECDIR=$(PREFIX)/libexec
-DATADIR=$(PREFIX)/share
-SYSCONFDIR=$(PREFIX)/etc
-SHAREDSTATEDIR=$(PREFIX)/com
-LOCALSTATEDIR=$(PREFIX)/var
-LIBDIR=$(PREFIX)/lib
-INFODIR=$(PREFIX)/info
-MANDIR=$(PREFIX)/man
-MAN1DIR=$(MANDIR)/man1
-MAN2DIR=$(MANDIR)/man2
-MAN3DIR=$(MANDIR)/man3
-MAN4DIR=$(MANDIR)/man4
-MAN5DIR=$(MANDIR)/man5
-MAN6DIR=$(MANDIR)/man6
-MAN7DIR=$(MANDIR)/man7
-MAN8DIR=$(MANDIR)/man8
-INCLUDEDIR=$(PREFIX)/include
-
-PKGDATADIR=$(DATADIR)/$(PACKAGE)
-PKGLIBDIR=$(LIBDIR)/$(PACKAGE)
-PKGINCLUDEIR=$(INCLUDEDIR)/$(PACKAGE)
-
-MAN_PAGES:= kexec/kexec.8
-MAN_PAGES+= kdump/kdump.8
-BINARIES_i386:=  $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
-BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
-BINARIES:=$(SBINDIR)/kexec $(SBINDIR)/kdump $(BINARIES_$(ARCH)) 
-
-TARGETS:=$(BINARIES) $(MAN_PAGES)
-
-all: $(TARGETS)
-
-# cc-option
-# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
-cc-option = $(shell if $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(1) -S -o /dev/null \
-	     -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else \
-	     echo "$(2)"; fi ;)
-
-# Utility function library
-#
-include util_lib/Makefile
-
-#
-# Stand alone utilities
-#
-include util/Makefile
-
-#
-# purgatory (code between kernels)
-#
-include purgatory/Makefile
-
-#
-# kexec (linux booting linux)
-#
-include kexec/Makefile
-
-
-# kdump (read a crashdump from memory)
-#
-include kdump/Makefile
-
-#
-# kexec_test (test program)
-#
-ifeq ($(ARCH),i386)
-include kexec_test/Makefile
-endif
-ifeq ($(ARCH),x86_64)
-include kexec_test/Makefile
-endif
-
-SPEC=$(PACKAGE).spec
-GENERATED_SRCS:= ./configure ./$(SPEC)
-TARBALL=$(OBJDIR)/$(PACKAGE)-$(VERSION).tar.gz
-SRCS:=$(shell $(FIND) \
-	./AUTHORS ./COPYING ./News ./TODO \
-	./Makefile ./Makefile.conf.in ./configure.ac \
-	./kexec-tools.spec.in ./config ./doc \
-	./include ./kexec ./purgatory ./kexec_test ./kdump ./util ./util_lib \
-	! -path '*CVS*' ! -name '*~' ! -name '.*' \
-	-type f -print )
-SRCS+=$(GENERATED_SRCS)
-PSRCS:=$(patsubst ./%,$(PACKAGE)-$(VERSION)/%,$(SRCS))
-
-Makefile.conf: Makefile.conf.in configure
-	/bin/sh ./configure
-
-configure: configure.ac
-	autoheader
-	autoconf
-	$(RM) -rf autom4te.cache
-
-tarball: $(TARBALL)
-
-$(TARBALL): $(SRCS) $(SPEC)
-	$(MKDIR) -p $(OBJDIR)
-	$(RM) -f $(OBJDIR)/$(PACKAGE)-$(VERSION)
-	$(LN) -s .. $(OBJDIR)/$(PACKAGE)-$(VERSION)
-	(cd $(OBJDIR); $(TAR) -cf - $(PSRCS) | gzip -9) > $@
-
-rpm: $(TARBALL)
-	$(MKDIR) -p $(OBJDIR)/RPM $(OBJDIR)/SRPM $(OBJDIR)/BUILD $(OBJDIR)/SPECS \
-		$(OBJDIR)/TMP $(OBJDIR)/SOURCES
-	unset MAKEFLAGS MAKELEVEL; \
-	$(RPMBUILD) -ta \
-		--define '_rpmdir $(OBJDIR)/RPM' \
-		--define '_srcrpmdir $(OBJDIR)/SRPM' \
-		--define '_builddir $(OBJDIR)/BUILD' \
-		--define '_specdir $(OBJDIR)/SPECS' \
-		--define '_tmppath $(OBJDIR)/TMP' \
-		--define '_sourcedir $(OBJDIR)/SOURCES' \
-		$(TARBALL)
-
-$(SPEC): kexec-tools.spec.in Makefile
-	$(SED) -e 's,^Version: $$,Version: $(VERSION),' $< > $@
-
-echo::
-	@echo ARCH=$(ARCH)
-	@echo BINARIES=$(BINARIES)
-	@echo TARGETS=$(TARGETS)
-	@echo CC=$(CC)
-	@echo AR=$(AR)
-	@echo LD=$(LD)
-
-clean:
-	@$(FIND) $(OBJDIR) ! -name '*.d' -type f | $(XARGS) $(RM) rm -f
-	@$(RM) -rf rpm
-	@$(RM) -f config.log config.status config.cache
-	@$(RM) -f $(TARBALL)
-
-distclean: dist-clean
-
-dist-clean: clean
-	@$(RM) -rf $(OBJDIR)
-	@$(FIND) . -type f -name '*~' -o -name '*.orig' | $(XARGS) $(RM) -f
-	@$(RM) -f Makefile.conf
-
-maintainerclean: maintainer-clean
-
-maintainer-clean: dist-clean
-	@$(RM) -f $(GENERATED_SRCS)
-
-
-install: $(TARGETS)
-	for file in $(TARGETS) ; do \
-		if test `$(DIRNAME) $$file` =     "$(SBINDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(sbindir)/; \
-			$(INSTALL) -m 555  $$file $(DESTDIR)/$(sbindir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(BINDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(bindir)/; \
-			$(INSTALL) -m 555 $$file $(DESTDIR)/$(bindir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(LIBEXECDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(libexecdir)/; \
-			$(INSTALL) -m 555 $$file $(DESTDIR)/$(libexecdir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(DATADIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(datadir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(datadir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(SYSCONFDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(sysconfdir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(sysconfdir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(SHAREDSTATEDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(sharedstatedir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(sharedstatedir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(LOCALSTATEDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(localstatedir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(localstatedir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(LIBDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(libdir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(libdir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(INFODIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(infodir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(infodir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN1DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man1; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man1; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN2DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man2; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man2; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN3DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man3/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man3/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN4DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man4/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man4/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN5DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man5/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man5/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN6DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man6/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man6/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN7DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man7/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man7/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(MAN8DIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man8/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man8/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(INCLUDEDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(includedir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(includedir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(PKGDATADIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(pkgdatadir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(pkgdatadir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(PKGLIBDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(pkglibdir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(pkglibdir)/; \
-		fi; \
-		if test `$(DIRNAME) $$file` =     "$(PKGINCLUDEDIR)" ; then \
-			$(MKDIR) -p     $(DESTDIR)/$(pkgincludedir)/; \
-			$(INSTALL) -m 444 $$file $(DESTDIR)/$(pkgincludedir)/; \
-		fi; \
-	done
-
-.PHONY: echo install all clean dist-clean distclean maintainer-clean 	\
-	maintainerclean tarball rpm
diff --git a/Makefile.conf.in b/Makefile.conf.in
deleted file mode 100644
index b5418e0..0000000
--- a/Makefile.conf.in
+++ /dev/null
@@ -1,51 +0,0 @@
-# Hey Emacs this is a -*- makefile-*-
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-
-bindir=@bindir@
-sbindir=@sbindir@
-libexecdir=@libexecdir@
-datadir=@datadir@
-sysconfdir=@sysconfdir@
-sharedstatedir=@sharedstatedir@
-localstatedir=@localstatedir@
-libdir=@libdir@
-infodir=@infodir@
-mandir=@mandir@
-includedir=@includedir@
-
-LIBS=@LIBS@
-
-# The target architecture
-ARCH  =@ARCH@
-OBJDIR=@OBJDIR@
-
-# Compiler for building kexec
-CC          =@CC@
-CPP         =@CPP@
-LD          =@LD@
-AS          =@AS@
-OBJCOPY     =@OBJCOPY@
-AR          =@AR@
-CFLAGS      =@CFLAGS@
-EXTRA_CFLAGS=@EXTRA_CFLAGS@
-LDFLAGS     =@LDFLAGS@ 
-
-# Utilities called by the makefiles
-INSTALL=@INSTALL@
-MKDIR=@MKDIR@
-RM=@RM@
-CP=@CP@
-LN=@LN@
-TAR=@TAR@
-RPMBUILD=@RPMBUILD@
-SED=@SED@
-FIND=@FIND@
-XARGS=@XARGS@
-DIRNAME=@DIRNAME@
-
-# C compiler for building utilities to use
-# during the build
-BUILD_CC=@BUILD_CC@
-BUILD_CFLAGS=@BUILD_CFLAGS@  $(DEFS)
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..fdbb7c2
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,319 @@
+# Hey Emacs this is a -*- makefile-*-
+
+PACKAGE_NAME	= @PACKAGE_NAME@
+PACKAGE_VERSION	= @PACKAGE_VERSION@
+
+prefix		= @prefix@
+exec_prefix	= @exec_prefix@
+
+bindir		= @bindir@
+sbindir		= @sbindir@
+libexecdir	= @libexecdir@
+datadir		= @datadir@
+sysconfdir	= @sysconfdir@
+sharedstatedir	= @sharedstatedir@
+localstatedir	= @localstatedir@
+libdir		= @libdir@
+infodir		= @infodir@
+mandir		= @mandir@
+includedir	= @includedir@
+
+
+# The target architecture
+ARCH		= @ARCH@
+OBJDIR		= @OBJDIR@
+target		= @target@
+host		= @host@
+
+# Compiler for building kexec
+CC		= @CC@
+CPP		= @CPP@
+LD		= @LD@
+AS		= @AS@
+OBJCOPY		= @OBJCOPY@
+AR		= @AR@
+
+# C compiler for binaries to run during the build
+BUILD_CC	= @BUILD_CC@
+BUILD_CFLAGS	= @BUILD_CFLAGS@
+TARGET_CC	= @TARGET_CC@
+TARGET_CFLAGS	= @TARGET_CFLAGS@
+
+
+# Base compiler flags. These are extended by the subcomponent-Makefiles
+# where necessary.
+CPPFLAGS	= @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \
+		  	-Iinclude/
+CFLAGS		= @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes
+ASFLAGS		= @ASFLAGS@
+LDFLAGS		= @LDFLAGS@
+LIBS		= @LIBS@
+
+# Utilities called by the makefiles
+INSTALL		= @INSTALL@
+MKDIR		= @MKDIR@
+RM		= @RM@
+CP		= @CP@
+LN		= @LN@
+TAR		= @TAR@
+RPMBUILD	= @RPMBUILD@
+SED		= @SED@
+FIND		= @FIND@
+XARGS		= @XARGS@
+DIRNAME		= @DIRNAME@
+
+
+pkgdatadir = $(datadir)/$(PACKAGE_NAME)
+pkglibdir = $(libdir)/$(PACKAGE_NAME)
+pkgincludedir = $(includedir)/$(PACKAGE_NAME)
+
+# You can specify DESTDIR on the command line to do a add
+# a prefix to the install so it doesn't really happen
+# Useful for building binary packages
+DESTDIR =
+
+srcdir		= @srcdir@
+VPATH		= .:$(srcdir)
+
+# install paths
+BUILD_PREFIX:=build
+SBINDIR=$(BUILD_PREFIX)/sbin
+BINDIR=$(BUILD_PREFIX)/bin
+LIBEXECDIR=$(BUILD_PREFIX)/libexec
+DATADIR=$(BUILD_PREFIX)/share
+SYSCONFDIR=$(BUILD_PREFIX)/etc
+SHAREDSTATEDIR=$(BUILD_PREFIX)/com
+LOCALSTATEDIR=$(BUILD_PREFIX)/var
+LIBDIR=$(BUILD_PREFIX)/lib
+INFODIR=$(BUILD_PREFIX)/info
+MANDIR=$(BUILD_PREFIX)/man
+MAN1DIR=$(MANDIR)/man1
+MAN2DIR=$(MANDIR)/man2
+MAN3DIR=$(MANDIR)/man3
+MAN4DIR=$(MANDIR)/man4
+MAN5DIR=$(MANDIR)/man5
+MAN6DIR=$(MANDIR)/man6
+MAN7DIR=$(MANDIR)/man7
+MAN8DIR=$(MANDIR)/man8
+INCLUDEDIR=$(BUILD_PREFIX)/include
+
+PKGDATADIR=$(DATADIR)/$(PACKAGE_NAME)
+PKGLIBDIR=$(LIBDIR)/$(PACKAGE_NAME)
+PKGINCLUDEIR=$(INCLUDEDIR)/$(PACKAGE_NAME)
+
+MAN_PAGES:= kexec/kexec.8
+MAN_PAGES+= kdump/kdump.8
+BINARIES_i386:=  $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
+BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
+BINARIES:=$(SBINDIR)/kexec $(SBINDIR)/kdump $(BINARIES_$(ARCH))
+
+TARGETS:=$(BINARIES) $(MAN_PAGES)
+
+all: $(TARGETS)
+
+# generic build rules
+%.o: %.c
+	@$(MKDIR) -p $(@D)
+	$(COMPILE.c) -MD -o $@ $<
+
+%.o: %.S
+	@$(MKDIR) -p $(@D)
+	$(COMPILE.S) -MD -o $@ $<
+
+# collect objects to be removed in 'make clean'
+clean =
+
+# utility function for converting a list of files (with extension) to
+# file.o (or file.d) format.
+objify = $(addsuffix .o, $(basename $(1)))
+depify = $(addsuffix .d, $(basename $(1)))
+
+# Utility function library
+#
+include $(srcdir)/util_lib/Makefile
+
+#
+# Stand alone utilities
+#
+include $(srcdir)/util/Makefile
+
+#
+# purgatory (code between kernels)
+#
+include $(srcdir)/purgatory/Makefile
+
+#
+# kexec (linux booting linux)
+#
+include $(srcdir)/kexec/Makefile
+
+
+# kdump (read a crashdump from memory)
+#
+include $(srcdir)/kdump/Makefile
+
+#
+# kexec_test (test program)
+#
+ifeq ($(ARCH),i386)
+include $(srcdir)/kexec_test/Makefile
+endif
+ifeq ($(ARCH),x86_64)
+include $(srcdir)/kexec_test/Makefile
+endif
+
+SPEC=$(PACKAGE_NAME).spec
+GENERATED_SRCS:= $(SPEC)
+TARBALL=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar
+TARBALL.gz=$(TARBALL).gz
+SRCS:= AUTHORS COPYING News TODO Makefile.in configure.ac \
+	kexec-tools.spec.in config doc include kexec purgatory kexec_test \
+	kdump util util_lib configure
+PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
+PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
+
+Makefile: Makefile.in configure
+	$(srcdir)/configure
+
+configure: configure.ac
+	cd $(srcdir) && autoheader && autoconf && rm -rf autom4te.cache
+
+tarball: $(TARBALL.gz)
+
+$(TARBALL): $(SRCS) $(GENERATED_SRCS)
+	$(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+	$(LN) -s $(srcdir) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+	$(TAR) -cf $@ $(PSRCS)
+	$(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+	$(LN) -sf . $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+	$(TAR) -rf $@ $(PGSRCS)
+	$(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
+$(TARBALL.gz): $(TARBALL)
+	gzip -c < $^ > $@
+
+RPMDIR=rpm
+rpm: $(TARBALL)
+	$(MKDIR) -p $(RPMDIR)/RPM $(RPMDIR)/SRPM $(RPMDIR)/BUILD \
+		$(RPMDIR)/SPECS $(RPMDIR)/TMP $(RPMDIR)/SOURCES
+	unset MAKEFLAGS MAKELEVEL; \
+	$(RPMBUILD) -ta \
+		--define '_rpmdir $(RPMDIR)/RPM' \
+		--define '_srcrpmdir $(RPMDIR)/SRPM' \
+		--define '_builddir $(RPMDIR)/BUILD' \
+		--define '_specdir $(RPMDIR)/SPECS' \
+		--define '_tmppath $(RPMDIR)/TMP' \
+		--define '_sourcedir $(RPMDIR)/SOURCES' \
+		$(TARBALL)
+
+$(SPEC): kexec-tools.spec.in Makefile
+	$(SED) -e 's,^Version: $$,Version: $(PACKAGE_VERSION),' $< > $@
+
+echo::
+	@echo ARCH=$(ARCH)
+	@echo BINARIES=$(BINARIES)
+	@echo TARGETS=$(TARGETS)
+	@echo CC=$(CC)
+	@echo AR=$(AR)
+	@echo LD=$(LD)
+
+clean:
+	$(RM) -f $(clean)
+	$(RM) -rf rpm build
+	$(RM) -f $(TARBALL) $(TARBALL.gz)
+
+distclean: dist-clean
+
+dist-clean: clean
+	$(RM) -f config.log config.status config.cache Makefile include/config.h
+
+install: $(TARGETS)
+	for file in $(TARGETS) ; do \
+		if test `$(DIRNAME) $$file` =     "$(SBINDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(sbindir)/; \
+			$(INSTALL) -m 555  $$file $(DESTDIR)/$(sbindir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(BINDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(bindir)/; \
+			$(INSTALL) -m 555 $$file $(DESTDIR)/$(bindir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(LIBEXECDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(libexecdir)/; \
+			$(INSTALL) -m 555 $$file $(DESTDIR)/$(libexecdir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(DATADIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(datadir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(datadir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(SYSCONFDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(sysconfdir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(sysconfdir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(SHAREDSTATEDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(sharedstatedir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(sharedstatedir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(LOCALSTATEDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(localstatedir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(localstatedir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(LIBDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(libdir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(libdir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(INFODIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(infodir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(infodir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN1DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man1; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man1; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN2DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man2; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man2; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN3DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man3/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man3/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN4DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man4/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man4/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN5DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man5/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man5/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN6DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man6/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man6/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN7DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man7/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man7/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(MAN8DIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(mandir)/man8/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(mandir)/man8/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(INCLUDEDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(includedir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(includedir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(PKGDATADIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(pkgdatadir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(pkgdatadir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(PKGLIBDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(pkglibdir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(pkglibdir)/; \
+		fi; \
+		if test `$(DIRNAME) $$file` =     "$(PKGINCLUDEDIR)" ; then \
+			$(MKDIR) -p     $(DESTDIR)/$(pkgincludedir)/; \
+			$(INSTALL) -m 444 $$file $(DESTDIR)/$(pkgincludedir)/; \
+		fi; \
+	done
+
+.PHONY: echo install all clean dist-clean distclean maintainer-clean 	\
+	maintainerclean tarball rpm
diff --git a/configure.ac b/configure.ac
index 8574bc6..6f0dbd6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,15 +13,11 @@ AC_DEFINE_UNQUOTED(PACKAGE_DATE, "30th October 2007",
 
 
 dnl -- Compilation platform configuration
+dnl -- the host specifices the host machine for the kexec binary, the
+dnl -- the target specifies the architecture of the kernel to be kexeced.
 AC_CANONICAL_HOST
-dnl Currentl AC_CANONICAL_HOST is sufficient for my needs
-dnl as there are only a small number of targets that kexec
-dnl can support on a given host system.  If it stops making
-dnl sense compile support for all possible targets a given
-dnl host can support AC_CANONICAL_TARGET may help
 AC_CANONICAL_TARGET
 
-
 dnl Compute ARCH from target cpu info
 case $target_cpu in
 	i?86 )
@@ -54,18 +50,8 @@ if test "${host_alias}" ; then
 	OBJDIR="$OBJDIR-${host_alias}"
 fi
 
-EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing -Wstrict-prototypes $(CPPFLAGS) $(EXTRA_CPPFLAGS)'
-BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)'
-
-# Check whether ppc64. Add -m64 for building 64-bit binary
-# Add -mcall-aixdesc to generate dot-symbols as in gcc 3.3.3
-if test "$host_cpu" = ppc64; then
-  EXTRA_CFLAGS="$EXTRA_CFLAGS -m64 -mcall-aixdesc"
-fi;
-
-if test "$host_cpu" = ppc; then
-  EXTRA_CFLAGS="$EXTRA_CFLAGS -m32"
-fi;
+BUILD_CFLAGS='-O2 -Wall'
+TARGET_CFLAGS='-O2 -Wall'
 
 AC_ARG_WITH([objdir], AC_HELP_STRING([--with-objdir=<dir>],[select directory for object files]),
 	[ OBJDIR="$withval" ], [ OBJDIR="$OBJDIR" ])
@@ -87,11 +73,17 @@ dnl To specify a different compiler, just 'export CC=/path/to/compiler'
 AC_PROG_CC
 
 if test "${build}" != "${host}" ; then
-	BUILD_CC=${CC_FOR_BUILD-gcc}
+	AC_CHECK_PROGS(BUILD_CC, [${build_alias}-gcc ${build}-gcc gcc])
 else
-	BUILD_CC="\$(CC)"
+	BUILD_CC="$CC"
 fi
 
+dnl Find compiler for target
+if test "${target}" != "${host}" ; then
+	AC_CHECK_PROGS(TARGET_CC, [${target_alias}-gcc ${target}-gcc gcc])
+else
+	TARGET_CC="$CC"
+fi
 
 dnl Find the compiler tool chain
 AC_PROG_CPP
@@ -149,11 +141,13 @@ if test "$DIRNAME" = "no"; then AC_MSG_ERROR([ dirname not found]) fi
 dnl ---Output variables...
 AC_SUBST([BUILD_CC])
 AC_SUBST([BUILD_CFLAGS])
+AC_SUBST([TARGET_CC])
+AC_SUBST([TARGET_CFLAGS])
+AC_SUBST([ASFLAGS])
 
-AC_SUBST([EXTRA_CFLAGS])
 AC_SUBST([ARCH])
 AC_SUBST([OBJDIR])
 AC_SUBST([INSTALL])
 
 dnl ---Output
-AC_OUTPUT([Makefile.conf])
+AC_OUTPUT([Makefile])
diff --git a/kdump/Makefile b/kdump/Makefile
index 456c2fc..25c187b 100644
--- a/kdump/Makefile
+++ b/kdump/Makefile
@@ -2,37 +2,26 @@
 # kdump (reading a crashdump from memory)
 #
 
-KDUMP_C_SRCS:= kdump/kdump.c
+KDUMP_SRCS:= kdump/kdump.c
 
-KDUMP_C_OBJS:= $(patsubst %.c, $(OBJDIR)/%.o, $(KDUMP_C_SRCS))
-KDUMP_C_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KDUMP_C_SRCS))
-KDUMP_SRCS:= $(KDUMP_C_SRCS)
-KDUMP_OBJS:= $(KDUMP_C_OBJS)
-KDUMP_DEPS:= $(KDUMP_C_DEPS)
-KDUMP:= $(SBINDIR)/kdump
-KDUMP_MANPAGE:= $(MANDIR)/man8/kdump.8
+KDUMP_OBJS = $(call objify, $(KDUMP_SRCS))
+KDUMP_DEPS = $(call depify, $(KDUMP_OBJS))
 
-include $(KDUMP_DEPS)
+KDUMP = $(SBINDIR)/kdump
+KDUMP_MANPAGE = $(MANDIR)/man8/kdump.8
 
-$(KDUMP_C_DEPS): $(OBJDIR)/%.d: %.c
-	mkdir -p $(@D)
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
+clean += $(KDUMP_OBJS) $(KDUMP_DEPS) $(KDUMP) $(KDUMP_MANPAGE)
 
-$(KDUMP_C_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d
-	mkdir -p $(@D)
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
+-include $(KDUMP_DEPS)
 
 $(KDUMP): $(KDUMP_OBJS)
-	mkdir -p $(@D)
+	@$(MKDIR) -p $(@D)
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $(KDUMP_OBJS)
 
 $(KDUMP_MANPAGE): kdump/kdump.8
 	$(MKDIR) -p     $(MANDIR)/man8
 	cp kdump/kdump.8 $(KDUMP_MANPAGE)
 echo::
-	@echo "KDUMP_C_SRCS $(KDUMP_C_SRCS)"
-	@echo "KDUMP_C_DEPS $(KDUMP_C_DEPS)"
-	@echo "KDUMP_C_OBJS $(KDUMP_C_OBJS)"
 	@echo "KDUMP_SRCS $(KDUMP_SRCS)"
 	@echo "KDUMP_DEPS $(KDUMP_DEPS)"
 	@echo "KDUMP_OBJS $(KDUMP_OBJS)"
diff --git a/kexec/Makefile b/kexec/Makefile
index 6ad9461..29534d0 100644
--- a/kexec/Makefile
+++ b/kexec/Makefile
@@ -1,88 +1,51 @@
 #
 # kexec (linux booting linux)
 #
-PURGATORY_HEX_C:= $(OBJDIR)/kexec/purgatory.c
+PURGATORY_HEX_C = kexec/purgatory.c
 
 $(PURGATORY_HEX_C): $(PURGATORY) $(BIN_TO_HEX)
 	$(MKDIR) -p $(@D)
 	$(BIN_TO_HEX) purgatory < $(PURGATORY) > $@
 
-KCFLAGS:= $(CFLAGS) $(EXTRA_CFLAGS) -Ikexec/arch/$(ARCH)/include
+KEXEC_SRCS =
+KEXEC_GENERATED_SRCS =
 
-KEXEC_C_SRCS:= kexec/kexec.c 
-KEXEC_C_SRCS+= kexec/ifdown.c
-KEXEC_C_SRCS+= kexec/kexec-elf.c 
-KEXEC_C_SRCS+= kexec/kexec-elf-exec.c 
-KEXEC_C_SRCS+= kexec/kexec-elf-core.c
-KEXEC_C_SRCS+= kexec/kexec-elf-rel.c 
-KEXEC_C_SRCS+= kexec/kexec-elf-boot.c 
-KEXEC_C_SRCS+= kexec/kexec-iomem.c
-KEXEC_C_SRCS+= kexec/crashdump.c
-KEXEC_C_SRCS+= kexec/crashdump-xen.c
-KEXEC_C_GENERATED_SRCS+= $(PURGATORY_HEX_C)
-KEXEC_S_SRCS:= 
-KEXEC_S_GENERATED_SRCS:=
-include kexec/arch/$(ARCH)/Makefile
+KEXEC_SRCS += kexec/kexec.c
+KEXEC_SRCS += kexec/ifdown.c
+KEXEC_SRCS += kexec/kexec-elf.c
+KEXEC_SRCS += kexec/kexec-elf-exec.c
+KEXEC_SRCS += kexec/kexec-elf-core.c
+KEXEC_SRCS += kexec/kexec-elf-rel.c
+KEXEC_SRCS += kexec/kexec-elf-boot.c
+KEXEC_SRCS += kexec/kexec-iomem.c
+KEXEC_SRCS += kexec/crashdump.c
+KEXEC_SRCS += kexec/crashdump-xen.c
 
-KEXEC_C_OBJS:= $(patsubst %.c, $(OBJDIR)/%.o, $(KEXEC_C_SRCS) \
-	       $(KEXEC_C_GENERATED_SRCS))
-KEXEC_C_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KEXEC_C_SRCS))
-KEXEC_C_DUMMY_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KEXEC_C_GENERATED_SRCS))
-KEXEC_S_OBJS:= $(patsubst %.S, $(OBJDIR)/%.o, $(KEXEC_S_SRCS) \
-	       $(KEXEC_S_GENERATED_SRCS))
-KEXEC_S_DEPS:= $(patsubst %.S, $(OBJDIR)/%.d, $(KEXEC_S_SRCS))
-KEXEC_S_DUMMY_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KEXEC_S_GENERATED_SRCS))
-KEXEC_SRCS:= $(KEXEC_C_SRCS) $(KEXEC_S_SRCS)
-KEXEC_OBJS:= $(KEXEC_C_OBJS) $(KEXEC_S_OBJS)
-KEXEC_DEPS:= $(KEXEC_C_DEPS) $(KEXEC_S_DEPS)
-KEXEC:= $(SBINDIR)/kexec
-KEXEC_MANPAGE:= $(MANDIR)/man8/kexec.8
+KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
 
-include $(KEXEC_DEPS)
+include $(srcdir)/kexec/arch/$(ARCH)/Makefile
 
-$(KEXEC_C_DEPS): $(OBJDIR)/%.d: %.c
-	mkdir -p $(@D)
-	$(CC) $(KCFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
+KEXEC_OBJS = $(call objify, $(KEXEC_SRCS) $(KEXEC_GENERATED_SRCS))
+KEXEC_DEPS = $(call depify, $(KEXEC_OBJS))
 
-$(KEXEC_S_DEPS): $(OBJDIR)/%.d: %.S
-	mkdir -p $(@D)
-	$(CC) $(KCFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
+clean += $(KEXEC_OBJS) $(KEXEC_DEPS) $(KEXEC_GENERATED_SRCS) \
+	 $(KEXEC) $(KEXEC_MANPAGE)
 
-# This is needed to ensure that the rule below that depend
-# on each .c file having a .d file don't break
-$(KEXEC_C_DUMMY_DEPS): $(OBJDIR)/%.d: %.c
-	mkdir -p $(@D)
-	touch $@
+KEXEC = $(SBINDIR)/kexec
+KEXEC_MANPAGE = $(MANDIR)/man8/kexec.8
 
-# This is needed to ensure that the rule below that depend
-# on each .S file having a .d file don't break
-$(KEXEC_S_DUMMY_DEPS): $(OBJDIR)/%.d: %.S
-	mkdir -p $(@D)
-	touch $@
-
-$(KEXEC_C_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d
-	mkdir -p $(@D)
-	$(CC) $(KCFLAGS) -o $@ -c $<
-
-$(KEXEC_S_OBJS): $(OBJDIR)/%.o: %.S $(OBJDIR)/%.d
-	mkdir -p $(@D)
-	$(CC) $(KCFLAGS) -o $@ -c $<
+-include $(KEXEC_DEPS)
 
 $(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB)
-	mkdir -p $(@D)
-	$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(KCFLAGS) -o $@ \
-		$(KEXEC_OBJS) $(UTIL_LIB) $(LIBS)
+	@$(MKDIR) -p $(@D)
+	$(LINK.o) -o $@ $^
+
+$(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include
 
 $(KEXEC_MANPAGE): kexec/kexec.8
-	 $(MKDIR) -p     $(MANDIR)/man8
+	@$(MKDIR) -p     $(MANDIR)/man8
 	cp kexec/kexec.8 $(KEXEC_MANPAGE)
 echo::
-	@echo "KEXEC_C_SRCS $(KEXEC_C_SRCS)"
-	@echo "KEXEC_C_DEPS $(KEXEC_C_DEPS)"
-	@echo "KEXEC_C_OBJS $(KEXEC_C_OBJS)"
-	@echo "KEXEC_S_SRCS $(KEXEC_S_SRCS)"
-	@echo "KEXEC_S_DEPS $(KEXEC_S_DEPS)"
-	@echo "KEXEC_S_OBJS $(KEXEC_S_OBJS)"
 	@echo "KEXEC_SRCS $(KEXEC_SRCS)"
 	@echo "KEXEC_DEPS $(KEXEC_DEPS)"
 	@echo "KEXEC_OBJS $(KEXEC_OBJS)"
diff --git a/kexec/arch/i386/Makefile b/kexec/arch/i386/Makefile
index d77b064..7bda300 100644
--- a/kexec/arch/i386/Makefile
+++ b/kexec/arch/i386/Makefile
@@ -1,12 +1,12 @@
 #
 # kexec i386 (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-x86.c 
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-elf-x86.c 
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-elf-rel-x86.c
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-bzImage.c 
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-multiboot-x86.c
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-beoboot-x86.c
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-nbi.c
-KEXEC_C_SRCS+= kexec/arch/i386/x86-linux-setup.c
-KEXEC_C_SRCS+= kexec/arch/i386/crashdump-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-elf-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-elf-rel-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-bzImage.c
+KEXEC_SRCS += kexec/arch/i386/kexec-multiboot-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-beoboot-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-nbi.c
+KEXEC_SRCS += kexec/arch/i386/x86-linux-setup.c
+KEXEC_SRCS += kexec/arch/i386/crashdump-x86.c
diff --git a/kexec/arch/ia64/Makefile b/kexec/arch/ia64/Makefile
index a8a94fe..ea0bdb0 100644
--- a/kexec/arch/ia64/Makefile
+++ b/kexec/arch/ia64/Makefile
@@ -1,9 +1,9 @@
 #
 # kexec ia64 (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/ia64/kexec-iomem.c
-KEXEC_C_SRCS+= kexec/arch/ia64/kexec-ia64.c 
-KEXEC_C_SRCS+= kexec/arch/ia64/kexec-elf-ia64.c 
-KEXEC_C_SRCS+= kexec/arch/ia64/kexec-elf-rel-ia64.c
-KEXEC_C_SRCS+= kexec/arch/ia64/crashdump-ia64.c
+KEXEC_SRCS += kexec/arch/ia64/kexec-iomem.c
+KEXEC_SRCS += kexec/arch/ia64/kexec-ia64.c
+KEXEC_SRCS += kexec/arch/ia64/kexec-elf-ia64.c
+KEXEC_SRCS += kexec/arch/ia64/kexec-elf-rel-ia64.c
+KEXEC_SRCS += kexec/arch/ia64/crashdump-ia64.c
 
diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile
index 972a2f2..52295ae 100644
--- a/kexec/arch/ppc/Makefile
+++ b/kexec/arch/ppc/Makefile
@@ -1,9 +1,9 @@
 #
 # kexec ppc (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/ppc/kexec-ppc.c 
-KEXEC_C_SRCS+= kexec/arch/ppc/kexec-elf-ppc.c 
-KEXEC_C_SRCS+= kexec/arch/ppc/kexec-elf-rel-ppc.c
-KEXEC_C_SRCS+= kexec/arch/ppc/kexec-dol-ppc.c
-KEXEC_S_SRCS+= kexec/arch/ppc/ppc-setup-simple.S
-KEXEC_S_SRCS+= kexec/arch/ppc/ppc-setup-dol.S
+KEXEC_SRCS += kexec/arch/ppc/kexec-ppc.c
+KEXEC_SRCS += kexec/arch/ppc/kexec-elf-ppc.c
+KEXEC_SRCS += kexec/arch/ppc/kexec-elf-rel-ppc.c
+KEXEC_SRCS += kexec/arch/ppc/kexec-dol-ppc.c
+KEXEC_SRCS += kexec/arch/ppc/ppc-setup-simple.S
+KEXEC_SRCS += kexec/arch/ppc/ppc-setup-dol.S
diff --git a/kexec/arch/ppc64/Makefile b/kexec/arch/ppc64/Makefile
index 187a303..b3de3a6 100644
--- a/kexec/arch/ppc64/Makefile
+++ b/kexec/arch/ppc64/Makefile
@@ -1,11 +1,9 @@
 #
 # kexec ppc64 (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-elf-rel-ppc64.c
-KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-zImage-ppc64.c
-KEXEC_C_SRCS+= kexec/arch/ppc64/fs2dt.c
-KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-elf-ppc64.c
-KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-ppc64.c
-KEXEC_C_SRCS+= kexec/arch/ppc64/crashdump-ppc64.c
-
-KEXEC_S_SRCS+=
+KEXEC_SRCS += kexec/arch/ppc64/kexec-elf-rel-ppc64.c
+KEXEC_SRCS += kexec/arch/ppc64/kexec-zImage-ppc64.c
+KEXEC_SRCS += kexec/arch/ppc64/fs2dt.c
+KEXEC_SRCS += kexec/arch/ppc64/kexec-elf-ppc64.c
+KEXEC_SRCS += kexec/arch/ppc64/kexec-ppc64.c
+KEXEC_SRCS += kexec/arch/ppc64/crashdump-ppc64.c
diff --git a/kexec/arch/s390/Makefile b/kexec/arch/s390/Makefile
index 1d26e81..2e496b0 100644
--- a/kexec/arch/s390/Makefile
+++ b/kexec/arch/s390/Makefile
@@ -1,6 +1,6 @@
 #
 # kexec s390 (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/s390/kexec-s390.c
-KEXEC_C_SRCS+= kexec/arch/s390/kexec-image.c
-KEXEC_C_SRCS+= kexec/arch/s390/kexec-elf-rel-s390.c
+KEXEC_SRCS += kexec/arch/s390/kexec-s390.c
+KEXEC_SRCS += kexec/arch/s390/kexec-image.c
+KEXEC_SRCS += kexec/arch/s390/kexec-elf-rel-s390.c
diff --git a/kexec/arch/sh/Makefile b/kexec/arch/sh/Makefile
index 753e073..4d49490 100644
--- a/kexec/arch/sh/Makefile
+++ b/kexec/arch/sh/Makefile
@@ -1,8 +1,8 @@
 #
 # kexec sh (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/sh/kexec-sh.c
-KEXEC_C_SRCS+= kexec/arch/sh/kexec-zImage-sh.c
-KEXEC_C_SRCS+= kexec/arch/sh/kexec-netbsd-sh.c
-KEXEC_C_SRCS+= kexec/arch/sh/kexec-elf-rel-sh.c
-KEXEC_S_SRCS+= kexec/arch/sh/netbsd_booter.S
+KEXEC_SRCS += kexec/arch/sh/kexec-sh.c
+KEXEC_SRCS += kexec/arch/sh/kexec-zImage-sh.c
+KEXEC_SRCS += kexec/arch/sh/kexec-netbsd-sh.c
+KEXEC_SRCS += kexec/arch/sh/kexec-elf-rel-sh.c
+KEXEC_SRCS += kexec/arch/sh/netbsd_booter.S
diff --git a/kexec/arch/x86_64/Makefile b/kexec/arch/x86_64/Makefile
index 799e2a4..c3a4d4e 100644
--- a/kexec/arch/x86_64/Makefile
+++ b/kexec/arch/x86_64/Makefile
@@ -1,13 +1,13 @@
 #
 # kexec x86_64 (linux booting linux)
 #
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-elf-x86.c 
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-bzImage.c 
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-multiboot-x86.c
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-beoboot-x86.c
-KEXEC_C_SRCS+= kexec/arch/i386/kexec-nbi.c
-KEXEC_C_SRCS+= kexec/arch/i386/x86-linux-setup.c
-KEXEC_C_SRCS+= kexec/arch/x86_64/crashdump-x86_64.c
-KEXEC_C_SRCS+= kexec/arch/x86_64/kexec-x86_64.c 
-KEXEC_C_SRCS+= kexec/arch/x86_64/kexec-elf-x86_64.c 
-KEXEC_C_SRCS+= kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+KEXEC_SRCS += kexec/arch/i386/kexec-elf-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-bzImage.c
+KEXEC_SRCS += kexec/arch/i386/kexec-multiboot-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-beoboot-x86.c
+KEXEC_SRCS += kexec/arch/i386/kexec-nbi.c
+KEXEC_SRCS += kexec/arch/i386/x86-linux-setup.c
+KEXEC_SRCS += kexec/arch/x86_64/crashdump-x86_64.c
+KEXEC_SRCS += kexec/arch/x86_64/kexec-x86_64.c
+KEXEC_SRCS += kexec/arch/x86_64/kexec-elf-x86_64.c
+KEXEC_SRCS += kexec/arch/x86_64/kexec-elf-rel-x86_64.c
diff --git a/kexec_test/Makefile b/kexec_test/Makefile
index 70542de..3f0d0fe 100644
--- a/kexec_test/Makefile
+++ b/kexec_test/Makefile
@@ -2,29 +2,24 @@
 # kexec_test Debugging payload to be certain the infrastructure works
 #
 RELOC:=0x10000
-KEXEC_TEST_S_SRCS:= kexec_test/kexec_test16.S kexec_test/kexec_test.S
-KEXEC_TEST_S_TEMPS:=$(patsubst %.S, $(OBJDIR)/%.s, $(KEXEC_TEST_S_SRCS))
-KEXEC_TEST_S_OBJS:=$(patsubst $(OBJDIR)/%.s, $(OBJDIR)/%.o, $(KEXEC_TEST_S_TEMPS))
-KEXEC_TEST_S_DEPS:=$(patsubst %.S, $(OBJDIR)/%.d, $(KEXEC_TEST_S_SRCS))
-KEXEC_TEST_SRCS:= $(KEXEC_TEST_S_SRCS)
-KEXEC_TEST_OBJS:= $(KEXEC_TEST_S_OBJS)
-KEXEC_TEST_DEPS:= $(KEXEC_TEST_S_DEPS)
-KEXEC_TEST:=$(PKGLIBDIR)/kexec_test
+KEXEC_TEST_SRCS:= kexec_test/kexec_test16.S kexec_test/kexec_test.S
 
-include $(KEXEC_TEST_DEPS)
+KEXEC_TEST_OBJS = $(call objify, $(KEXEC_TEST_SRCS))
+KEXEC_TEST_DEPS = $(call depify, $(KEXEC_TEST_OBJS))
 
-$(KEXEC_TEST_S_DEPS): $(OBJDIR)/%.d: %.S
-	mkdir -p $(@D)
-	$(CC) -m32 $(CFLAGS) $(EXTRA_CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
+KEXEC_TEST = $(PKGLIBDIR)/kexec_test
 
-$(KEXEC_TEST_S_TEMPS): $(OBJDIR)/%.s: %.S 
-	mkdir -p $(@D)
-	$(CPP) $(CPPFLAGS) $(EXTRA_CPPFLAGS) -DRELOC=$(RELOC) $< > $@
+clean += $(KEXEC_TEST_OBJS) $(KEXEC_TEST_DEPS) $(KEXEC_TEST)
 
-$(KEXEC_TEST_S_OBJS): $(OBJDIR)/%.o: $(OBJDIR)/%.s 
-	mkdir -p $(@D)
-	$(AS) --32 -o $@ $<
+-include $(KEXEC_TEST_DEPS)
+
+$(KEXEC_TEST): CPPFLAGS+=-DRELOC=$(RELOC)
+$(KEXEC_TEST): ASFLAGS+=-m32
+#$(KEXEC_TEST): LDFLAGS=-m32 -Wl,-e -Wl,_start -Wl,-Ttext -Wl,$(RELOC) \
+#		       -nostartfiles
+$(KEXEC_TEST): LDFLAGS=-melf_i386 -e _start -Ttext $(RELOC)
 
-$(KEXEC_TEST): $(KEXEC_TEST_OBJS) 
+$(KEXEC_TEST): $(KEXEC_TEST_OBJS)
 	mkdir -p $(@D)
-	$(LD) -m elf_i386 -e _start -Ttext $(RELOC) $(KEXEC_TEST_OBJS) -o $@
+	#$(LINK.o) -o $@ $^
+	$(LD) $(LDFLAGS) -o $@ $^
diff --git a/purgatory/Makefile b/purgatory/Makefile
index adbd814..a543cdb 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -7,67 +7,46 @@
 # should keep us from accidentially include unsafe library functions
 # or headers.
 
-ifeq ($(ARCH),ppc64)
-EXTRA_LDFLAGS = -melf64ppc
-endif
+PURGATORY = purgatory/purgatory.ro
+PURGATORY_SRCS =
+PURGATORY_SRCS += purgatory/purgatory.c
+PURGATORY_SRCS += purgatory/printf.c
+PURGATORY_SRCS += purgatory/string.c
 
-PCFLAGS:=-Wall -Os  \
-	-I$(shell $(CC) -print-file-name=include) \
-	-Ipurgatory/include -Ipurgatory/arch/$(ARCH)/include \
-	$(CPPFLAGS) $(EXTRA_CPPFLAGS)
+include $(srcdir)/purgatory/arch/$(ARCH)/Makefile
 
-PCFLAGS += $(call cc-option, -ffreestanding)
-PCFLAGS += $(call cc-option, -fnobuiltin)
-PCFLAGS += $(call cc-option, -fnostdinc)
-PCFLAGS += $(call cc-option, -fno-zero-initialized-in-bss)
+PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
+PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
 
-PURGATORY_C_SRCS:=
-PURGATORY_C_SRCS += purgatory/purgatory.c
-PURGATORY_C_SRCS += purgatory/printf.c
-PURGATORY_C_SRCS += purgatory/string.c
-PURGATORY_S_OBJS:=
+clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
 
-include purgatory/arch/$(ARCH)/Makefile
+-include $(PURGATORY_DEPS)
 
+# sha256.c needs to be compiled without optimization, else
+# purgatory fails to execute on ia64.
+purgatory/sha256.o: CFLAGS += -O0
 
-PURGATORY_C_OBJS:= $(patsubst %.c, $(OBJDIR)/%.o, $(PURGATORY_C_SRCS))
-PURGATORY_C_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(PURGATORY_C_SRCS))
-PURGATORY_S_OBJS:= $(patsubst %.S, $(OBJDIR)/%.o, $(PURGATORY_S_SRCS))
-PURGATORY_S_DEPS:= $(patsubst %.S, $(OBJDIR)/%.d, $(PURGATORY_S_SRCS))
-PURGATORY_SRCS:= $(PURGATORY_S_SRCS) $(PURGATORY_C_SRCS)
-PURGATORY_OBJS:= $(PURGATORY_S_OBJS) $(PURGATORY_C_OBJS)
-PURGATORY_DEPS:= $(PURGATORY_S_DEPS) $(PURGATORY_C_DEPS)
-PURGATORY:= $(OBJDIR)/purgatory/purgatory.ro
+purgatory/sha256.o: $(srcdir)/util_lib/sha256.c
+	mkdir -p $(@D)
+	$(COMPILE.c) -o $@ $^
 
-include $(PURGATORY_DEPS)
+$(PURGATORY): CC=$(TARGET_CC)
+$(PURGATORY): CFLAGS+=-Os -fno-builtin -ffreestanding \
+		      -fno-zero-initialized-in-bss
 
-$(PURGATORY_C_DEPS): $(OBJDIR)/%.d: %.c
-	$(MKDIR) -p $(@D)
-	$(CC) $(PCFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
-
-$(PURGATORY_S_DEPS): $(OBJDIR)/%.d: %.S
-	$(MKDIR) -p $(@D)
-	$(CC) $(PCFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
+$(PURGATORY): CPPFLAGS+=-I$(srcdir)/purgatory/include \
+			-I$(srcdir)/purgatory/arch/$(ARCH)/include \
+			-I$(shell $(CC) -print-file-name=include)
+$(PURGATORY): LDFLAGS+=--no-undefined -nostartfiles -nostdlib -nodefaultlibs \
+			-e purgatory_start -r
 
-$(PURGATORY_C_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d
+$(PURGATORY): $(PURGATORY_OBJS)
 	$(MKDIR) -p $(@D)
-	$(CC) $(PCFLAGS) -o $@ -c $<
+	$(LD) $(LDFLAGS) -o $@ $^
 
-$(PURGATORY_S_OBJS): $(OBJDIR)/%.o: %.S $(OBJDIR)/%.d
-	$(MKDIR) -p $(@D)
-	$(CC) $(PCFLAGS) -o $@ -c $<
-
-$(PURGATORY): $(PURGATORY_OBJS) $(UTIL_LIB)
-	$(MKDIR) -p $(@D)
-	$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
+#	$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
 
 echo::
-	@echo "PURGATORY_C_SRCS $(PURGATORY_C_SRCS)"
-	@echo "PURGATORY_C_DEPS $(PURGATORY_C_DEPS)"
-	@echo "PURGATORY_C_OBJS $(PURGATORY_C_OBJS)"
-	@echo "PURGATORY_S_SRCS $(PURGATORY_S_SRCS)"
-	@echo "PURGATORY_S_DEPS $(PURGATORY_S_DEPS)"
-	@echo "PURGATORY_S_OBJS $(PURGATORY_S_OBJS)"
-	@echo "PURGATORY_SRCS   $(PURGATORY_SRCS)"
-	@echo "PURGATORY_DEPS   $(PURGATORY_DEPS)"
-	@echo "PURGATORY_OBJS   $(PURGATORY_OBJS)"
+	@echo "PURGATORY_SRCS $(PURGATORY_SRCS)"
+	@echo "PURGATORY_DEPS $(PURGATORY_DEPS)"
+	@echo "PURGATORY_OBJS $(PURGATORY_OBJS)"
diff --git a/purgatory/arch/alpha/Makefile b/purgatory/arch/alpha/Makefile
index a626bbd..02f62b2 100644
--- a/purgatory/arch/alpha/Makefile
+++ b/purgatory/arch/alpha/Makefile
@@ -2,6 +2,5 @@
 # Purgatory alpha
 #
 
-PURGATORY_C_SRCS+=
-PURGATORY_S_SRCS+=
+PURGATORY_SRCS +=
 
diff --git a/purgatory/arch/i386/Makefile b/purgatory/arch/i386/Makefile
index 97478f4..55cc7af 100644
--- a/purgatory/arch/i386/Makefile
+++ b/purgatory/arch/i386/Makefile
@@ -2,14 +2,14 @@
 # Purgatory i386
 #
 
-PURGATORY_S_SRCS+= purgatory/arch/i386/entry32-16.S
-PURGATORY_S_SRCS+= purgatory/arch/i386/entry32-16-debug.S
-PURGATORY_S_SRCS+= purgatory/arch/i386/entry32.S
-PURGATORY_S_SRCS+= purgatory/arch/i386/setup-x86.S
-PURGATORY_S_SRCS+= purgatory/arch/i386/stack.S
-PURGATORY_S_SRCS+= purgatory/arch/i386/compat_x86_64.S
-PURGATORY_C_SRCS+= purgatory/arch/i386/purgatory-x86.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/console-x86.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/vga.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/pic.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/crashdump_backup.c
+PURGATORY_SRCS += purgatory/arch/i386/entry32-16.S
+PURGATORY_SRCS += purgatory/arch/i386/entry32-16-debug.S
+PURGATORY_SRCS += purgatory/arch/i386/entry32.S
+PURGATORY_SRCS += purgatory/arch/i386/setup-x86.S
+PURGATORY_SRCS += purgatory/arch/i386/stack.S
+PURGATORY_SRCS += purgatory/arch/i386/compat_x86_64.S
+PURGATORY_SRCS += purgatory/arch/i386/purgatory-x86.c
+PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
+PURGATORY_SRCS += purgatory/arch/i386/vga.c
+PURGATORY_SRCS += purgatory/arch/i386/pic.c
+PURGATORY_SRCS += purgatory/arch/i386/crashdump_backup.c
diff --git a/purgatory/arch/ia64/Makefile b/purgatory/arch/ia64/Makefile
index 953b3ee..9dda91d 100644
--- a/purgatory/arch/ia64/Makefile
+++ b/purgatory/arch/ia64/Makefile
@@ -1,9 +1,10 @@
 #
 # Purgatory ia64
 #
-PCFLAGS		+= -ffixed-r28
-PURGATORY_S_SRCS+= purgatory/arch/ia64/entry.S
-PURGATORY_C_SRCS+= purgatory/arch/ia64/purgatory-ia64.c
-PURGATORY_C_SRCS+= purgatory/arch/ia64/console-ia64.c
-PURGATORY_C_SRCS+= purgatory/arch/ia64/vga.c
+PURGATORY_SRCS += purgatory/arch/ia64/entry.S
+PURGATORY_SRCS += purgatory/arch/ia64/purgatory-ia64.c
+PURGATORY_SRCS += purgatory/arch/ia64/console-ia64.c
+PURGATORY_SRCS += purgatory/arch/ia64/vga.c
+
+$(PURGATORY): CFLAGS += -ffixed-r28
 
diff --git a/purgatory/arch/ppc/Makefile b/purgatory/arch/ppc/Makefile
index 4ce40fe..c40b4b5 100644
--- a/purgatory/arch/ppc/Makefile
+++ b/purgatory/arch/ppc/Makefile
@@ -2,7 +2,7 @@
 # Purgatory ppc
 #
 
-PURGATORY_S_SRCS+= purgatory/arch/ppc/misc.S
-PURGATORY_C_SRCS+= purgatory/arch/ppc/purgatory-ppc.c
-PURGATORY_C_SRCS+= purgatory/arch/ppc/console-ppc.c
+PURGATORY_SRCS += purgatory/arch/ppc/misc.S
+PURGATORY_SRCS += purgatory/arch/ppc/purgatory-ppc.c
+PURGATORY_SRCS += purgatory/arch/ppc/console-ppc.c
 
diff --git a/purgatory/arch/ppc64/Makefile b/purgatory/arch/ppc64/Makefile
index 0406278..a62484e 100644
--- a/purgatory/arch/ppc64/Makefile
+++ b/purgatory/arch/ppc64/Makefile
@@ -2,9 +2,11 @@
 # Purgatory ppc
 #
 
-PURGATORY_S_SRCS+= purgatory/arch/ppc64/v2wrap.S
-PURGATORY_C_SRCS += purgatory/arch/ppc64/purgatory-ppc64.c
-PURGATORY_C_SRCS += purgatory/arch/ppc64/console-ppc64.c
-PURGATORY_C_SRCS += purgatory/arch/ppc64/crashdump_backup.c
+PURGATORY_SRCS += purgatory/arch/ppc64/v2wrap.S
+PURGATORY_SRCS += purgatory/arch/ppc64/purgatory-ppc64.c
+PURGATORY_SRCS += purgatory/arch/ppc64/console-ppc64.c
+PURGATORY_SRCS += purgatory/arch/ppc64/crashdump_backup.c
 
-PCFLAGS += -m64 -mcall-aixdesc
+$(PURGATORY): CFLAGS += -m64 -mcall-aixdesc
+$(PURGATORY): ASFLAGS += -m64 -mcall-aixdesc
+$(PURGATORY): LDFLAGS += -melf64ppc
diff --git a/purgatory/arch/s390/Makefile b/purgatory/arch/s390/Makefile
index 63dac9d..9c795d1 100644
--- a/purgatory/arch/s390/Makefile
+++ b/purgatory/arch/s390/Makefile
@@ -2,6 +2,6 @@
 # Purgatory s390
 #
 
-PURGATORY_C_SRCS+=
-PURGATORY_S_SRCS+=
+PURGATORY_SRCS +=
+PURGATORY_SRCS +=
 
diff --git a/purgatory/arch/sh/Makefile b/purgatory/arch/sh/Makefile
index a626bbd..537d260 100644
--- a/purgatory/arch/sh/Makefile
+++ b/purgatory/arch/sh/Makefile
@@ -2,6 +2,6 @@
 # Purgatory alpha
 #
 
-PURGATORY_C_SRCS+=
-PURGATORY_S_SRCS+=
+PURGATORY_SRCS +=
+PURGATORY_SRCS +=
 
diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
index 29f4340..e8fe96c 100644
--- a/purgatory/arch/x86_64/Makefile
+++ b/purgatory/arch/x86_64/Makefile
@@ -2,15 +2,14 @@
 # Purgatory x86_64
 #
 
-PURGATORY_S_SRCS+= purgatory/arch/i386/entry32-16.S
-PURGATORY_S_SRCS+= purgatory/arch/i386/entry32-16-debug.S
-PURGATORY_S_SRCS+= purgatory/arch/x86_64/entry64-32.S
-PURGATORY_S_SRCS+= purgatory/arch/x86_64/entry64.S
-PURGATORY_S_SRCS+= purgatory/arch/x86_64/setup-x86_64.S
-PURGATORY_S_SRCS+= purgatory/arch/x86_64/stack.S
-PURGATORY_C_SRCS+= purgatory/arch/x86_64/purgatory-x86_64.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/crashdump_backup.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/console-x86.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/vga.c
-PURGATORY_C_SRCS+= purgatory/arch/i386/pic.c
-
+PURGATORY_SRCS += purgatory/arch/i386/entry32-16.S
+PURGATORY_SRCS += purgatory/arch/i386/entry32-16-debug.S
+PURGATORY_SRCS += purgatory/arch/x86_64/entry64-32.S
+PURGATORY_SRCS += purgatory/arch/x86_64/entry64.S
+PURGATORY_SRCS += purgatory/arch/x86_64/setup-x86_64.S
+PURGATORY_SRCS += purgatory/arch/x86_64/stack.S
+PURGATORY_SRCS += purgatory/arch/x86_64/purgatory-x86_64.c
+PURGATORY_SRCS += purgatory/arch/i386/crashdump_backup.c
+PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
+PURGATORY_SRCS += purgatory/arch/i386/vga.c
+PURGATORY_SRCS += purgatory/arch/i386/pic.c
diff --git a/purgatory/include/string.h b/purgatory/include/string.h
index 87cc4e1..14e172d 100644
--- a/purgatory/include/string.h
+++ b/purgatory/include/string.h
@@ -1,6 +1,8 @@
 #ifndef STRING_H
 #define STRING_H
 
+#include <stddef.h>
+
 size_t strnlen(const char *s, size_t max);
 void* memset(void* s, int c, size_t n);
 void* memcpy(void *dest, const void *src, size_t len);
diff --git a/purgatory/purgatory.c b/purgatory/purgatory.c
index aacbb3b..3889cf5 100644
--- a/purgatory/purgatory.c
+++ b/purgatory/purgatory.c
@@ -1,4 +1,4 @@
-#include <stdarg.h>
+
 #include <limits.h>
 #include <stdint.h>
 #include <purgatory.h>
@@ -46,5 +46,3 @@ void purgatory(void)
 	verify_sha256_digest();
 	post_verification_setup_arch();
 }
-
-#include "../util_lib/sha256.c"
diff --git a/util/Makefile b/util/Makefile
index d6e8e79..6fee925 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -1,4 +1,10 @@
-BIN_TO_HEX:= $(OBJDIR)/bin/bin-to-hex
-$(BIN_TO_HEX): util/bin-to-hex.c
-	mkdir -p $(@D)
-	$(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
+BIN_TO_HEX:= bin/bin-to-hex
+
+$(BIN_TO_HEX): $(srcdir)/util/bin-to-hex.c
+	@$(MKDIR) -p $(@D)
+	$(LINK.o) -o $@ $^
+
+$(BIN_TO_HEX): CC=$(BUILD_CC)
+$(BIN_TO_HEX): CFLAGS=$(BUILD_CFLAGS)
+
+clean += util/bin-to-hex.o $(BIN_TO_HEX)
diff --git a/util_lib/Makefile b/util_lib/Makefile
index 75cde25..5b4bd22 100644
--- a/util_lib/Makefile
+++ b/util_lib/Makefile
@@ -1,28 +1,20 @@
 #
 # Utility function library
 #
-UTIL_LIB_SRCS:=util_lib/compute_ip_checksum.c
-UTIL_LIB_SRCS+=util_lib/sha256.c
-UTIL_LIB_OBJS:=$(patsubst %.c, $(OBJDIR)/%.o, $(UTIL_LIB_SRCS))
-UTIL_LIB_DEPS:=$(patsubst %.c, $(OBJDIR)/%.d, $(UTIL_LIB_SRCS))
-UTIL_LIB:=$(OBJDIR)/libutil.a
+UTIL_LIB_SRCS +=
+UTIL_LIB_SRCS += util_lib/compute_ip_checksum.c
+UTIL_LIB_SRCS += util_lib/sha256.c
+UTIL_LIB_OBJS =$(call objify, $(UTIL_LIB_SRCS))
+UTIL_LIB_DEPS =$(call depify, $(UTIL_LIB_OBJS))
+UTIL_LIB = libutil.a
 
-include $(UTIL_LIB_DEPS)
+-include $(UTIL_LIB_DEPS)
 
-$(UTIL_LIB_DEPS): $(OBJDIR)/%.d: %.c 
-	$(MKDIR) -p $(@D)
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@
+clean += $(UTIL_LIB_OBJS) $(UTIL_LIB_DEPS) $(UTIL_LIB)
 
-# sha256.c needs to be compiled without optimization, else
-# purgatory fails to execute (on ia64 at least).
-# By placing -O0 after $(CFLAGS), which is provided by
-# the prevailing environment, it overrides any other -O flags
-# provided.
-$(UTIL_LIB_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d
-	$(MKDIR) -p $(@D)
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -O0 -c -o $@ $<
+$(UTIL_LIB): CPPFLAGS += -I$(srcdir)/util_lib/include
 
 $(UTIL_LIB): $(UTIL_LIB_OBJS)
-	$(MKDIR) -p $(@D)
+	@$(MKDIR) -p $(@D)
 	$(AR) rs $(UTIL_LIB) $(UTIL_LIB_OBJS)
 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (7 preceding siblings ...)
  2007-12-18  8:47 ` [PATCH 6/8] Build system simplification/standardisation Jeremy Kerr
@ 2007-12-18 23:25 ` Vivek Goyal
  2007-12-19  5:37   ` Jeremy Kerr
  2007-12-19 14:38   ` Lombard, David N
  2007-12-19  6:04 ` Simon Horman
  9 siblings, 2 replies; 15+ messages in thread
From: Vivek Goyal @ 2007-12-18 23:25 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: kexec

On Tue, Dec 18, 2007 at 05:47:55PM +0900, Jeremy Kerr wrote:
> Hi all,
> 
> This series of patches is aimed at simplifying the kexec build system,
> mainly in order to make cross-compilation much easier.
> 
> As well as cross-compiling, this makes it possible to separate the
> 'host' architecture (ie, the arch of the kexec binary built), and the
> 'target' architecture (ie, the arch of the kernel that we're kexecing).
> We can specify these with the standard --host and --target arguments
> to configure.
> 

Hi Jermey,

I got a stupid question.

- What's the advantage of building a 32bit binary for powerpc64 bit
  platforms? IOW, why do you need to build 32bit purgatory? Can't we
  launch 32bit kernel from 64bit purgatory?

> This allows us to kexec a powerpc64 kernel from a powerpc userspace.
> x86{,_64} users might find this handy too, but I don't have hardware
> to test.

I think x86 it already happens. I think I can launch 64bit kernel from
a 32bit kexec.

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing
  2007-12-18 23:25 ` [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Vivek Goyal
@ 2007-12-19  5:37   ` Jeremy Kerr
  2007-12-19 14:38   ` Lombard, David N
  1 sibling, 0 replies; 15+ messages in thread
From: Jeremy Kerr @ 2007-12-19  5:37 UTC (permalink / raw)
  To: kexec

(resend to kexec list)

Hi Vivek,

> I got a stupid question.
>
> - What's the advantage of building a 32bit binary for powerpc64 bit
>   platforms?

So you don't need to have 64-bit libc and libz present. It's often the 
case that you have an entire 32-bit userspace environment, but still 
require 64-bit libraries just for the kexec program.

>   IOW, why do you need to build 32bit purgatory?

We build the purgatory for the $target architecture, that's all. My 
setup involves:

 build: powerpc-linux-gnu
 host: powerpc-linux-uclibc
 target: powerpc64-linux-uclibc

So I'm aiming for a 64-bit purgatory here, we generally tend to boot 
64-bit kernels on powerpc64 machines.

>   Can't we launch 32bit kernel from 64bit purgatory?

I assume so, but you wouldn't be able to do this on 32-bit machines, of 
course. I haven't been trying the case where the purgatory arch != 
kernel arch.

> > This allows us to kexec a powerpc64 kernel from a powerpc
> > userspace. x86{,_64} users might find this handy too, but I don't
> > have hardware to test.
>
> I think x86 it already happens. I think I can launch 64bit kernel
> from a 32bit kexec.

OK, this change should make this possible for all arches, just by 
specifying --host and --target - are you able to make sure that you can 
build a kexec where host=i386-linux and target=x86_64-linux ?

Cheers,


Jeremy


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 1/8] Enable building a 32 bit binary for ppc64 platforms.
  2007-12-18  8:47 ` [PATCH 1/8] Enable building a 32 bit binary for ppc64 platforms Jeremy Kerr
@ 2007-12-19  6:02   ` Geoff Levand
  0 siblings, 0 replies; 15+ messages in thread
From: Geoff Levand @ 2007-12-19  6:02 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: kexec

On 12/18/2007 12:47 AM, Jeremy Kerr wrote:
> From: David Woodhouse <dwmw2@infradead.org>
> 
> Based on
> http://cvs.fedora.redhat.com/viewcvs/rpms/kexec-tools/devel/kexec-tools-1.101-ppc-boots-ppc64.patch?rev=1.2&view=auto
> 
> 64 bit: OK
> 32 bit: purgatory build fails
> 
> Work-in-progress-by: Geoff Levand <geoffrey.levand@am.sony.com>
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

I think we need to clean these commit comments up.

-Geoff


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing
  2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
                   ` (8 preceding siblings ...)
  2007-12-18 23:25 ` [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Vivek Goyal
@ 2007-12-19  6:04 ` Simon Horman
  9 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2007-12-19  6:04 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: kexec

On Tue, Dec 18, 2007 at 05:47:55PM +0900, Jeremy Kerr wrote:
> Hi all,
> 
> This series of patches is aimed at simplifying the kexec build system,
> mainly in order to make cross-compilation much easier.
> 
> As well as cross-compiling, this makes it possible to separate the
> 'host' architecture (ie, the arch of the kexec binary built), and the
> 'target' architecture (ie, the arch of the kernel that we're kexecing).
> We can specify these with the standard --host and --target arguments
> to configure.
> 
> This allows us to kexec a powerpc64 kernel from a powerpc userspace.
> x86{,_64} users might find this handy too, but I don't have hardware
> to test.
> 
> Any comments are most welcome - if you're able to test on your
> arch, that would be great too.

Thanks Jeremy,

I've run these patches through the build for all supported architectures
and they seem clean to me. So I have gone ahead and applied them. If
anyone notices any breakage please let Jeremy and/or myself know.

-- 
Horms


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing
  2007-12-18 23:25 ` [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Vivek Goyal
  2007-12-19  5:37   ` Jeremy Kerr
@ 2007-12-19 14:38   ` Lombard, David N
  2007-12-19 14:45     ` Vivek Goyal
  1 sibling, 1 reply; 15+ messages in thread
From: Lombard, David N @ 2007-12-19 14:38 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: kexec, Jeremy Kerr

On Tue, Dec 18, 2007 at 06:25:58PM -0500, Vivek Goyal wrote:
> On Tue, Dec 18, 2007 at 05:47:55PM +0900, Jeremy Kerr wrote:
> 
> > This allows us to kexec a powerpc64 kernel from a powerpc userspace.
> > x86{,_64} users might find this handy too, but I don't have hardware
> > to test.
> 
> I think x86 it already happens. I think I can launch 64bit kernel from
> a 32bit kexec.

You certainly can...

-- 
David N. Lombard, Intel, Irvine, CA
I do not speak for Intel Corporation; all comments are strictly my own.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing
  2007-12-19 14:38   ` Lombard, David N
@ 2007-12-19 14:45     ` Vivek Goyal
  0 siblings, 0 replies; 15+ messages in thread
From: Vivek Goyal @ 2007-12-19 14:45 UTC (permalink / raw)
  To: Jeremy Kerr, kexec, dnlombar

On Wed, Dec 19, 2007 at 06:38:22AM -0800, Lombard, David N wrote:
> On Tue, Dec 18, 2007 at 06:25:58PM -0500, Vivek Goyal wrote:
> > On Tue, Dec 18, 2007 at 05:47:55PM +0900, Jeremy Kerr wrote:
> > 
> > > This allows us to kexec a powerpc64 kernel from a powerpc userspace.
> > > x86{,_64} users might find this handy too, but I don't have hardware
> > > to test.
> > 
> > I think x86 it already happens. I think I can launch 64bit kernel from
> > a 32bit kexec.
> 
> You certainly can...
> 

If that's the case why should we build 64 bit purgatory for 32 bit kexec?
The only advantage I can think of is I can enter the new 64bit
kernel using 64bit entry point instead of 32bit entry point. Is that
the intention behind this work? Otherwise one should be able to launch
64bit kernel from a 32bit purgatory (Using 32bit entry point).

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2007-12-19 14:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18  8:47 [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Jeremy Kerr
2007-12-18  8:47 ` [PATCH 7/8] removed partially duplicated system headers Jeremy Kerr
2007-12-18  8:47 ` [PATCH 2/8] Use --target for target architecture specification Jeremy Kerr
2007-12-18  8:47 ` [PATCH 1/8] Enable building a 32 bit binary for ppc64 platforms Jeremy Kerr
2007-12-19  6:02   ` Geoff Levand
2007-12-18  8:47 ` [PATCH 3/8] Consolidate BOOTLOADER defines Jeremy Kerr
2007-12-18  8:47 ` [PATCH 8/8] Don't assume we can re-make Makefile Jeremy Kerr
2007-12-18  8:47 ` [PATCH 5/8] Add gamecube to config.h defines Jeremy Kerr
2007-12-18  8:47 ` [PATCH 4/8] Use config.h for defines Jeremy Kerr
2007-12-18  8:47 ` [PATCH 6/8] Build system simplification/standardisation Jeremy Kerr
2007-12-18 23:25 ` [PATCH 0/8] kexec build system updates, to allow cross-kexec()ing Vivek Goyal
2007-12-19  5:37   ` Jeremy Kerr
2007-12-19 14:38   ` Lombard, David N
2007-12-19 14:45     ` Vivek Goyal
2007-12-19  6:04 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox