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
86f778c0
Commit
86f778c0
authored
Feb 24, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group unsupported formats into the same code
parent
defbbdfe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
17 deletions
+6
-17
bootimg.cpp
native/jni/magiskboot/bootimg.cpp
+5
-9
boot_patch.sh
scripts/boot_patch.sh
+1
-8
No files found.
native/jni/magiskboot/bootimg.cpp
View file @
86f778c0
...
@@ -44,10 +44,8 @@ boot_img::~boot_img() {
...
@@ -44,10 +44,8 @@ boot_img::~boot_img() {
delete
b_hdr
;
delete
b_hdr
;
}
}
#define CHROMEOS_RET 2
#define UNSUPP_RET 1
#define ELF32_RET 3
#define CHROME_RET 2
#define ELF64_RET 4
int
boot_img
::
parse_file
(
const
char
*
image
)
{
int
boot_img
::
parse_file
(
const
char
*
image
)
{
mmap_ro
(
image
,
(
void
**
)
&
map_addr
,
&
map_size
);
mmap_ro
(
image
,
(
void
**
)
&
map_addr
,
&
map_size
);
fprintf
(
stderr
,
"Parsing boot image: [%s]
\n
"
,
image
);
fprintf
(
stderr
,
"Parsing boot image: [%s]
\n
"
,
image
);
...
@@ -74,15 +72,13 @@ int boot_img::parse_file(const char *image) {
...
@@ -74,15 +72,13 @@ int boot_img::parse_file(const char *image) {
/* Unsupported */
/* Unsupported */
case
ELF32
:
case
ELF32
:
exit
(
ELF32_RET
);
case
ELF64
:
case
ELF64
:
exit
(
ELF64
_RET
);
exit
(
UNSUPP
_RET
);
default
:
default
:
break
;
break
;
}
}
}
}
LOGE
(
"No boot image magic found!
\n
"
);
exit
(
UNSUPP_RET
);
exit
(
1
);
}
}
#define pos_align() pos = do_align(pos, hdr.page_size())
#define pos_align() pos = do_align(pos, hdr.page_size())
...
@@ -177,7 +173,7 @@ int boot_img::parse_image(uint8_t *head) {
...
@@ -177,7 +173,7 @@ int boot_img::parse_image(uint8_t *head) {
fprintf
(
stderr
,
"KERNEL_FMT [%s]
\n
"
,
fmt2name
[
k_fmt
]);
fprintf
(
stderr
,
"KERNEL_FMT [%s]
\n
"
,
fmt2name
[
k_fmt
]);
fprintf
(
stderr
,
"RAMDISK_FMT [%s]
\n
"
,
fmt2name
[
r_fmt
]);
fprintf
(
stderr
,
"RAMDISK_FMT [%s]
\n
"
,
fmt2name
[
r_fmt
]);
return
(
flags
&
CHROMEOS_FLAG
)
?
CHROME
OS
_RET
:
0
;
return
(
flags
&
CHROMEOS_FLAG
)
?
CHROME_RET
:
0
;
}
}
void
boot_img
::
find_dtb
()
{
void
boot_img
::
find_dtb
()
{
...
...
scripts/boot_patch.sh
View file @
86f778c0
...
@@ -75,19 +75,12 @@ ui_print "- Unpacking boot image"
...
@@ -75,19 +75,12 @@ ui_print "- Unpacking boot image"
case
$?
in
case
$?
in
1
)
1
)
abort
"! Un
able to unpack boot image
"
abort
"! Un
supported/Unknown image format
"
;;
;;
2
)
2
)
ui_print
"- ChromeOS boot image detected"
ui_print
"- ChromeOS boot image detected"
CHROMEOS
=
true
CHROMEOS
=
true
;;
;;
3
)
ui_print
"! Sony ELF32 format detected"
abort
"! Please use BootBridge from @AdrianDC to flash Magisk"
;;
4
)
ui_print
"! Sony ELF64 format detected"
abort
"! Stock kernel cannot be patched, please use a custom kernel"
esac
esac
##########################################################################################
##########################################################################################
...
...
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