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
b436bce5
Commit
b436bce5
authored
May 26, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor optimizations
parent
886286a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
19 deletions
+9
-19
bootstages.c
native/jni/core/bootstages.c
+8
-11
img.c
native/jni/utils/img.c
+1
-8
No files found.
native/jni/core/bootstages.c
View file @
b436bce5
...
...
@@ -581,6 +581,12 @@ initialize:
close
(
sbin
);
close
(
root
);
// Create directories in tmpfs overlay
xmkdirs
(
MIRRDIR
"/system"
,
0755
);
xmkdir
(
MIRRDIR
"/bin"
,
0755
);
xmkdir
(
BBPATH
,
0755
);
xmkdir
(
MOUNTPOINT
,
0755
);
LOGI
(
"* Mounting mirrors"
);
struct
vector
mounts
;
vec_init
(
&
mounts
);
...
...
@@ -590,16 +596,10 @@ initialize:
// Check whether skip_initramfs device
vec_for_each
(
&
mounts
,
line
)
{
if
(
strstr
(
line
,
" /system_root "
))
{
xmkdirs
(
MIRRDIR
"/system"
,
0755
);
bind_mount
(
"/system_root/system"
,
MIRRDIR
"/system"
);
skip_initramfs
=
1
;
break
;
}
}
vec_for_each
(
&
mounts
,
line
)
{
if
(
!
skip_initramfs
&&
strstr
(
line
,
" /system "
))
{
}
else
if
(
!
skip_initramfs
&&
strstr
(
line
,
" /system "
))
{
sscanf
(
line
,
"%s"
,
buf
);
xmkdirs
(
MIRRDIR
"/system"
,
0755
);
xmount
(
buf
,
MIRRDIR
"/system"
,
"ext4"
,
MS_RDONLY
,
NULL
);
#ifdef MAGISK_DEBUG
LOGI
(
"mount: %s <- %s
\n
"
,
MIRRDIR
"/system"
,
buf
);
...
...
@@ -609,7 +609,7 @@ initialize:
}
else
if
(
strstr
(
line
,
" /vendor "
))
{
seperate_vendor
=
1
;
sscanf
(
line
,
"%s"
,
buf
);
xmkdir
s
(
MIRRDIR
"/vendor"
,
0755
);
xmkdir
(
MIRRDIR
"/vendor"
,
0755
);
xmount
(
buf
,
MIRRDIR
"/vendor"
,
"ext4"
,
MS_RDONLY
,
NULL
);
#ifdef MAGISK_DEBUG
LOGI
(
"mount: %s <- %s
\n
"
,
MIRRDIR
"/vendor"
,
buf
);
...
...
@@ -628,11 +628,8 @@ initialize:
LOGI
(
"link: %s
\n
"
,
MIRRDIR
"/vendor"
);
#endif
}
xmkdirs
(
MIRRDIR
"/bin"
,
0755
);
xmkdirs
(
DATABIN
,
0755
);
bind_mount
(
DATABIN
,
MIRRDIR
"/bin"
);
xmkdirs
(
BBPATH
,
0755
);
if
(
access
(
MIRRDIR
"/bin/busybox"
,
X_OK
)
==
0
)
{
LOGI
(
"* Setting up internal busybox"
);
exec_command_sync
(
MIRRDIR
"/bin/busybox"
,
"--install"
,
"-s"
,
BBPATH
,
NULL
);
...
...
native/jni/utils/img.c
View file @
b436bce5
...
...
@@ -140,15 +140,8 @@ int resize_img(const char *img, int size) {
}
char
*
mount_image
(
const
char
*
img
,
const
char
*
target
)
{
if
(
access
(
img
,
F_OK
)
==
-
1
)
if
(
access
(
img
,
F_OK
)
==
-
1
||
access
(
target
,
F_OK
)
==
-
1
)
return
NULL
;
if
(
access
(
target
,
F_OK
)
==
-
1
)
{
if
(
xmkdirs
(
target
,
0755
)
==
-
1
)
{
xmount
(
NULL
,
"/"
,
NULL
,
MS_REMOUNT
,
NULL
);
xmkdirs
(
target
,
0755
);
xmount
(
NULL
,
"/"
,
NULL
,
MS_REMOUNT
|
MS_RDONLY
,
NULL
);
}
}
if
(
e2fsck
(
img
))
return
NULL
;
...
...
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