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
985249c3
Commit
985249c3
authored
May 12, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support GKIs without ramdisk
Fix #5819
parent
622e0986
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
bootimg.cpp
native/jni/boot/bootimg.cpp
+7
-0
twostage.cpp
native/jni/init/twostage.cpp
+9
-1
boot_patch.sh
scripts/boot_patch.sh
+1
-1
No files found.
native/jni/boot/bootimg.cpp
View file @
985249c3
...
@@ -398,6 +398,13 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
...
@@ -398,6 +398,13 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
}
}
fprintf
(
stderr
,
"%-*s [%s]
\n
"
,
PADDING
,
"RAMDISK_FMT"
,
fmt2name
[
r_fmt
]);
fprintf
(
stderr
,
"%-*s [%s]
\n
"
,
PADDING
,
"RAMDISK_FMT"
,
fmt2name
[
r_fmt
]);
}
}
if
(
!
hdr
->
is_vendor
&&
hdr
->
ramdisk_size
()
==
0
&&
hdr
->
header_version
()
==
4
)
{
// When a v4 boot image does not contain ramdisk, we will have to create
// the CPIO from scratch. However, since this ramdisk will have to be merged
// with other vendor ramdisks, it has to use the exact same compression method.
// v4 GKIs are required to use lz4 (legacy), so hardcode it here.
r_fmt
=
LZ4_LEGACY
;
}
if
(
auto
size
=
hdr
->
extra_size
())
{
if
(
auto
size
=
hdr
->
extra_size
())
{
e_fmt
=
check_fmt_lg
(
extra
,
size
);
e_fmt
=
check_fmt_lg
(
extra
,
size
);
fprintf
(
stderr
,
"%-*s [%s]
\n
"
,
PADDING
,
"EXTRA_FMT"
,
fmt2name
[
e_fmt
]);
fprintf
(
stderr
,
"%-*s [%s]
\n
"
,
PADDING
,
"EXTRA_FMT"
,
fmt2name
[
e_fmt
]);
...
...
native/jni/init/twostage.cpp
View file @
985249c3
...
@@ -17,7 +17,15 @@ void FirstStageInit::prepare() {
...
@@ -17,7 +17,15 @@ void FirstStageInit::prepare() {
cp_afc
(
"/init"
/* magiskinit */
,
REDIR_PATH
);
cp_afc
(
"/init"
/* magiskinit */
,
REDIR_PATH
);
unlink
(
"/init"
);
unlink
(
"/init"
);
xrename
(
backup_init
(),
"/init"
);
const
char
*
orig_init
=
backup_init
();
if
(
access
(
orig_init
,
F_OK
)
==
0
)
{
xrename
(
orig_init
,
"/init"
);
}
else
{
// If the backup init is missing, this means that the boot ramdisk
// was created from scratch, and the real init is in a separate CPIO,
// which is guaranteed to be placed at /system/bin/init.
xsymlink
(
INIT_PATH
,
"/init"
);
}
{
{
auto
init
=
mmap_data
(
"/init"
,
true
);
auto
init
=
mmap_data
(
"/init"
,
true
);
...
...
scripts/boot_patch.sh
View file @
985249c3
...
@@ -111,7 +111,7 @@ if [ -e ramdisk.cpio ]; then
...
@@ -111,7 +111,7 @@ if [ -e ramdisk.cpio ]; then
./magiskboot cpio ramdisk.cpio
test
./magiskboot cpio ramdisk.cpio
test
STATUS
=
$?
STATUS
=
$?
else
else
# Stock A only
system-as-root
# Stock A only
legacy SAR, or some Android 13 GKIs
STATUS
=
0
STATUS
=
0
fi
fi
case
$((
STATUS
&
3
))
in
case
$((
STATUS
&
3
))
in
...
...
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