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
1699da17
Commit
1699da17
authored
Jun 15, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update help message and make behavior consistent
parent
754e6902
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
24 deletions
+37
-24
bootimg.cpp
native/jni/boot/bootimg.cpp
+1
-1
main.cpp
native/jni/boot/main.cpp
+36
-23
No files found.
native/jni/boot/bootimg.cpp
View file @
1699da17
...
@@ -577,7 +577,7 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
...
@@ -577,7 +577,7 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
}
}
if
(
access
(
KERNEL_FILE
,
R_OK
)
==
0
)
{
if
(
access
(
KERNEL_FILE
,
R_OK
)
==
0
)
{
auto
m
=
mmap_data
(
KERNEL_FILE
);
auto
m
=
mmap_data
(
KERNEL_FILE
);
if
(
!
COMPRESSED_ANY
(
check_fmt
(
m
.
buf
,
m
.
sz
))
&&
COMPRESSED
(
boot
.
k_fmt
))
{
if
(
!
skip_comp
&&
!
COMPRESSED_ANY
(
check_fmt
(
m
.
buf
,
m
.
sz
))
&&
COMPRESSED
(
boot
.
k_fmt
))
{
// Always use zopfli for zImage compression
// Always use zopfli for zImage compression
auto
fmt
=
(
boot
.
flags
[
ZIMAGE_KERNEL
]
&&
boot
.
k_fmt
==
GZIP
)
?
ZOPFLI
:
boot
.
k_fmt
;
auto
fmt
=
(
boot
.
flags
[
ZIMAGE_KERNEL
]
&&
boot
.
k_fmt
==
GZIP
)
?
ZOPFLI
:
boot
.
k_fmt
;
hdr
->
kernel_size
()
=
compress
(
fmt
,
fd
,
m
.
buf
,
m
.
sz
);
hdr
->
kernel_size
()
=
compress
(
fmt
,
fd
,
m
.
buf
,
m
.
sz
);
...
...
native/jni/boot/main.cpp
View file @
1699da17
...
@@ -20,30 +20,38 @@ Usage: %s <action> [args...]
...
@@ -20,30 +20,38 @@ Usage: %s <action> [args...]
Supported actions:
Supported actions:
unpack [-n] [-h] <bootimg>
unpack [-n] [-h] <bootimg>
Unpack <bootimg> to, if available, kernel, kernel_dtb, ramdisk.cpio,
Unpack <bootimg> to its individual components, each component to
second, dtb, extra, and recovery_dtbo into current directory.
a file with its corresponding file name in the current directory.
If '-n' is provided, it will not attempt to decompress kernel or
Supported components: kernel, kernel_dtb, ramdisk.cpio, second,
ramdisk.cpio from their original formats.
dtb, extra, and recovery_dtbo.
If '-h' is provided, it will dump header info to 'header',
By default, each component will be automatically decompressed
which will be parsed when repacking.
on-the-fly before writing to the output file.
If '-n' is provided, all decompression operations will be skipped;
each component will remain untouched, dumped in its original format.
If '-h' is provided, the boot image header information will be
dumped to the file 'header', which can be used to modify header
configurations during repacking.
Return values:
Return values:
0:valid 1:error 2:chromeos
0:valid 1:error 2:chromeos
repack [-n] <origbootimg> [outbootimg]
repack [-n] <origbootimg> [outbootimg]
Repack boot image components from current directory
Repack boot image components using files from the current directory
to [outbootimg], or new-boot.img if not specified.
to [outbootimg], or 'new-boot.img' if not specified.
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
<origbootimg> is the original boot image used to unpack the components.
otherwise it will compress ramdisk.cpio and kernel with the same format
By default, each component will be automatically compressed using its
as in <origbootimg> if the file provided is not already compressed.
corresponding format detected in <origbootimg>. If a component file
If env variable PATCHVBMETAFLAG is set to true, all disable flags will
in the current directory is already compressed, then no addition
be set in the vbmeta header.
compression will be performed for that specific component.
If '-n' is provided, all compression operations will be skipped.
If env variable PATCHVBMETAFLAG is set to true, all disable flags in
the boot image's vbmeta header will be set.
hexpatch <file> <hexpattern1> <hexpattern2>
hexpatch <file> <hexpattern1> <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
Search <hexpattern1> in <file>, and replace
it
with <hexpattern2>
cpio <incpio> [commands...]
cpio <incpio> [commands...]
Do cpio commands to <incpio> (modifications are done in-place)
Do cpio commands to <incpio> (modifications are done in-place)
Each command is a single argument, add quotes for each command
Each command is a single argument, add quotes for each command
.
Supported commands:
Supported commands:
exists ENTRY
exists ENTRY
Return 0 if ENTRY exists, else return 1
Return 0 if ENTRY exists, else return 1
...
@@ -60,7 +68,7 @@ Supported actions:
...
@@ -60,7 +68,7 @@ Supported actions:
extract [ENTRY OUT]
extract [ENTRY OUT]
Extract ENTRY to OUT, or extract all entries to current directory
Extract ENTRY to OUT, or extract all entries to current directory
test
test
Test the c
urrent c
pio's status
Test the cpio's status
Return value is 0 or bitwise or-ed of following values:
Return value is 0 or bitwise or-ed of following values:
0x1:Magisk 0x2:unsupported 0x4:Sony
0x1:Magisk 0x2:unsupported 0x4:Sony
patch
patch
...
@@ -73,8 +81,8 @@ Supported actions:
...
@@ -73,8 +81,8 @@ Supported actions:
sha1
sha1
Print stock boot SHA1 if previously backed up in ramdisk
Print stock boot SHA1 if previously backed up in ramdisk
dtb <
input
> <action> [args...]
dtb <
file
> <action> [args...]
Do dtb related actions to <
input
>
Do dtb related actions to <
file
>
Supported actions:
Supported actions:
print [-f]
print [-f]
Print all contents of dtb for debugging
Print all contents of dtb for debugging
...
@@ -84,7 +92,7 @@ Supported actions:
...
@@ -84,7 +92,7 @@ Supported actions:
Modifications are done directly to the file in-place
Modifications are done directly to the file in-place
Configure with env variables: KEEPVERITY
Configure with env variables: KEEPVERITY
split <
input
>
split <
file
>
Split image.*-dtb into kernel + kernel_dtb
Split image.*-dtb into kernel + kernel_dtb
sha1 <file>
sha1 <file>
...
@@ -94,8 +102,11 @@ Supported actions:
...
@@ -94,8 +102,11 @@ Supported actions:
Cleanup the current working directory
Cleanup the current working directory
compress[=format] <infile> [outfile]
compress[=format] <infile> [outfile]
Compress <infile> with [format] (default: gzip), optionally to [outfile]
Compress <infile> with [format] to [outfile].
<infile>/[outfile] can be '-' to be STDIN/STDOUT
<infile>/[outfile] can be '-' to be STDIN/STDOUT.
If [format] is not specified, then gzip will be used.
If [outfile] is not specified, then <infile> will be replaced
with another file suffixed with a matching file extension.
Supported formats: )EOF"
,
arg0
);
Supported formats: )EOF"
,
arg0
);
print_formats
();
print_formats
();
...
@@ -103,8 +114,10 @@ Supported actions:
...
@@ -103,8 +114,10 @@ Supported actions:
fprintf
(
stderr
,
R"EOF(
fprintf
(
stderr
,
R"EOF(
decompress <infile> [outfile]
decompress <infile> [outfile]
Detect format and decompress <infile>, optionally to [outfile]
Detect format and decompress <infile> to [outfile].
<infile>/[outfile] can be '-' to be STDIN/STDOUT
<infile>/[outfile] can be '-' to be STDIN/STDOUT.
If [outfile] is not specified, then <infile> will be replaced
with another file removing its archive format file extension.
Supported formats: )EOF"
);
Supported formats: )EOF"
);
print_formats
();
print_formats
();
...
...
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