From 4417707e759b34de3eb720bd83f838c947906aad Mon Sep 17 00:00:00 2001 From: Markham Date: Tue, 11 Oct 2022 15:23:44 +0200 Subject: [PATCH] rework busybox target --- ...ox-1.29.1-changing-the-order-sys-tree.diff | 33 ----------- .../busybox-1.29.1-hack-init-s-console.patch | 57 ------------------- archive-patches/busybox-1.29.1-mdev.diff | 37 ------------ archive-patches/busybox-1.29.1-unicode.patch | 20 ------- .../busybox-1.29.1-flashcp-small-output.patch | 0 .../{ => busybox}/busybox-1.35.0-arm.config | 0 .../{ => busybox}/busybox-1.35.0-cst.config | 0 .../busybox-mount_single_uuid.patch | 0 make/applications.mk | 12 ++-- 9 files changed, 4 insertions(+), 155 deletions(-) delete mode 100644 archive-patches/busybox-1.29.1-changing-the-order-sys-tree.diff delete mode 100644 archive-patches/busybox-1.29.1-hack-init-s-console.patch delete mode 100644 archive-patches/busybox-1.29.1-mdev.diff delete mode 100644 archive-patches/busybox-1.29.1-unicode.patch rename archive-patches/{ => busybox}/busybox-1.29.1-flashcp-small-output.patch (100%) rename archive-patches/{ => busybox}/busybox-1.35.0-arm.config (100%) rename archive-patches/{ => busybox}/busybox-1.35.0-cst.config (100%) rename archive-patches/{ => busybox}/busybox-mount_single_uuid.patch (100%) diff --git a/archive-patches/busybox-1.29.1-changing-the-order-sys-tree.diff b/archive-patches/busybox-1.29.1-changing-the-order-sys-tree.diff deleted file mode 100644 index 590ea9d..0000000 --- a/archive-patches/busybox-1.29.1-changing-the-order-sys-tree.diff +++ /dev/null @@ -1,33 +0,0 @@ -For details of this patch see https://bugs.busybox.net/show_bug.cgi?id=6806 - -Simon Edlund -The problem seems to be the symlink /sys/block/mtdblockX/device -which points to /sys/class/mtd/mtdX, which exists on some kernels (i.e. 2.6.31) -When mdev -s traverses the /sys directory looking for "dev" files, -it starts with the block devices under /sys/block, and will find the "dev" file -through the symlink, and create a block device node. -In the next stage it will scan the /sys/class looking for char devices, -and will find mtdX/dev again, but this time the mknod will fail because there -is already a device node with that name. -I fixed this by having mdev -s scan the /sys/class before /sys/block, -whether this is the best way, someone else with a deeper knowledge -of the /sys directory hierarchy will have to judge. - -gregory.0xf0 -I believe this patch is a good approach. -Also, it appears that this is only a problem when both -CONFIG_SYSFS_DEPRECATED and CONFIG_SYSFS_DEPRECATED_V2 are set. - ---- a/util-linux/mdev.c -+++ b/util-linux/mdev.c -@@ -1141,6 +1141,10 @@ - - putenv((char*)"ACTION=add"); - -+ recursive_action("/sys/class", -+ ACTION_RECURSE | ACTION_FOLLOWLINKS, -+ fileAction, dirAction, temp); -+ - /* Create all devices from /sys/dev hierarchy */ - recursive_action("/sys/dev", - ACTION_RECURSE | ACTION_FOLLOWLINKS, diff --git a/archive-patches/busybox-1.29.1-hack-init-s-console.patch b/archive-patches/busybox-1.29.1-hack-init-s-console.patch deleted file mode 100644 index 8a3dfe5..0000000 --- a/archive-patches/busybox-1.29.1-hack-init-s-console.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/init/init.c b/init/init.c ---- a/init/init.c -+++ b/init/init.c -@@ -287,6 +287,11 @@ static void message(int where, const char *fmt, ...) - } - } - -+#ifdef VT_OPENQRY -+/* don't want that "vt102" stuff... */ -+#undef VT_OPENQRY -+#endif -+ - static void console_init(void) - { - #ifdef VT_OPENQRY -@@ -294,21 +299,28 @@ static void console_init(void) - #endif - char *s; - -+# if 0 - s = getenv("CONSOLE"); - if (!s) - s = getenv("console"); -+#endif -+ s = (char*)"/dev/console"; -+ mknod(s, (S_IFCHR | 0600), 0x0501); -+ - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - /* BSD people say their kernels do not open fd 0,1,2; they need this: */ - if (!s) - s = (char*)"/dev/console"; - #endif - if (s) { -+ close(STDIN_FILENO); -+ /* we'll get STDIN_FILENO from open... */ - int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY); - if (fd >= 0) { -- dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); -- xmove_fd(fd, STDERR_FILENO); -+ dup2(fd, STDERR_FILENO); - } -+ ndelay_off(STDIN_FILENO); - dbg_message(L_LOG, "console='%s'", s); - } else { - /* Make sure fd 0,1,2 are not closed -@@ -325,8 +337,8 @@ static void console_init(void) - /* Not a linux terminal, probably serial console. - * Force the TERM setting to vt102 - * if TERM is set to linux (the default) */ -- if (!s || strcmp(s, "linux") == 0) -- putenv((char*)"TERM=vt102"); -+/* if (!s || strcmp(s, "linux") == 0) -+ putenv((char*)"TERM=vt102");*/ - # if !ENABLE_FEATURE_INIT_SYSLOG - log_console = NULL; - # endif diff --git a/archive-patches/busybox-1.29.1-mdev.diff b/archive-patches/busybox-1.29.1-mdev.diff deleted file mode 100644 index 7ce8586..0000000 --- a/archive-patches/busybox-1.29.1-mdev.diff +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/util-linux/mdev.c b/util-linux/mdev.c -index a59115d..8445e4a 100644 ---- a/util-linux/mdev.c -+++ b/util-linux/mdev.c -@@ -881,11 +881,20 @@ static void load_firmware(const char *firmware, const char *sysfs_path) - - /* check for /lib/firmware/$FIRMWARE */ - firmware_fd = -1; -- if (chdir("/lib/firmware") == 0) -- firmware_fd = open(firmware, O_RDONLY); /* can fail */ -+ if (chdir("/lib/firmware")) { -+ /* don't die -- might need to write mdev.seq */ -+ bb_perror_msg("chdir(/lib/firmware)"); -+ return; -+ } -+ firmware_fd = xopen(firmware, O_RDONLY); -+ loading_fd = -1; - - /* check for /sys/$DEVPATH/loading ... give 30 seconds to appear */ -- xchdir(sysfs_path); -+ if (chdir(sysfs_path)) { -+ bb_perror_msg("chdir(%s)", sysfs_path); /* crappy driver... */ -+ goto out; -+ } -+ - for (cnt = 0; cnt < 30; ++cnt) { - loading_fd = open("loading", O_WRONLY); - if (loading_fd >= 0) -@@ -962,7 +971,7 @@ wait_for_seqfile(unsigned expected_seq) - { - /* We time out after 2 sec */ - static const struct timespec ts = { 0, 32*1000*1000 }; -- int timeout = 2000 / 32; -+ int timeout = 5000 / 32; - int seq_fd = -1; - int do_once = 1; - sigset_t set_CHLD; diff --git a/archive-patches/busybox-1.29.1-unicode.patch b/archive-patches/busybox-1.29.1-unicode.patch deleted file mode 100644 index 9758269..0000000 --- a/archive-patches/busybox-1.29.1-unicode.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- busybox/libbb/printable_string.c -+++ busybox/libbb/printable_string.c -@@ -28,8 +28,6 @@ - } - if (c < ' ') - break; -- if (c >= 0x7f) -- break; - s++; - } - -@@ -42,7 +40,7 @@ - unsigned char c = *d; - if (c == '\0') - break; -- if (c < ' ' || c >= 0x7f) -+ if (c < ' ') - *d = '?'; - d++; - } diff --git a/archive-patches/busybox-1.29.1-flashcp-small-output.patch b/archive-patches/busybox/busybox-1.29.1-flashcp-small-output.patch similarity index 100% rename from archive-patches/busybox-1.29.1-flashcp-small-output.patch rename to archive-patches/busybox/busybox-1.29.1-flashcp-small-output.patch diff --git a/archive-patches/busybox-1.35.0-arm.config b/archive-patches/busybox/busybox-1.35.0-arm.config similarity index 100% rename from archive-patches/busybox-1.35.0-arm.config rename to archive-patches/busybox/busybox-1.35.0-arm.config diff --git a/archive-patches/busybox-1.35.0-cst.config b/archive-patches/busybox/busybox-1.35.0-cst.config similarity index 100% rename from archive-patches/busybox-1.35.0-cst.config rename to archive-patches/busybox/busybox-1.35.0-cst.config diff --git a/archive-patches/busybox-mount_single_uuid.patch b/archive-patches/busybox/busybox-mount_single_uuid.patch similarity index 100% rename from archive-patches/busybox-mount_single_uuid.patch rename to archive-patches/busybox/busybox-mount_single_uuid.patch diff --git a/make/applications.mk b/make/applications.mk index ec13b4c..88f675b 100755 --- a/make/applications.mk +++ b/make/applications.mk @@ -26,7 +26,7 @@ busyboxconfig: $(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2 | $(TARGETPREFIX) $(START_BUILD) $(UNTAR)/busybox-$(BUSYBOX_VER).tar.bz2 pushd $(BUILD_TMP)/busybox-$(BUSYBOX_VER) && \ - cp $(PATCHES)/$(BB_CONFIG) .config && \ + cp $(PATCHES)/busybox/$(BB_CONFIG) .config && \ make ARCH=arm CROSS_COMPILE=$(TARGET)- menuconfig # Link against libtirpc so that we can leverage its RPC @@ -55,12 +55,8 @@ BUSYBOX_MAKE_OPTS = \ # # busybox_patches # -BUSYBOX_PATCHES = busybox-1.29.1-hack-init-s-console.patch -BUSYBOX_PATCHES += busybox-1.29.1-changing-the-order-sys-tree.diff -BUSYBOX_PATCHES += busybox-1.29.1-mdev.diff -#BUSYBOX_PATCHES += busybox-1.29.1-unicode.patch -BUSYBOX_PATCHES += busybox-1.29.1-flashcp-small-output.patch -BUSYBOX_PATCHES += busybox-mount_single_uuid.patch +BUSYBOX_PATCHES = busybox/busybox-1.29.1-flashcp-small-output.patch +BUSYBOX_PATCHES += busybox/busybox-mount_single_uuid.patch $(D)/busybox: $(D)/libtirpc $(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2 | $(TARGETPREFIX) $(START_BUILD) @@ -68,7 +64,7 @@ $(D)/busybox: $(D)/libtirpc $(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2 | $(TARGET $(UNTAR)/busybox-$(BUSYBOX_VER).tar.bz2 pushd $(BUILD_TMP)/busybox-$(BUSYBOX_VER) && \ $(call apply_patches, $(BUSYBOX_PATCHES)); \ - cp $(PATCHES)/$(BB_CONFIG) .config && \ + cp $(PATCHES)/busybox/$(BB_CONFIG) .config; \ $(BUSYBOX_MAKE_ENV) $(MAKE) busybox $(BUSYBOX_MAKE_OPTS) && \ $(BUSYBOX_MAKE_ENV) $(MAKE) install $(BUSYBOX_MAKE_OPTS) $(TARGET)-strip $(TARGETPREFIX)/bin/busybox -- 2.39.5