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
476b61c4
Commit
476b61c4
authored
Dec 05, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support system_root with NVIDIA partition names
Fix #2063
parent
8cc5f096
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
early_mount.cpp
native/jni/init/early_mount.cpp
+20
-5
No files found.
native/jni/init/early_mount.cpp
View file @
476b61c4
...
...
@@ -43,7 +43,7 @@ static void parse_device(devinfo *dev, const char *uevent) {
static
void
collect_devices
()
{
char
path
[
128
];
struct
dirent
*
entry
;
devinfo
dev
;
devinfo
dev
{}
;
DIR
*
dir
=
xopendir
(
"/sys/dev/block"
);
if
(
dir
==
nullptr
)
return
;
...
...
@@ -57,13 +57,14 @@ static void collect_devices() {
closedir
(
dir
);
}
static
dev
_t
setup_block
(
char
*
block_dev
=
nullptr
)
{
static
int64
_t
setup_block
(
char
*
block_dev
=
nullptr
)
{
if
(
dev_list
.
empty
())
collect_devices
();
for
(;;)
{
xmkdir
(
"/dev"
,
0755
);
for
(
int
tries
=
0
;
tries
<
3
;
++
tries
)
{
for
(
auto
&
dev
:
dev_list
)
{
if
(
strcasecmp
(
dev
.
partname
,
partname
)
==
0
)
{
xmkdir
(
"/dev"
,
0755
);
if
(
block_dev
)
{
sprintf
(
block_dev
,
"/dev/block/%s"
,
dev
.
devname
);
xmkdir
(
"/dev/block"
,
0755
);
...
...
@@ -79,6 +80,9 @@ static dev_t setup_block(char *block_dev = nullptr) {
dev_list
.
clear
();
collect_devices
();
}
// The requested partname does not exist
return
-
1
;
}
static
bool
is_lnk
(
const
char
*
name
)
{
...
...
@@ -205,7 +209,18 @@ void SARInit::early_mount() {
LOGD
(
"Early mount system_root
\n
"
);
sprintf
(
partname
,
"system%s"
,
cmd
->
slot
);
system_dev
=
setup_block
();
auto
dev
=
setup_block
();
if
(
dev
<
0
)
{
// Try NVIDIA naming scheme
strcpy
(
partname
,
"APP"
);
dev
=
setup_block
();
if
(
dev
<
0
)
{
// We don't really know what to do at this point...
LOGE
(
"Cannot find root partition, abort
\n
"
);
exit
(
1
);
}
}
system_dev
=
dev
;
xmkdir
(
"/system_root"
,
0755
);
if
(
xmount
(
"/dev/root"
,
"/system_root"
,
"ext4"
,
MS_RDONLY
,
nullptr
))
xmount
(
"/dev/root"
,
"/system_root"
,
"erofs"
,
MS_RDONLY
,
nullptr
);
...
...
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