From 09c194e7c38cf564b4948a711f81b671f87ae3a8 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pmiscml@gmail.com>
Date: Fri, 23 Nov 2007 19:54:17 +0000
Subject: klibc 1.1.1: Fix multimachine build. * klibc fishes in kernel
 sources, and this is per-machine stuff, so klibc must be per-machine too.
 This is of course not ideal, as klibc is *not* machine-dependent, but at
 least it's on par with uclibc, which has the same issue.

---
 packages/klibc/klibc.inc      | 1 +
 packages/klibc/klibc_1.1.1.bb | 2 ++
 2 files changed, 3 insertions(+)

(limited to 'packages/klibc')

diff --git a/packages/klibc/klibc.inc b/packages/klibc/klibc.inc
index 0ddcef82d9..a7f0094264 100644
--- a/packages/klibc/klibc.inc
+++ b/packages/klibc/klibc.inc
@@ -7,6 +7,7 @@ LICENSE = "BSD-ADV"
 SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/klibc/Stable/klibc-${PV}.tar.bz2"
 SRC_URI += "file://install.patch;patch=1"
 S = "${WORKDIR}/klibc-${PV}"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 # for the correct kernel staging path
 # inherit module-base
diff --git a/packages/klibc/klibc_1.1.1.bb b/packages/klibc/klibc_1.1.1.bb
index cd1ba9d56e..ff715765d5 100644
--- a/packages/klibc/klibc_1.1.1.bb
+++ b/packages/klibc/klibc_1.1.1.bb
@@ -1 +1,3 @@
 require klibc.inc
+
+PR = "r1"
-- 
cgit v1.2.3


From 441495912bc291680f007450b598274948b727b7 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pmiscml@gmail.com>
Date: Sat, 24 Nov 2007 15:34:07 +0000
Subject: klibc-utils-fstype: Create a separate recipe for klibc's fstype. *
 ... built against normal system libc.

---
 packages/klibc/files/fstype-sane-and-vfat.patch | 60 +++++++++++++++++++++++++
 packages/klibc/klibc-utils-fstype_1.1.1.bb      | 14 ++++++
 2 files changed, 74 insertions(+)
 create mode 100644 packages/klibc/files/fstype-sane-and-vfat.patch
 create mode 100644 packages/klibc/klibc-utils-fstype_1.1.1.bb

(limited to 'packages/klibc')

diff --git a/packages/klibc/files/fstype-sane-and-vfat.patch b/packages/klibc/files/fstype-sane-and-vfat.patch
new file mode 100644
index 0000000000..7b7674637a
--- /dev/null
+++ b/packages/klibc/files/fstype-sane-and-vfat.patch
@@ -0,0 +1,60 @@
+Patch to compile fstype util against "normal" libc (glibc/uclicb), and to
+add vfat detection.
+
+--- klibc-1.1.1/utils/fstype.c.org	2005-09-06 23:49:34.000000000 +0300
++++ klibc-1.1.1/utils/fstype.c	2007-11-24 01:07:26.000000000 +0200
+@@ -13,11 +13,18 @@
+  */
+ 
+ #include <sys/types.h>
++#include <linux/types.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <endian.h>
+ #include <netinet/in.h>
++#if __BYTE_ORDER == __BIG_ENDIAN
++#include <linux/byteorder/big_endian.h> 
++#else 
++#include <linux/byteorder/little_endian.h> 
++#endif 
++
+ 
+ #define cpu_to_be32(x) __cpu_to_be32(x)	/* Needed by romfs_fs.h */
+ 
+@@ -105,6 +112,18 @@
+ 	return 0;
+ }
+ 
++static int vfat_image(const unsigned char *buf, unsigned long *blocks)
++{
++        const struct romfs_super_block *sb =
++		(const struct romfs_super_block *)buf;
++	if (!strncmp(buf + 54, "FAT12   ", 8)
++	    || !strncmp(buf + 54, "FAT16   ", 8)
++	    || !strncmp(buf + 82, "FAT32   ", 8))
++		return 1;
++
++	return 0;
++}
++
+ static int minix_image(const unsigned char *buf, unsigned long *blocks)
+ {
+ 	const struct minix_super_block *sb =
+@@ -167,8 +186,6 @@
+ 		(const struct xfs_sb *)buf;
+ 
+ 	if (__be32_to_cpu(sb->sb_magicnum) == XFS_SB_MAGIC) {
+-		*blocks = __be64_to_cpu(sb->sb_dblocks) *
+-			  (__be32_to_cpu(sb->sb_blocksize) / BLOCK_SIZE);
+ 		return 1;
+ 	}
+ 	return 0;
+@@ -184,6 +201,7 @@
+ 	{ 0,	"gzip",		gzip_image	},
+ 	{ 0,	"cramfs",	cramfs_image	},
+ 	{ 0,	"romfs",	romfs_image	},
++	{ 0,	"vfat",		vfat_image	},
+ 	{ 0,	"xfs",		xfs_image	},
+ 	{ 1,	"minix",	minix_image	},
+ 	{ 1,	"ext3",		ext3_image	},
diff --git a/packages/klibc/klibc-utils-fstype_1.1.1.bb b/packages/klibc/klibc-utils-fstype_1.1.1.bb
new file mode 100644
index 0000000000..29ce38285c
--- /dev/null
+++ b/packages/klibc/klibc-utils-fstype_1.1.1.bb
@@ -0,0 +1,14 @@
+SRC_URI = "${KERNELORG_MIRROR}/pub/linux/libs/klibc/Stable/klibc-${PV}.tar.bz2" 
+SRC_URI += "file://fstype-sane-and-vfat.patch;patch=1" 
+PR = "r0"
+
+S = "${WORKDIR}/klibc-${PV}"
+
+do_compile() {
+    ${CC} -o fstype utils/fstype.c -static
+}
+
+do_install () {
+        install -d ${D}${bindir}
+        install -m 0755 fstype ${D}${bindir}/
+}
-- 
cgit v1.2.3