Skip to content

Commit

Permalink
busybox: fix build with ndk r23
Browse files Browse the repository at this point in the history
Compiler and tool names need to be updated in Makefile.

Also fix some patch offsets while we are at it
  • Loading branch information
Grimler91 authored and finagolfin committed Aug 21, 2021
1 parent 6090d7b commit 28bb602
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 36 deletions.
21 changes: 16 additions & 5 deletions packages/busybox/0000-use-clang.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
diff -uNr busybox-1.31.1/Makefile busybox-1.31.1.mod/Makefile
--- busybox-1.31.1/Makefile 2019-10-25 11:44:52.000000000 +0300
+++ busybox-1.31.1.mod/Makefile 2019-11-11 22:19:06.004778909 +0200
@@ -289,7 +289,7 @@
--- ./Makefile.orig 2021-08-19 16:48:15.223628163 +0200
+++ ./Makefile 2021-08-19 16:47:29.456942514 +0200
@@ -289,14 +289,14 @@
# Make variables (CC, etc...)

AS = $(CROSS_COMPILE)as
-CC = $(CROSS_COMPILE)gcc
+CC = $(CROSS_COMPILE)clang
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
-AR = $(CROSS_COMPILE)ar
-NM = $(CROSS_COMPILE)nm
-STRIP = $(CROSS_COMPILE)strip
-OBJCOPY = $(CROSS_COMPILE)objcopy
-OBJDUMP = $(CROSS_COMPILE)objdump
+AR = llvm-ar
+NM = llvm-nm
+STRIP = llvm-strip
+OBJCOPY = llvm-objcopy
+OBJDUMP = llvm-objdump
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
AWK = awk
GENKSYMS = scripts/genksyms/genksyms
6 changes: 3 additions & 3 deletions packages/busybox/0004-Makefile.flags.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- ../Makefile.flags.orig 2020-07-20 19:17:12.263392471 +0000
+++ ./Makefile.flags 2020-07-20 19:17:22.988106865 +0000
@@ -150,9 +150,9 @@
--- ./Makefile.flags.orig 2021-01-01 11:52:27.000000000 +0100
+++ ./Makefile.flags 2021-08-19 16:49:06.743647568 +0200
@@ -151,9 +151,9 @@
# fall back to using a temp file:
CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c)
ifeq ($(CRYPT_AVAILABLE),y)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
diff -uNr busybox-1.31.1/networking/ftpd.c busybox-1.31.1.mod/networking/ftpd.c
--- busybox-1.31.1/networking/ftpd.c 2019-06-10 13:50:53.000000000 +0300
+++ busybox-1.31.1.mod/networking/ftpd.c 2019-11-11 22:26:50.216912741 +0200
@@ -1301,8 +1301,11 @@
--- ./networking/ftpd.c.orig 2021-08-19 16:49:06.730314230 +0200
+++ ./networking/ftpd.c 2021-08-19 16:49:06.753647572 +0200
@@ -1302,8 +1302,11 @@
G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
close_on_exec_on(G.root_fd);
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.c
--- busybox-1.31.1/networking/httpd.c 2019-11-11 21:31:58.406733857 +0200
+++ busybox-1.31.1.mod/networking/httpd.c 2019-11-11 22:29:16.534250966 +0200
@@ -232,7 +232,7 @@
--- ./networking/httpd.c.orig 2021-08-19 16:49:06.730314230 +0200
+++ ./networking/httpd.c 2021-08-19 16:49:06.756980906 +0200
@@ -270,7 +270,7 @@
//usage: "\n -i Inetd mode"
//usage: "\n -f Don't daemonize"
//usage: "\n -v[v] Verbose"
Expand All @@ -10,16 +9,16 @@ diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.
//usage: IF_FEATURE_HTTPD_SETUID(
//usage: "\n -u USER[:GRP] Set uid/gid after binding to port")
//usage: IF_FEATURE_HTTPD_BASIC_AUTH(
@@ -488,7 +488,7 @@
asm volatile("":::"memory"); \
@@ -538,7 +538,7 @@
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
IF_FEATURE_HTTPD_RANGES(range_start = -1;) \
- bind_addr_or_port = "80"; \
+ bind_addr_or_port = "8080"; \
index_page = index_html; \
file_size = -1; \
} while (0)
@@ -1004,7 +1004,7 @@
@@ -1030,7 +1030,7 @@
if (!errno && n && n <= 0xffff)
n = create_and_bind_stream_or_die(NULL, n);
else
Expand All @@ -28,7 +27,7 @@ diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.
xlisten(n, 9);
return n;
}
@@ -2209,7 +2209,7 @@
@@ -2279,7 +2279,7 @@
if (proxy_entry) {
if (verbose > 1)
bb_error_msg("proxy:%s", urlcopy);
Expand Down
15 changes: 15 additions & 0 deletions packages/busybox/0011-networking-tftp-no-chroot.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- ./networking/tftp.c.orig 2021-01-01 11:52:27.000000000 +0100
+++ ./networking/tftp.c 2021-08-19 16:49:06.763647575 +0200
@@ -917,7 +917,12 @@
G.pw = xgetpwnam(user_opt);
}
if (argv[0]) {
+#ifdef __ANDROID__
+ // chroot may trigger seccomp and is allowed only for root anyway.
+ xchdir(argv[0]);
+#else
xchroot(argv[0]);
+#endif
}

result = recv_from_to(STDIN_FILENO,
16 changes: 0 additions & 16 deletions packages/busybox/0012-networking-tftp-no-chroot.patch

This file was deleted.

0 comments on commit 28bb602

Please sign in to comment.