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
2487ec94
Commit
2487ec94
authored
Nov 09, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support to remove avb verity
parent
811489f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
16 deletions
+36
-16
cpio.c
jni/magiskboot/cpio.c
+7
-2
dtb.c
jni/magiskboot/dtb.c
+17
-4
magiskboot.h
jni/magiskboot/magiskboot.h
+1
-1
main.c
jni/magiskboot/main.c
+11
-9
No files found.
jni/magiskboot/cpio.c
View file @
2487ec94
...
...
@@ -208,8 +208,13 @@ static void cpio_test(struct vector *v) {
int
check_verity_pattern
(
const
char
*
s
)
{
int
pos
=
0
;
if
(
s
[
0
]
==
','
)
++
pos
;
if
(
strncmp
(
s
+
pos
,
"verify"
,
6
)
!=
0
)
return
-
1
;
pos
+=
6
;
if
(
strncmp
(
s
+
pos
,
"verify"
,
6
)
==
0
)
pos
+=
6
;
else
if
(
strncmp
(
s
+
pos
,
"avb"
,
3
)
==
0
)
pos
+=
3
;
else
return
-
1
;
if
(
s
[
pos
]
==
'='
)
{
while
(
s
[
pos
]
!=
'\0'
&&
s
[
pos
]
!=
' '
&&
s
[
pos
]
!=
'\n'
&&
s
[
pos
]
!=
','
)
++
pos
;
}
...
...
jni/magiskboot/dtb.c
View file @
2487ec94
...
...
@@ -7,11 +7,24 @@
extern
int
check_verity_pattern
(
const
char
*
s
);
static
void
print_props
(
const
void
*
fdt
,
int
node
,
int
depth
)
{
int
prop
;
fdt_for_each_property_offset
(
prop
,
fdt
,
node
)
{
for
(
int
i
=
0
;
i
<
depth
;
++
i
)
printf
(
" "
);
printf
(
" "
);
int
size
;
const
char
*
name
;
const
char
*
value
=
fdt_getprop_by_offset
(
fdt
,
prop
,
&
name
,
&
size
);
printf
(
"[%s]: [%s]
\n
"
,
name
,
value
);
}
}
static
void
print_subnode
(
const
void
*
fdt
,
int
parent
,
int
depth
)
{
int
node
;
fdt_for_each_subnode
(
node
,
fdt
,
parent
)
{
for
(
int
i
=
0
;
i
<
depth
;
++
i
)
printf
(
" "
);
printf
(
"%d: %s
\n
"
,
node
,
fdt_get_name
(
fdt
,
node
,
NULL
));
for
(
int
i
=
0
;
i
<
depth
;
++
i
)
printf
(
" "
);
printf
(
"#%d: %s
\n
"
,
node
,
fdt_get_name
(
fdt
,
node
,
NULL
));
print_props
(
fdt
,
node
,
depth
);
print_subnode
(
fdt
,
node
,
depth
+
1
);
}
}
...
...
@@ -28,7 +41,7 @@ static int find_fstab(const void *fdt, int parent) {
return
-
1
;
}
void
dtb_
print
(
const
char
*
file
)
{
void
dtb_
dump
(
const
char
*
file
)
{
size_t
size
;
void
*
dtb
,
*
fdt
;
fprintf
(
stderr
,
"Loading dtbs from [%s]
\n
"
,
file
);
...
...
@@ -38,7 +51,7 @@ void dtb_print(const char *file) {
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
if
(
memcmp
(
dtb
+
i
,
DTB_MAGIC
,
4
)
==
0
)
{
fdt
=
dtb
+
i
;
fprintf
(
stderr
,
"
\n
Print
ing dtb.%04d
\n\n
"
,
dtb_num
++
);
fprintf
(
stderr
,
"
Dump
ing dtb.%04d
\n\n
"
,
dtb_num
++
);
print_subnode
(
fdt
,
0
,
0
);
}
}
...
...
jni/magiskboot/magiskboot.h
View file @
2487ec94
...
...
@@ -21,7 +21,7 @@ int parse_img(void *orig, size_t size, boot_img *boot);
int
cpio_commands
(
const
char
*
command
,
int
argc
,
char
*
argv
[]);
void
comp_file
(
const
char
*
method
,
const
char
*
from
,
const
char
*
to
);
void
decomp_file
(
char
*
from
,
const
char
*
to
);
void
dtb_
print
(
const
char
*
file
);
void
dtb_
dump
(
const
char
*
file
);
void
dtb_patch
(
const
char
*
file
);
// Compressions
...
...
jni/magiskboot/main.c
View file @
2487ec94
...
...
@@ -44,8 +44,8 @@ static void usage(char *arg0) {
" Move <from-entry> to <to-entry>
\n
"
" -extract <entry> <outfile>
\n
"
" Extract <entry> to <outfile>
\n
"
" -test
\n
"
" Return value: 0/stock 1/Magisk 2/other (
e.g. phh, SuperSU
)
\n
"
" -test
\n
"
" Return value: 0/stock 1/Magisk 2/other (
phh, SuperSU, Xposed
)
\n
"
" -patch <KEEPVERITY> <KEEPFORCEENCRYPT>
\n
"
" Patch cpio for Magisk. KEEP**** are true/false values
\n
"
" -backup <origcpio> [SHA1]
\n
"
...
...
@@ -56,11 +56,13 @@ static void usage(char *arg0) {
" -stocksha1
\n
"
" Get stock boot SHA1 recorded within <incpio>
\n
"
"
\n
"
" --dtb-print <dtb>
\n
"
" Print all nodes in <dtb>, for debugging
\n
"
"
\n
"
" --dtb-patch <dtb>
\n
"
" Search for fstab in <dtb> and remove verity checks
\n
"
" --dtb-<cmd> <dtb>
\n
"
" Do dtb related cmds to <dtb> (modifications are done directly)
\n
"
" Supported commands:
\n
"
" -dump
\n
"
" Dump all contents from dtb for debugging
\n
"
" -patch
\n
"
" Search for fstab and remove verity/avb
\n
"
"
\n
"
" --compress[=method] <infile> [outfile]
\n
"
" Compress <infile> with [method] (default: gzip), optionally to [outfile]
\n
"
...
...
@@ -119,8 +121,8 @@ int main(int argc, char *argv[]) {
repack
(
argv
[
2
],
argc
>
3
?
argv
[
3
]
:
NEW_BOOT
);
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"--decompress"
)
==
0
)
{
decomp_file
(
argv
[
2
],
argc
>
3
?
argv
[
3
]
:
NULL
);
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"--dtb-
print
"
)
==
0
)
{
dtb_
print
(
argv
[
2
]);
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"--dtb-
dump
"
)
==
0
)
{
dtb_
dump
(
argv
[
2
]);
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"--dtb-patch"
)
==
0
)
{
dtb_patch
(
argv
[
2
]);
}
else
if
(
argc
>
2
&&
strncmp
(
argv
[
1
],
"--compress"
,
10
)
==
0
)
{
...
...
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