summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2010-02-21 00:41:24 +0100
committerAndrea Adami <andrea.adami@gmail.com>2010-02-21 00:41:24 +0100
commitb3fbdbad1f8de629f25a2c109fe65858a86a9a54 (patch)
tree4d799c210dd9741a1e29354bd8dcd9df08956339
parentfcf7098132baf04073cc549918dacfc66cad8f97 (diff)
klibc_1.5.15+1.5.16: initial commit. Legacy staging is broken. WIP.
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/fix-must_inline-macro-for-gcc4.3.patch36
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/fstype-sane-vfat-and-jffs2-for-1.5.patch63
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-omit-zero-lenght-DHCP-vendor-class-id.patch88
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-send-req-hostname-in-DHCP.patch114
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-set-null-ciaddr-on-dhcprequest.patch43
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/isystem.patch13
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/klibc-utils-add-simple-ls.patch249
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/mntproc-definitions.patch20
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/modprobe.patch1985
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/signal-cleanup.patch38
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/staging.patch134
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/use-headers_install-to-install-headers.patch41
-rw-r--r--recipes/klibc/klibc-1.5.15+1.5.16/wc.patch236
-rw-r--r--recipes/klibc/klibc-utils-static_1.5.15+1.5.16.bb138
-rw-r--r--recipes/klibc/klibc_1.5.15+1.5.16.bb33
-rw-r--r--recipes/klibc/klibc_1.5.15+1.5.16.inc154
16 files changed, 3385 insertions, 0 deletions
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/fix-must_inline-macro-for-gcc4.3.patch b/recipes/klibc/klibc-1.5.15+1.5.16/fix-must_inline-macro-for-gcc4.3.patch
new file mode 100644
index 0000000000..0ab93fa138
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/fix-must_inline-macro-for-gcc4.3.patch
@@ -0,0 +1,36 @@
+From 63237c6e7037a6058deadc92ddcbcb41c5d4c2f8 Mon Sep 17 00:00:00 2001
+From: Jon Ringle <jon@ringle.org>
+Date: Wed, 22 Jul 2009 03:09:29 -0400
+Subject: [PATCH] [klibc] fix must_inline macro in klibc/compiler.h for gcc-4.3
+
+Add __gnu_inline__ if we find __GNUC_STDC_INLINE__.
+
+See http://gcc.gnu.org/gcc-4.3/porting_to.html for details.
+
+Signed-off-by: Jon Ringle <jon@ringle.org>
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+---
+ usr/include/klibc/compiler.h | 7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+diff --git a/usr/include/klibc/compiler.h b/usr/include/klibc/compiler.h
+index 816a4ee..9dee742 100644
+--- a/usr/include/klibc/compiler.h
++++ b/usr/include/klibc/compiler.h
+@@ -24,7 +24,12 @@
+ /* Use "extern inline" even in the gcc3+ case to avoid warnings in ctype.h */
+ #ifdef __GNUC__
+ # if __GNUC__ >= 3
+-# define __must_inline extern __inline__ __attribute__((always_inline))
++# ifdef __GNUC_STDC_INLINE__
++# define __must_inline extern __inline__ \
++ __attribute__((__gnu_inline__,__always_inline__))
++# else
++# define __must_inline extern __inline__ __attribute__((__always_inline__))
++# endif
+ # else
+ # define __must_inline extern __inline__
+ # endif
+--
+1.7.0
+
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/fstype-sane-vfat-and-jffs2-for-1.5.patch b/recipes/klibc/klibc-1.5.15+1.5.16/fstype-sane-vfat-and-jffs2-for-1.5.patch
new file mode 100644
index 0000000000..6eb604e45c
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/fstype-sane-vfat-and-jffs2-for-1.5.patch
@@ -0,0 +1,63 @@
+Index: klibc-1.5/usr/kinit/fstype/fstype.c
+===================================================================
+--- klibc-1.5.orig/usr/kinit/fstype/fstype.c 2008-02-28 00:48:35.319254938 +0100
++++ klibc-1.5/usr/kinit/fstype/fstype.c 2008-02-28 00:52:20.583257793 +0100
+@@ -20,7 +20,7 @@
+ #include <netinet/in.h>
+ #include <sys/utsname.h>
+ #include <sys/vfs.h>
+-
++#include <linux/types.h>
+ #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */
+
+ #include "romfs_fs.h"
+@@ -37,6 +37,12 @@
+ #include "ocfs2_fs.h"
+ #include "nilfs_fs.h"
+
++#if __BYTE_ORDER == __BIG_ENDIAN
++#include <linux/byteorder/big_endian.h>
++#else
++#include <linux/byteorder/little_endian.h>
++#endif
++
+ /*
+ * Slightly cleaned up version of jfs_superblock to
+ * avoid pulling in other kernel header files.
+@@ -59,6 +65,27 @@
+ /* Swap needs the definition of block size */
+ #include "swap_fs.h"
+
++static int jffs2_image(const unsigned char *buf, unsigned long *blocks)
++{
++ // Very sloppy! ;-E
++ if (*buf == 0x85 && buf[1] == 0x19)
++ return 1;
++
++ 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 gzip_image(const void *buf, unsigned long long *bytes)
+ {277 304
+ const unsigned char *p = buf;
+@@ -490,6 +517,8 @@
+ {1, "ext3", ext3_image},
+ {1, "ext2", ext2_image},
+ {1, "minix", minix_image},
++ {0, "jffs2", jffs2_image},
++ {0, "vfat", vfat_image},
+ {1, "nilfs2", nilfs2_image},
+ {2, "ocfs2", ocfs2_image},
+ {8, "reiserfs", reiserfs_image},
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-omit-zero-lenght-DHCP-vendor-class-id.patch b/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-omit-zero-lenght-DHCP-vendor-class-id.patch
new file mode 100644
index 0000000000..21166d47f0
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-omit-zero-lenght-DHCP-vendor-class-id.patch
@@ -0,0 +1,88 @@
+From b4bad5be5fa41416bf67fa1fba0624a0c541ea39 Mon Sep 17 00:00:00 2001
+From: Aron Griffis <agriffis@n01se.net>
+Date: Sun, 21 Jun 2009 22:40:17 -0400
+Subject: [PATCH] ipconfig: omit zero-length DHCP vendor_class_identifier
+
+If ipconfig is executed with -i "", omit the vendor class
+identifier from the DHCP discover/request rather than
+sending it empty. This patch paves the way for more
+flexibility in the DHCP packet, particularly hostname
+request.
+
+Signed-off-by: Aron Griffis <agriffis@n01se.net>
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+---
+ usr/kinit/ipconfig/dhcp_proto.c | 31 +++++++++++++++++++++----------
+ 1 files changed, 21 insertions(+), 10 deletions(-)
+
+diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c
+index d4f2c09..c127d39 100644
+--- a/usr/kinit/ipconfig/dhcp_proto.c
++++ b/usr/kinit/ipconfig/dhcp_proto.c
+@@ -51,22 +51,22 @@ static uint8_t dhcp_end[] = {
+ pokes at the internals */
+ #define DHCP_IOV_LEN 6
+
+-static struct iovec dhcp_discover_iov[] = {
++static struct iovec dhcp_discover_iov[DHCP_IOV_LEN] = {
+ /* [0] = ip + udp header */
+ /* [1] = bootp header */
+ [2] = {dhcp_discover_hdr, sizeof(dhcp_discover_hdr)},
+ [3] = {dhcp_params, sizeof(dhcp_params)},
+- /* [4] = DHCP vendor class */
+- [5] = {dhcp_end, sizeof(dhcp_end)}
++ /* [4] = optional vendor class */
++ /* [5] = {dhcp_end, sizeof(dhcp_end)} */
+ };
+
+-static struct iovec dhcp_request_iov[] = {
++static struct iovec dhcp_request_iov[DHCP_IOV_LEN] = {
+ /* [0] = ip + udp header */
+ /* [1] = bootp header */
+ [2] = {dhcp_request_hdr, sizeof(dhcp_request_hdr)},
+ [3] = {dhcp_params, sizeof(dhcp_params)},
+- /* [4] = DHCP vendor class */
+- [5] = {dhcp_end, sizeof(dhcp_end)}
++ /* [4] = optional vendor class */
++ /* [5] = {dhcp_end, sizeof(dhcp_end)} */
+ };
+
+ /*
+@@ -164,6 +164,7 @@ static int dhcp_recv(struct netdev *dev)
+ static int dhcp_send(struct netdev *dev, struct iovec *vec)
+ {
+ struct bootp_hdr bootp;
++ int i = 4;
+
+ memset(&bootp, 0, sizeof(struct bootp_hdr));
+
+@@ -179,12 +180,22 @@ static int dhcp_send(struct netdev *dev, struct iovec *vec)
+ vec[1].iov_base = &bootp;
+ vec[1].iov_len = sizeof(struct bootp_hdr);
+
+- vec[4].iov_base = vendor_class_identifier;
+- vec[4].iov_len = vendor_class_identifier_len;
+-
+ DEBUG(("xid %08x secs %d ", bootp.xid, ntohs(bootp.secs)));
+
+- return packet_send(dev, vec, DHCP_IOV_LEN);
++ if (vendor_class_identifier_len > 2) {
++ vec[i].iov_base = vendor_class_identifier;
++ vec[i].iov_len = vendor_class_identifier_len;
++ i++;
++
++ DEBUG(("vendor_class_identifier \"%.*s\" ",
++ vendor_class_identifier_len-2,
++ vendor_class_identifier+2));
++ }
++
++ vec[i].iov_base = dhcp_end;
++ vec[i].iov_len = sizeof(dhcp_end);
++
++ return packet_send(dev, vec, i);
+ }
+
+ /*
+--
+1.7.0
+
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-send-req-hostname-in-DHCP.patch b/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-send-req-hostname-in-DHCP.patch
new file mode 100644
index 0000000000..be4fd71fde
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-send-req-hostname-in-DHCP.patch
@@ -0,0 +1,114 @@
+From 1f2b4e044a6a0fde32bc976e5ad6436035c84cec Mon Sep 17 00:00:00 2001
+From: Aron Griffis <agriffis@n01se.net>
+Date: Sun, 21 Jun 2009 22:40:17 -0400
+Subject: [PATCH] ipconfig: send requested hostname in DHCP discover/request
+
+If a hostname is requested, for example -d ::::foo::dhcp,
+then include the hostname in the DHCP discover/request.
+
+Signed-off-by: Aron Griffis <agriffis@n01se.net>
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+---
+ usr/kinit/ipconfig/dhcp_proto.c | 22 +++++++++++++++++++---
+ usr/kinit/ipconfig/main.c | 4 ++++
+ usr/kinit/ipconfig/netdev.h | 1 +
+ 3 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c
+index c127d39..775a5ca 100644
+--- a/usr/kinit/ipconfig/dhcp_proto.c
++++ b/usr/kinit/ipconfig/dhcp_proto.c
+@@ -49,7 +49,7 @@ static uint8_t dhcp_end[] = {
+
+ /* Both iovecs below have to have the same structure, since dhcp_send()
+ pokes at the internals */
+-#define DHCP_IOV_LEN 6
++#define DHCP_IOV_LEN 7
+
+ static struct iovec dhcp_discover_iov[DHCP_IOV_LEN] = {
+ /* [0] = ip + udp header */
+@@ -57,7 +57,8 @@ static struct iovec dhcp_discover_iov[DHCP_IOV_LEN] = {
+ [2] = {dhcp_discover_hdr, sizeof(dhcp_discover_hdr)},
+ [3] = {dhcp_params, sizeof(dhcp_params)},
+ /* [4] = optional vendor class */
+- /* [5] = {dhcp_end, sizeof(dhcp_end)} */
++ /* [5] = optional hostname */
++ /* [6] = {dhcp_end, sizeof(dhcp_end)} */
+ };
+
+ static struct iovec dhcp_request_iov[DHCP_IOV_LEN] = {
+@@ -66,7 +67,8 @@ static struct iovec dhcp_request_iov[DHCP_IOV_LEN] = {
+ [2] = {dhcp_request_hdr, sizeof(dhcp_request_hdr)},
+ [3] = {dhcp_params, sizeof(dhcp_params)},
+ /* [4] = optional vendor class */
+- /* [5] = {dhcp_end, sizeof(dhcp_end)} */
++ /* [5] = optional hostname */
++ /* [6] = {dhcp_end, sizeof(dhcp_end)} */
+ };
+
+ /*
+@@ -164,6 +166,7 @@ static int dhcp_recv(struct netdev *dev)
+ static int dhcp_send(struct netdev *dev, struct iovec *vec)
+ {
+ struct bootp_hdr bootp;
++ char dhcp_hostname[SYS_NMLN+2];
+ int i = 4;
+
+ memset(&bootp, 0, sizeof(struct bootp_hdr));
+@@ -192,6 +195,19 @@ static int dhcp_send(struct netdev *dev, struct iovec *vec)
+ vendor_class_identifier+2));
+ }
+
++ if (dev->reqhostname[0] != '\0') {
++ int len = strlen(dev->reqhostname);
++ dhcp_hostname[0] = 12;
++ dhcp_hostname[1] = len;
++ memcpy(dhcp_hostname+2, dev->reqhostname, len);
++
++ vec[i].iov_base = dhcp_hostname;
++ vec[i].iov_len = len+2;
++ i++;
++
++ DEBUG(("hostname %.*s ", len, dhcp_hostname+2));
++ }
++
+ vec[i].iov_base = dhcp_end;
+ vec[i].iov_len = sizeof(dhcp_end);
+
+diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
+index 2ded0f3..619edf7 100644
+--- a/usr/kinit/ipconfig/main.c
++++ b/usr/kinit/ipconfig/main.c
+@@ -522,6 +522,8 @@ static int parse_device(struct netdev *dev, const char *ip)
+ case 4:
+ strncpy(dev->hostname, ip, SYS_NMLN - 1);
+ dev->hostname[SYS_NMLN - 1] = '\0';
++ memcpy(dev->reqhostname, dev->hostname,
++ SYS_NMLN);
+ break;
+ case 5:
+ dev->name = ip;
+@@ -569,6 +571,8 @@ static void bringup_one_dev(struct netdev *template, struct netdev *dev)
+ dev->ip_nameserver[1] = template->ip_nameserver[1];
+ if (template->hostname[0] != '\0')
+ strcpy(dev->hostname, template->hostname);
++ if (template->reqhostname[0] != '\0')
++ strcpy(dev->reqhostname, template->reqhostname);
+ dev->caps &= template->caps;
+
+ bringup_device(dev);
+diff --git a/usr/kinit/ipconfig/netdev.h b/usr/kinit/ipconfig/netdev.h
+index fb6640a..a25a544 100644
+--- a/usr/kinit/ipconfig/netdev.h
++++ b/usr/kinit/ipconfig/netdev.h
+@@ -35,6 +35,7 @@ struct netdev {
+ uint32_t ip_gateway; /* my gateway */
+ uint32_t ip_nameserver[2]; /* two nameservers */
+ uint32_t serverid; /* dhcp serverid */
++ char reqhostname[SYS_NMLN]; /* requested hostname */
+ char hostname[SYS_NMLN]; /* hostname */
+ char dnsdomainname[SYS_NMLN]; /* dns domain name */
+ char nisdomainname[SYS_NMLN]; /* nis domain name */
+--
+1.7.0
+
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-set-null-ciaddr-on-dhcprequest.patch b/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-set-null-ciaddr-on-dhcprequest.patch
new file mode 100644
index 0000000000..7a82335599
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/ipconfig-set-null-ciaddr-on-dhcprequest.patch
@@ -0,0 +1,43 @@
+From cfc8d649a959f845983aae4c0fc33a0a0c995c92 Mon Sep 17 00:00:00 2001
+From: maximilian attems <max@stro.at>
+Date: Fri, 5 Sep 2008 22:48:27 +0200
+Subject: [PATCH] [klibc] ipconfig: set null ciaddr on DHCPREQUEST during SELECTING state
+
+RFC 2131, Section 4.3.2 states:
+
+ Clients send DHCPREQUEST messages as follows:
+
+ o DHCPREQUEST generated during SELECTING state:
+
+ Client inserts the address of the selected server in 'server
+ identifier', 'ciaddr' MUST be zero, 'requested IP address' MUST be
+ filled in with the yiaddr value from the chosen DHCPOFFER.
+
+fixes: http://bugs.debian.org/497879
+
+my test dhcpd seem all not that picky, ipconfig worked before
+and after this RFC 2131 conformal change.
+
+Reported-by: Craig Bernstein <cbernstein@stanford.edu>
+Signed-off-by: maximilian attems <max@stro.at>
+---
+ usr/kinit/ipconfig/dhcp_proto.c | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c
+index d4f2c09..21448f7 100644
+--- a/usr/kinit/ipconfig/dhcp_proto.c
++++ b/usr/kinit/ipconfig/dhcp_proto.c
+@@ -171,7 +171,8 @@ static int dhcp_send(struct netdev *dev, struct iovec *vec)
+ bootp.htype = dev->hwtype;
+ bootp.hlen = dev->hwlen;
+ bootp.xid = dev->bootp.xid;
+- bootp.ciaddr = dev->ip_addr;
++ bootp.ciaddr = INADDR_NONE;
++ bootp.yiaddr = dev->ip_addr;
+ bootp.giaddr = INADDR_ANY;
+ bootp.secs = htons(time(NULL) - dev->open_time);
+ memcpy(bootp.chaddr, dev->hwaddr, 16);
+--
+1.7.0
+
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/isystem.patch b/recipes/klibc/klibc-1.5.15+1.5.16/isystem.patch
new file mode 100644
index 0000000000..2ec40c16c2
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/isystem.patch
@@ -0,0 +1,13 @@
+Index: klibc-1.5.15/klcc/klcc.in
+===================================================================
+--- klibc-1.5.15.orig/klcc/klcc.in 2009-12-14 00:32:41.373661102 +0100
++++ klibc-1.5.15/klcc/klcc.in 2009-12-14 00:34:20.855735356 +0100
+@@ -147,7 +147,7 @@
+ } elsif ( $a =~ /^-([fmwWQdO]|std=|ansi|pedantic|M[GPD]|MMD)/ ) {
+ # Options to gcc
+ push(@ccopt, $a);
+- } elsif ( $a =~ /^-([DUI]|M[FQT])(.*)$/ ) {
++ } elsif ( $a =~ /^-([DUI]|M[FQT]|isystem)(.*)$/ ) {
+ # Options to gcc, which can take either a conjoined argument
+ # (-DFOO) or a disjoint argument (-D FOO)
+ push(@ccopt, $a);
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/klibc-utils-add-simple-ls.patch b/recipes/klibc/klibc-1.5.15+1.5.16/klibc-utils-add-simple-ls.patch
new file mode 100644
index 0000000000..6d7a66eb52
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/klibc-utils-add-simple-ls.patch
@@ -0,0 +1,249 @@
+From f9f820a9fadbd8c6ff3e2dcba6b82ed5abc204ba Mon Sep 17 00:00:00 2001
+From: Alexey Gladkov <gladkov.alexey@gmail.com>
+Date: Sat, 30 May 2009 01:24:05 +0400
+Subject: [PATCH] [klibc] utils: add simple ls
+
+Simple utility to list information about a files. The utility which
+does the same thing as "ls -la". This is a useful test program.
+
+Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+---
+ usr/utils/Kbuild | 4 +-
+ usr/utils/ls.c | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 205 insertions(+), 1 deletions(-)
+ create mode 100644 usr/utils/ls.c
+
+diff --git a/usr/utils/Kbuild b/usr/utils/Kbuild
+index 5b6dc28..354a364 100644
+--- a/usr/utils/Kbuild
++++ b/usr/utils/Kbuild
+@@ -3,7 +3,7 @@
+ #
+
+ progs := chroot dd mkdir mkfifo mknod mount pivot_root umount
+-progs += true false sleep ln nuke minips cat losetup wc
++progs += true false sleep ln nuke minips cat losetup wc ls
+ progs += uname halt kill readlink cpio sync dmesg modprobe
+
+ static-y := $(addprefix static/, $(progs))
+@@ -36,6 +36,8 @@ static/sleep-y := sleep.o
+ shared/sleep-y := sleep.o
+ static/ln-y := ln.o
+ shared/ln-y := ln.o
++static/ls-y := ls.o
++shared/ls-y := ls.o
+ static/nuke-y := nuke.o
+ shared/nuke-y := nuke.o
+ static/minips-y := minips.o
+diff --git a/usr/utils/ls.c b/usr/utils/ls.c
+new file mode 100644
+index 0000000..859142a
+--- /dev/null
++++ b/usr/utils/ls.c
+@@ -0,0 +1,202 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <dirent.h>
++#include <unistd.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <sys/sysmacros.h>
++
++#define STAT_ISSET(mode, mask) (((mode) & mask) == mask)
++
++static size_t max_linksiz = 128;
++static int max_nlinks = 1;
++static int max_size = 1;
++static int max_uid = 1;
++static int max_gid = 1;
++static int max_min = 1;
++static int max_maj = 1;
++
++static void do_preformat(const struct stat *st)
++{
++ int bytes;
++
++ if ((bytes = snprintf(NULL, 0, "%ju", (uintmax_t) st->st_nlink)) > max_nlinks)
++ max_nlinks = bytes;
++
++ if ((bytes = snprintf(NULL, 0, "%ju", (uintmax_t) st->st_uid)) > max_uid)
++ max_uid = bytes;
++
++ if ((bytes = snprintf(NULL, 0, "%ju", (uintmax_t) st->st_gid)) > max_gid)
++ max_gid = bytes;
++
++ if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
++ if ((bytes = snprintf(NULL, 0, "%u", major(st->st_rdev))) > max_maj)
++ max_maj = bytes;
++
++ if ((bytes = snprintf(NULL, 0, "%u", minor(st->st_rdev))) > max_min)
++ max_min = bytes;
++
++ max_size = max_maj + max_min + 1;
++ }
++ else {
++ if ((bytes = snprintf(NULL, 0, "%ju", (uintmax_t) st->st_size)) > max_size)
++ max_size = bytes;
++ }
++ return;
++}
++
++static void do_stat(const struct stat *st, const char *path)
++{
++ char *fmt, *link_name;
++ int rc;
++
++ switch (st->st_mode & S_IFMT) {
++ case S_IFBLK: putchar('b'); break;
++ case S_IFCHR: putchar('c'); break;
++ case S_IFDIR: putchar('d'); break;
++ case S_IFIFO: putchar('p'); break;
++ case S_IFLNK: putchar('l'); break;
++ case S_IFSOCK: putchar('s'); break;
++ case S_IFREG: putchar('-'); break;
++ default: putchar('?'); break;
++ }
++ putchar(STAT_ISSET(st->st_mode, S_IRUSR) ? 'r' : '-');
++ putchar(STAT_ISSET(st->st_mode, S_IWUSR) ? 'w' : '-');
++
++ !STAT_ISSET(st->st_mode, S_ISUID) ?
++ putchar(STAT_ISSET(st->st_mode, S_IXUSR) ? 'x' : '-') :
++ putchar('S');
++
++ putchar(STAT_ISSET(st->st_mode, S_IRGRP) ? 'r' : '-');
++ putchar(STAT_ISSET(st->st_mode, S_IWGRP) ? 'w' : '-');
++
++ !STAT_ISSET(st->st_mode, S_ISGID) ?
++ putchar(STAT_ISSET(st->st_mode, S_IXGRP) ? 'x' : '-') :
++ putchar('S');
++
++ putchar(STAT_ISSET(st->st_mode, S_IROTH) ? 'r' : '-');
++ putchar(STAT_ISSET(st->st_mode, S_IWOTH) ? 'w' : '-');
++
++ !STAT_ISSET(st->st_mode, S_ISVTX) ?
++ putchar(STAT_ISSET(st->st_mode, S_IXOTH) ? 'x' : '-') :
++ putchar(S_ISDIR(st->st_mode) ? 't' : 'T');
++
++ if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
++ rc = asprintf(&fmt," %%%dju %%%dju %%%dju %%%du,%%%du %%s",
++ max_nlinks, max_uid, max_gid, max_maj, max_min);
++ if (rc == -1) {
++ perror("asprintf");
++ exit(1);
++ }
++ fprintf(stdout, fmt,
++ (uintmax_t) st->st_nlink,
++ (uintmax_t) st->st_uid,
++ (uintmax_t) st->st_gid,
++ major(st->st_rdev),
++ minor(st->st_rdev),
++ path);
++ }
++ else {
++ rc = asprintf(&fmt," %%%dju %%%dju %%%dju %%%dju %%s",
++ max_nlinks, max_uid, max_gid, max_size);
++ if (rc == -1) {
++ perror("asprintf");
++ exit(1);
++ }
++ fprintf(stdout, fmt,
++ (uintmax_t) st->st_nlink,
++ (uintmax_t) st->st_uid,
++ (uintmax_t) st->st_gid,
++ (uintmax_t) st->st_size,
++ path);
++ }
++ free(fmt);
++
++ if (S_ISLNK(st->st_mode)) {
++ if ((link_name = malloc(max_linksiz)) == NULL) {
++ perror("malloc");
++ exit(1);
++ }
++ if ((rc = readlink(path, link_name, max_linksiz)) == -1) {
++ free(link_name);
++ perror("readlink");
++ exit(1);
++ }
++ link_name[rc] = '\0';
++ fprintf(stdout, " -> %s", link_name);
++ free(link_name);
++ }
++
++ putchar('\n');
++ return;
++}
++
++static void do_dir(const char *path, int preformat)
++{
++ DIR *dir;
++ struct dirent *dent;
++ struct stat st;
++
++ if (chdir(path) == -1) {
++ perror(path);
++ exit(1);
++ }
++
++ if ((dir = opendir(path)) == NULL) {
++ perror(path);
++ exit(1);
++ }
++
++ while ((dent = readdir(dir)) != NULL) {
++ if (lstat(dent->d_name, &st)) {
++ perror(dent->d_name);
++ exit(1);
++ }
++ (preformat) ?
++ do_preformat(&st) :
++ do_stat(&st, dent->d_name);
++ }
++
++ closedir(dir);
++}
++
++int main(int argc, char *argv[])
++{
++ int i;
++ struct stat st;
++
++ if (argc == 1) {
++ do_dir(".", 1);
++ do_dir(".", 0);
++ return 0;
++ }
++
++ for (i = 1; i < argc; i++) {
++ if (argv[i][0] == '-' && argv[i][1] == 'h') {
++ fprintf(stdout, "Usage: ls [-h] [FILE ...]\n");
++ return 0;
++ }
++
++ if (lstat(argv[i], &st)) {
++ perror(argv[i]);
++ exit(1);
++ }
++
++ S_ISDIR(st.st_mode) ?
++ do_dir(argv[i], 1) :
++ do_preformat(&st);
++ }
++
++ for (i = 1; i < argc; i++) {
++ if (lstat(argv[i], &st)) {
++ perror(argv[i]);
++ exit(1);
++ }
++
++ S_ISDIR(st.st_mode) ?
++ do_dir(argv[i], 0) :
++ do_stat(&st, argv[i]);
++ }
++
++ return 0;
++}
+--
+1.7.0
+
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/mntproc-definitions.patch b/recipes/klibc/klibc-1.5.15+1.5.16/mntproc-definitions.patch
new file mode 100644
index 0000000000..eea606be2b
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/mntproc-definitions.patch
@@ -0,0 +1,20 @@
+Description: MNTPROC_MNT and MNTPROC_UMNT are no longer defined by the
+ kernel. Hack around this by restoring the old definitions.
+Upstream: http://thread.gmane.org/gmane.linux.nfs/28059 suggests a better
+ fix is in progress.
+
+diff -Nur -x '*.orig' -x '*~' klibc-1.5.15/usr/kinit/nfsmount/mount.c klibc-1.5.15.new/usr/kinit/nfsmount/mount.c
+--- klibc-1.5.15/usr/kinit/nfsmount/mount.c 2009-01-04 19:28:03.000000000 +0000
++++ klibc-1.5.15.new/usr/kinit/nfsmount/mount.c 2009-10-04 22:52:44.000000000 +0100
+@@ -44,6 +44,11 @@
+
+ #define MNT_REPLY_MINSIZE (sizeof(struct rpc_reply) + sizeof(uint32_t))
+
++#ifndef MNTPROC_MNT
++# define MNTPROC_MNT 1
++# define MNTPROC_UMNT 3
++#endif /* MNTPROC_MNT */
++
+ static int get_ports(uint32_t server, const struct nfs_mount_data *data)
+ {
+ uint32_t nfs_ver, mount_ver;
diff --git a/recipes/klibc/klibc-1.5.15+1.5.16/modprobe.patch b/recipes/klibc/klibc-1.5.15+1.5.16/modprobe.patch
new file mode 100644
index 0000000000..61ee340ff9
--- /dev/null
+++ b/recipes/klibc/klibc-1.5.15+1.5.16/modprobe.patch
@@ -0,0 +1,1985 @@
+Index: klibc-1.5/usr/utils/Kbuild
+===================================================================
+--- klibc-1.5.orig/usr/utils/Kbuild 2008-03-07 22:01:45.223695348 +0100
++++ klibc-1.5/usr/utils/Kbuild 2008-03-07 22:48:44.660783243 +0100
+@@ -3,8 +3,8 @@
+ #
+
+ progs := chroot dd mkdir mkfifo mknod mount pivot_root umount
+-progs += true false sleep ln nuke minips cat
+-progs += uname halt kill readlink cpio sync dmesg
++progs += true false sleep ln nuke minips cat losetup
++progs += uname halt kill readlink cpio sync dmesg modprobe
+
+ static-y := $(addprefix static/, $(progs))
+ shared-y := $(addprefix shared/, $(progs))
+@@ -54,7 +54,10 @@
+ shared/cpio-y := cpio.o
+ static/sync-y := sync.o
+ shared/sync-y := sync.o
+-
++static/modprobe-y := modprobe.o
++shared/modprobe-y := modprobe.o
++static/losetup-y := losetup.o
++shared/losetup-y := losetup.o
+ # Additionally linked targets
+ always := static/reboot static/poweroff shared/reboot shared/poweroff
+
+Index: klibc-1.5/usr/utils/list.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ klibc-1.5/usr/utils/list.h 2008-03-07 22:33:22.287688586 +0100
+@@ -0,0 +1,238 @@
++/* Stolen from Linux Kernel Source's list.h -- GPL. */
++#ifndef _MODINITTOOLS_LIST_H
++#define _MODINITTOOLS_LIST_H
++
++#undef offsetof
++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
++
++/**
++ * container_of - cast a member of a structure out to the containing structure
++ *
++ * @ptr: the pointer to the member.
++ * @type: the type of the container struct this is embedded in.
++ * @member: the name of the member within the struct.
++ *
++ */
++#define container_of(ptr, type, member) ({ \
++ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
++ (type *)( (char *)__mptr - offsetof(type,member) );})
++
++/*
++ * Simple doubly linked list implementation.
++ *
++ * Some of the internal functions ("__xxx") are useful when
++ * manipulating whole lists rather than single entries, as
++ * sometimes we already know the next/prev entries and we can
++ * generate better code by using them directly rather than
++ * using the generic single-entry routines.
++ */
++
++struct list_head {
++ struct list_head *next, *prev;
++};
++
++#define LIST_HEAD_INIT(name) { &(name), &(name) }
++
++#define LIST_HEAD(name) \
++ struct list_head name = LIST_HEAD_INIT(name)
++
++#define INIT_LIST_HEAD(ptr) do { \
++ (ptr)->next = (ptr); (ptr)->prev = (ptr); \
++} while (0)
++
++/*
++ * Insert a new entry between two known consecutive entries.
++ *
++ * This is only for internal list manipulation where we know
++ * the prev/next entries already!
++ */
++static inline void __list_add(struct list_head *new,
++ struct list_head *prev,
++ struct list_head *next)
++{
++ next->prev = new;
++ new->next = next;
++ new->prev = prev;
++ prev->next = new;
++}
++
++/**
++ * list_add - add a new entry
++ * @new: new entry to be added
++ * @head: list head to add it after
++ *
++ * Insert a new entry after the specified head.
++ * This is good for implementing stacks.
++ */
++static inline void list_add(struct list_head *new, struct list_head *head)
++{
++ __list_add(new, head, head->next);
++}
++
++/**
++ * list_add_tail - add a new entry
++ * @new: new entry to be added
++ * @head: list head to add it before
++ *
++ * Insert a new entry before the specified head.
++ * This is useful for implementing queues.
++ */
++static inline void list_add_tail(struct list_head *new, struct list_head *head)
++{
++ __list_add(new, head->prev, head);
++}
++
++/*
++ * Delete a list entry by making the prev/next entries
++ * point to each other.
++ *
++ * This is only for internal list manipulation where we know
++ * the prev/next entries already!
++ */
++static inline void __list_del(struct list_head * prev, struct list_head * next)
++{
++ next->prev = prev;
++ prev->next = next;
++}
++
++/**
++ * list_del - deletes entry from list.
++ * @entry: the element to delete from the list.
++ * Note: list_empty on entry does not return true after this, the entry is
++ * in an undefined state.
++ */
++static inline void list_del(struct list_head *entry)
++{
++ __list_del(entry->prev, entry->next);
++}
++
++/**
++ * list_del_init - deletes entry from list and reinitialize it.
++ * @entry: the element to delete from the list.
++ */
++static inline void list_del_init(struct list_head *entry)
++{
++ __list_del(entry->prev, entry->next);
++ INIT_LIST_HEAD(entry);
++}
++
++/**
++ * list_move - delete from one list and add as another's head
++ * @list: the entry to move
++ * @head: the head that will precede our entry
++ */
++static inline void list_move(struct list_head *list, struct list_head *head)
++{
++ __list_del(list->prev, list->next);
++ list_add(list, head);
++}
++
++/**
++ * list_move_tail - delete from one list and add as another's tail
++ * @list: the entry to move
++ * @head: the head that will follow our entry
++ */
++static inline void list_move_tail(struct list_head *list,
++ struct list_head *head)
++{
++ __list_del(list->prev, list->next);
++ list_add_tail(list, head);
++}
++
++/**
++ * list_empty - tests whether a list is empty
++ * @head: the list to test.
++ */
++static inline int list_empty(struct list_head *head)
++{
++ return head->next == head;
++}
++
++static inline void __list_splice(struct list_head *list,
++ struct list_head *head)
++{
++ struct list_head *first = list->next;
++ struct list_head *last = list->prev;
++ struct list_head *at = head->next;
++
++ first->prev = head;
++ head->next = first;
++
++ last->next = at;
++ at->prev = last;
++}
++
++/**
++ * list_splice - join two lists
++ * @list: the new list to add.
++ * @head: the place to add it in the first list.
++ */
++static inline void list_splice(struct list_head *list, struct list_head *head)
++{
++ if (!list_empty(list))
++ __list_splice(list, head);
++}
++
++/**
++ * list_splice_init - join two lists and reinitialise the emptied list.
++ * @list: the new list to add.
++ * @head: the place to add it in the first list.
++ *
++ * The list at @list is reinitialised
++ */
++static inline void list_splice_init(struct list_head *list,
++ struct list_head *head)
++{
++ if (!list_empty(list)) {
++ __list_splice(list, head);
++ INIT_LIST_HEAD(list);
++ }
++}
++
++/**
++ * list_entry - get the struct for this entry
++ * @ptr: the &struct list_head pointer.
++ * @type: the type of the struct this is embedded in.
++ * @member: the name of the list_struct within the struct.
++ */
++#define list_entry(ptr, type, member) \
++ container_of(ptr, type, member)
++
++/**
++ * list_for_each - iterate over a list
++ * @pos: the &struct list_head to use as a loop counter.
++ * @head: the head for your list.
++ */
++#define list_for_each(pos, head) \
++ for (pos = (head)->next; pos != (head); pos = pos->next)
++
++/**
++ * list_for_each_prev - iterate over a list backwards
++ * @pos: the &struct list_head to use as a loop counter.
++ * @head: the head for your list.
++ */
++#define list_for_each_prev(pos, head) \
++ for (pos = (head)->prev; pos != (head); pos = pos->prev)
++
++/**
++ * list_for_each_safe - iterate over a list safe against removal of list entry
++ * @pos: the &struct list_head to use as a loop counter.
++ * @n: another &struct list_head to use as temporary storage
++ * @head: the head for your list.
++ */
++#define list_for_each_safe(pos, n, head) \
++ for (pos = (head)->next, n = pos->next; pos != (head); \
++ pos = n, n = pos->next)
++
++/**
++ * list_for_each_entry - iterate over list of given type