mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-03-29 18:52:15 +00:00
Make it easy to build without crt0
This commit is contained in:
parent
47e6dd286d
commit
365b373480
1
build.py
1
build.py
@ -421,6 +421,7 @@ def build_binary(args):
|
|||||||
|
|
||||||
if "magiskinit" in args.target:
|
if "magiskinit" in args.target:
|
||||||
flag += " B_INIT=1"
|
flag += " B_INIT=1"
|
||||||
|
flag += " B_CRT0=1"
|
||||||
|
|
||||||
if flag:
|
if flag:
|
||||||
dump_bin_header(args)
|
dump_bin_header(args)
|
||||||
|
@ -59,13 +59,9 @@ endif
|
|||||||
|
|
||||||
ifdef B_INIT
|
ifdef B_INIT
|
||||||
|
|
||||||
# -lc -lm is hardcoded in this variable, disable it
|
|
||||||
TARGET_LDLIBS :=
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := magiskinit
|
LOCAL_MODULE := magiskinit
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
crt0 \
|
|
||||||
libbase \
|
libbase \
|
||||||
libpolicy \
|
libpolicy \
|
||||||
libxz \
|
libxz \
|
||||||
@ -80,6 +76,14 @@ LOCAL_SRC_FILES := \
|
|||||||
init/selinux.cpp \
|
init/selinux.cpp \
|
||||||
init/init-rs.cpp
|
init/init-rs.cpp
|
||||||
|
|
||||||
|
LOCAL_LDFLAGS := -static
|
||||||
|
|
||||||
|
ifdef B_CRT0
|
||||||
|
# -lc -lm is hardcoded in this variable, disable it
|
||||||
|
TARGET_LDLIBS :=
|
||||||
|
LOCAL_STATIC_LIBRARIES += crt0
|
||||||
|
endif
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -8,14 +8,13 @@ APP_PLATFORM := android-26
|
|||||||
APP_THIN_ARCHIVE := true
|
APP_THIN_ARCHIVE := true
|
||||||
APP_STRIP_MODE := none
|
APP_STRIP_MODE := none
|
||||||
|
|
||||||
# magiskinit uses crt0
|
ifdef B_CRT0
|
||||||
ifdef B_INIT
|
|
||||||
|
|
||||||
# Disable all security and debugging features
|
# Disable all security and debugging features
|
||||||
APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -U_FORTIFY_SOURCE
|
APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -U_FORTIFY_SOURCE
|
||||||
APP_LDFLAGS += -Wl,-wrap,abort_message
|
APP_LDFLAGS += -Wl,-wrap,abort_message
|
||||||
# Override output folder to make sure all dependencies are rebuilt with new CFLAGS
|
# Override output folder to make sure all dependencies are rebuilt with new CFLAGS
|
||||||
NDK_APP_OUT := ./obj/init
|
NDK_APP_OUT := ./obj/nolibc
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user