Create a TWRP-compatible device tree only from an Android recovery image (or a boot image if the device uses non-dynamic partitions A/B) of your device's stock ROM.
It has been confirmed that this script supports images built starting from Android 4.4 up to Android 12
Installation
Bash:
pip3 install twrpdtgen
The module is supported on Python 3.6 and above.
Linux only: Be sure to have cpio installed in your system (Install cpio using sudo apt install cpio or sudo pacman -S cpio based on what package manager you're using)
Bash:
$ python3 -m twrpdtgen -h
TWRP device tree generator
usage: python3 -m twrpdtgen [-h] [-o OUTPUT] [-k] [--no-git] [--huawei] [--recovery_kernel RECOVERY_KERNEL] [--recovery_ramdisk RECOVERY_RAMDISK]
[--recovery_vendor RECOVERY_VENDOR] [-v]
[recovery_image]
positional arguments:
recovery_image path to a recovery image (or boot image if the device is A/B)
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
custom output folder
-k, --keep-aik keep AIK after the generation
--no-git don't create a git repo after the generation
--huawei Huawei mode (split kernel, ramdisk and vendor)
--recovery_kernel RECOVERY_KERNEL
path to a recovery_kernel file (huawei mode only)
--recovery_ramdisk RECOVERY_RAMDISK
path to a recovery_ramdisk file (huawei mode only)
--recovery_vendor RECOVERY_VENDOR
path to a recovery_vendor file (huawei mode only)
-v, --verbose enable debugging logging
When an image is provided, if everything goes well, there will be a device tree at
Bash:
output/manufacturer/codename
You can find the script source code here: https://github.com/SebaUbuntu/TWRP-device-tree-generator
reserved
Deleted
Noiceee
Hi, trying to use this but I get error Arch not supported on my poco f2 pro. Any idea?
Amazing work, this tool useful for create basic configuration for recovery:good:
Nice work!
but the descriptions says samsung odin tar support.
script accepts only .img files.
Hello Everyone and @SebaUbuntu. How do you think we can extract and make appended DTBs? Most new devices do not make use of a DT.img anymore. Even though the script doesn't support this, I want to do it by hand manually using a recovery.img But how?
---------- Post added at 08:43 AM ---------- Previous post was at 08:41 AM ----------
itzik16 said:
Nice work!
but the descriptions says samsung odin tar support.
script accepts only .img files.
Click to expand...
Click to collapse
do not worry, just rename the .tar.md5 to .tar and extract the recovery image from inside it to use in the script. Easy
NullCode said:
Hello Everyone and @SebaUbuntu. How do you think we can extract and make appended DTBs? Most new devices do not make use of a DT.img anymore. Even though the script doesn't support this, I want to do it by hand manually using a recovery.img But how?
---------- Post added at 08:43 AM ---------- Previous post was at 08:41 AM ----------
do not worry, just rename the .tar.md5 to .tar and extract the recovery image from inside it to use in the script. Easy
Click to expand...
Click to collapse
TWRP supports dt.img, there's no need to append it
Hey there, @SebaUbuntu, I tried to use your latest script as python. I see you use AIK to unpack recovery.img. But it cant unpack my recovery.img and says my image is in unsupported format. But my recovery.img isn't corrupted. And if I clone AIK myself w/o the script, It does unpack my recovery.img successfully. So what is the problem?
Royna said:
Hey there, @SebaUbuntu, I tried to use your latest script as python. I see you use AIK to unpack recovery.img. But it cant unpack my recovery.img and says my image is in unsupported format. But my recovery.img isn't corrupted. And if I clone AIK myself w/o the script, It does unpack my recovery.img successfully. So what is the problem?
Click to expand...
Click to collapse
I think you should remove the generator and clone it again. Because with my recovery images it works perfectly [or remove the aik folder from where it is in the tree gen with your own one]
---------- Post added at 03:40 AM ---------- Previous post was at 03:35 AM ----------
SebaUbuntu said:
TWRP supports dt.img, there's no need to append it
Click to expand...
Click to collapse
thanks a lot for clearing it up!
@SebaUbuntu, is this script not supported in macOS Big Sur (The lastest beta ver.)? Installed the python module using the guide on your Github wiki. Run
Code:
python -m twrpdtgen /Users/roynatech/Desktop/recovery.img
with the terminal pointing at the root of cloned script.
Output:
Code:
TWRP device tree generator
Python Edition
Version 1.0.0
Cloning AIK...
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/roynatech/Downloads/TWRP-device-tree-generator/twrpdtgen/__main__.py", line 6, in <module>
main()
File "/Users/roynatech/Downloads/TWRP-device-tree-generator/twrpdtgen/twrp_dt_gen.py", line 53, in main
aik_ramdisk_path, aik_images_path = aik.extract_recovery(recovery_image)
File "/Users/roynatech/Downloads/TWRP-device-tree-generator/twrpdtgen/aik_manager.py", line 59, in extract_recovery
copyfile(recovery_image, new_recovery_image)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py", line 261, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/roynatech/Downloads/TWRP-device-tree-generator/extract/recovery.img'
What's wrong here?
I also had the same error, can anyone help me? I'm using Windows 10 and trying to create my Nokia device tree!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
hey i am trying this out but i got this error
Error: Please clone the script with Git instead of downloading it as a zip
i cloned the repo but it still says this
[INFO] Cloning AIK...
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/data/data/com.termux/files/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/__main__.py", line 28, in <module>
dt = generate_device_tree(args.recovery_image, args.output, no_git=args.no_git, keep_aik=args.keep_aik)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/twrp_dt_gen.py", line 30, in generate_device_tree
aik.extract(recovery_image)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/utils/aik_manager.py", line 64, in extract
self.get_image_infos()
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/utils/aik_manager.py", line 79, in get_image_infos
self.base_address = self.read_recovery_file(self.get_extracted_info("base"))
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/utils/aik_manager.py", line 108, in read_recovery_file
return file.read_text().splitlines()[0]
File "/data/data/com.termux/files/usr/lib/python3.9/pathlib.py", line 1255, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "/data/data/com.termux/files/usr/lib/python3.9/pathlib.py", line 1241, in open
return io.open(self, mode, buffering, encoding, errors, newline,
File "/data/data/com.termux/files/usr/lib/python3.9/pathlib.py", line 1109, in _opener
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/data/data/com.termux/files/usr/tmp/tmpkxqc0gaz/split_img/recovery.img-base'
Can anyone explain the situation here?
Hi. Can anyone give me the steps to get this running in Minimal ADB on windows? Or do I have to use linux? Treat me like a 5 year old. I'm trying to learn. Haven't been able to figure out how to use this on Kali Linux.
braveone1 said:
[INFO] Cloning AIK...
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/data/data/com.termux/files/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/__main__.py", line 28, in <module>
dt = generate_device_tree(args.recovery_image, args.output, no_git=args.no_git, keep_aik=args.keep_aik)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/twrp_dt_gen.py", line 30, in generate_device_tree
aik.extract(recovery_image)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/utils/aik_manager.py", line 64, in extract
self.get_image_infos()
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/utils/aik_manager.py", line 79, in get_image_infos
self.base_address = self.read_recovery_file(self.get_extracted_info("base"))
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/twrpdtgen/utils/aik_manager.py", line 108, in read_recovery_file
return file.read_text().splitlines()[0]
File "/data/data/com.termux/files/usr/lib/python3.9/pathlib.py", line 1255, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "/data/data/com.termux/files/usr/lib/python3.9/pathlib.py", line 1241, in open
return io.open(self, mode, buffering, encoding, errors, newline,
File "/data/data/com.termux/files/usr/lib/python3.9/pathlib.py", line 1109, in _opener
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/data/data/com.termux/files/usr/tmp/tmpkxqc0gaz/split_img/recovery.img-base'
Can anyone explain the situation here?
Click to expand...
Click to collapse
Similar problem here.
Code:
TWRP device tree generator
Version 1.2.6
[INFO] Cloning AIK...
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/marty/.local/lib/python3.8/site-packages/twrpdtgen/__main__.py", line 52, in <module>
dt = DeviceTree(args.output, recovery_image=args.recovery_image,
File "/home/marty/.local/lib/python3.8/site-packages/twrpdtgen/device_tree.py", line 49, in __init__
aik.extract(recovery_image)
File "/home/marty/.local/lib/python3.8/site-packages/twrpdtgen/utils/aik_manager.py", line 79, in extract
raise RuntimeError(f"AIK extraction failed, return code {returncode}")
RuntimeError: AIK extraction failed, return code 1
Normally the image presented in case of Samsung device should be bootimage right, instead of recoveryimage?
how to update twrpdtgen?
I got:
Code:
[WARNING] Platform prop not found! Defaulting to "default"
How can I do a " Platform prop"?
Related
Hello, I wanna share on this forum about How to unpack, repack, split, mkboot boot.img
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
First, u need a file names Bootimgutils that u can download here.
After u done, u extract the file into a directory that u wanna and give it name (Like, Bootimgutils for the example)
.
Then, U grab boot.img file (U can grab it directly on onepack ROM. U can find boot.img on Code, if u use fullpack ROM)
*Don't forget to check the file permissions as executeable programs. Right-click, properties. Click on permissions tab
Go to terminal (Linux) or Cygwin (Windows)
Type these commands :
Code:
cd Bootimgutils
./split_bootimg.pl boot.img
mkdir ramdisk
cd ramdisk
gzip -dc ../boot.img-ramdisk.gz | cpio -i
cd ..
O.K. Up to ya to edit boot.img.
And, don't forget!
If u have done to change files.
U need to repack it anymore.
For that, u can type :
Code:
./repack_bootimg.pl boot.img-kernel ramdisk bootnew.img
or u can replace it.
U just need to change a command to be like this :
Code:
./repack_bootimg.pl boot.img-kernel ramdisk boot.img
*If u have backup of an original boot.img
CMIIW
^_^
Yeah... Good start mas bro....
huryiw said:
Yeah... Good start mas bro....
Click to expand...
Click to collapse
OK ^_^
hehehe
Can someone make this to extract CyanogenMOD's boot.img or suggest something for this ?
neobuddy89 said:
Can someone make this to extract CyanogenMOD's boot.img or suggest something for this ?
Click to expand...
Click to collapse
boot.img of CM? Sure these commands can be used by everyone for every boot.img
Hello, and thanks for that tutorial, I was wondering for a long time how to extract a boot.img file
But I just have a question: how is it possible to extract another sort of .img file ? Actually, the Alpha ICS firmware from Sony Ericsson includes a system.img file, and for curiosity I'd lile to extract it. Of course I tried the same method by changing "boot.img" by "system.img" in the commands and that didn't work.
help
I'm following these instruction but my boot.img wont boot, even if i don't touch it, just unpack/repack... doesn't work
split:
Code:
./split_bootimg.pl boot.img
Page size: 2048 (0x00000800)
Kernel size: 5046640 (0x004d0170)
Ramdisk size: 180818 (0x0002c252)
Second size: 0 (0x00000000)
Board name:
Command line: console=ttyHSL0,115200,n8 androidboot.hardware=hws7300u vmalloc=578M kgsl.ptcount=16
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
unpack ramdisk:
Code:
mkdir ramdisk
cd ramdisk/
gzip -dc ../boot.img-ramdisk.gz | cpio -i
760 blocks
then repack, modifying base and cmdline according to my device in repack_bootimg.pl
--cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=hws7300u vmalloc=578M kgsl.ptcount=16' --base 0x40200000
Code:
./repack_bootimg.pl boot.img-kernel ramdisk boot.img
760 blocks
repacked boot image written at ramdisk-repack.img
flashed via fastboot, reboot... hang :|
any hint?
EDIT: nevermind... seems that /proc/config.gz is not the right place to find the base address, my base address is 0x40300000 :|
While browsing XDA i didn't find anything for unpacking Livesuite images so i created this THREAD.
Things you need
Allwiner kitchen
Stock Firmware
Linux image tool
Ubuntu 64 bit
Click to expand...
Click to collapse
Lets start
Step 1
Extracting and building the stock image (Windows)
Extract a10_flash_kitchen_v1.zip and look inside the directory, you'll see packer_gb and packer_ics. packer_ics is for Android ICS, so that is the one you will be using.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Open packer_ics and you will notice a bunch of directories and a couple of .bat scripts. We will spend a lot of time in these directories.
Extract the stock firmware you downloaded earlier, and copy the .img file into this directory. Rename the file to original.img.
Run the extract_image.bat script, and a command window will pop up while it is extracting.
The command window will output like the following, it will display Press any key to continue . . . when it is complete. Press a key to close the window.
Once the command window is closed, open the _extract directory and all of the extracted files will be there. The three following files are the ones we are interested in: RFSFAT16_BOOT_00000000000.fex (the boot partition), RFSFAT16_RECOVERY_0000000.fex (the recovery partition), RFSFAT16_SYSTEM_000000000.fex (the system partition, ext4 sparse).
NOTE and WARNING Some systems may also have a RFSFAT16_BOOTLOADER_00000.fex, which may also be required for your device to boot properly. There are some vague instructions @ this TechKnow forums post. I (the reader) will attempt to clarify and modify this page with the updated additional instructions for these devices to aid in making these instructions more universal for anyone using LiveSuit.
Click to expand...
Click to collapse
Step 2
Extracting, modifying and building partitions (Linux)
Copy your Extracted files to ubuntu
Rename the files as follows:
RFSFAT16_BOOT_00000000000.fex -> boot.img
RFSFAT16_RECOVERY_0000000.fex -> recovery.img
RFSFAT16_SYSTEM_000000000.fex -> system.fex
Click to expand...
Click to collapse
Copy the tools.tar.gz archive you downloaded earlier into the same directory.
To extract the tools, right click on the file and click Extract here.
This will extract the tools into a tools subdirectory.
Type terminal to show the terminal application. Hit enter and the terminal will appear.
Boot partition
Code:
$ cd "custom image"
$ tools/split_bootimg.pl boot.img
$ ls
Now extract the ramdisk file into a ramdisk subdirectory.
Code:
$ mkdir ramdisk
$ cd ramdisk
$ gunzip -c ../boot.img-ramdisk.gz | cpio -i
$ ls
You are now able to modify the files as needed.
Once you have finished modifying the file, we will rebuild the image. Run the following commands.
Code:
$ cd ..
$ tools/mkbootfs ramdisk | gzip > ramdisk-new.gz
$ tools/mkbootimg --base 0x40000000 --kernel boot.img-kernel --ramdisk ramdisk-new.gz --cmdline 'console=ttyS0,115200 rw init=/init loglevel=8' -o new-boot.img
$ ls
Recovery partition
his follows the same process as the boot partition. Execute the following commands to extract the image:
Code:
$ tools/split_bootimg.pl recovery.img
$ rm -rf ramdisk
$ mkdir ramdisk
$ cd ramdisk
$ gunzip -c ../recovery.img-ramdisk.gz | cpio -i
$ ls
rebuild the image with the following commands:
Code:
$ cd ..
$ tools/mkbootfs ramdisk | gzip > ramdisk-new.gz
$ tools/mkbootimg --base 0x40000000 --kernel recovery.img-kernel --ramdisk ramdisk-new.gz --cmdline 'console=ttyS0,115200 rw init=/init loglevel=8' -o new-recovery.img
$ ls
System partition
The process for the system partition is different, because it is not bootable and because it is ext4 sparse, so it cannot be mounted straight away. Execute the following commands to convert and mount the image:
Code:
$ tools/simg2img system.fex system.img
$ mkdir system
$ sudo mount -o loop system.img system
$ cd system
$ ls
Once you are done, execute the following commands to rebuild the system image:
Code:
$ cd ../tools
$ sudo ./mkuserimg.sh -s ../system ../new-system.fex ext4 ../tmp 300M
$ cd ..
$ sudo umount system
$ ls
Now switch back to the file browser and you will see many new files in your directory. The three files that you are interested in are new-boot.img, new-recovery.img, new-system.fex
Copy these to your Windows drive to the directory a10_flash_kitchen_v2/packer_ics/_input
Click to expand...
Click to collapse
Step 3
Building the new image (Windows)
Once the files are copied, jump back to Windows and rename the files as following:
new-boot.img -> root.fex
new-recovery.img -> recovery.fex
new-system.fex -> system.fex
Click to expand...
Click to collapse
http://i.imgur.com/klTA5.png/img]
Now we need to make some modifications to the image config file. Navigate to the files directory and you should see image.cfg.
[img]http://i.imgur.com/Wg6Ov.png/img]
Open this file using your text editor that supports Unix line endings. Using Notepad will break this file. Locate the two lines that reference OEM and VOEM as is highlighted below.
[img]http://i.imgur.com/YxczH.png
Comment these lines by adding a semicolon ( to the start of each line. Do not make any other modifications. Save the file once you have made the change.
http://i.imgur.com/urMMN.png/img]
Go back to the packer_ics root directory and find the create_image.bat script. It will open a console while it is creating the new image.
[img]http://i.imgur.com/X2O6l.png
Once the process is complete, you will see Press any key to continue . . . and you will have a new image called output.img.
AND JUST FLASH IT AND YOU ARE DONE
Click to expand...
Click to collapse
Credits
miniandwiki
To ME
To Everyone who helped me creating this one
do i have to use 64bit liux?? i only have a 32 bit computer?? thnx
Permission denied
Hey....
I installed Ubuntu on an external disk. But even logged at su (also tried sudo su) I dont have the permission to perform with the Linux-tool. When I click at the roo-folder, it is already set to rw permission for root.
What am I doing wrong?
Links are broken, can you kindly update them.
Links are broken Pls Upload to another host
This instruction is only valid for modems without a digital signature (or modems with Qualcomm testing signature).
New modem has been tested on my phone Innos D10F (msm8228).
1. Install dependencies:
PHP:
sudo apt-get install p7zip-full
sudo apt-get install lib32z1 lib32ncurses5
sudo apt-get install scons
sudo apt-get install libxml-parser-perl
2. Download all sources:
PHP:
ROOTDIR=$HOME/dev/qcom/msm8626
mkdir -p $ROOTDIR
cd $ROOTDIR
git clone --branch "master" --progress -v "https://v2.pikacode.com/jsr-d10/qcom_msm8626_modem_proc.git" modem_proc
git clone --branch "master" --progress -v "https://v2.pikacode.com/jsr-d10/qcom_msm8626_adsp_proc.git" adsp_proc
git clone --branch "master" --progress -v "https://v2.pikacode.com/jsr-d10/qcom_msm8626_wcnss_proc.git" wcnss_proc
Mirror: magnet:?xt=urn:btih:61e8b8a520181ade801c251e5ec9352e33a7bb8c
3. Copy hexagon_tools_6.4.06.a.7z (this file is present in the torrent) into directory: $HOME/Downloads
4. Install HEXAGON Tools:
PHP:
HEXAGON_ROOT=$HOME/Qualcomm/HEXAGON_Tools
7za x -y -o$HEXAGON_ROOT $HOME/Downloads/hexagon_tools_6.4.06.a.7z
5. Start modem build:
PHP:
ROOTDIR=$HOME/dev/qcom/msm8626
cd $ROOTDIR/modem_proc/build/ms/
./build.sh 8626.gen.prod BUILD_ID=AAAAANAZ -k
For clean repo type:
PHP:
ROOTDIR=$HOME/dev/qcom/msm8626
cd $ROOTDIR/modem_proc/build/ms/
./build.sh 8626.gen.prod BUILD_ID=AAAAANAZ --clean
6. Start ADSP build:
PHP:
ROOTDIR=$HOME/dev/qcom/msm8626
cd $ROOTDIR/adsp_proc/build/ms/
./build.sh msm8x26 msm8x26_MPD BUILD_VER=1234 -k
7. WCNSS module is distributed without sources.
8. Download pil-splitter.py :
PHP:
ROOTDIR=$HOME/dev/qcom/msm8626
cd $ROOTDIR
wget http://github.com/remittor/qcom-mbn-tools/raw/master/pil-splitter.py
9. Copy NON-HLOS.bin image from stock ROM to ROOTDIR directory. Rename NON-HLOS.bin to NON-HLOS-BASE.bin
10. Create file makeimg.sh into ROOTDIR directory and insert following content:
PHP:
cd `dirname $0`
ROOTDIR=$(pwd)
TMPDIR=mbn_images
rm -rf $ROOTDIR/$TMPDIR
mkdir -p $ROOTDIR/$TMPDIR
cd $ROOTDIR/$TMPDIR
MODEM_STK=$ROOTDIR/NON-HLOS-BASE.bin
MODEM_NEW=$ROOTDIR/NON-HLOS.bin
BUILD_ID=AAAAANAZ
IMAGE_DIR=$ROOTDIR/modem_proc/build/ms/bin/$BUILD_ID
python $ROOTDIR/pil-splitter.py $IMAGE_DIR/qdsp6sw.mbn modem
python $ROOTDIR/pil-splitter.py $IMAGE_DIR/mba.mbn mba
BUILD_ID=AAAAAAAA
IMAGE_DIR=$ROOTDIR/adsp_proc/build/ms/bin/$BUILD_ID
python $ROOTDIR/pil-splitter.py $IMAGE_DIR/dsp2.mbn adsp
BUILD_ID=8x26
IMAGE_DIR=$ROOTDIR/wcnss_proc/build/ms/bin/$BUILD_ID
python $ROOTDIR/pil-splitter.py $IMAGE_DIR/wcnss.mbn wcnss
MODEMVERSTR=`grep -aohPz "QC_IMAGE_VERSION_STRING=.*" ./modem.*`
MODEMVER=`echo $MODEMVERSTR | cut -d "=" -f 2`
echo $MODEMVER > $ROOTDIR/ver_info.txt
MODEM_VDISK=/media/vdisk
cp -f $MODEM_STK $MODEM_NEW
sudo mkdir -p $MODEM_VDISK
sudo mount -t vfat $MODEM_NEW -o rw,umask=0000,shortname=lower $MODEM_VDISK
rm -f $MODEM_VDISK/image/modem.*
rm -f $MODEM_VDISK/image/mba.*
rm -f $MODEM_VDISK/image/adsp.*
rm -f $MODEM_VDISK/image/wcnss.*
cp -f ./* $MODEM_VDISK/image/
rm -f $MODEM_VDISK/verinfo/ver_info.txt
mkdir -p $MODEM_VDISK/verinfo
cp -f $ROOTDIR/ver_info.txt $MODEM_VDISK/verinfo/
sudo umount $MODEM_NEW
cd $ROOTDIR
11. Run script makeimg.sh (result: NON-HLOS.bin)
12. New image NON-HLOS.bin should flash in the relevant section of eMMC.
My test result:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
BONUS
Qualcomm Developers Tools (2016)
QXDM 3.14.1144 (76 MB) (with license and patch)
After installation, you must do:
1) Copy qlms.txt to a directory %PUBLIC%\Documents\Qualcomm\QXDM
2) Replace QXDM.exe file to the patched version
QCAT 6.30.30 (140 MB) (with license and patch)
After installation, replace QCAT.exe to the patched version.
wow
you came back with another great thread :fingers-crossed:
thank you for sharing
i have a question
i still confused, where you got those files?
faizauthar12 said:
where you got those files?
Click to expand...
Click to collapse
Chinese Internet contains a lot of closed sources (qcom & MTK).
Sir, can I have source for msm8916 ?
Btw, greet guide sir
@bugerxXx
Check this thread. Post # 3.
Rename the file to .gz or .zip to get it to extract right.
https://forum.xda-developers.com/de...-rom-msm8909-service-rom-source-qpst-t3544178
Code-8916.gz is the link you are looking for.
Dont forget to hit the thanks button.
BigCountry907 said:
@bugerxXx
Check this thread. Post # 3.
Rename the file to .gz or .zip to get it to extract right.
https://forum.xda-developers.com/de...-rom-msm8909-service-rom-source-qpst-t3544178
Code-8916.gz is the link you are looking for.
Dont forget to hit the thanks button.
Click to expand...
Click to collapse
Thank you sir :highfive:
Sir, I need your help
How to solve this ?
Error : tools are untested for QuRT, please contact qurt.support
I'm try to build 8916 modem_proc
The method and instruction can be found here.
https://translate.google.com/transl.../2016/08/build-qualcomm-modem.html&edit-text=
The original page is in russian.
Use google translate.
http://syshwid.blogspot.com/2016/08/build-qualcomm-modem.html
You will need the untranslated page to see the "code" that is in code boxes.
And the translated page to read the instruction.
Dont forget to hit the thanks button.
This stuff is hard to find.
BigCountry907 said:
The method and instruction can be found here.
https://translate.google.com/transl.../2016/08/build-qualcomm-modem.html&edit-text=
The original page is in russian.
Use google translate.
http://syshwid.blogspot.com/2016/08/build-qualcomm-modem.html
You will need the untranslated page to see the "code" that is in code boxes.
And the translated page to read the instruction.
Dont forget to hit the thanks button.
This stuff is hard to find.
Click to expand...
Click to collapse
if the chip suports ,can we enable LTE using this?
redfeast said:
if the chip suports ,can we enable LTE using this?
Click to expand...
Click to collapse
I would lean more towards thinking that to enable LTE would require the driver to be included in the kernel.
Secondary to that some of the NV Items may need switched.
Install file: "/home/test/dev/qcom/msm8626/modem_proc/core/bsp/mba_img/build/AAAAANAZ/MBA_CORE_IMG_AAAAANAZQ.mbn" as "/home/test/dev/qcom/msm8626/modem_proc/core/bsp/mba_img/build/mba.mbn"
=== Generating mba/qdsp6/AAAAANAZ/MBA_CORE_IMG_AAAAANAZQ_wrap.elf
=== Generating mba/qdsp6/AAAAANAZ/MBA_CORE_IMG_AAAAANAZQ_wrap.elf
=== Generating mba/qdsp6/AAAAANAZ/MBA_CORE_IMG_AAAAANAZQ_wrap_reloc.elf
Install file: "/home/test/dev/qcom/msm8626/modem_proc/core/bsp/mba_img/build/AAAAANAZ/wp/MBA_CORE_IMG_AAAAANAZQ_wrap.elf" as "bin/AAAAANAZ/wp/mba.mbn"
Install file: "/home/test/dev/qcom/msm8626/modem_proc/core/bsp/mba_img/build/AAAAANAZ/MBA_CORE_IMG_AAAAANAZQ_wrap_reloc.elf" as "bin/AAAAANAZ/reloc/mba.mbn"
Install file: "/home/test/dev/qcom/msm8626/modem_proc/core/bsp/mba_img/build/AAAAANAZ/MBA_CORE_IMG_AAAAANAZQ_wrap.elf" as "bin/AAAAANAZ/mba.mbn"
scons: done building targets (errors occurred during build).
scons: *** Found dependency cycle(s):
Internal Error: no cycle found for node /home/test/dev/qcom/msm8626/modem_proc/core/bsp/devcfg_img/build/devcfg_img/qdsp6/AAAAANAZ/M8x26AAAAANAZQ00772_relocflags.elf (<SCons.Node.FS.File object at 0x14ece610>) in state pending
Internal Error: no cycle found for node /home/test/dev/qcom/msm8626/modem_proc/core/bsp/devcfg_img/build/devcfg_img/qdsp6/AAAAANAZ/M8x26AAAAANAZQ00772_reloc.elf (<SCons.Node.FS.File object at 0x14ecd960>) in state pending
Internal Error: no cycle found for node /home/test/dev/qcom/msm8626/modem_proc/core/bsp/devcfg_img/build/devcfg_img/qdsp6/AAAAANAZ/devcfg_def.h (<SCons.Node.FS.File object at 0x15aedf30>) in state pending
File "/usr/lib/scons/SCons/Taskmaster.py", line 1043, in cleanup
==============================================================================
SCons build summary
==============================================================================
** Build errors...
/home/test/dev/qcom/msm8626/modem_proc/build/bsp/modem_proc_img/build/AAAAANAZ/MODEM_PROC_IMG_AAAAANAZQ.elf failed: Error 126
** Build time...
Build start : Wed Jan 3 10:57:20 2018
Build end : Wed Jan 3 11:07:50 2018
Elapsed time : 0:10:30
/home/test/dev/qcom/msm8626/modem_proc/tools/build/scons/SCons/scons command returned error: 2
#-------------------------------------------------------------------------------
# BUILD END: AAAAANAZ
#-------------------------------------------------------------------------------
Build AAAAANAZ: Start Time: Wed Jan 3 10:57:20 2018, End Time: Wed Jan 3 11:07:52 2018
Build AAAAANAZ: Delta Time: 10 minutes, 31 seconds
#-------------------------------------------------------------------------------
Overall Start Time: Wed Jan 3 10:57:20 2018, Overall End Time: Wed Jan 3 11:07:52 2018
Overall Delta Time: 10 minutes, 31 seconds
#-------------------------------------------------------------------------------
Hi!
Thanks for these tools, Do you have the last version patched? QXDM 4.0? With 3.14.1144 version, some message shown "unknown" and I can read the information.
Thanks in advance!
Marco.
Update links in first post:
1) qcom_msm8x26_modem: magnet:?xt=urn:btih:61e8b8a520181ade801c251e5ec9352e33a7bb8c&dn=qcom_msm8x26_modem
2) qcom_msm8x26_vendor: magnet:?xt=urn:btih:313a2f9bc1f2b1fe3ad830e9dfbf4d4432fea384&dn=qcom_msm8x26_vendor
remittor said:
Update links in first post:
1) qcom_msm8x26_modem: magnet:?xt=urn:btih:61e8b8a520181ade801c251e5ec9352e33a7bb8c&dn=qcom_msm8x26_modem
2) qcom_msm8x26_vendor: magnet:?xt=urn:btih:313a2f9bc1f2b1fe3ad830e9dfbf4d4432fea384&dn=qcom_msm8x26_vendor
Click to expand...
Click to collapse
Thank you.
Big question about building a image. I know the plmn are in the image.im looking for a way to bypass the simlock check. I proven with a Dev build there are no plmn's and this in turn locks all sim cards. Even one's that should be carrier unlocked for the phone. If this can be accomplished we can just flash the modem.img to simunlock like back in the day.
This is guide for extract payload.bin from OTA zip file
-----------------
Pre-requirement:
- Python3
-----------------
For extract OTA update
Please flow step by step instruction
Step 1: Get a OTA for Nokia 7 plus -> here
Step 2: Download payload_dumper.zip --> View attachment payload_dumper.zip
Step 3: Unzip payload_dumper.zip
This is list file
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Step 4: Open Power Shell (on Windows) or Terminal (on Linux/macOS).
Go to folder payload_dumper with command
Code:
cd "<Path to folder>"
Step 5: Create a python environment with virtualenv
Command:
Code:
virtualenv .py
Step 6: Active python enviroment
Command:
Code:
source .py/bin/activate
Folktroll said:
Works fine. :good:
Step 5 (Windows):
Code:
pip install virtualenv
virtualenv .py
Step 6 (Windows):
Code:
CMD: call .py\Scripts\activate.bat
PS: .py\Scripts\activate.ps1
Click to expand...
Click to collapse
Step 7: Install dependencies with command
Code:
pip install -r requirements.txt
Step 8: Extract OTA.zip file
Step 9: Copy payload.bin file to payload_dumper folder
Step 10: Run command
Code:
python3 payload_dumper.py payload.bin
Step 11: Wait extract...
Step 12: File extracted on out folder in payload_dumper
-----------------
Python 3 can get it here: https://www.python.org/downloads/
Flow step install python 3, please tick to option install pip and virutalenv
Thank you very much.
This tool is very useful for me. I can extract boot.img for rooting my phone with magisk every OTA update package.
Works fine. :good:
Step 5 (Windows):
Code:
pip install virtualenv
virtualenv .py
Step 6 (Windows):
Code:
CMD: call .py\Scripts\activate.bat
PS: .py\Scripts\activate.ps1
Help !!!!!!
How do you do?
i want to extract a payload.bin (HTC OTA), i need the boot.img.
Step 1-9 Okay at step 10 I get an error message. :crying:
Do I need other programs?
"python-3.7.0.exe" is installed
Thanks
Did you follow folktroll advises for windows.
I've just installed it in my computer followed all steps and extracted all images in my payload file.
Hollilightman said:
How do you do?
Click to expand...
Click to collapse
I doing in Linux, but maybe try python.exe, no python3.exe
k4sh44 said:
Did you follow folktroll advises for windows.
I've just installed it in my computer followed all steps and extracted all images in my payload file.
Click to expand...
Click to collapse
Thanks,
I know where the mistake is. Step 10 says.
Run command
Code. python3 payload_dumper.py payload.bin
python3 payload_dumper.py payload.bin
with "python3" the "3" must go away, so
python payload_dumper.python payload.bin
---------- Post added at 05:18 PM ---------- Previous post was at 05:00 PM ----------
k3dar7 said:
I doing in Linux, but maybe try python.exe, no python3.exe
Click to expand...
Click to collapse
have seen too late... lol
I am stuck in virtualenv" (See screenshot)
How to package system.img boot.img vendor.img back to payload.bin
Hollilightman said:
How do you do?
i want to extract a payload.bin (HTC OTA), i need the boot.img.
Step 1-9 Okay at step 10 I get an error message. :crying:
Do I need other programs?
"python-3.7.0.exe" is installed
Thanks
View attachment 4605210
View attachment 4605212
View attachment 4605213
Click to expand...
Click to collapse
python payload_dumper.py payload.bin
type this command and you are done :laugh:
und3fined said:
This is guide for extract payload.bin from OTA zip file
-----------------
Pre-requirement:
- Python3
-----------------
For extract OTA update
Please flow step by step instruction
Step 1: Get a OTA for Nokia 7 plus -> here
Step 2: Download payload_dumper.zip from here
Step 3: Unzip payload_dumper.zip
This is list file
Step 4: Open Power Shell (on Windows) or Terminal (on Linux/macOS).
Go to folder payload_dumper with command
Code:
cd "<Path to folder>"
Step 5: Create a python environment with virtualenv
Command:
Code:
virtualenv .py
Step 6: Active python enviroment
Command:
Code:
source .py/bin/activate
Step 7: Install dependencies with command
Code:
pip install -r requirements.txt
Step 8: Extract OTA.zip file
Step 9: Copy payload.bin file to payload_dumper folder
Step 10: Run command
Code:
python3 payload_dumper.py payload.bin
Step 11: Wait extract...
Step 12: File extracted on out folder in payload_dumper
-----------------
Python 3 can get it here: https://www.python.org/downloads/
Flow step install python 3, please tick to option install pip and virutalenv
Click to expand...
Click to collapse
goodmorning. bro, pls tho i have python3 installed-i dnt know **** bout programming.
is there a walkthrough for noobs to do all this on python3 on windows7.
bcos i have a Mi A2 lite and i need to do all i can to bring it back. thanks
I have this error in step 10:
(.py) imac-3ayload_dumper Eche$ python3 payload_dumper.py payload.bin
Traceback (most recent call last):
File "payload_dumper.py", line 12, in <module>
import update_metadata_pb2 as um
File "/Users/Eche/Downloads/payload_dumper/update_metadata_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'
EMJI79 said:
I have this error in step 10:
(.py) imac-3ayload_dumper Eche$ python3 payload_dumper.py payload.bin
Traceback (most recent call last):
File "payload_dumper.py", line 12, in <module>
import update_metadata_pb2 as um
File "/Users/Eche/Downloads/payload_dumper/update_metadata_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'
Click to expand...
Click to collapse
Try:
Code:
pip3 install -r requirements.txt
instead of:
Code:
pip install -r requirements.txt
EMJI79 said:
I have this error in step 10:
(.py) imac-3ayload_dumper Eche$ python3 payload_dumper.py payload.bin
Traceback (most recent call last):
File "payload_dumper.py", line 12, in <module>
import update_metadata_pb2 as um
File "/Users/Eche/Downloads/payload_dumper/update_metadata_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'
Click to expand...
Click to collapse
use
Code:
pip install -r requirements.txt
outside the virutalenv environment
I added support for incremental(differential) OTA
https://forum.xda-developers.com/android/development/extract-files-ota-payload-bin-diff-t3959161
https://github.com/vm03/payload_dumper
und3fined said:
This is guide for extract payload.bin from OTA zip file
-----------------
Pre-requirement:
- Python3
-----------------
For extract OTA update
Please flow step by step instruction
Step 1: Get a OTA for Nokia 7 plus -> here
Step 2: Download payload_dumper.zip -->
Step 3: Unzip payload_dumper.zip
This is list file
Step 4: Open Power Shell (on Windows) or Terminal (on Linux/macOS).
Go to folder payload_dumper with command
Step 5: Create a python environment with virtualenv
Command:
Step 6: Active python enviroment
Command:
Works fine. :good:
Step 5 (Windows):
Step 6 (Windows):
Step 7: Install dependencies with command
Step 8: Extract OTA.zip file
Step 9: Copy payload.bin file to payload_dumper folder
Step 10: Run command
Step 11: Wait extract...
Step 12: File extracted on out folder in payload_dumper
-----------------
Python 3 can get it here: https://www.python.org/downloads/
Flow step install python 3, please tick to option install pip and virutalenv
Click to expand...
Click to collapse
for what is payload.bin needed? What is this turtorial for?
2gg1 said:
for what is payload.bin needed? What is this turtorial for?
Click to expand...
Click to collapse
in "ota update".zip is payload.bin, contain many img flashed in ota update proces, if you need change(with unlocked bootloader only) example boot.img then use payload_dumper to extract from payload.bin...
k3dar7 said:
in "ota update".zip is payload.bin, contain many img flashed in ota update proces, if you need change(with unlocked bootloader only) example boot.img then use payload_dumper to extract from payload.bin...
Click to expand...
Click to collapse
thx
und3fined said:
This is guide for extract payload.bin from OTA zip file
-----------------
Pre-requirement:
- Python3
-----------------
For extract OTA update
Please flow step by step instruction
Step 1: Get a OTA for Nokia 7 plus -> here
Step 2: Download payload_dumper.zip --> View attachment 4760222
Step 3: Unzip payload_dumper.zip
This is list file
Step 4: Open Power Shell (on Windows) or Terminal (on Linux/macOS).
Go to folder payload_dumper with command
Code:
cd "<Path to folder>"
Step 5: Create a python environment with virtualenv
Command:
Code:
virtualenv .py
Step 6: Active python enviroment
Command:
Code:
source .py/bin/activate
Step 7: Install dependencies with command
Code:
pip install -r requirements.txt
Step 8: Extract OTA.zip file
Step 9: Copy payload.bin file to payload_dumper folder
Step 10: Run command
Code:
python3 payload_dumper.py payload.bin
Step 11: Wait extract...
Step 12: File extracted on out folder in payload_dumper
-----------------
Python 3 can get it here: https://www.python.org/downloads/
Flow step install python 3, please tick to option install pip and virutalenv
Click to expand...
Click to collapse
A very helpful guide! Tried it with OnePlus 8 OTA
:good::good:
ADDONS/PLUGINS for Dynamic Installer
SUPPORT: TELEGRAM CHANNEL - TELEGRAM GROUP
ABOUT THIS:
These are some addons that dont included by default in the Dynamic Installer cuz they arent necessary in generic installations / mods but they could be useful
ALL ADDONS:
-----------------------------------
ImageMagick (Best Tool to manipulate images)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Unzip the downloaded Addon
Add magick and magick_ files in ur META-INF/addons of the Dynamic Installer
Then to import it add this in the first lines (Recommended) of your updater-script or customize.sh
Bash:
#Look carefully, "a dot" "space" "File to import"
. "$addons/magick"
Enjoy ur new command "magick"
DOWNLOAD
-----------------------------------
ffmpeg (Best Tool to manipulate all multimedia content vídeos/audio/....)
Unzip the downloaded Addon
Add ffmpeg and ffmpeg_ files in ur META-INF/addons of the Dynamic Installer
Then to import it add this in the first lines (Recommended) of your updater-script or customize.sh
Bash:
#Look carefully, "a dot" "space" "File to import"
. "$addons/ffmpeg"
Enjoy ur new command "ffmpeg"
DOWNLOAD
-----------------------------------
Omc Decoder ( JAR to decode Samsung .XMLs)
For JARs that have been converted to .DEX there is a native run_jar action (It only works when the device is booted or in some devices from custom Recovery when the setdefault apex_mount is enabled in the updater-script).
Download omc-decoder.jar
Add omc-decoder.jar in ur META-INF/addons
Then to run it use this example line ur updater-script or customize.sh
Bash:
run_jar "$addons/omc-decoder.jar" -d -i "cscfeature.xml" -o "decoded-cscfeature.xml"
#Btw you can use this format line too
run_jar_addon "omc-decoder.jar" -d -i "cscfeature.xml" -o "decoded-cscfeature.xml"
DOWNLOAD
-----------------------------------
DX (JAR to convert JAVA CODE / JARs into .DEX for Android)
For JARs that have been converted to .DEX there is a native run_jar action (It only works when the device is booted or in some devices from custom Recovery when the setdefault apex_mount is enabled in the updater-script).
Download dx.jar
Add dx.jar in ur META-INF/addons
Then to run it use this example line ur updater-script or customize.sh
Bash:
run_jar "$addons/dx.jar" --dex --output=result.dex "UNDEXED JAR FILE"
#Btw you can use this format line too
run_jar_addon "dx.jar" --dex --output=result.dex "UNDEXED JAR FILE"
DOWNLOAD
-----------------------------------
boot_patch (Allows unpacking and packing the boot.img of most Android devices)
Unzip the downloaded Addon
Add boot_patch.sh and boot_patch files in ur META-INF/addons of the Dynamic Installer
Then to import it add this in the first lines (Recommended) of your updater-script or customize.sh
Bash:
#Look carefully, "a dot" "space" "File to import"
. "$addons/boot_patch.sh"
DOWNLOAD
USAGE:
GENERAL NOTE: All these functions support processing an additional compression in the kernel or ramdisk, for example, you can include a ramdisk that additionally compressed as .XZ and these functions will have no problem to decompressing/processing it (Supports: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg).
unpack_boot "IMG/Partition to extract" "Output folder" <1>
You can unpack an existing IMG or you can use directly the partition that containing it.
NOTE: The third argument is optional, if you add "1" it will not unpack the ramdisk (Useful if you are not going to edit any internal contents of the ramdisk)
Bash:
#Unpack some existing IMG
unpack_boot "$TMP/boot.img" "$TMP/first_boot"
#Unpack from some Partition
unpack_boot $(find_block boot) "$TMP/second_boot"
#Unpack without unpacking the Ramdisk
unpack_boot $(find_block boot) "$TMP/second_boot" 1
repack_boot "Folder to build" "Output File/Partition" <recovery>
Rebuild the IMG unpacked by unpack_boot, the result can be saved in any path or you can send it to the partition directly (automatically repack_boot will evaluate what to do)
NOTE: The third argument is optional, if you add "recovery" it will use AVB1 signing (only if needed) for recovery images.
Bash:
#Repack some unpacked IMG
repack_boot "$TMP/first_boot" "$TMP/result.img"
#Repack and send it to some Partition
repack_boot "$TMP/second_boot" $(find_block boot)
#Repack some unpacked Recovery image
repack_boot "$TMP/second_boot" $(find_block recovery) recovery
Additionally you can know if in the process the resulting IMG lost Magisk, if it is the case, the repack_boot will return the error code "2", so:
Bash:
repack_boot "$TMP/first_boot" $(find_block boot)
result=$?
if [ $result == 0]; then
ui_print "No error and Magisk ensured"
elif [ $result == 1]; then
ui_print "Some fatal problem! and no changes were made"
elif [ $result == 2]; then
ui_print "No error but Magisk is not present"
fi
update_ramdisk "New ramdisk" "IMG/Partition to edit"
You can automatically update the ramdisk of an existing IMG or you can use directly the partition that containing it.
NOTE: The update_ramdisk will return the direct results of the repack_boot (You can save the error code to know if the IMG lost Magisk)
Bash:
#Update the Ramdisk in some existing IMG
update_ramdisk "$TMP/new_ramdisk.cpio" "$TMP/boot.img"
#Update the Ramdisk in some Partition
update_ramdisk "$TMP/new_ramdisk.cpio" $(find_block boot)
update_kernel "New kernel" "IMG/Partition to edit"
You can automatically update the kernel of an existing IMG or you can use directly the partition that containing it.
NOTE: The update_kernel will return the direct results of the repack_boot (You can save the error code to know if the IMG lost Magisk)
Bash:
#Update the Kernel in some existing IMG
update_kernel "$TMP/new_kernel" "$TMP/boot.img"
#Update the Ramdisk in some Partition
update_kernel "$TMP/new_kernel" $(find_block boot)
patch_cmdline "New prop" "New prop" "..."
You can patch multiple properties (props) of the cmdline of an IMG unpacked by unpack_boot, the only condition is to be in that path ( cd "path")
NOTE: The patch_cmdline automatically replaces or adds props (If you patch the same prop twice, it wont repeat)
Bash:
cd "$TMP/first_boot"
patch_cmdline androidboot.selinux=permissive
remove_cmdline "prop to remove" "prop to remove" "..."
You can remove multiple properties (props) of the cmdline of an IMG unpacked by unpack_boot, the only condition is to be in that path ( cd "path")
Bash:
cd "$TMP/first_boot"
remove_cmdline skip_override
flash_image "IMG to install" "Partition/Output file"
It is the default IMG installer of the boot_patch plugin utilities, it can automatically evaluate what to do in different cases
Bash:
flash_image "$TMP/boot.img" $(find_block boot)
-----------------------------------
No More for the moment
CREDITS TO:
Me @BlassGO (Developer of Dynamic Installer)
fei-ke (Developer of Omc Decoder)
ayaromenok (Developer of Static ImageMagick)
Khang-NT (Developer of Static ffmpeg)
@topjohnwu (For his amazing tools / methods for editing boot.img for Magisk)
@osm0sis (For giving more enhance the edition of boot.img with new methods in his AnyKernel project)