Step1: build with busybox.
Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
From e1690453cd84c798ca88cc4370710f65da86d986 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Sat, 5 Oct 2013 15:55:06 +0200
|
||||
Subject: [PATCH] networking/libiproute: use <linux/if_packet.h> instead of
|
||||
<net/if_packet.h>
|
||||
|
||||
The musl C library doesn't provide the <net/if_packet.h> since the
|
||||
corresponding kernel headers <linux/if_packet.h> already provides the
|
||||
necessary definitions. Replacing <net/if_packet.h> by
|
||||
<linux/if_packet.h> also removes the need to include
|
||||
<netpacket/packet.h>
|
||||
|
||||
This commit fixes the build of iplink with the musl C library.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[Gustavo: update for busybox 1.22.0]
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
networking/libiproute/iplink.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
|
||||
index 37ed114bc..bc526d89c 100644
|
||||
--- a/networking/libiproute/iplink.c
|
||||
+++ b/networking/libiproute/iplink.c
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include <net/if.h>
|
||||
/*#include <net/if_packet.h> - not needed? */
|
||||
-#include <netpacket/packet.h>
|
||||
+#include <linux/if_packet.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From df20ae1280a2601a4c233ec12372d1e17db21e96 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Mon, 25 Nov 2013 22:51:53 +0100
|
||||
Subject: [PATCH] Makefile.flags: strip non -l arguments returned by pkg-config
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[yann.morin.1998@free.fr: refresh for 1.29.0]
|
||||
[petr.vorel@gmail.com: refresh for 1.32.0]
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
Makefile.flags | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 97cb4dca2..92a9063d9 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -181,7 +181,9 @@ ifeq ($(CONFIG_SELINUX),y)
|
||||
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%=%))
|
||||
+LDLIBS += $(if $(SELINUX_LIBS),\
|
||||
+ $(patsubst -l%,%,$(filter -l%,$(SELINUX_LIBS))),\
|
||||
+ $(SELINUX_PC_MODULES:lib%=%))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 68eaf20d86d4fe0f16a914817217f386155157cc Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] libbb: sockaddr2str: ensure only printable characters are
|
||||
returned for the hostname part
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089796.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index 0e0b247b8..02c061e67 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -497,8 +497,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -509,7 +510,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
From 56b84c6efb9a06ae294eb92cf9634f70af443b0a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] nslookup: sanitize all printed strings with printable_string
|
||||
|
||||
Otherwise, terminal sequences can be injected, which enables various terminal injection
|
||||
attacks from DNS results.
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089795.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
networking/nslookup.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index b67d354f7..79412477c 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -784,7 +784,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -799,7 +799,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -811,7 +811,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -831,7 +831,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
}
|
||||
|
||||
printf("%s\tservice = %u %u %u %s\n", ns_rr_name(rr),
|
||||
- ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), dname);
|
||||
+ ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_soa:
|
||||
@@ -860,7 +860,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
From 9fed109be1f811069cb2f727e04c6996cd44b017 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
|
||||
Date: Tue, 18 Apr 2023 15:54:43 +0200
|
||||
Subject: [PATCH] seedrng: fix getrandom() detection for non-glibc libc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc <= 2.24 does not provide getrandom(). A check for it has been
|
||||
added in 200a9669fbf6f06894e4243cccc9fc11a1a6073a and fixed in
|
||||
cb57abb46f06f4ede8d9ccbdaac67377fdf416cf.
|
||||
|
||||
However, building with a libc other than glibc can lead to the same
|
||||
problem as not every other libc has getrandom() either:
|
||||
|
||||
- uClibc provides it from v1.0.2 onwards, but requires to define
|
||||
_GNU_SOURCE (all versions - we already define it by default), and
|
||||
stddef to be included first (when using uClibc < 1.0.35 - we already
|
||||
include it through libbb.h).
|
||||
|
||||
- musl libc has getrandom(), but only from version 1.1.20 onwards. As
|
||||
musl does not provide __MUSL__ or version information, it's not
|
||||
possible to check for it like we did for glibc.
|
||||
|
||||
All of this makes it difficult (or impossible in case of musl) to
|
||||
check what we need to do to have getrandom() based on each libc
|
||||
versions.
|
||||
|
||||
On top of that, getrandom() is also not available on older kernels. As
|
||||
an example, when using a 3.10 kernel with uClibc 1.0.26, getrandom()
|
||||
is declared so compiling works, but it fails at link time because
|
||||
getrandom() is not defined.
|
||||
|
||||
To make it easier, take a similar approach to what was done for the
|
||||
crypt library: try to build a sample program to see if we have
|
||||
getrandom(). To keep it compatible with different versions of
|
||||
make (for reference see [1]), a variable for '#' is also introduced.
|
||||
|
||||
Based on the new Makefile variable, we now either use the
|
||||
libc-provided getrandom() when it's available, or use our own
|
||||
implementation when it's not (like it was the case already for glibc <
|
||||
2.25).
|
||||
|
||||
This should fix compiling with many libc/kernel combinations.
|
||||
|
||||
[1]: https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b576b907b06aea5f4
|
||||
|
||||
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2023-May/090317.html
|
||||
---
|
||||
Makefile.flags | 12 ++++++++++++
|
||||
miscutils/seedrng.c | 8 ++++----
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 92a9063d9..c8f601308 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -162,6 +162,18 @@ ifeq ($(RT_AVAILABLE),y)
|
||||
LDLIBS += rt
|
||||
endif
|
||||
|
||||
+# GNU Make version 4.2.1 and earlier require number signs ('#')
|
||||
+# inside function invocations to be escaped, while versions 4.3+
|
||||
+# require them to be unescaped. Use a variable for it so that it works
|
||||
+# for both versions:
|
||||
+C := \#
|
||||
+# Not all libc versions have getrandom, so check for it:
|
||||
+HAVE_GETRANDOM := $(shell printf '$Cdefine _GNU_SOURCE\n$Cinclude <stddef.h>\n$Cinclude <sys/random.h>\nint main(void){char buf[256];\ngetrandom(buf,sizeof(buf),0);}' >bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
|
||||
+
|
||||
+ifeq ($(HAVE_GETRANDOM),y)
|
||||
+CFLAGS += -DHAVE_GETRANDOM
|
||||
+endif
|
||||
+
|
||||
# libpam may use libpthread, libdl and/or libaudit.
|
||||
# On some platforms that requires an explicit -lpthread, -ldl, -laudit.
|
||||
# However, on *other platforms* it fails when some of those flags
|
||||
diff --git a/miscutils/seedrng.c b/miscutils/seedrng.c
|
||||
index 7a2331cb1..ba98f4d19 100644
|
||||
--- a/miscutils/seedrng.c
|
||||
+++ b/miscutils/seedrng.c
|
||||
@@ -44,8 +44,10 @@
|
||||
#include <linux/random.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
-/* Fix up glibc <= 2.24 not having getrandom() */
|
||||
-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 24
|
||||
+/* Fix up some libc (e.g. glibc <= 2.24) not having getrandom() */
|
||||
+#if defined HAVE_GETRANDOM
|
||||
+#include <sys/random.h>
|
||||
+#else /* No getrandom */
|
||||
#include <sys/syscall.h>
|
||||
static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
{
|
||||
@@ -56,8 +58,6 @@ static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
-#else
|
||||
-#include <sys/random.h>
|
||||
#endif
|
||||
|
||||
/* Apparently some headers don't ship with this yet. */
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 7f0bb7f69f38298971aa8153d3fbe9b1fdda8ae7 Mon Sep 17 00:00:00 2001
|
||||
From: ctxnop <ctxnop@gmail.com>
|
||||
Date: Sun, 26 Jan 2025 20:59:20 +0100
|
||||
Subject: [PATCH] menuconfig: GCC failing saying ncurses is not found
|
||||
|
||||
Newer GCC increased diagnostics levels resulting in considering the
|
||||
test code to be invalid. The resulting message was misleading, saying
|
||||
that ncurses was not found, while the check failed for an unrelated
|
||||
reason which was hidden because GCC stderr was redirected to
|
||||
/dev/null.
|
||||
|
||||
Signed-off-by: ctxnop <ctxnop@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-July/090840.html
|
||||
[Fiona: rephrased commit message for clarity]
|
||||
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
|
||||
---
|
||||
scripts/kconfig/lxdialog/check-lxdialog.sh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
index 5075ebf2d..08e4da3de 100755
|
||||
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
@@ -45,9 +45,9 @@ trap "rm -f $tmp" 0 1 2 3 15
|
||||
|
||||
# Check if we can link to ncurses
|
||||
check() {
|
||||
- $cc -x c - -o $tmp 2>/dev/null <<'EOF'
|
||||
+ $cc -x c - -o $tmp <<'EOF'
|
||||
#include CURSES_LOC
|
||||
-main() {}
|
||||
+int main() { return 0; }
|
||||
EOF
|
||||
if [ $? != 0 ]; then
|
||||
echo " *** Unable to find the ncurses libraries or the" 1>&2
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
From 1dbb3073a3a8856b9446b882f797be1bb2e21a26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
|
||||
Date: Mon, 23 Sep 2024 18:56:00 +0200
|
||||
Subject: [PATCH] tc: Fix compilation with Linux v6.8-rc1
|
||||
|
||||
Linux v6.8-rc1 removed the definitions related to CBQ:
|
||||
https://github.com/torvalds/linux/commit/33241dca486264193ed68167c8eeae1fb197f3df
|
||||
making tc fail to build.
|
||||
Add some #ifdefs to handle this missing support.
|
||||
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-March/090678.html
|
||||
Bug report: https://bugs.busybox.net/show_bug.cgi?id=15931
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
networking/tc.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/networking/tc.c b/networking/tc.c
|
||||
index 3a79fd2d9..d08fd1359 100644
|
||||
--- a/networking/tc.c
|
||||
+++ b/networking/tc.c
|
||||
@@ -231,6 +231,13 @@ static int cbq_parse_opt(int argc, char **argv, struct nlmsghdr *n)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifndef TCA_CBQ_MAX
|
||||
+/*
|
||||
+ * Linux v6.8-rc1~131^2~60^2^2 removed the uapi definitions for CBQ.
|
||||
+ * See https://git.kernel.org/linus/33241dca48626
|
||||
+ */
|
||||
+#else
|
||||
static int cbq_print_opt(struct rtattr *opt)
|
||||
{
|
||||
struct rtattr *tb[TCA_CBQ_MAX+1];
|
||||
@@ -322,6 +329,7 @@ static int cbq_print_opt(struct rtattr *opt)
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static FAST_FUNC int print_qdisc(
|
||||
const struct sockaddr_nl *who UNUSED_PARAM,
|
||||
@@ -372,8 +380,10 @@ static FAST_FUNC int print_qdisc(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
prio_print_opt(tb[TCA_OPTIONS]);
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this qdisc */
|
||||
printf("(options for %s)", name);
|
||||
@@ -442,9 +452,11 @@ static FAST_FUNC int print_class(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
/* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
/* cbq_print_copt() is identical to cbq_print_opt(). */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this class */
|
||||
printf("(options for %s)", name);
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 88f8a046f27cb81ccc30d038465e963b8300cf1b Mon Sep 17 00:00:00 2001
|
||||
From: Valery Ushakov <uwe@stderr.spb.ru>
|
||||
Date: Wed, 24 Jan 2024 22:24:41 +0300
|
||||
Subject: [PATCH] awk.c: fix CVE-2023-42366 (bug #15874)
|
||||
|
||||
Make sure we don't read past the end of the string in next_token()
|
||||
when backslash is the last character in an (invalid) regexp.
|
||||
a fix and issue reported in bugzilla
|
||||
|
||||
https://bugs.busybox.net/show_bug.cgi?id=15874
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html]
|
||||
|
||||
CVE: CVE-2023-42366
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Thomas: https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch?id=e0ff4813b1cf4df0d851c857d57fb88d7db51bdd]
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-May/090766.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
editors/awk.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index 64e752f4b..222e6298d 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -1234,9 +1234,11 @@ static uint32_t next_token(uint32_t expected)
|
||||
s[-1] = bb_process_escape_sequence((const char **)&pp);
|
||||
if (*p == '\\')
|
||||
*s++ = '\\';
|
||||
- if (pp == p)
|
||||
+ if (pp == p) {
|
||||
+ if (*p == '\0')
|
||||
+ syntax_error(EMSG_UNEXP_EOS);
|
||||
*s++ = *p++;
|
||||
- else
|
||||
+ } else
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0583f8eda94f97e15e371e12458877b738439e8c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 7 Mar 2021 17:30:24 -0800
|
||||
Subject: [PATCH] hwclock: Check for SYS_settimeofday before calling syscall
|
||||
|
||||
Some newer architectures e.g. RISCV32 have 64bit time_t from get go and
|
||||
thusly do not have gettimeofday_time64/settimeofday_time64 implemented
|
||||
therefore check for SYS_settimeofday definition before making the
|
||||
syscall. Fixes build for riscv32 and it will bail out at runtime.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-March/088583.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2021-March/088583.html
|
||||
[Thomas: this issue has been discussed on the musl mailing list, and
|
||||
the musl developers' opinion is that Busybox is wrong:
|
||||
https://www.openwall.com/lists/musl/2024/03/03/2
|
||||
https://www.openwall.com/lists/musl/2024/04/07/2. The correct fix
|
||||
isn't clear, and in the mean time, the patch from Khem turns the build
|
||||
issue into a runtime error only on the problematic architecture, which
|
||||
seems like a reasonable trade-off]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
util-linux/hwclock.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
|
||||
index c3fd0eb57..dea9c9a55 100644
|
||||
--- a/util-linux/hwclock.c
|
||||
+++ b/util-linux/hwclock.c
|
||||
@@ -132,6 +132,7 @@ static void show_clock(const char **pp_rtcname, int utc)
|
||||
|
||||
static void set_kernel_tz(const struct timezone *tz)
|
||||
{
|
||||
+ int ret = 1;
|
||||
#if LIBC_IS_MUSL
|
||||
/* musl libc does not pass tz argument to syscall
|
||||
* because "it's deprecated by POSIX, therefore it's fine
|
||||
@@ -140,9 +141,11 @@ static void set_kernel_tz(const struct timezone *tz)
|
||||
#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
|
||||
# define SYS_settimeofday SYS_settimeofday_time32
|
||||
#endif
|
||||
- int ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#if defined(SYS_settimeofday)
|
||||
+ ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#endif
|
||||
#else
|
||||
- int ret = settimeofday(NULL, tz);
|
||||
+ ret = settimeofday(NULL, tz);
|
||||
#endif
|
||||
if (ret)
|
||||
bb_simple_perror_msg_and_die("settimeofday");
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From bba9e99026a3dafe75f608459533e0b6d8cf3874 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Przywara <andre.przywara@arm.com>
|
||||
Date: Tue, 10 Sep 2024 14:32:46 +0100
|
||||
Subject: [PATCH] libbb/sha: add missing sha-NI guard
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The ENABLE_SHA1_HWACCEL Kconfig symbol is meant to be archicture
|
||||
agnostic, so can be enabled regardless of whether your build
|
||||
architecture provides hardware acceleration or not. At the moment only
|
||||
x86 implements this, so every piece of optimised code should be guarded
|
||||
by both ENABLE_SHA1_HWACCEL and (__x86_64__ || __i386__). This is missing
|
||||
at one place, so compiling for arm64 breaks when ENABLE_SHA1_HWACCEL is
|
||||
enabled:
|
||||
================================
|
||||
libbb/hash_md5_sha.c: In function ‘sha1_end’:
|
||||
libbb/hash_md5_sha.c:1316:28: error: ‘sha1_process_block64_shaNI’ undeclared (first use in this function); did you mean ‘sha1_process_block64’?
|
||||
1316 | || ctx->process_block == sha1_process_block64_shaNI
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| sha1_process_block64
|
||||
libbb/hash_md5_sha.c:1316:28: note: each undeclared identifier is reported only once for each function it appears in
|
||||
make[1]: *** [scripts/Makefile.build:197: libbb/hash_md5_sha.o] Error 1
|
||||
make: *** [Makefile:744: libbb] Error 2
|
||||
================================
|
||||
|
||||
Add the missing guards around the call to sha1_process_block64_shaNI to
|
||||
fix the build on other architectures with ENABLE_SHA1_HWACCEL enabled.
|
||||
|
||||
Change-Id: I40bba388422625f4230abf15a5de23e1fdc654fc
|
||||
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-September/090899.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
libbb/hash_md5_sha.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
|
||||
index 57a801459..75a61c32c 100644
|
||||
--- a/libbb/hash_md5_sha.c
|
||||
+++ b/libbb/hash_md5_sha.c
|
||||
@@ -1313,7 +1313,9 @@ unsigned FAST_FUNC sha1_end(sha1_ctx_t *ctx, void *resbuf)
|
||||
hash_size = 8;
|
||||
if (ctx->process_block == sha1_process_block64
|
||||
#if ENABLE_SHA1_HWACCEL
|
||||
+# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
|| ctx->process_block == sha1_process_block64_shaNI
|
||||
+# endif
|
||||
#endif
|
||||
) {
|
||||
hash_size = 5;
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 34d331d642c3312e1c04e4650f547f1a67abee24 Mon Sep 17 00:00:00 2001
|
||||
From: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Date: Wed, 16 Oct 2024 10:15:08 +0200
|
||||
Subject: [PATCH] syslogd: fix wrong OPT_locallog flag detection
|
||||
|
||||
The OPT_locallog was set on "option_mask32" but checked on local
|
||||
"opts" variable. While this flag it's used on multiple places can't be
|
||||
has to be used with "option_mask32". Without this change syslogd
|
||||
is more-less unusable while no messages are logged locally.
|
||||
|
||||
Signed-off-by: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-October/090969.html
|
||||
[Thomas: this was reported as beeing needed by Bernd Kuhls at
|
||||
https://lore.kernel.org/buildroot/pan$de0bb$35c5a64$ca9b6f21$2408ff40@ID-313208.user.individual.net/,
|
||||
but also on the Busybox mailing list at
|
||||
https://lists.busybox.net/pipermail/busybox/2023-September/090499.html]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
sysklogd/syslogd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
|
||||
index 7558051f0..fa03aa280 100644
|
||||
--- a/sysklogd/syslogd.c
|
||||
+++ b/sysklogd/syslogd.c
|
||||
@@ -1179,7 +1179,7 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
- if (!ENABLE_FEATURE_REMOTE_LOG || (opts & OPT_locallog)) {
|
||||
+ if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
|
||||
recvbuf[sz] = '\0'; /* ensure it *is* NUL terminated */
|
||||
split_escape_and_log(recvbuf, sz);
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
60
package/busybox/S01syslogd
Normal file
60
package/busybox/S01syslogd
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="syslogd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
SYSLOGD_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' syslogd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "--make-pidfile" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/sbin/$DAEMON" \
|
||||
-- -n $SYSLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
55
package/busybox/S02klogd
Normal file
55
package/busybox/S02klogd
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="klogd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
KLOGD_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' klogd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "-m" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" \
|
||||
-- -n $KLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon -K -q -p "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -f "$PIDFILE"
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
94
package/busybox/S02sysctl
Normal file
94
package/busybox/S02sysctl
Normal file
@@ -0,0 +1,94 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script is used by busybox and procps-ng.
|
||||
#
|
||||
# With procps-ng, the "--system" option of sysctl also enables "--ignore", so
|
||||
# errors are not reported via syslog. Use the run_logger function to mimic the
|
||||
# --system behavior, still reporting errors via syslog. Users not interested
|
||||
# on error reports can add "-e" to SYSCTL_ARGS.
|
||||
#
|
||||
# busybox does not have a "--system" option neither reports errors via syslog,
|
||||
# so the scripting provides a consistent behavior between the implementations.
|
||||
# Testing the busybox sysctl exit code is fruitless, as at the moment, since
|
||||
# its exit status is zero even if errors happen. Hopefully this will be fixed
|
||||
# in a future busybox version.
|
||||
|
||||
PROGRAM="sysctl"
|
||||
|
||||
SYSCTL_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$PROGRAM" ] && . "/etc/default/$PROGRAM"
|
||||
|
||||
# Files are read from directories in the SYSCTL_SOURCES list, in the given
|
||||
# order. A file may be used more than once, since there can be multiple
|
||||
# symlinks to it. No attempt is made to prevent this.
|
||||
SYSCTL_SOURCES="/etc/sysctl.d/ /usr/local/lib/sysctl.d/ /usr/lib/sysctl.d/ /lib/sysctl.d/ /etc/sysctl.conf"
|
||||
|
||||
# If the logger utility is available all messages are sent to syslog, except
|
||||
# for the final status. The file redirections do the following:
|
||||
#
|
||||
# - stdout is redirected to syslog with facility.level "kern.info"
|
||||
# - stderr is redirected to syslog with facility.level "kern.err"
|
||||
# - file dscriptor 4 is used to pass the result to the "start" function.
|
||||
#
|
||||
run_logger() {
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
find $SYSCTL_SOURCES -maxdepth 1 -name '*.conf' -print0 2> /dev/null | \
|
||||
xargs -0 -r -n 1 readlink -f | {
|
||||
prog_status="OK"
|
||||
while :; do
|
||||
read -r file || {
|
||||
echo "$prog_status" >&4
|
||||
break
|
||||
}
|
||||
echo "* Applying $file ..."
|
||||
/sbin/sysctl $SYSCTL_ARGS -p "$file" || prog_status="FAIL"
|
||||
done 2>&1 >&3 | /usr/bin/logger -t sysctl -p kern.err
|
||||
} 3>&1 | /usr/bin/logger -t sysctl -p kern.info
|
||||
}
|
||||
|
||||
# If logger is not available all messages are sent to stdout/stderr.
|
||||
run_std() {
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
find $SYSCTL_SOURCES -maxdepth 1 -name '*.conf' -print0 2> /dev/null | \
|
||||
xargs -0 -r -n 1 readlink -f | {
|
||||
prog_status="OK"
|
||||
while :; do
|
||||
read -r file || {
|
||||
echo "$prog_status" >&4
|
||||
break
|
||||
}
|
||||
echo "* Applying $file ..."
|
||||
/sbin/sysctl $SYSCTL_ARGS -p "$file" || prog_status="FAIL"
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
if [ -x /usr/bin/logger ]; then
|
||||
run_program="run_logger"
|
||||
else
|
||||
run_program="run_std"
|
||||
fi
|
||||
|
||||
start() {
|
||||
printf '%s %s: ' "$1" "$PROGRAM"
|
||||
status=$("$run_program" 4>&1)
|
||||
echo "$status"
|
||||
if [ "$status" = "OK" ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start "Running";;
|
||||
restart|reload)
|
||||
start "Rerunning";;
|
||||
stop)
|
||||
:;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
85
package/busybox/S41ifplugd
Normal file
85
package/busybox/S41ifplugd
Normal file
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="ifplugd"
|
||||
|
||||
# Each ifplugd instance handles only one interface, so this script is
|
||||
# designed to be symlinked per interface. For each interface create a
|
||||
# symlink with .IFACE appended to the name. E.g. to launch ifplugd for
|
||||
# eth1 create a symlink from /etc/init.d/S41ifplugd.eth1 to this
|
||||
# script. DEFAULT_IFACE sets the interface the non-symlink script will
|
||||
# use, set it to empty in /etc/default/ifplugd to disable the default
|
||||
# instance and use symlinked instances only.
|
||||
DEFAULT_IFACE="eth0"
|
||||
# If your action script is not in the default location
|
||||
# /etc/ifplugd/ifplugd.action, use the "-r" option to set the
|
||||
# location.
|
||||
IFPLUGD_ARGS="-M"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
NAME_IFACE="$(basename "$0" | cut -s -d. -f2)"
|
||||
if [ -n "$NAME_IFACE" ]; then
|
||||
IFACE="${NAME_IFACE}"
|
||||
elif [ -n "$DEFAULT_IFACE" ]; then
|
||||
IFACE="${DEFAULT_IFACE}"
|
||||
else
|
||||
# no interface configured
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# check-package disable Variables
|
||||
PIDFILE="/var/run/${DAEMON}.${IFACE}.pid"
|
||||
IFPLUGD_ARGS="${IFPLUGD_ARGS} -i ${IFACE}"
|
||||
|
||||
# BusyBox' ifplugd does not create a pidfile, so pass "-n" in the
|
||||
# command line and use "--make-pidfile" to instruct start-stop-daemon
|
||||
# to create one.
|
||||
start() {
|
||||
printf 'Starting %s for %s: ' "$DAEMON" "$IFACE"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -n $IFPLUGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s for %s: ' "$DAEMON" "$IFACE"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
60
package/busybox/S50crond
Normal file
60
package/busybox/S50crond
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="crond"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
CROND_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' crond does not create a pidfile, so pass "-f" on the crond
|
||||
# command line and use "--make-pidfile" to instruct start-stop-daemon
|
||||
# to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -f $CROND_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
39
package/busybox/S50telnet
Normal file
39
package/busybox/S50telnet
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start telnet....
|
||||
#
|
||||
|
||||
TELNETD_ARGS=-F
|
||||
[ -r /etc/default/telnet ] && . /etc/default/telnet
|
||||
|
||||
start() {
|
||||
printf "Starting telnetd: "
|
||||
start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd -- $TELNETD_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping telnetd: "
|
||||
start-stop-daemon -K -q -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
1227
package/busybox/busybox.config
Normal file
1227
package/busybox/busybox.config
Normal file
File diff suppressed because it is too large
Load Diff
40
package/busybox/inittab
Normal file
40
package/busybox/inittab
Normal file
@@ -0,0 +1,40 @@
|
||||
# /etc/inittab
|
||||
#
|
||||
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Note: BusyBox init doesn't support runlevels. The runlevels field is
|
||||
# completely ignored by BusyBox init. If you want runlevels, use
|
||||
# sysvinit.
|
||||
#
|
||||
# Format for each entry: <id>:<runlevels>:<action>:<process>
|
||||
#
|
||||
# id == tty to run on, or empty for /dev/console
|
||||
# runlevels == ignored
|
||||
# action == one of sysinit, respawn, askfirst, wait, and once
|
||||
# process == program to run
|
||||
|
||||
# Startup the system
|
||||
::sysinit:/bin/mount -t proc proc /proc
|
||||
::sysinit:/bin/mount -o remount,rw /
|
||||
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
|
||||
::sysinit:/bin/mount -a
|
||||
::sysinit:/bin/mkdir -p /run/lock/subsys
|
||||
::sysinit:/sbin/swapon -a
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
# now run any rc scripts
|
||||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# Put a getty on the serial port
|
||||
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
#::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/sbin/swapoff -a
|
||||
::shutdown:/bin/umount -a -r
|
||||
86
package/busybox/make.sh
Executable file
86
package/busybox/make.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=busybox
|
||||
PKGVERSION=1.37.0
|
||||
PKGSOURCE_DIR=busybox
|
||||
PKGSOURCE=busybox-1.37.0.tar.bz2
|
||||
PKGURL=https://www.busybox.net/downloads/busybox-1.37.0.tar.bz2
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
bzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch
|
||||
|
||||
# Before running configure, the configuration file should be present and fixed
|
||||
# busybox 这里的动作分以下几步:
|
||||
# 先用 busybox.config 替换 .config 文件,busybox.config 基于 1.36.1,这里直接参考了 buildroot (2025.08.1) 维护的一套针对 busybox 的默认配置
|
||||
# 然后执行 yes = "" | make oldconfig,目的是基于我们当前的 busybox 版本(1.37.0)升级 .config 文件
|
||||
# 然后执行 fix,即手动调整一些配置
|
||||
# 最后再执行一遍 yes = "" | make oldconfig,确保配置正确
|
||||
/usr/bin/install -m 0644 -D ${PROJECT_DIR}/package/busybox/busybox.config ${PKGBUILD_DIR}/.config
|
||||
yes "" | eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} HOSTCC=\"/usr/bin/gcc\" AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y oldconfig"
|
||||
touch ${PKGBUILD_DIR}/.stamp_dotconfig
|
||||
# fixup
|
||||
kconfig_disable_option CONFIG_NOMMU
|
||||
kconfig_enable_option CONFIG_USE_BB_CRYPT_SHA
|
||||
kconfig_disable_option CONFIG_PAM
|
||||
kconfig_enable_option CONFIG_INIT
|
||||
yes "" | eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} HOSTCC=\"/usr/bin/gcc\" AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y oldconfig"
|
||||
touch ${PKGBUILD_DIR}/.stamp_kconfig_fixup_done
|
||||
|
||||
# 对于 busybox 来说没有使用 configure 脚本
|
||||
stamp_configured
|
||||
|
||||
step_start build
|
||||
eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-target
|
||||
eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y -C ${PKGBUILD_DIR} install-noclobber"
|
||||
if test ! -e ${TARGET_DIR}/etc/inittab; then
|
||||
/usr/bin/install -D -m 0644 ${PROJECT_DIR}/package/busybox/inittab ${TARGET_DIR}/etc/inittab;
|
||||
fi
|
||||
if grep -q CONFIG_UDHCPC=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/udhcpc.script ${TARGET_DIR}/usr/share/udhcpc/default.script;
|
||||
/usr/bin/install -m 0755 -d ${TARGET_DIR}/usr/share/udhcpc/default.script.d;
|
||||
fi
|
||||
if grep -q CONFIG_ZCIP=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PKGBUILD_DIR}/examples/zcip.script ${TARGET_DIR}/usr/share/zcip/default.script;
|
||||
fi
|
||||
if grep -q CONFIG_SYSLOGD=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S01syslogd ${TARGET_DIR}/etc/init.d/S01syslogd;
|
||||
fi;
|
||||
if grep -q CONFIG_KLOGD=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S02klogd ${TARGET_DIR}/etc/init.d/S02klogd;
|
||||
fi
|
||||
if grep -q CONFIG_BB_SYSCTL=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S02sysctl ${TARGET_DIR}/etc/init.d/S02sysctl ;
|
||||
fi
|
||||
if grep -q CONFIG_IFPLUGD=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S41ifplugd ${TARGET_DIR}/etc/init.d/S41ifplugd;
|
||||
fi;
|
||||
if grep -q CONFIG_CROND=y ${PKGBUILD_DIR}/.config; then
|
||||
mkdir -p ${TARGET_DIR}/etc/cron/crontabs
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S50crond ${TARGET_DIR}/etc/init.d/S50crond
|
||||
fi;
|
||||
if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S50telnet ${TARGET_DIR}/etc/init.d/S50telnet ;
|
||||
fi
|
||||
step_end install-target
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
122
package/busybox/udhcpc.script
Executable file
122
package/busybox/udhcpc.script
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
|
||||
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
||||
|
||||
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
|
||||
|
||||
ACTION="$1"
|
||||
RESOLV_CONF="/etc/resolv.conf"
|
||||
[ -e $RESOLV_CONF ] || touch $RESOLV_CONF
|
||||
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
|
||||
[ -n "$subnet" ] && NETMASK="netmask $subnet"
|
||||
# Handle stateful DHCPv6 like DHCPv4
|
||||
[ -n "$ipv6" ] && ip="$ipv6/128"
|
||||
|
||||
if [ -z "${IF_WAIT_DELAY}" ]; then
|
||||
IF_WAIT_DELAY=10
|
||||
fi
|
||||
|
||||
wait_for_ipv6_default_route() {
|
||||
printf "Waiting for IPv6 default route to appear"
|
||||
while [ $IF_WAIT_DELAY -gt 0 ]; do
|
||||
if ip -6 route list | grep -q default; then
|
||||
printf "\n"
|
||||
return
|
||||
fi
|
||||
sleep 1
|
||||
printf "."
|
||||
: $((IF_WAIT_DELAY -= 1))
|
||||
done
|
||||
printf " timeout!\n"
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
deconfig)
|
||||
/sbin/ifconfig $interface up
|
||||
/sbin/ifconfig $interface 0.0.0.0
|
||||
|
||||
# drop info from this interface
|
||||
# resolv.conf may be a symlink to /tmp/, so take care
|
||||
TMPFILE=$(mktemp)
|
||||
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
|
||||
cat $TMPFILE > $RESOLV_CONF
|
||||
rm -f $TMPFILE
|
||||
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
;;
|
||||
|
||||
leasefail|nak)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot
|
||||
fi
|
||||
;;
|
||||
|
||||
renew|bound)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
|
||||
if [ -n "$ipv6" ] ; then
|
||||
wait_for_ipv6_default_route
|
||||
fi
|
||||
|
||||
# RFC3442: If the DHCP server returns both a Classless
|
||||
# Static Routes option and a Router option, the DHCP
|
||||
# client MUST ignore the Router option.
|
||||
if [ -n "$staticroutes" ]; then
|
||||
echo "deleting routers"
|
||||
route -n | while read dest gw mask flags metric ref use iface; do
|
||||
[ "$iface" != "$interface" -o "$gw" = "0.0.0.0" ] || \
|
||||
route del -net "$dest" netmask "$mask" gw "$gw" dev "$interface"
|
||||
done
|
||||
|
||||
# format: dest1/mask gw1 ... destn/mask gwn
|
||||
set -- $staticroutes
|
||||
while [ -n "$1" -a -n "$2" ]; do
|
||||
route add -net "$1" gw "$2" dev "$interface"
|
||||
shift 2
|
||||
done
|
||||
elif [ -n "$router" ] ; then
|
||||
echo "deleting routers"
|
||||
while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do
|
||||
:
|
||||
done
|
||||
|
||||
for i in $router ; do
|
||||
route add default gw $i dev $interface
|
||||
done
|
||||
fi
|
||||
|
||||
# drop info from this interface
|
||||
# resolv.conf may be a symlink to /tmp/, so take care
|
||||
TMPFILE=$(mktemp)
|
||||
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
|
||||
cat $TMPFILE > $RESOLV_CONF
|
||||
rm -f $TMPFILE
|
||||
|
||||
# prefer rfc3397 domain search list (option 119) if available
|
||||
if [ -n "$search" ]; then
|
||||
search_list=$search
|
||||
elif [ -n "$domain" ]; then
|
||||
search_list=$domain
|
||||
fi
|
||||
|
||||
[ -n "$search_list" ] &&
|
||||
echo "search $search_list # $interface" >> $RESOLV_CONF
|
||||
|
||||
for i in $dns ; do
|
||||
echo adding dns $i
|
||||
echo "nameserver $i # $interface" >> $RESOLV_CONF
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
HOOK_DIR="$0.d"
|
||||
for hook in "${HOOK_DIR}/"*; do
|
||||
[ -f "${hook}" -a -x "${hook}" ] || continue
|
||||
"${hook}" "$ACTION"
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user