Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
c3c78428
Commit
c3c78428
authored
May 12, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use lower API level for static binaries
parent
c6d2bf57
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
24 deletions
+38
-24
build.py
build.py
+27
-17
build.gradle
native/build.gradle
+1
-1
Android.mk
native/jni/Android.mk
+1
-2
Application.mk
native/jni/Application.mk
+7
-2
Android.mk
native/jni/external/Android.mk
+1
-1
busybox
native/jni/external/busybox
+1
-1
No files found.
build.py
View file @
c3c78428
...
@@ -104,17 +104,35 @@ def build_binary(args):
...
@@ -104,17 +104,35 @@ def build_binary(args):
os
.
utime
(
os
.
path
.
join
(
'native'
,
'jni'
,
'include'
,
'logging.h'
))
os
.
utime
(
os
.
path
.
join
(
'native'
,
'jni'
,
'include'
,
'logging.h'
))
# Basic flags
# Basic flags
flags
=
'MAGISK_VERSION=
\"
{}
\"
MAGISK_VER_CODE={} MAGISK_DEBUG={}'
.
format
(
config
[
'version'
],
config
[
'versionCode'
],
base_
flags
=
'MAGISK_VERSION=
\"
{}
\"
MAGISK_VER_CODE={} MAGISK_DEBUG={}'
.
format
(
config
[
'version'
],
config
[
'versionCode'
],
''
if
args
.
release
else
'-DMAGISK_DEBUG'
)
''
if
args
.
release
else
'-DMAGISK_DEBUG'
)
if
'magisk'
in
args
.
target
:
if
'magisk'
in
args
.
target
:
# Magisk is special case as it is a dependency of magiskinit
# Magisk is special case as it is a dependency of magiskinit
proc
=
subprocess
.
run
(
'{} -C native {} B_MAGISK=
true -j{}'
.
format
(
ndk_build
,
flags
,
cpu_count
),
shell
=
True
)
proc
=
subprocess
.
run
(
'{} -C native {} B_MAGISK=
1 -j{}'
.
format
(
ndk_build
,
base_
flags
,
cpu_count
),
shell
=
True
)
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
error
(
'Build Magisk binary failed!'
)
error
(
'Build Magisk binary failed!'
)
collect_binary
()
collect_binary
()
non_magisk
=
False
old_platform
=
False
flags
=
base_flags
if
'busybox'
in
args
.
target
:
flags
+=
' B_BB=1'
old_platform
=
True
if
'b64xz'
in
args
.
target
:
flags
+=
' B_BXZ=1'
old_platform
=
True
if
old_platform
:
proc
=
subprocess
.
run
(
'{} -C native OLD_PLAT=1 {} -j{}'
.
format
(
ndk_build
,
flags
,
cpu_count
),
shell
=
True
)
if
proc
.
returncode
!=
0
:
error
(
'Build binaries failed!'
)
collect_binary
()
other
=
False
flags
=
base_flags
if
'magiskinit'
in
args
.
target
:
if
'magiskinit'
in
args
.
target
:
# We need to create dump.h beforehand
# We need to create dump.h beforehand
...
@@ -127,22 +145,14 @@ def build_binary(args):
...
@@ -127,22 +145,14 @@ def build_binary(args):
dump
.
write
(
'const uint8_t magisk_dump[] = "'
)
dump
.
write
(
'const uint8_t magisk_dump[] = "'
)
dump
.
write
(
''
.
join
(
"
\\
x{:02X}"
.
format
(
c
)
for
c
in
lzma
.
compress
(
bin
.
read
(),
preset
=
9
)))
dump
.
write
(
''
.
join
(
"
\\
x{:02X}"
.
format
(
c
)
for
c
in
lzma
.
compress
(
bin
.
read
(),
preset
=
9
)))
dump
.
write
(
'";
\n
'
)
dump
.
write
(
'";
\n
'
)
flags
+=
' B_INIT=
true
'
flags
+=
' B_INIT=
1
'
non_magisk
=
True
other
=
True
if
'magiskboot'
in
args
.
target
:
if
'magiskboot'
in
args
.
target
:
flags
+=
' B_BOOT=true'
flags
+=
' B_BOOT=1'
non_magisk
=
True
other
=
True
if
'busybox'
in
args
.
target
:
flags
+=
' B_BB=true'
non_magisk
=
True
if
'b64xz'
in
args
.
target
:
flags
+=
' B_BXZ=true'
non_magisk
=
True
if
non_magisk
:
if
other
:
proc
=
subprocess
.
run
(
'{} -C native {} -j{}'
.
format
(
ndk_build
,
flags
,
cpu_count
),
shell
=
True
)
proc
=
subprocess
.
run
(
'{} -C native {} -j{}'
.
format
(
ndk_build
,
flags
,
cpu_count
),
shell
=
True
)
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
error
(
'Build binaries failed!'
)
error
(
'Build binaries failed!'
)
...
@@ -369,7 +379,7 @@ def cleanup(args):
...
@@ -369,7 +379,7 @@ def cleanup(args):
if
'binary'
in
args
.
target
:
if
'binary'
in
args
.
target
:
header
(
'* Cleaning binaries'
)
header
(
'* Cleaning binaries'
)
subprocess
.
run
(
ndk_build
+
' -C native B_MAGISK=
true B_INIT=true B_BOOT=true B_BXZ=true B_BB=true
clean'
,
shell
=
True
)
subprocess
.
run
(
ndk_build
+
' -C native B_MAGISK=
1 B_INIT=1 B_BOOT=1 B_BXZ=1 B_BB=1
clean'
,
shell
=
True
)
shutil
.
rmtree
(
os
.
path
.
join
(
'native'
,
'out'
),
ignore_errors
=
True
)
shutil
.
rmtree
(
os
.
path
.
join
(
'native'
,
'out'
),
ignore_errors
=
True
)
if
'java'
in
args
.
target
:
if
'java'
in
args
.
target
:
...
...
native/build.gradle
View file @
c3c78428
...
@@ -14,7 +14,7 @@ android {
...
@@ -14,7 +14,7 @@ android {
externalNativeBuild
{
externalNativeBuild
{
ndkBuild
{
ndkBuild
{
// Pass arguments to ndk-build.
// Pass arguments to ndk-build.
arguments
(
'B_MAGISK=
true'
,
'B_INIT=true'
,
'B_BOOT=true
'
,
'MAGISK_VERSION=debug'
,
arguments
(
'B_MAGISK=
1'
,
'B_INIT=1'
,
'B_BOOT=1
'
,
'MAGISK_VERSION=debug'
,
'MAGISK_VER_CODE=99999'
,
'MAGISK_DEBUG=-DMAGISK_DEBUG'
)
'MAGISK_VER_CODE=99999'
,
'MAGISK_DEBUG=-DMAGISK_DEBUG'
)
}
}
}
}
...
...
native/jni/Android.mk
View file @
c3c78428
...
@@ -57,8 +57,7 @@ LOCAL_SRC_FILES := \
...
@@ -57,8 +57,7 @@ LOCAL_SRC_FILES := \
su/su_socket.c \
su/su_socket.c \
$(UTIL_SRC)
$(UTIL_SRC)
LOCAL_CFLAGS := -DIS_DAEMON -DSELINUX ${MAGISK_DEBUG} \
LOCAL_CFLAGS := -DIS_DAEMON -DSELINUX
-DMAGISK_VERSION="${MAGISK_VERSION}" -DMAGISK_VER_CODE=${MAGISK_VER_CODE}
LOCAL_LDLIBS := -llog
LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE)
include $(BUILD_EXECUTABLE)
...
...
native/jni/Application.mk
View file @
c3c78428
APP_ABI := x86 armeabi-v7a
APP_ABI := x86 armeabi-v7a
APP_
PLATFORM := android-21
APP_
CFLAGS := -std=gnu99 ${MAGISK_DEBUG} \
APP_CFLAGS := -std=gnu99
-DMAGISK_VERSION="${MAGISK_VERSION}" -DMAGISK_VER_CODE=${MAGISK_VER_CODE}
APP_CPPFLAGS := -std=c++11
APP_CPPFLAGS := -std=c++11
APP_SHORT_COMMANDS := true
APP_SHORT_COMMANDS := true
ifdef OLD_PLAT
APP_PLATFORM := android-9
else
APP_PLATFORM := android-21
endif
native/jni/external/Android.mk
View file @
c3c78428
...
@@ -175,7 +175,7 @@ LOCAL_SRC_FILES := \
...
@@ -175,7 +175,7 @@ LOCAL_SRC_FILES := \
xz/src/liblzma/simple/simple_encoder.c \
xz/src/liblzma/simple/simple_encoder.c \
xz/src/liblzma/simple/sparc.c \
xz/src/liblzma/simple/sparc.c \
xz/src/liblzma/simple/x86.c
xz/src/liblzma/simple/x86.c
LOCAL_CFLAGS += -DHAVE_CONFIG_H -
std=c99
LOCAL_CFLAGS += -DHAVE_CONFIG_H -
Wno-implicit-function-declaration
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_STATIC_LIBRARY)
# libsepol.a
# libsepol.a
...
...
busybox
@
869ebbfa
Subproject commit
4f5bf4ad8361c46441db19bd61605d0de324f19e
Subproject commit
869ebbfa97d9b47b2707adb10a01d1bfacd52191
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment