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
14ae29d9
Commit
14ae29d9
authored
Mar 03, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support Android Q new init setup
parent
e8f35b02
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
.gitignore
.gitignore
+0
-1
.gitignore
native/.gitignore
+3
-1
init.cpp
native/jni/core/init.cpp
+21
-6
util_functions.sh
scripts/util_functions.sh
+4
-3
No files found.
.gitignore
View file @
14ae29d9
...
...
@@ -15,4 +15,3 @@ native/out
/.idea
/build
/captures
.externalNativeBuild
native/.gitignore
View file @
14ae29d9
/build
obj
libs
/.externalNativeBuild
/.cxx
native/jni/core/init.cpp
View file @
14ae29d9
...
...
@@ -281,14 +281,29 @@ static bool patch_sepolicy() {
}
if
(
init_patch
)
{
// Force init to load /sepolicy
uint8_t
*
addr
;
// If init is symlink, copy it to rootfs so we can patch
char
real_init
[
128
];
real_init
[
0
]
=
'\0'
;
struct
stat
st
;
lstat
(
"/init"
,
&
st
);
if
(
S_ISLNK
(
st
.
st_mode
))
{
xreadlink
(
"/init"
,
real_init
,
sizeof
(
real_init
));
cp_afc
(
real_init
,
"/init"
);
}
size_t
real_init_len
=
strlen
(
real_init
);
char
*
addr
;
size_t
size
;
mmap_rw
(
"/init"
,
addr
,
size
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
if
(
memcmp
(
addr
+
i
,
SPLIT_PLAT_CIL
,
sizeof
(
SPLIT_PLAT_CIL
)
-
1
)
==
0
)
{
memcpy
(
addr
+
i
+
sizeof
(
SPLIT_PLAT_CIL
)
-
4
,
"xxx"
,
3
);
break
;
for
(
char
*
p
=
addr
;
p
<
addr
+
size
;
++
p
)
{
if
(
memcmp
(
p
,
SPLIT_PLAT_CIL
,
sizeof
(
SPLIT_PLAT_CIL
))
==
0
)
{
// Force init to load /sepolicy
memset
(
p
,
'x'
,
sizeof
(
SPLIT_PLAT_CIL
)
-
1
);
p
+=
sizeof
(
SPLIT_PLAT_CIL
)
-
1
;
}
else
if
(
real_init_len
>
0
&&
memcmp
(
p
,
real_init
,
real_init_len
+
1
)
==
0
)
{
// Force execute /init instead of real init
strcpy
(
p
,
"/init"
);
p
+=
real_init_len
;
}
}
munmap
(
addr
,
size
);
...
...
scripts/util_functions.sh
View file @
14ae29d9
...
...
@@ -185,12 +185,13 @@ mount_partitions() {
fi
[
-f
/system/build.prop
]
||
is_mounted /system
||
abort
"! Cannot mount /system"
grep
-qE
'/dev/root|/system_root'
/proc/mounts
&&
SYSTEM_ROOT
=
true
||
SYSTEM_ROOT
=
false
if
[
-f
/system/init
]
;
then
if
[
-f
/system/init
.rc
]
;
then
SYSTEM_ROOT
=
true
mkdir
/system_root 2>/dev/null
mount
--move
/system /system_root
mount
-o
bind
/system_root/system /system
fi
$SYSTEM_ROOT
&&
ui_print
"- Device is system-as-root"
if
[
-L
/system/vendor
]
;
then
mkdir
/vendor 2>/dev/null
is_mounted /vendor
||
mount
-o
ro /vendor 2>/dev/null
...
...
@@ -210,7 +211,7 @@ get_flags() {
if
[
-z
$KEEPVERITY
]
;
then
if
$SYSTEM_ROOT
;
then
KEEPVERITY
=
true
ui_print
"-
Using system_root_image
, keep dm/avb-verity"
ui_print
"-
System-as-root
, keep dm/avb-verity"
else
KEEPVERITY
=
false
fi
...
...
@@ -221,7 +222,7 @@ get_flags() {
# No data access means unable to decrypt in recovery
if
$FDE
||
$FBE
||
!
$DATA
;
then
KEEPFORCEENCRYPT
=
true
ui_print
"- Encrypted data
detected
, keep forceencrypt"
ui_print
"- Encrypted data, keep forceencrypt"
else
KEEPFORCEENCRYPT
=
false
fi
...
...
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