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
748a3577
Commit
748a3577
authored
Sep 22, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support patching fstab in ramdisk for A-only 2SI
parent
a52a3e38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
20 deletions
+30
-20
rootdir.cpp
native/jni/init/rootdir.cpp
+30
-20
No files found.
native/jni/init/rootdir.cpp
View file @
748a3577
...
...
@@ -384,26 +384,7 @@ void SARBase::patch_rootdir() {
close
(
dest
);
}
#define FSR "/first_stage_ramdisk"
void
ABFirstStageInit
::
prepare
()
{
// Find fstab
DIR
*
dir
=
xopendir
(
FSR
);
if
(
!
dir
)
return
;
dirent
*
de
;
string
fstab
(
FSR
"/"
);
while
((
de
=
readdir
(
dir
)))
{
if
(
strstr
(
de
->
d_name
,
"fstab"
))
{
fstab
+=
de
->
d_name
;
break
;
}
}
closedir
(
dir
);
if
(
fstab
.
length
()
==
sizeof
(
FSR
))
return
;
// Patch fstab
static
void
patch_fstab
(
const
string
&
fstab
)
{
string
patched
=
fstab
+
".p"
;
FILE
*
fp
=
xfopen
(
patched
.
data
(),
"we"
);
file_readline
(
fstab
.
data
(),
[
=
](
string_view
l
)
->
bool
{
...
...
@@ -437,6 +418,26 @@ void ABFirstStageInit::prepare() {
// Replace old fstab
clone_attr
(
fstab
.
data
(),
patched
.
data
());
rename
(
patched
.
data
(),
fstab
.
data
());
}
#define FSR "/first_stage_ramdisk"
void
ABFirstStageInit
::
prepare
()
{
DIR
*
dir
=
xopendir
(
FSR
);
if
(
!
dir
)
return
;
string
fstab
(
FSR
"/"
);
for
(
dirent
*
de
;
(
de
=
readdir
(
dir
));)
{
if
(
strstr
(
de
->
d_name
,
"fstab"
))
{
fstab
+=
de
->
d_name
;
break
;
}
}
closedir
(
dir
);
if
(
fstab
.
length
()
==
sizeof
(
FSR
))
return
;
patch_fstab
(
fstab
);
// Move stuffs for next stage
xmkdir
(
FSR
"/system"
,
0755
);
...
...
@@ -449,6 +450,15 @@ void ABFirstStageInit::prepare() {
}
void
AFirstStageInit
::
prepare
()
{
DIR
*
dir
=
xopendir
(
"/"
);
for
(
dirent
*
de
;
(
de
=
readdir
(
dir
));)
{
if
(
strstr
(
de
->
d_name
,
"fstab"
))
{
patch_fstab
(
de
->
d_name
);
break
;
}
}
closedir
(
dir
);
// Move stuffs for next stage
xmkdir
(
"/system"
,
0755
);
xmkdir
(
"/system/bin"
,
0755
);
...
...
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