Commit Graph

170 Commits

Author SHA1 Message Date
vvb2060 439d497a13 boot image header v4 2021-08-29 03:14:23 -07:00
topjohnwu 34e5a7cd24 Zopfli is not always smaller 2021-08-28 17:16:20 -07:00
topjohnwu 7343c195b7 Cleanup compress.cpp 2021-08-28 17:01:08 -07:00
topjohnwu 0af041b54e Cleanup magiskboot code 2021-08-28 14:07:34 -07:00
Chaosmaster 92a8a3e91f Add zopfli gzip encoder for better compression 2021-08-28 11:00:30 -07:00
Chaosmaster f41575d8b0 Add support for legacy ARM32 zImage 2021-08-28 10:53:45 -07:00
topjohnwu cf8f042a20 Cleanup magiskboot cpio code 2021-08-13 04:53:11 -07:00
topjohnwu 844bc2d808 Remove unused code 2021-08-13 03:30:58 -07:00
topjohnwu 27f7fa7153 Extend stream support 2021-08-13 02:08:56 -07:00
topjohnwu 7df23ceb74 Prevent undefined behavior in magiskboot 2021-05-10 18:38:30 -07:00
Shaka Huang e3801d6965 Fix overflow
`totalsize` might be a big (invalid) number so instead of checking the end address we check the size of the image.

Fix #4049
2021-03-24 03:02:46 -07:00
topjohnwu 1ff45ac5f5 Proper pattern matching
Fix #3998
2021-03-09 04:08:34 -08:00
topjohnwu 117ae71025 Use custom class instead of std::map 2021-03-02 23:16:10 -08:00
topjohnwu 027ec70262 Patch AVB structures
Disable vbmeta verification in flags
2021-03-02 20:37:37 -08:00
topjohnwu 55fdee4d65 Use memmem for searching byte patterns 2021-02-28 14:37:12 -08:00
topjohnwu 0d42f937dd Refactor magiskboot 2021-02-28 14:37:12 -08:00
topjohnwu 2963747d14 Fix LZ4_LG format decompression
Fix #3802, fix #3722, fix #3770, fix #3635, fix #3787, close #3812
2021-02-07 17:40:59 -08:00
topjohnwu d2bc2cfcf8 Install both 32 and 64 bit binaries 2021-01-18 12:37:08 -08:00
topjohnwu b100d0c503 Revert DTB fstab changes 2021-01-14 19:48:00 -08:00
topjohnwu 76061296c9 Let MagiskBoot handle dtb fstab patching 2021-01-14 06:20:12 -08:00
topjohnwu bb303d2da1 Remove old unused code 2021-01-14 05:59:53 -08:00
topjohnwu c91c070343 Re-enable DTB table rebuilding 2021-01-14 05:45:05 -08:00
topjohnwu aec06a6f61 Get proper total image size 2021-01-14 03:55:27 -08:00
topjohnwu f9bde347bc Convert indentation to spaces
The tab war is lost
2020-12-30 22:11:24 -08:00
topjohnwu 552ec1eb35 Header v3 does not have name entry 2020-11-20 22:52:09 -08:00
topjohnwu 02ea3ca525 Headers doesn't always occupy 1 page 2020-10-25 06:25:42 -07:00
topjohnwu 0632b146b8 Add vendor boot image support to magiskboot 2020-10-25 06:09:36 -07:00
topjohnwu 1b0b180761 Fix COMPRESSED macro
Fix #3383
2020-10-25 05:10:19 -07:00
topjohnwu aaaaa3d044 Minor refactoring 2020-10-15 00:19:11 -07:00
topjohnwu f3cd4da026 Make lz4_lg an exception of lz4_legacy 2020-10-14 23:45:06 -07:00
topjohnwu 339ca6d666 Improve magiskboot info logging 2020-10-12 01:55:33 -07:00
topjohnwu 4aeac3b8f4 Support header_version 3 2020-10-12 01:06:42 -07:00
topjohnwu 8b5652ced5 Skip image padding on Pixel C 2020-09-29 02:49:10 -07:00
topjohnwu c91ebfbcc1 Pad images to original sizes with zero
Close #2005
2020-09-26 14:36:57 -07:00
topjohnwu 1e2f776b83 Move logging.hpp 2020-06-17 01:17:28 -07:00
topjohnwu 2f824f59dc Better logging system
Use C++ magic to strip out debug logs at compile time
2020-06-01 04:15:37 -07:00
osm0sis e50295d337 magiskboot: add support for lz4 compressed dt (extra)
- legacy devices brought up to Android 10 may now use a compressed dt in a hdr_v0 AOSP dt variant extra section, so detect, decompress and recompress this
- so far these have only been done using lz4 compression (latest format revision magic), e.g. LOS 17.1 victara (Moto X)
2020-05-30 12:52:15 -07:00
topjohnwu 02dc1172be Revert DTB patches to in-place binary patches
Since we no longer need to add new properties in the device tree, and
all the patches we do removes strings, we can just directly patch
the flat device tree in-place, ignoring basically all the higher level
DTB structure and format to accomplish 100% compatibility.
2020-05-05 01:03:09 -07:00
topjohnwu ba7cb47383 Make version reporting consistent 2020-03-23 01:17:13 -07:00
Zackptg5 d7cd1b37f8 add missing flags 2020-03-22 13:41:55 -07:00
topjohnwu a0998009c1 Small native code reorganization 2020-03-09 01:50:30 -07:00
osm0sis a7435dad6d magiskboot: fix lzop detection 2020-02-01 01:09:12 +08:00
topjohnwu 5b56ca7ffc Use MAX_FDT_GROWTH instead of hardcode value 2020-02-01 00:58:33 +08:00
topjohnwu 5c988510b3 Preserve fdt paddings
Some Motorola devices (Qualcomm kernel with CONFIG_MMI_DEVICE_DTBS
configuration enabled) need 1k of padding to the DTBs to allow for
environment variables to be runtime added by the bootloader.
Those extra paddings will be removed during the process of dtb patch,
devices won’t be able to boot-up and return to fastboot mode immediately
after flashed the flawed boot.img.

Credits to @shakalaca, close #2273
2020-02-01 00:48:21 +08:00
topjohnwu 290624844b Reorganize dtb code 2020-02-01 00:15:52 +08:00
topjohnwu 242e64d72f Make write return something sane 2020-01-06 17:09:09 +08:00
topjohnwu 2262af728e Eliminate undefined behavior 2020-01-06 05:31:38 +08:00
topjohnwu 78c64d39ec Add split command to magiskboot
Allow splitting image.*-dtb files to kernel and dtb
2019-12-30 13:04:39 +08:00
Zackptg5 d19f65ce4a Ignore twrp fstabs 2019-12-28 13:47:05 +08:00
topjohnwu af060b3132 General QoL changes 2019-12-13 00:37:06 -05:00