From 5cb85a53b3e33d42ae4cbb2e3f1d5cbb5cab709d Mon Sep 17 00:00:00 2001 From: Zhenhua Luo Date: Fri, 24 Feb 2012 09:48:05 +0000 Subject: [PATCH] busybox: fix the build error when enable CONFIG_TCPSVD These patches were pulled from upstream busybox Signed-off-by: Zhenhua Luo --- ...-do-not-use-homegrown-struct-sysinfo.patch | 54 +++++++++++ ...d-sysinfo.h-versus-linux-.h-problems.patch | 95 +++++++++++++++++++ .../busybox/busybox_1.18.5.bbappend | 5 + 3 files changed, 154 insertions(+) create mode 100644 meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0001-libbb.h-do-not-use-homegrown-struct-sysinfo.patch create mode 100644 meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0002-work-around-sysinfo.h-versus-linux-.h-problems.patch create mode 100644 meta-fsl-ppc/recipes-append/busybox/busybox_1.18.5.bbappend diff --git a/meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0001-libbb.h-do-not-use-homegrown-struct-sysinfo.patch b/meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0001-libbb.h-do-not-use-homegrown-struct-sysinfo.patch new file mode 100644 index 00000000..ab0c48f7 --- /dev/null +++ b/meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0001-libbb.h-do-not-use-homegrown-struct-sysinfo.patch @@ -0,0 +1,54 @@ +From b87113587ed488ee10f621bde099766e13088923 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Mon, 25 Jul 2011 09:05:43 +0000 +Subject: [PATCH 1/2] libbb.h: do not use homegrown struct sysinfo. + +Signed-off-by: Denys Vlasenko +--- + include/libbb.h | 23 ++++------------------- + 1 files changed, 4 insertions(+), 19 deletions(-) + +diff --git a/include/libbb.h b/include/libbb.h +index 7c1db3f..afe3b61 100644 +--- a/include/libbb.h ++++ b/include/libbb.h +@@ -44,6 +44,10 @@ + #ifdef HAVE_SYS_STATFS_H + # include + #endif ++/* struct sysinfo is linux-specific */ ++#ifdef __linux__ ++# include ++#endif + #if ENABLE_SELINUX + # include + # include +@@ -100,25 +104,6 @@ int klogctl(int type, char *b, int len); + #if !defined __FreeBSD__ + char *dirname(char *path); + #endif +-/* Include our own copy of struct sysinfo to avoid binary compatibility +- * problems with Linux 2.4, which changed things. Grumble, grumble. */ +-struct sysinfo { +- long uptime; /* Seconds since boot */ +- unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ +- unsigned long totalram; /* Total usable main memory size */ +- unsigned long freeram; /* Available memory size */ +- unsigned long sharedram; /* Amount of shared memory */ +- unsigned long bufferram; /* Memory used by buffers */ +- unsigned long totalswap; /* Total swap space size */ +- unsigned long freeswap; /* swap space still available */ +- unsigned short procs; /* Number of current processes */ +- unsigned short pad; /* Padding needed for m68k */ +- unsigned long totalhigh; /* Total high memory size */ +- unsigned long freehigh; /* Available high memory size */ +- unsigned int mem_unit; /* Memory unit size in bytes */ +- char _f[20 - 2 * sizeof(long) - sizeof(int)]; /* Padding: libc5 uses this.. */ +-}; +-int sysinfo(struct sysinfo* info); + #ifndef PATH_MAX + # define PATH_MAX 256 + #endif +-- +1.7.5 + diff --git a/meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0002-work-around-sysinfo.h-versus-linux-.h-problems.patch b/meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0002-work-around-sysinfo.h-versus-linux-.h-problems.patch new file mode 100644 index 00000000..4d4d1756 --- /dev/null +++ b/meta-fsl-ppc/recipes-append/busybox/busybox-1.18.5/0002-work-around-sysinfo.h-versus-linux-.h-problems.patch @@ -0,0 +1,95 @@ +From f0256fb16d37061e04ca966da9d51d8eb205bc89 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Tue, 26 Jul 2011 11:42:12 +0000 +Subject: *: work around sysinfo.h versus linux/*.h problems + +Signed-off-by: Denys Vlasenko +--- + include/libbb.h | 10 ++++++---- + init/init.c | 3 ++- + procps/free.c | 3 +++ + procps/ps.c | 3 +++ + procps/uptime.c | 4 ++++ + 5 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/include/libbb.h b/include/libbb.h +index afe3b61..9fcd770 100644 +--- a/include/libbb.h ++++ b/include/libbb.h +@@ -44,10 +44,12 @@ + #ifdef HAVE_SYS_STATFS_H + # include + #endif +-/* struct sysinfo is linux-specific */ +-#ifdef __linux__ +-# include +-#endif ++/* Don't do this here: ++ * #include ++ * Some linux/ includes pull in conflicting definition ++ * of struct sysinfo (only in some toolchanins), which breaks build. ++ * Include sys/sysinfo.h only in those files which need it. ++ */ + #if ENABLE_SELINUX + # include + # include +diff --git a/init/init.c b/init/init.c +index 0a0d503..5121b94 100644 +--- a/init/init.c ++++ b/init/init.c +@@ -113,7 +113,8 @@ + #include + #include + #ifdef __linux__ +-#include ++# include ++# include + #endif + #if ENABLE_FEATURE_UTMP + # include /* DEAD_PROCESS */ +diff --git a/procps/free.c b/procps/free.c +index efbac5b..706be1b 100644 +--- a/procps/free.c ++++ b/procps/free.c +@@ -10,6 +10,9 @@ + /* getopt not needed */ + + #include "libbb.h" ++#ifdef __linux__ ++# include ++#endif + + struct globals { + unsigned mem_unit; +diff --git a/procps/ps.c b/procps/ps.c +index 48b55a7..e9e6ca9 100644 +--- a/procps/ps.c ++++ b/procps/ps.c +@@ -16,6 +16,9 @@ enum { MAX_WIDTH = 2*1024 }; + + #if ENABLE_DESKTOP + ++#ifdef __linux__ ++# include ++#endif + #include /* for times() */ + #ifndef AT_CLKTCK + #define AT_CLKTCK 17 +diff --git a/procps/uptime.c b/procps/uptime.c +index 5c48795..eda782c 100644 +--- a/procps/uptime.c ++++ b/procps/uptime.c +@@ -16,6 +16,10 @@ + /* getopt not needed */ + + #include "libbb.h" ++#ifdef __linux__ ++# include ++#endif ++ + + #ifndef FSHIFT + # define FSHIFT 16 /* nr of bits of precision */ +-- +1.7.5 + diff --git a/meta-fsl-ppc/recipes-append/busybox/busybox_1.18.5.bbappend b/meta-fsl-ppc/recipes-append/busybox/busybox_1.18.5.bbappend new file mode 100644 index 00000000..b285c16c --- /dev/null +++ b/meta-fsl-ppc/recipes-append/busybox/busybox_1.18.5.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/busybox-1.18.5:" + +SRC_URI += "file://0001-libbb.h-do-not-use-homegrown-struct-sysinfo.patch \ + file://0002-work-around-sysinfo.h-versus-linux-.h-problems.patch \ +" -- 2.40.1