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
0a28dfe1
Commit
0a28dfe1
authored
Nov 28, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AVB blobs expect to be 4096-byte aligned
parent
1c8ebfac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
bootimg.cpp
native/jni/magiskboot/bootimg.cpp
+8
-3
No files found.
native/jni/magiskboot/bootimg.cpp
View file @
0a28dfe1
...
...
@@ -504,8 +504,10 @@ int unpack(const char *image, bool skip_decomp, bool hdr) {
return
boot
.
flags
[
CHROMEOS_FLAG
]
?
2
:
0
;
}
#define file_align() \
write_zero(fd, align_off(lseek(fd, 0, SEEK_CUR) - off.header, boot.hdr->page_size()))
#define file_align_with(page_size) \
write_zero(fd, align_off(lseek(fd, 0, SEEK_CUR) - off.header, page_size))
#define file_align() file_align_with(boot.hdr->page_size())
void
repack
(
const
char
*
src_img
,
const
char
*
out_img
,
bool
skip_comp
)
{
const
boot_img
boot
(
src_img
);
...
...
@@ -682,8 +684,11 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
file_align
();
// vbmeta
off
.
vbmeta
=
lseek
(
fd
,
0
,
SEEK_CUR
);
if
(
boot
.
flags
[
AVB_FLAG
])
{
// According to avbtool.py, if the input is not an Android sparse image
// (which boot images are not), the default block size is 4096
file_align_with
(
4096
);
off
.
vbmeta
=
lseek
(
fd
,
0
,
SEEK_CUR
);
uint64_t
vbmeta_size
=
__builtin_bswap64
(
boot
.
avb_footer
->
vbmeta_size
);
xwrite
(
fd
,
boot
.
avb_meta
,
vbmeta_size
);
}
...
...
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