topjohnwu
d81ccde569
Pretty print dtb content
2019-09-20 03:05:14 -04:00
topjohnwu
53de6da26c
Only print relevant info according to header version
2019-09-17 05:11:09 -04:00
topjohnwu
3e30ccdeee
Make parsing behaves according to header
...
Close #1778 . Close #1848
2019-09-17 05:01:04 -04:00
osm0sis
a48c4f9e05
magiskboot: don't clobber /overlay with cpio restore anymore
...
- Magisk "dirty" flashes would remove the /overlay directory which might have been put there by a custom kernel or other mod
- this is a leftover from when Magisk itself used /overlay for placing init.magisk.rc, so just remove this file specifically and leave the rest intact
2019-06-27 18:59:54 -04:00
topjohnwu
e8d900c58e
Fix typo
2019-06-15 18:12:12 -07:00
topjohnwu
a6241ae912
Fix magiskboot unpack option parsing
2019-06-15 16:15:12 -07:00
osm0sis
ee407472cf
magiskboot: allow forcing no recompression on ramdisk.cpio
...
- when input image had a compressed ramdisk magiskboot had no way to force the repack with the uncompressed ramdisk.cpio since it does not formally recognize cpio as its own format, so add a switch to support forcing repacking to any possible ramdisk format regardless of input image
2019-06-10 21:57:39 -07:00
osm0sis
f341f3b2dd
magiskboot: accept forcing recognized but unsupported format compression
...
- when input image had a different supported format (e.g. gzip) magiskboot would not accept a manually compressed ramdisk or kernel in an unsupported format (e.g. lzop) despite being able to recognize it, so instead would double compress using whatever the input format was, breaking the image with, in effect, a ramdisk.cpio.lzo.gz
2019-06-10 21:56:51 -07:00
Ian Macdonald
8513946e09
'magiskboot hexpatch' will exit with status 1 when nothing patched.
2019-06-10 21:41:40 -07:00
osm0sis
bf58205b0a
magiskboot: be clear lzop is not a supported compression format
...
- keep detection and always display detected format type to fascilitate external support
2019-05-30 20:31:24 -07:00
osm0sis
b79d1bcded
magiskboot: clean up remaining unneeded ELF detection bits
...
- default for no format match is UNSUPP_RET (unsupported) so there is no needed to explicitly detect ELF still
2019-05-21 02:49:19 -07:00
Chris Renshaw
17e234f9d5
magiskboot: fix bootimg hdr v2 checksum generation
...
- new AOSP dtb section was missing from HASH_update
2019-05-21 02:49:19 -07:00
osm0sis
2ff5d9606b
magiskboot: add support for remaining Nook HD pre-image loaders
2019-05-19 17:38:41 -07:00
osm0sis
b0d6de783e
Correct magiskboot help
2019-05-09 20:28:48 -07:00
topjohnwu
00a9f18a1e
Build with -Wall
2019-04-29 21:26:43 -04:00
topjohnwu
e784212283
Update tools docs
2019-03-28 04:54:06 -04:00
topjohnwu
b7e2e972c7
Support boot_img_hdr_v2
2019-03-13 16:51:22 -04:00
topjohnwu
a57a94040e
Update some format magics
2019-03-08 00:47:15 -05:00
topjohnwu
1bde78d121
Rename patch_level -> os_patch_level
2019-03-07 21:59:03 -05:00
topjohnwu
bbd014ad1b
More saftey checks and improvements
2019-03-07 21:49:47 -05:00
topjohnwu
1287372f5a
Support patching header in magiskboot
2019-03-07 21:32:01 -05:00
topjohnwu
bbe4b69c8d
Fix LZ4FEncoder constructor
2019-03-07 19:58:59 -05:00
topjohnwu
7f08c06943
Remove unnecessary '--' from magiskboot actions
2019-03-07 18:07:23 -05:00
topjohnwu
0442d6d509
Only compress kernel and ramdisk if input not compressed
2019-03-07 07:24:20 -05:00
topjohnwu
e72c6685ed
Support A only System-as-root Devices
...
Most Chinese devices (and supposedly Galaxy S10) running Android Pie
is using system-as-root without A/B partition.
https://source.android.com/devices/bootloader/system-as-root#about-system-as-root
According to the docs above, these devices will have a ramdisk block
with size 0 in their boot images. Since magiskinit can run independently
on system-as-root devices, we simply just create an empty ramdisk with
magiskinit added as init.
Huge thanks to @vvb2060 for the heads up and original PR.
Close #980 , close #1102
2019-02-28 05:46:36 -05:00
topjohnwu
c9fa8118d1
Some code adjustments
2019-02-24 23:09:34 -05:00
topjohnwu
63b18246d8
Add compressed ramdisk support
2019-02-24 20:39:01 -05:00
topjohnwu
16ec37a226
Fix compression without outname
2019-02-24 17:45:08 -05:00
topjohnwu
c84023bdc2
Fix crashes when removing verity_key
2019-02-24 04:29:15 -05:00
topjohnwu
86f778c0aa
Group unsupported formats into the same code
2019-02-24 02:30:04 -05:00
topjohnwu
340bac7e42
Add decompression command
2019-02-23 16:53:51 -05:00
topjohnwu
4a398642b8
Set mode in constructor
2019-02-23 15:22:11 -05:00
topjohnwu
9c89e56c56
Add ramdisk compression option
2019-02-23 15:04:15 -05:00
topjohnwu
75939047d1
Fix bugs in compression
2019-02-23 04:51:13 -05:00
topjohnwu
2d7f130d2c
Introduce Java-like OutputStream
2019-02-23 04:51:13 -05:00
topjohnwu
f7ae72a36c
Move CPIO to libutils
2019-02-23 02:42:26 -05:00
topjohnwu
391783e268
Introduce mmap based CPIO class
2019-02-23 02:23:24 -05:00
topjohnwu
6f12c08204
Use ordered map to store CPIO entries
2019-02-22 22:53:20 -05:00
topjohnwu
cb8fe70734
Modernize CPIO code
2019-02-22 02:56:18 -05:00
topjohnwu
69d10b747a
Directly use FDT headers for detection
2019-02-21 05:24:05 -05:00
topjohnwu
da3394f34e
Move image parsing out of header searching
2019-02-21 05:08:38 -05:00
topjohnwu
b4c2a9f49f
More macro magic
2019-02-21 04:14:52 -05:00
topjohnwu
7cee77f57a
Some C++ magic to make code cleaner
2019-02-21 02:54:37 -05:00
topjohnwu
f28bd1972f
Adjust LZ4F block size
2019-02-21 00:52:47 -05:00
topjohnwu
0f92d1de1b
Fix bzip2 decompression
2019-02-20 20:53:54 -05:00
topjohnwu
e59c5c8780
Modernize compress and decompress
2019-02-20 20:49:26 -05:00
kirill9617
86d8026301
Update format.h
...
GZIP magic is \x1f\x8b\x08 not \x1f\x8b\x08\x00
2019-02-20 03:53:41 -05:00
topjohnwu
d67b827338
Rewrite compression with OOP
2019-02-20 02:10:06 -05:00
topjohnwu
ed027ec3ee
Refactor build flags
2019-02-12 05:17:02 -05:00
topjohnwu
71ecbb3af3
Clean/refactor includes
2019-02-10 03:57:51 -05:00
topjohnwu
9275975b2c
Re-organize functions
2019-01-26 06:00:23 -05:00
topjohnwu
3e4c12cf56
Migrate to STL
2019-01-19 23:59:37 -05:00
topjohnwu
b245931c79
Prevent duplicates when "." or ".." occurs
2018-12-09 22:12:04 -05:00
topjohnwu
1fae89cbb6
Add new cpio command: "exists", to magiskboot
2018-12-05 20:27:48 -05:00
topjohnwu
08cd5b81d1
Try to repair boot_hdr v1 entries
2018-12-04 03:30:43 -05:00
topjohnwu
83ae66daea
Change stock boot image SHA1 backup method
2018-11-15 00:33:20 -05:00
topjohnwu
3603b7c82b
Move cmdline and extra_cmdline to the same line
2018-11-08 20:57:30 -05:00
topjohnwu
8745c7884e
Rename Array to Vector
...
Finally get rid of the C style vector, rename the template class to its proper name
2018-11-08 05:03:59 -05:00
topjohnwu
7c12bf7fa1
Modernize code base
2018-11-07 02:10:38 -05:00
topjohnwu
ca35a9681f
Minor code improvements
2018-11-06 05:02:30 -05:00
topjohnwu
3e2afd4b1d
Better debugging output
2018-11-01 01:16:15 -04:00
topjohnwu
2efc423cf8
Add missing flags and move debug logging logic to libutils
2018-10-28 04:25:31 -04:00
topjohnwu
6add02702b
Fix bug in MagiskBoot
2018-10-26 17:02:07 -04:00
topjohnwu
4ecbf8c12c
Remove recovery_dtbo when cleanup
2018-10-24 22:23:14 -04:00
topjohnwu
fc8a3c5fb4
Migrate MagiskBoot to C++
2018-10-24 22:23:14 -04:00
topjohnwu
018c0064cd
Make sure boot_img is initialized correctly
2018-10-22 01:58:50 -04:00
topjohnwu
74aae523ba
Properly support boot image header v1
...
Close #695
2018-10-20 00:27:56 -04:00
topjohnwu
df8b047bca
Generalize logging interface
2018-09-27 03:11:10 -04:00
topjohnwu
190646d50c
Fix incorrect magisk metadata in ramdisk
2018-08-11 16:31:46 +08:00
topjohnwu
5bac442b18
Reorganize sources
2018-08-10 03:49:25 +08:00
topjohnwu
6add682705
Remove high compression mode
2018-08-10 03:49:25 +08:00
topjohnwu
f339a087a2
Let Magisk compile against SDK 16
2018-07-13 22:14:32 +08:00
topjohnwu
058dbc9f9e
Add more indentation
2018-06-21 18:11:43 +08:00
Alexandre Boeglin
f6ee252572
magiskboot: Check dtb header content to avoid false positives
2018-06-10 03:02:13 +08:00
topjohnwu
ac05e2f2e2
Fix tail size calculation
...
Close #381
2018-03-27 00:45:18 +08:00
topjohnwu
9e737df534
Update high compression mode detection logic
2018-03-10 15:55:55 +08:00
Shaka Huang
0b3192c4d5
Check dtb even if kernel is not available
...
By the flow of unpacking boot image of Chrome OS there will be no kernel file but an dtb image. In that case the dtb image won’t be added when repacking boot image.
Signed-off-by: Shaka Huang <shakalaca@gmail.com>
2018-03-03 20:57:55 +08:00
Shaka Huang
968e6237bd
Fix error parsing MTK boot.img
...
Should be copy & paste error:
1. boot->r_fmt should be re-checked instead of boot->k_fmt once MTK header was found in ramdisk.
2. ramdisk_size should be restored instead of kernel_size when uncompressed ramdisk was found.
3. Correct header of ramdisk
Signed-off-by: Shaka Huang <shakalaca@gmail.com>
2018-03-03 20:57:37 +08:00
worstperson
d780b5a0e4
Add support for the Nook Tablet, Acclaim
...
Also changed occurences of NOOK with NOOKHD
2018-03-03 20:55:44 +08:00
worstperson
3e48427eaf
Add support for the new NOOK_MAGIC
...
The new cmdline value that's been in use since Marshmallow
2018-03-03 20:55:44 +08:00
worstperson
31360c34ed
Set NOOK_PRE_HEADER_SZ from 0xFFFFF to 0x100000
...
All applicable Nook HD/HD+ roms are using this offset
2018-03-03 20:55:44 +08:00
topjohnwu
6728445542
Support separate ramdisk images
2018-02-10 03:34:13 +08:00
topjohnwu
28350e3ad9
Support Nook Green Loader
2018-01-30 05:56:59 +08:00
topjohnwu
f48e6c93b8
Support Tegra blobs
2018-01-30 05:20:18 +08:00
topjohnwu
7cfc24d68f
Add DHTB header support
2018-01-29 22:16:02 +08:00
topjohnwu
a58d3ea04d
Use libmincrypt
2018-01-29 15:34:05 +08:00
topjohnwu
dfee9954e0
Small refactor of magiskboot
2018-01-29 03:12:35 +08:00
topjohnwu
eed86c760f
Add support to PXA devices
...
Close #340
2018-01-29 02:44:30 +08:00
topjohnwu
328fc44194
Rename module core to native
2018-01-27 09:11:28 +08:00