[busybox/f14] Fix compilation of uClibc vs Linux-3.0 headers
Daniel Drake
dsd at fedoraproject.org
Sat Aug 27 00:58:39 UTC 2011
commit 56d0366f71e5b3ceb4cc7e3e7363d46ae6a9477e
Author: Daniel Drake <dsd at laptop.org>
Date: Sat Aug 27 01:24:30 2011 +0100
Fix compilation of uClibc vs Linux-3.0 headers
busybox-sysinfo-1.patch | 49 ++++++++++++++++++++++++++
busybox-sysinfo-2.patch | 86 +++++++++++++++++++++++++++++++++++++++++++++++
busybox.spec | 9 ++++-
3 files changed, 143 insertions(+), 1 deletions(-)
---
diff --git a/busybox-sysinfo-1.patch b/busybox-sysinfo-1.patch
new file mode 100644
index 0000000..0cdda6e
--- /dev/null
+++ b/busybox-sysinfo-1.patch
@@ -0,0 +1,49 @@
+From be391e759675b23ccf6e19cb6ea5b819840f3026 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux at googlemail.com>
+Date: Mon, 25 Jul 2011 09:05:43 +0000
+Subject: libbb.h: do not use homegrown struct sysinfo.
+
+Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
+---
+Index: busybox-1.15.1/include/libbb.h
+===================================================================
+--- busybox-1.15.1.orig/include/libbb.h
++++ busybox-1.15.1/include/libbb.h
+@@ -56,6 +56,11 @@
+ #include <sys/statfs.h>
+ #endif
+
++/* struct sysinfo is linux-specific */
++#ifdef __linux__
++# include <sys/sysinfo.h>
++#endif
++
+ #if ENABLE_SELINUX
+ #include <selinux/selinux.h>
+ #include <selinux/context.h>
+@@ -98,25 +103,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);
+
+
+ /* Make all declarations hidden (-fvisibility flag only affects definitions) */
diff --git a/busybox-sysinfo-2.patch b/busybox-sysinfo-2.patch
new file mode 100644
index 0000000..33beca1
--- /dev/null
+++ b/busybox-sysinfo-2.patch
@@ -0,0 +1,86 @@
+From 67905e2d7c6ee273b753af22fb22de0ebec918c1 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux at googlemail.com>
+Date: Tue, 26 Jul 2011 11:42:12 +0000
+Subject: *: work around sysinfo.h versus linux/*.h problems
+
+Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
+---
+Index: busybox-1.15.1/include/libbb.h
+===================================================================
+--- busybox-1.15.1.orig/include/libbb.h
++++ busybox-1.15.1/include/libbb.h
+@@ -56,10 +56,12 @@
+ #include <sys/statfs.h>
+ #endif
+
+-/* struct sysinfo is linux-specific */
+-#ifdef __linux__
+-# include <sys/sysinfo.h>
+-#endif
++/* Don't do this here:
++ * #include <sys/sysinfo.h>
++ * 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 <selinux/selinux.h>
+Index: busybox-1.15.1/init/init.c
+===================================================================
+--- busybox-1.15.1.orig/init/init.c
++++ busybox-1.15.1/init/init.c
+@@ -15,7 +15,9 @@
+ #include <sys/reboot.h>
+ #include <sys/resource.h>
+ #include <linux/vt.h>
+-
++#ifdef __linux__
++# include <sys/sysinfo.h>
++#endif
+
+ /* Was a CONFIG_xxx option. A lot of people were building
+ * not fully functional init by switching it on! */
+Index: busybox-1.15.1/procps/free.c
+===================================================================
+--- busybox-1.15.1.orig/procps/free.c
++++ busybox-1.15.1/procps/free.c
+@@ -10,6 +10,9 @@
+ /* getopt not needed */
+
+ #include "libbb.h"
++#ifdef __linux__
++# include <sys/sysinfo.h>
++#endif
+
+ int free_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int free_main(int argc, char **argv)
+Index: busybox-1.15.1/procps/ps.c
+===================================================================
+--- busybox-1.15.1.orig/procps/ps.c
++++ busybox-1.15.1/procps/ps.c
+@@ -16,6 +16,9 @@ enum { MAX_WIDTH = 2*1024 };
+
+ #if ENABLE_DESKTOP
+
++#ifdef __linux__
++# include <sys/sysinfo.h>
++#endif
+ #include <sys/times.h> /* for times() */
+ //#include <sys/sysinfo.h> /* for sysinfo() */
+ #ifndef AT_CLKTCK
+Index: busybox-1.15.1/procps/uptime.c
+===================================================================
+--- busybox-1.15.1.orig/procps/uptime.c
++++ busybox-1.15.1/procps/uptime.c
+@@ -16,6 +16,10 @@
+ /* getopt not needed */
+
+ #include "libbb.h"
++#ifdef __linux__
++# include <sys/sysinfo.h>
++#endif
++
+
+ #ifndef FSHIFT
+ # define FSHIFT 16 /* nr of bits of precision */
diff --git a/busybox.spec b/busybox.spec
index 08d03d7..f925659 100644
--- a/busybox.spec
+++ b/busybox.spec
@@ -1,7 +1,7 @@
Summary: Statically linked binary providing simplified versions of system commands
Name: busybox
Version: 1.15.1
-Release: 10%{?dist}
+Release: 11%{?dist}
Epoch: 1
License: GPLv2
Group: System Environment/Shells
@@ -12,6 +12,8 @@ Patch16: busybox-1.10.1-hwclock.patch
Patch23: busybox-1.15.1-man.patch
Patch25: busybox-1.15.1-uname.patch
Patch27: busybox-1.15.1-build_system.patch
+Patch40: busybox-sysinfo-1.patch
+Patch41: busybox-sysinfo-2.patch
Obsoletes: busybox-anaconda
URL: http://www.busybox.net
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -47,6 +49,8 @@ better suited to normal use.
%patch23 -b .man -p1
%patch25 -b .uname -p1
%patch27 -b .build_system -p1
+%patch40 -p1 -b .sysinfo1
+%patch41 -p1 -b .sysinfo2
%build
# create static busybox - the executable is kept as busybox-static
@@ -109,6 +113,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/busybox.petitboot.1.gz
%changelog
+* Sat Aug 27 2011 Daniel Drake <dsd at laptop.org> - 1:1.15.1-11
+- Fix compilation against uClibc and Linux-3.0 headers
+
* Fri Aug 26 2011 Daniel Drake <dsd at laptop.org> - 1:1.15.1-10
- Remove Linux 2.4 support from insmod/modprobe/etc.
- Use systemwide uClibc
More information about the scm-commits
mailing list