fix ext2 and compile against newer linux-kernel-headers
diff --git a/debian/changelog b/debian/changelog
index 6740cd9..defd384 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+palo (1.12) unstable; urgency=low
+
+  * Work around differences in linux-kernel-headers between
+    Debian and Ubuntu. Test built on sid and dapper on hppa, and
+    sid/i386.
+  * Use userspace sanitized ext2_fs.h file from e2fsprogs, note, we still
+    need to include some kernel headers for per-arch types and endian
+    conversions.
+
+ -- Kyle McMartin <kyle@debian.org>  Mon,  2 Jan 2006 12:16:36 -0500
+
 palo (1.11) unstable; urgency=low
 
   * Flush Instruction Cache insn now requires space register to be
diff --git a/ipl/ext2.c b/ipl/ext2.c
index a4c3141..80de700 100644
--- a/ipl/ext2.c
+++ b/ipl/ext2.c
@@ -17,13 +17,14 @@
 /* The following defines are necessary to satisfy ext2_fs.h and
  * things it pulls in.
  */
-typedef unsigned int u32;
-typedef unsigned char u8;
-#define GFP_KERNEL     0
 
-#include <linux/stat.h>
+#include <asm/byteorder.h>	/* for le32_to_cpu et al */
+
 #include <linux/types.h>
-#include <linux/ext2_fs.h>
+
+#include <sys/stat.h>
+
+#include "ext2_fs.h"
 #include "bootloader.h"
 
 #define MAX_OPEN_FILES		5
diff --git a/lib/common.h b/lib/common.h
index 1ddc167..e044021 100644
--- a/lib/common.h
+++ b/lib/common.h
@@ -8,10 +8,24 @@
  * Copyright (C) Hewlett-Packard (Paul Bame) paul_bame@hp.com
  */
 #include <stdarg.h>
+#include <byteswap.h>
 #include <asm/byteorder.h>
 #include "part.h"
 
-#define PALOVERSION "1.11"
+/* Newer versions of linux-kernel-headers provide a sanitized swab.h
+ * which uses GLIBC provided functionality, and dump the kernel provided
+ * ones. Include <byteswap.h> above, and provide compatibility #define's
+ * to work around this. 
+ */
+#ifndef __swab32
+#define __swab32(x)	bswap_32(x)
+#endif /* __swab32 */
+
+#ifndef __swab16
+#define __swab16(x)	bswap_16(x)
+#endif /* __swab16 */
+
+#define PALOVERSION "1.12"
 
 /* size of I/O block used in HP firmware */
 #define FW_BLOCKSIZE	2048