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
ee0cef06
Commit
ee0cef06
authored
Sep 22, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for A-only 2SI
parent
0e5a113a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
8 deletions
+29
-8
init.cpp
native/jni/init/init.cpp
+3
-1
init.h
native/jni/init/init.h
+17
-6
rootdir.cpp
native/jni/init/rootdir.cpp
+9
-1
No files found.
native/jni/init/init.cpp
View file @
ee0cef06
...
...
@@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
if
(
run_test
)
{
init
=
make_unique
<
TestInit
>
(
argv
,
&
cmd
);
}
else
if
(
cmd
.
force_normal_boot
)
{
init
=
make_unique
<
FirstStageInit
>
(
argv
,
&
cmd
);
init
=
make_unique
<
AB
FirstStageInit
>
(
argv
,
&
cmd
);
}
else
if
(
cmd
.
system_as_root
)
{
if
(
access
(
"/overlay"
,
F_OK
)
==
0
)
/* Compatible mode */
init
=
make_unique
<
SARCompatInit
>
(
argv
,
&
cmd
);
...
...
@@ -217,6 +217,8 @@ int main(int argc, char *argv[]) {
decompress_ramdisk
();
if
(
access
(
"/sbin/recovery"
,
F_OK
)
==
0
)
init
=
make_unique
<
RecoveryInit
>
(
argv
,
&
cmd
);
else
if
(
access
(
"/apex"
,
F_OK
)
==
0
)
init
=
make_unique
<
AFirstStageInit
>
(
argv
,
&
cmd
);
else
init
=
make_unique
<
LegacyInit
>
(
argv
,
&
cmd
);
}
...
...
native/jni/init/init.h
View file @
ee0cef06
...
...
@@ -97,21 +97,32 @@ public:
}
};
/* *************
******
*
Logical Partitions
* *************
******
/
/* *************
*
2 Stage Init
* *************/
class
FirstStageInit
:
public
BaseInit
{
class
AB
FirstStageInit
:
public
BaseInit
{
protected
:
void
prepare
();
public
:
FirstStageInit
(
char
*
argv
[],
cmdline
*
cmd
)
:
BaseInit
(
argv
,
cmd
)
{};
AB
FirstStageInit
(
char
*
argv
[],
cmdline
*
cmd
)
:
BaseInit
(
argv
,
cmd
)
{};
void
start
()
override
{
prepare
();
exec_init
(
"/system/bin/init"
);
}
};
class
AFirstStageInit
:
public
BaseInit
{
protected
:
void
prepare
();
public
:
AFirstStageInit
(
char
*
argv
[],
cmdline
*
cmd
)
:
BaseInit
(
argv
,
cmd
)
{};
void
start
()
override
{
prepare
();
exec_init
();
}
};
class
SecondStageInit
:
public
SARCommon
{
protected
:
void
early_mount
()
override
;
...
...
@@ -121,7 +132,7 @@ public:
};
/* ***********
*
Normal
SAR
*
Legacy
SAR
* ***********/
class
SARInit
:
public
SARCommon
{
...
...
native/jni/init/rootdir.cpp
View file @
ee0cef06
...
...
@@ -386,7 +386,7 @@ void SARCommon::patch_rootdir() {
#define FSR "/first_stage_ramdisk"
void
FirstStageInit
::
prepare
()
{
void
AB
FirstStageInit
::
prepare
()
{
// Find fstab
DIR
*
dir
=
xopendir
(
FSR
);
if
(
!
dir
)
...
...
@@ -448,6 +448,14 @@ void FirstStageInit::prepare() {
rename
(
"/overlay.d"
,
FSR
"/overlay.d"
);
}
void
AFirstStageInit
::
prepare
()
{
// Move stuffs for next stage
xmkdir
(
"/system"
,
0755
);
xmkdir
(
"/system/bin"
,
0755
);
rename
(
"/init"
,
"/system/bin/init"
);
rename
(
"/.backup/init"
,
"/init"
);
}
#ifdef MAGISK_DEBUG
static
FILE
*
kmsg
;
static
int
vprintk
(
const
char
*
fmt
,
va_list
ap
)
{
...
...
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