android 折腾笔记

发布于 23 小时前  3 次阅读


1、解包系统包

解压payload 使用payloaddumper python或者可执行都可以

解压super分区 如果是多个文件 (_sparsechunk.*) 要simg2img 直接加*通配符

然后lpunpack

cat合并之后的文件会出问题

2、解包modem/radio

使用file命令检查文件头

如果是ext fat之类的直接挂载

ubuntu下安装gnome的磁盘软件 disks 之类的 右键就能挂载

如果不是标准的img 双击不可以挂 则mkdir /mnt/文件夹

mount 镜像 /mnt/文件夹

如果是spilit image 就要用simg2img

顺便moto有个特殊的工具

https://gist.github.com/adithya2306/88e8fc468695bcdaa8b880ba4bd01420#file-unpack-moto-img-py

3、解包boot.img

//更新:

其他都是渣渣

直接用magiskboot

编译magisk源码 在

native/obj/debug-nolibc/local/<architure> 下面

MagiskBoot - Boot Image Modification Tool

Usage: magiskboot <action> [args...]

Supported actions:
 unpack [-n] [-h] <bootimg>
   Unpack <bootimg> to its individual components, each component to
   a file with its corresponding file name in the current directory.
   Supported components: kernel, kernel_dtb, ramdisk.cpio, second,
   dtb, extra, and recovery_dtbo.
   By default, each component will be decompressed on-the-fly.
   If '-n' is provided, all decompression operations will be skipped;
   each component will remain untouched, dumped in its original format.
   If '-h' is provided, the boot image header information will be
   dumped to the file 'header', which can be used to modify header
   configurations during repacking.
   Return values:
   0:valid    1:error    2:chromeos

 repack [-n] <origbootimg> [outbootimg]
   Repack boot image components using files from the current directory
   to [outbootimg], or 'new-boot.img' if not specified. Current directory
   should only contain required files for [outbootimg], or incorrect
   [outbootimg] may be produced.
   <origbootimg> is the original boot image used to unpack the components.
   By default, each component will be automatically compressed using its
   corresponding format detected in <origbootimg>. If a component file
   in the current directory is already compressed, then no addition
   compression will be performed for that specific component.
   If '-n' is provided, all compression operations will be skipped.
   If env variable PATCHVBMETAFLAG is set to true, all disable flags in
   the boot image's vbmeta header will be set.

 verify <bootimg> [x509.pem]
   Check whether the boot image is signed with AVB 1.0 signature.
   Optionally provide a certificate to verify whether the image is
   signed by the public key certificate.
   Return value:
   0:valid    1:error

 sign <bootimg> [name] [x509.pem pk8]
   Sign <bootimg> with AVB 1.0 signature.
   Optionally provide the name of the image (default: '/boot').
   Optionally provide the certificate/private key pair for signing.
   If the certificate/private key pair is not provided, the AOSP
   verity key bundled in the executable will be used.

 extract <payload.bin> [partition] [outfile]
   Extract [partition] from <payload.bin> to [outfile].
   If [outfile] is not specified, then output to '[partition].img'.
   If [partition] is not specified, then attempt to extract either
   'init_boot' or 'boot'. Which partition was chosen can be determined
   by whichever 'init_boot.img' or 'boot.img' exists.
   <payload.bin> can be '-' to be STDIN.

 hexpatch <file> <hexpattern1> <hexpattern2>
   Search <hexpattern1> in <file>, and replace it with <hexpattern2>

 cpio <incpio> [commands...]
   Do cpio commands to <incpio> (modifications are done in-place).
   Each command is a single argument; add quotes for each command.
   See "cpio --help" for supported commands.

 dtb <file> <action> [args...]
   Do dtb related actions to <file>.
   See "dtb --help" for supported actions.

 split [-n] <file>
   Split image.*-dtb into kernel + kernel_dtb.
   If '-n' is provided, decompression operations will be skipped;
   the kernel will remain untouched, split in its original format.

 sha1 <file>
   Print the SHA1 checksum for <file>

 cleanup
   Cleanup the current working directory

 compress[=format] <infile> [outfile]
   Compress <infile> with [format] to [outfile].
   <infile>/[outfile] can be '-' to be STDIN/STDOUT.
   If [format] is not specified, then gzip will be used.
   If [outfile] is not specified, then <infile> will be replaced
   with another file suffixed with a matching file extension.
   Supported formats: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg  

 decompress <infile> [outfile]
   Detect format and decompress <infile> to [outfile].
   <infile>/[outfile] can be '-' to be STDIN/STDOUT.
   If [outfile] is not specified, then <infile> will be replaced
   with another file removing its archive format file extension.
   Supported formats: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg

兼容性极强! 能刷magisk的机子约等于能用

最后更新于 2025-01-09