Browse Source

- drop obsolete busybox patches

master
gixxpunk 8 years ago
parent
commit
3949602e11
  1. 15
      archive-patches/busybox-1.20.2/busybox-1.20-init_avoid_loop_opening_tty.patch
  2. 166
      archive-patches/busybox-1.20.2/busybox-1.20-insmod-hack.patch
  3. 17
      archive-patches/busybox-1.20.2/busybox-1.20-mount-use-var-etc-fstab.patch
  4. 25
      archive-patches/busybox-1.20.2/busybox-1.20.2-kernel_ver.patch
  5. 11
      archive-patches/busybox-1.20.2/busybox-1.20.2-ntpd.patch
  6. 67
      archive-patches/busybox-1.20.2/busybox-1.20.2-pkg-config-selinux.patch
  7. 123
      archive-patches/busybox-1.20.2/busybox-1.20.2-sys-resource.patch
  8. 13
      archive-patches/busybox-1.20.2/busybox-fix-config-header.diff

15
archive-patches/busybox-1.20.2/busybox-1.20-init_avoid_loop_opening_tty.patch

@ -1,15 +0,0 @@
--- a/init/init.c 2012-06-14 17:48:06+02:00
+++ b/init/init.c 2012-06-14 17:48:06+02:00
@@ -586,8 +586,11 @@
/* Only run stuff with pid == 0. If pid != 0,
* it is already running
*/
- if (a->pid == 0)
+ if (a->pid == 0) {
+ if (a->terminal[0] && access(a->terminal, R_OK | W_OK))
+ continue;
a->pid = run(a);
+ }
}
}
}

166
archive-patches/busybox-1.20.2/busybox-1.20-insmod-hack.patch

@ -1,166 +0,0 @@
modutils/Config.src | 2 +-
modutils/insmod.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 124 insertions(+), 3 deletions(-)
diff --git a/modutils/Config.src b/modutils/Config.src
index 449ac65..02fbc41 100644
--- a/modutils/Config.src
+++ b/modutils/Config.src
@@ -247,7 +247,7 @@ config FEATURE_MODUTILS_SYMBOLS
config DEFAULT_MODULES_DIR
string "Default directory containing modules"
default "/lib/modules"
- depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO
+ depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO || INSMOD
help
Directory that contains kernel modules.
Defaults to "/lib/modules"
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 887d9f2..fa4a4f9 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -35,11 +35,42 @@
//usage: )
//usage:#endif
+#include <sys/utsname.h>
+static char *m_filename;
+static char *m_fullName;
+
+static int FAST_FUNC check_module_name_match(const char *filename,
+ struct stat *statbuf UNUSED_PARAM,
+ void *userdata, int depth UNUSED_PARAM)
+{
+ char *fullname = (char *) userdata;
+ char *tmp;
+
+ if (fullname[0] == '\0')
+ return FALSE;
+
+ tmp = bb_get_last_path_component_nostrip(filename);
+ if (strcmp(tmp, fullname) == 0) {
+ /* Stop searching if we find a match */
+ m_filename = xstrdup(filename);
+ return FALSE;
+ }
+ return TRUE;
+}
+
int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int insmod_main(int argc UNUSED_PARAM, char **argv)
{
char *filename;
int rc;
+int len;
+char *tmp;
+char *tmp2;
+int k_version = 0;
+struct stat st;
+struct utsname uts;
+char *m_name;
+FILE *fp;
/* Compat note:
* 2.6 style insmod has no options and required filename
@@ -58,9 +89,99 @@ int insmod_main(int argc UNUSED_PARAM, char **argv)
if (!filename)
bb_show_usage();
- rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0));
+ /* Grab the module name */
+ tmp = xstrdup(filename);
+ len = strlen(filename);
+
+ if (uname(&uts) == 0) {
+ if (uts.release[0] == '2') {
+ k_version = uts.release[2] - '0';
+ }
+ }
+
+ if (k_version > 4 && len > 3 && tmp[len - 3] == '.'
+ && tmp[len - 2] == 'k' && tmp[len - 1] == 'o'
+ ) {
+ len -= 3;
+ tmp[len] = '\0';
+ } else
+ if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') {
+ len -= 2;
+ tmp[len] = '\0';
+ }
+
+ if (k_version > 4)
+ m_fullName = xasprintf("%s.ko", tmp);
+ else
+ m_fullName = xasprintf("%s.o", tmp);
+
+ if (!m_name) {
+ m_name = tmp;
+ }
+ free(tmp);
+
+ /* first look in /var/lib/modules */
+ tmp2 = alloca(strlen(m_fullName) + sizeof("/var/lib/modules/"));
+ strcpy(tmp2, "/var/lib/modules/");
+ strcat(tmp2, m_fullName);
+ if (stat(tmp2, &st) >= 0 && S_ISREG(st.st_mode) && (fp = fopen(tmp2, "r")) != NULL) {
+ m_filename = xstrdup(tmp2);
+ printf("insmod: preferring module %s\n", m_filename);
+ } else
+ /* Get a filedesc for the module. Check that we have a complete path */
+ if (stat(filename, &st) < 0 || !S_ISREG(st.st_mode)
+ || (fp = fopen_for_read(filename)) == NULL
+ ) {
+ /* Hmm. Could not open it. First search under /lib/modules/`uname -r`,
+ * but do not error out yet if we fail to find it... */
+ if (k_version) { /* uname succeedd */
+ char *module_dir;
+ char *tmdn;
+
+ tmdn = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, uts.release);
+ /* Jump through hoops in case /lib/modules/`uname -r`
+ * is a symlink. We do not want recursive_action to
+ * follow symlinks, but we do want to follow the
+ * /lib/modules/`uname -r` dir, So resolve it ourselves
+ * if it is a link... */
+ module_dir = xmalloc_readlink(tmdn);
+ if (!module_dir)
+ module_dir = xstrdup(tmdn);
+ recursive_action(module_dir, ACTION_RECURSE,
+ check_module_name_match, NULL, m_fullName, 0);
+ free(module_dir);
+ free(tmdn);
+ }
+
+ /* Check if we have found anything yet */
+ if (!m_filename || ((fp = fopen_for_read(m_filename)) == NULL)) {
+ int r;
+ char *module_dir;
+
+ free(m_filename);
+ m_filename = NULL;
+ module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR);
+ if (!module_dir)
+ module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR);
+ /* No module found under /lib/modules/`uname -r`, this
+ * time cast the net a bit wider. Search /lib/modules/ */
+ r = recursive_action(module_dir, ACTION_RECURSE,
+ check_module_name_match, NULL, m_fullName, 0);
+ if (r)
+ bb_error_msg_and_die("%s: module not found", m_fullName);
+ free(module_dir);
+ if (m_filename == NULL
+ || ((fp = fopen_for_read(m_filename)) == NULL)
+ ) {
+ bb_error_msg_and_die("%s: module not found", m_fullName);
+ }
+ }
+ } else
+ m_filename = xstrdup(filename);
+
+ rc = bb_init_module(m_filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0));
if (rc)
- bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
+ bb_error_msg("can't insert '%s': %s", m_filename, moderror(rc));
return rc;
}

17
archive-patches/busybox-1.20.2/busybox-1.20-mount-use-var-etc-fstab.patch

@ -1,17 +0,0 @@
--- a/util-linux/mount.c 2014-02-24 21:48:18.000000000 +0100
+++ b/util-linux/mount.c 2014-02-24 21:49:20.000000000 +0100
@@ -2083,6 +2083,14 @@
// Open either fstab or mtab
fstabname = "/etc/fstab";
+ //NI use /var/etc/fstab if accessible
+ FILE * f= fopen ("/var/etc/fstab", "r");
+ if (f) {
+ fstabname = "/var/etc/fstab";
+ fclose(f);
+ }
+ printf("mount: using %s\n", fstabname);
+
if (i & MS_REMOUNT) {
// WARNING. I am not sure this matches util-linux's
// behavior. It's possible util-linux does not

25
archive-patches/busybox-1.20.2/busybox-1.20.2-kernel_ver.patch

@ -1,25 +0,0 @@
--- busybox-1.20.2/libbb/kernel_version.c
+++ busybox-1.20.2-kernel_ver/libbb/kernel_version.c
@@ -20,18 +20,15 @@
int FAST_FUNC get_linux_version_code(void)
{
struct utsname name;
- char *s;
+ char *s, *t;
int i, r;
- if (uname(&name) == -1) {
- bb_perror_msg("can't get system information");
- return 0;
- }
-
+ uname(&name); /* never fails */
s = name.release;
r = 0;
for (i = 0; i < 3; i++) {
- r = r * 256 + atoi(strtok(s, "."));
+ t = strtok(s, ".");
+ r = r * 256 + (t ? atoi(t) : 0);
s = NULL;
}
return r;

11
archive-patches/busybox-1.20.2/busybox-1.20.2-ntpd.patch

@ -1,11 +0,0 @@
--- busybox-1.20.2/networking/ntpd.c
+++ busybox-1.20.2-ntpd/networking/ntpd.c
@@ -1840,7 +1840,7 @@ recv_and_process_client_pkt(void /*int f
/* Build a reply packet */
memset(&msg, 0, sizeof(msg));
- msg.m_status = G.stratum < MAXSTRAT ? G.ntp_status : LI_ALARM;
+ msg.m_status = G.stratum < MAXSTRAT ? (G.ntp_status & LI_MASK) : LI_ALARM;
msg.m_status |= (query_status & VERSION_MASK);
msg.m_status |= ((query_status & MODE_MASK) == MODE_CLIENT) ?
MODE_SERVER : MODE_SYM_PAS;

67
archive-patches/busybox-1.20.2/busybox-1.20.2-pkg-config-selinux.patch

@ -1,67 +0,0 @@
From b1cec5003b73080a8aa7ea277621bf1c71c3e8d6 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 20 Oct 2012 15:01:26 -0400
Subject: [PATCH] build system: use pkg-config to look up selinux libs
Newer versions of libselinux has started linking against more libs.
Rather than continuing hardcoding things, switch to using pkg-config
to query for its dependencies.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
Makefile | 1 +
Makefile.flags | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index fccde4a..3a0a5e1 100644
--- a/Makefile
+++ b/Makefile
@@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
+PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
AWK = awk
GENKSYMS = scripts/genksyms/genksyms
DEPMOD = /sbin/depmod
diff --git a/Makefile.flags b/Makefile.flags
index c43c8dc..15dcc1f 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -74,6 +74,12 @@ ARCH_FPIC ?= -fpic
ARCH_FPIE ?= -fpie
ARCH_PIE ?= -pie
+# Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES))
+define pkg_check_modules
+$(1)_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags $(2))
+$(1)_LIBS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs $(2))
+endef
+
ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
# on i386: 14% smaller libbusybox.so
# (code itself is 9% bigger, we save on relocs/PLT/GOT)
@@ -85,6 +91,7 @@ endif
ifeq ($(CONFIG_STATIC),y)
CFLAGS_busybox += -static
+PKG_CONFIG_FLAGS += --static
endif
ifeq ($(CONFIG_PIE),y)
@@ -127,7 +134,10 @@ LDLIBS += pam pam_misc pthread
endif
ifeq ($(CONFIG_SELINUX),y)
-LDLIBS += selinux sepol
+SELINUX_PC_MODULES = libselinux libsepol
+$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
+CPPFLAGS += $(SELINUX_CFLAGS)
+LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
endif
ifeq ($(CONFIG_EFENCE),y)
--
1.7.12

123
archive-patches/busybox-1.20.2/busybox-1.20.2-sys-resource.patch

@ -1,123 +0,0 @@
From 5a5dfcad6ba96d12d68bd7b39279215a8fee70d3 Mon Sep 17 00:00:00 2001
From: Tias Guns <tias@ulyssis.org>
Date: Sun, 10 Jun 2012 14:19:01 +0200
Subject: [PATCH] inetd: fix build failure in Android
Signed-off-by: Tias Guns <tias@ulyssis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
(cherry picked from commit 64f763b42a43cbf36e401690ff6767c25575e520)
---
networking/inetd.c | 1 +
1 file changed, 1 insertion(+)
--
1.7.12
From 246ea72843d5b7e9d4cd902dc5e9d71359196303 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 5 Jul 2012 23:19:09 -0400
Subject: [PATCH] include sys/resource.h where needed
We use functions from sys/resource.h in misc applets, but don't include
the header. This breaks building with newer glibc versions, so add the
include where needed.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
(cherry picked from commit c5fe9f7b723f949457263ef8e22ab807d5b549ce)
---
loginutils/passwd.c | 1 +
miscutils/time.c | 1 +
networking/inetd.c | 1 +
networking/ntpd.c | 1 +
networking/ntpd_simple.c | 1 +
runit/chpst.c | 1 +
shell/shell_common.c | 1 +
7 files changed, 7 insertions(+)
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index b83db00..a7006f0 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -15,6 +15,7 @@
#include "libbb.h"
#include <syslog.h>
+#include <sys/resource.h> /* setrlimit */
static void nuke_str(char *str)
{
diff --git a/miscutils/time.c b/miscutils/time.c
index 945f15f..ffed386 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -16,6 +16,7 @@
//usage: "\n -v Verbose"
#include "libbb.h"
+#include <sys/resource.h> /* getrusage */
/* Information on the resources used by a child process. */
typedef struct {
diff --git a/networking/inetd.c b/networking/inetd.c
index 1308d74..00baf69 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -165,6 +165,8 @@
//usage: "\n (default: 0 - disabled)"
#include <syslog.h>
+#include <sys/resource.h> /* setrlimit */
+#include <sys/socket.h> /* un.h may need this */
#include <sys/un.h>
#include "libbb.h"
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 603801e..b885215 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -46,6 +46,7 @@
#include "libbb.h"
#include <math.h>
#include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */
+#include <sys/resource.h> /* setpriority */
#include <sys/timex.h>
#ifndef IPTOS_LOWDELAY
# define IPTOS_LOWDELAY 0x10
diff --git a/networking/ntpd_simple.c b/networking/ntpd_simple.c
index 4ad44e4..1b7c66b 100644
--- a/networking/ntpd_simple.c
+++ b/networking/ntpd_simple.c
@@ -7,6 +7,7 @@
*/
#include "libbb.h"
#include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */
+#include <sys/resource.h> /* setpriority */
#ifndef IPTOS_LOWDELAY
# define IPTOS_LOWDELAY 0x10
#endif
diff --git a/runit/chpst.c b/runit/chpst.c
index ac296ba..ed72c8b 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -91,6 +91,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//usage: "\n a SIGXCPU after N seconds"
#include "libbb.h"
+#include <sys/resource.h> /* getrlimit */
/*
Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit.
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 51c92d6..780e27e 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -18,6 +18,7 @@
*/
#include "libbb.h"
#include "shell_common.h"
+#include <sys/resource.h> /* getrlimit */
const char defifsvar[] ALIGN1 = "IFS= \t\n";
--
1.7.12

13
archive-patches/busybox-1.20.2/busybox-fix-config-header.diff

@ -1,13 +0,0 @@
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 8f4ecbd..b73fe02 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -383,7 +383,7 @@ int conf_write(const char *name)
use_timestamp = 0;
fprintf(out, _("#\n"
- "# Automatically generated make config: don't edit\n"
+ "# Automatically generated make config: do not edit\n"
"# Busybox version: %s\n"
"%s%s"
"#\n"),
Loading…
Cancel
Save