Compare commits

..

2 Commits

Author SHA1 Message Date
Wang Han
30cd19ec9c Fix formatting and update comments in bootimg.cpp 2026-01-17 16:35:41 +08:00
Wang Han
1f1eb01a7d magiskboot: Fix tail offset calculation 2026-01-17 14:38:51 +08:00
2 changed files with 3 additions and 6 deletions

View File

@@ -292,7 +292,7 @@ static int find_dtb_offset(const uint8_t *buf, unsigned sz) {
auto fdt_hdr = reinterpret_cast<const fdt_header *>(curr);
// Check that fdt_header.totalsize does not overflow kernel image size or is empty dtb
// https://github.com/torvalds/linux/commit/7b937cc243e5b1df8780a0aa743ce800df6c68d1
// https://github.com/torvalds/linux/commit/7b937cc243e5b1df8780a0aa743ce800df6c68d1
uint32_t totalsize = fdt_hdr->totalsize;
if (totalsize > end - curr || totalsize <= 0x48)
continue;
@@ -913,8 +913,6 @@ void repack(Utf8CStr src_img, Utf8CStr out_img, bool skip_comp) {
file_align();
}
off.tail = lseek(fd, 0, SEEK_CUR);
// Proprietary stuffs
if (boot.flags[SEANDROID_FLAG]) {
xwrite(fd, SEANDROID_MAGIC, 16);
@@ -925,6 +923,7 @@ void repack(Utf8CStr src_img, Utf8CStr out_img, bool skip_comp) {
xwrite(fd, LG_BUMP_MAGIC, 16);
}
off.tail = lseek(fd, 0, SEEK_CUR);
file_align();
// vbmeta

View File

@@ -137,9 +137,7 @@ case "$1" in
# Back up PREINITDEVICE from existing partition before OTA on A-only devices
if ! $backuptool_ab; then
initialize
# Suppress ui_print for this stage
ui_print() { return; }
get_flags
RECOVERYMODE=false
find_boot_image
$MAGISKBIN/magiskboot unpack "$BOOTIMAGE"
$MAGISKBIN/magiskboot cpio ramdisk.cpio "extract .backup/.magisk config.orig"