[TOOL][Linux] Split kernel with appended dtb into standalone kernel and dtbs - Miscellaneous Android Development

What's the tool for:
Almost all Qualcomm device is using linux device tree, and there're 2 ways to handle to kernel:
Use a "dt.img" to pack dtbs and attached it to boot.img. When booting, lk will unpack it and handle dtbs to kernel.(Most devices in this way)
Directly append dtbs on kernel image. When booting, lk will split them off and handle to kernel.(Nexus devices in this way since Nexus 5. Qualcomm switched to this way in every M branch, so generally you won't see a dt.img after unpacking a boot.img from official M release)
This tool is implemented to split a kernel image with appended dtbs into separated kernel and dtb files.
How it works:
Every dtb is started with 0xd00dfeed(defined in scripts/dtc/libfdt/fdt.h in kernel source), and a kernel image with appended dtbs is generated with command similar to the following one:
Code:
echo Image a.dtb b.dtb > Image-dtb
My program will search 0xd00dfeed in the provided kernel image, and dump "Image", "a.dtb", "b.dtb" in "Image-dtb" into sepreated files. After that, you're free to use dtc to decompile the .dtb into .dts
Download & Source:
https://github.com/dianlujitao/split-appended-dtb
XDA:DevDB Information
split-appended-dtb, Tool/Utility for all devices (see above for details)
Contributors
dianlujitao
Source Code: https://github.com/dianlujitao/split-appended-dtb
Version Information
Status: Stable
Created 2016-03-22
Last Updated 2016-03-22

@dianlujitao how to add dtb files back to zImage? Thank you
I have 13 dtb files.. converted them to dts, edited and converted back to dtb...

ingbrzy said:
@dianlujitao how to add dtb files back to zImage? Thank you
I have 13 dtb files.. converted them to dts, edited and converted back to dtb...
Click to expand...
Click to collapse
cat xxx.dtb >> zImage

dianlujitao said:
cat xxx.dtb >> zImage
Click to expand...
Click to collapse
Thanks it works!

dianlujitao said:
cat xxx.dtb >> zImage
Click to expand...
Click to collapse
By using this command, I added a new dtb to my zimage.
There is some way to replace it that already exists in the zimage and not to add a new dtb file inside the zimage.
Thank you very much

kenet said:
By using this command, I added a new dtb to my zimage.
There is some way to replace it that already exists in the zimage and not to add a new dtb file inside the zimage.
Thank you very much
Click to expand...
Click to collapse
this is the files' layout
| ++++++++++++ Image-dtb ++++++++++++++ |
| ______ zImage ______ | _ a.dtb _ | _ b.dtb _ |
Image-dtb contains zImage followed by dtbs
zImage itself doesn't contain device tree blobs, and that command will append the latter to it.

Related

kernel compile issue

I'm working on a kernel for the Samsung Exhibit II. I used dsixda's Android Kitchen to rip the initramfs from the stock kernel, it looks good, and I can edit it and rejoin it to the stock zImage w/o problems. Boots fine.
When I compile the zImage from source, initramfs is apparently not making into the kernel.
Code:
Android 'magic' header not found at start of boot.img
Checking if it exists elsewhere ...
Warning: Android header not found in boot.img (unsupported format)
Kernel found at offset 24061976 in boot.img
Making folder BOOT-EXTRACTED ...
Extracting kernel ...
Error: zImage is empty!
Extracting ramdisk ...
Error: No ramdisk folder found!
However, initramfs is being found & generated by the kernel compile. In Kernel/usr:
3549184 Jan 25 16:02 initramfs_data.cpio
Click to expand...
Click to collapse
Dumping the contents of the cpio file show the expected initramfs.
Any help appreciated, thanks.
Me to.
Please help someone!
jocala said:
I'm working on a kernel for the Samsung Exhibit II. I used dsixda's Android Kitchen to rip the initramfs from the stock kernel, it looks good, and I can edit it and rejoin it to the stock zImage w/o problems. Boots fine.
When I compile the zImage from source, initramfs is apparently not making into the kernel.
Android 'magic' header not found at start of boot.img
Checking if it exists elsewhere ...
Warning: Android header not found in boot.img (unsupported format)
Kernel found at offset 24061976 in boot.img
Making folder BOOT-EXTRACTED ...
Extracting kernel ...
Error: zImage is empty!
Extracting ramdisk ...
Error: No ramdisk folder found!
However, initramfs is being found & generated by the kernel compile. In Kernel/usr:
Dumping the contents of the cpio file show the expected initramfs.
Any help appreciated, thanks.
Click to expand...
Click to collapse
You need to make sure you add location of initramfs to config file
:: LOVE MY HATERS :: DARKSIDE ::
where you add the location address of the file?

[Q] [GT-P3100][Kernel] Compiled kernel does not boot!

Hi,
I'm trying to boot my galaxy tab2 7 with compiled kernel.
First, I downloaded kernel source from http://opensource.samsung.com.
I download GT-P3100_JB_Opensource_Update2.zip file and extract it.
To compile, I followed ketut.kumajaya's thread (http://forum.xda-developers.com/show....php?t=2086996)
I build only kernel, not other modules. Compile was done without problem.
And I extract boot.img from Stock ROM file downloaded from samsung-updates.com (http://samsung-updates.com/device/?id=GT-P3100).
Stock ROM version is P3100XXCLJ3 (that's my device's baseband version).
I unpacked boot.img and I got boot.img-kernel.gz and boot.img-ramdisk.cpio.gz.
(To make sure unpack/repack tool is working properly, I simply unpack stock boot.img and repack it. And the new boot.img was working properly. So I assume my unpack/repack tool have no problem).
So, I replace boot.img-kernel.gz with zImage and repack it.
But this time new boot image does not working (Device stuck in boot logo)
What did I done wrong? Any body help! I've been stuck with this for a week now...
(When stock ROM is flashed, Kernel version in device info is "3.0.31-595683"
You must compile pvrsrvkm kernel module as I mentioned in http://forum.xda-developers.com/showthread.php?t=1859227 and then you can use KK-Boot 0.5.x core as your flashable zip template (have PowerVR 3D driver binary inside). If you decide to keep the stock PowerVR binary, change:
#define PVRVERSION_BUILD 2166536
Click to expand...
Click to collapse
to
#define PVRVERSION_BUILD 2120756
Click to expand...
Click to collapse
and
#define PVRVERSION_BUILD_HI 216
#define PVRVERSION_BUILD_LO 6536
Click to expand...
Click to collapse
to
#define PVRVERSION_BUILD_HI 212
#define PVRVERSION_BUILD_LO 0756
Click to expand...
Click to collapse
in pvrversion.h
Do not forget to copy pvrsrvkm_sgx540_120.ko to /system/lib/modules (backup the stock modules first!)
For trouble free development, I recommend you to use GT-P3110_JB_Opensource.zip, apply all my kernel patch and use my android_espresso_omap4430_r04_blackhawk_defconfig as your kernel config file. Good luck!
necesriverua
ketut.kumajaya said:
You must compile pvrsrvkm kernel module as I mentioned in http://forum.xda-developers.com/showthread.php?t=1859227 and then you can use KK-Boot 0.5.x core as your flashable zip template (have PowerVR 3D driver binary inside). If you decide to keep the stock PowerVR binary, change:
to
and
to
in pvrversion.h
Do not forget to copy pvrsrvkm_sgx540_120.ko to /system/lib/modules (backup the stock modules first!)
For trouble free development, I recommend you to use GT-P3110_JB_Opensource.zip, apply all my kernel patch and use my android_espresso_omap4430_r04_blackhawk_defconfig as your kernel config file. Good luck!
Click to expand...
Click to collapse
Many thanx.
I really appreiciate it.
I will try this right away.
ketut.kumajaya said:
You must compile pvrsrvkm kernel module as I mentioned in http://forum.xda-developers.com/showthread.php?t=1859227 and then you can use KK-Boot 0.5.x core as your flashable zip template (have PowerVR 3D driver binary inside). If you decide to keep the stock PowerVR binary, change:
to
and
to
in pvrversion.h
Do not forget to copy pvrsrvkm_sgx540_120.ko to /system/lib/modules (backup the stock modules first!)
For trouble free development, I recommend you to use GT-P3110_JB_Opensource.zip, apply all my kernel patch and use my android_espresso_omap4430_r04_blackhawk_defconfig as your kernel config file. Good luck!
Click to expand...
Click to collapse
Dear ketut,
Because I'm behind firewall, I cannot download pvrsrvkm kernel source.
Frankly, I have very little knowledge about android system. so I'm not sure I understand your guide correctly..
What I've done is as follows:
1. Download GT-P3110_JB_Opensource
2. Apply your patch from http://forum.xda-developers.com/showthread.php?t=1859227
3. Modify PVRVERSION_BUILD and PVRVERSION_BUILD_HI and PVRVERSION_BUILD_LOW in drivers/gpu/pvr/pvrversion.h (kernel source)
4. Apply android_espresso_omap4430_r04_blackhawk_defconfig and Build (using arm-2010q1-202..)
5. Repack zImage with ramdisk.cpio.gz (extracted from stock rom file)
6. Replace boot.img in your kkboot-0.5.2-core-p31xx.zip with repacked boot.img
7. Apply new kkboot.zip in CWM and installation failed and aborted.
Am I totally in wrong direction? What am I missing here?
I sincerely ask your help.
(I found that when build kernel after your patch, additional module files (.ko) are generated.
Should I do something with that?)
cks1119 said:
Dear ketut,
Because I'm behind firewall, I cannot download pvrsrvkm kernel source.
Frankly, I have very little knowledge about android system. so I'm not sure I understand your guide correctly..
What I've done is as follows:
1. Download GT-P3110_JB_Opensource
Click to expand...
Click to collapse
Correct.
2. Apply your patch from http://forum.xda-developers.com/showthread.php?t=1859227
Click to expand...
Click to collapse
Correct, all my patch from 01-07.
3. Modify PVRVERSION_BUILD and PVRVERSION_BUILD_HI and PVRVERSION_BUILD_LOW in drivers/gpu/pvr/pvrversion.h (kernel source)
Click to expand...
Click to collapse
Incorrect, nothing to do with pvr driver inside the kernel source, it's useless. You can download eurasia_km.tgz from http://www.mediafire.com/?m9te7t4rosp131d . Do not modify PVRVERSION if you plan to use my kkboot boot image.
4. Apply android_espresso_omap4430_r04_blackhawk_defconfig and Build (using arm-2010q1-202..)
Click to expand...
Click to collapse
Code:
export CROSS_COMPILE='/opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-'
export LDFLAGS=''
export CFLAGS=''
export SUBARCH=arm
export ARCH=arm
make mrproper
make android_espresso_omap4430_r04_blackhawk_defconfig
make -j4
5. Repack zImage with ramdisk.cpio.gz (extracted from stock rom file)
Click to expand...
Click to collapse
Incorrect, use kkboot ramdisk for now.
6. Replace boot.img in your kkboot-0.5.2-core-p31xx.zip with repacked boot.img
Click to expand...
Click to collapse
Correct.
7. Apply new kkboot.zip in CWM and installation failed and aborted.
Click to expand...
Click to collapse
Try to unpack and repack kkboot without modification, is it works?
Am I totally in wrong direction? What am I missing here?
I sincerely ask your help.
(I found that when build kernel after your patch, additional module files (.ko) are generated.
Should I do something with that?)
Click to expand...
Click to collapse
Unpack kkboot, you will see a lot of modules inside system/lib/modules
Try to unpack and repack kkboot without modification, is it works?
Click to expand...
Click to collapse
No, unpack tool that I have is not working.
I found the tool that you've uploaded, but the unzip password was not correct for some reason
I downloaded your tool in http://forum.xda-developers.com/showthread.php?t=1241005
But while unpacking, it says below:
Code:
BOARD_KERNEL_CMDLINE console=ttyO2,115200n8 mem=1024M androidboot.console=ttyO2 vram=20M omapfb.vram=0:16M
BOARD_KERNEL_BASE 80000000
BOARD_PAGE_SIZE 00000800
gzip: ../kkboot.img-ramdisk.gz: not in gzip format
cpio: premature end of archive
Is it require special tools to unpack kkboot image?
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
ketut.kumajaya said:
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
Click to expand...
Click to collapse
You mean only ramdisk?
If so, as my understanding, unpacking boot.img in kkboot-0.5.2 and repack without any change, should be working
whether your ramdisk is packed with lzo or not.
But when I did it, I still got installation fail.
(I used the unpackbootimg in blackhawk tool from http://forum.xda-developers.com/showthread.php?t=1241005)
By the way,
I've searching about lzop compressed ramdisk and found this: https://github.com/trevd/aos-tools/blob/master/scripts/unpack-ramdisk.sh
And with this method, I could unpack ramdisk file.
Code:
cat boot.img-ramdisk.gz | lzop -d | cpio -i
But, I think this is not the point.
ketut.kumajaya said:
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
Click to expand...
Click to collapse
I simply unpack and repack boot.img from kkboot-0.5.2-core-p31xx.zip
with boot.img-tools in http://forum.xda-developers.com/showthread.php?t=1241005
Then change original boot.img with repacked one and make new zip file in external SD card.
When I go to CWM recovery and try to install new zip file, then I got following message:
Code:
-Extracting files
set_perm : some changes failed
E:Error in /external_sd/newfile.zip
(Status 7)
Installation aborted
I've been trying other tools that I could find but still does not working :crying:
ketut.kumajaya said:
Forgot to mention, my ramdisk packed in lzo format You need lzop application to unpack it.
Click to expand...
Click to collapse
Finally done it!
I've got tab 2 running my own kernel!
Again, thank you for your help and all works you've done!:good:
cks1119 said:
Finally done it!
I've got tab 2 running my own kernel!
Again, thank you for your help and all works you've done!:good:
Click to expand...
Click to collapse
Congrat :good:

[TOOL] CIVICX KERNEL PACKING TOOL-2.0 [TOOL-kernel]

CIVICX KERNEL PACKING TOOL
Well i made this simple kernel packing tool for new users out there who want to enter into this kernel developement. I am using this tool of myself from many days and now i will like to share . Some names of bashcripts are **** given so dont look over those !
Code:
[COLOR="Red"]NOTE:THIS TOOL IS ADAPTED FOR XPERIA L ONLY , YOU WILL HAVE TO EDIT IT IN ORDER TO WORK WITH NEW DEVICE [/COLOR]
Ok so i consider all of you may be using Git and if you are not simply click on Download as zip
https://github.com/aniketroxx/Aniket_Packer
Click to expand...
Click to collapse
For Cloning Type this Command :
Code:
git clone https://github.com/aniketroxx/Aniket_Packer.git
Now in AOSP_RAMDISK
Insert the Ramdisk from Stock Kernel
Click to expand...
Click to collapse
Now in RECOVERY_RAMDISK
Insert or Create your own Recovery ramdisk folder Structure with ****ing init script and bootrec ,busybox and all
Click to expand...
Click to collapse
Go into cloned folder or downloaded folder and Simply type :
sh menu.sh
Click to expand...
Click to collapse
Rest of things are self explainatory !
Currently this is adopted for Packing of Kitkat Kernel which is having Page Size of 2048 ,
if you want to change it then simple open the pack.sh in any text editor [Provided that you are root directory of Packer]
Type command :
cd Z_PACKER
Click to expand...
Click to collapse
gedit pack.sh
Click to expand...
Click to collapse
At almost the end of line you will see page size , you can change it whatever you like
If you got any error then simple reply the thread
FAQ
AOSP_RAMDISK :
This will contain the ramdisk that you get from stock sony kernel , like as sony updated from 4.1 to 4.2 their ramdisk changed so here you can place that ramdisk in extracted form for further compression
Click to expand...
Click to collapse
RECOVERY:
Suppose you are implementing some cwm/twrp then then you can put it here for further xz compression
Click to expand...
Click to collapse
RECOVERY_RAMDISK:
This will contain the Recovery ramdisk structure with all of your bootrec and init.sh script and all
Click to expand...
Click to collapse
ZPACKER/OUT:
This will contain your output boot.img
You can flash the kernel directly through the option present in the menu
Click to expand...
Click to collapse
INPUT
Here you can put the boot.img of the kernel you want to extract
Click to expand...
Click to collapse
Z_IMAGE
Your extracted zImage will contain in this folder
Click to expand...
Click to collapse
EXTRACTED_RAMDISK
This will contain the ramdisk extracted from the boot.img , if you want to use it for packing then you will have to copy it to RECOVERY_RAMDISK
Click to expand...
Click to collapse
Changelog:
Version 1.0
Initial Release includes Packing Stock Ramdisk Packing Recovery Ramdisk Creating boot.img
Version 1.1
Added option for packing CWM/TWRP in XZ compression
Version 1.2
Added option for flashing kernel that you packed Fastboot must be installed
Version 1.3
Fix the normal bugs , syntax error in menu and remove device specific path
Version 1.4
Added the missing directory and changed SE-Linux to permissive
Version 1.5
Added automated fastboot and adb installer for linux thanks @HeadFox
Version 2.0
Added the ability to extract the kernel having ramdisk with xz compression​
Nice work! :highfive:
Nice work buddy
aniketroxx said:
Changelog:
Version 1.0
Initial Release includes Packing Stock Ramdisk Packing Recovery Ramdisk Creating boot.img
Version 1.1
Added option for packing CWM/TWRP in XZ compression
Version 1.2
Added option for flashing kernel that you packed Fastboot must be installed
Version 1.3
Fix the normal bugs , syntax error in menu and remove device specific path
Version 1.4
Added the missing directory and changed SE-Linux to permissive
Version 1.5
Added automated fastboot and adb installer for linux thanks @HeadFox​
Click to expand...
Click to collapse
Can you fix this? I am on Ubuntu 14.04 LTS
menu.sh: 38: menu.sh: Syntax error: ")" unexpected (expecting ";;")
Click to expand...
Click to collapse
FantasticalX said:
Can you fix this? I am on Ubuntu 14.04 LTS
Click to expand...
Click to collapse
Its fixed , sorry i forgot to push one commit ! Now just type in packer directory
Code:
git pull
or
Code:
git clone url
if you want to clone it somewhere else
aniketroxx said:
Its fixed , sorry i forgot to push one commit ! Now just type in packer directory
Code:
git pull
or
Code:
git clone url
if you want to clone it somewhere else
Click to expand...
Click to collapse
Thanks for fixed it! Btw can i unpack zImage with this tool?
FantasticalX said:
Thanks for fixed it! Btw can i unpack zImage with this tool?
Click to expand...
Click to collapse
no not yet , i will add it soon ! you can use kernel kitchen for unpacking
Ability to extract boot.img has been added to the tool @FantasticalX :fingers-crossed:
aniketroxx said:
Ability to extract boot.img has been added to the tool @FantasticalX :fingers-crossed:
Click to expand...
Click to collapse
Great! Glad to hear that! Thank you so much for your work :angel:

[TOOLS] Boot image tools for Samsung Galaxy Tab 4 7.0

Boot image tools for Samsung Galaxy Tab 4 7.0, Degas board Marvell PXA1088
Unpack boot.img:
Code:
$ mkdir boot
$ tools/degas-unpackbootimg -i boot.img -o boot
$ mkdir -p boot/ramdisk
$ cd boot/ramdisk/
$ gunzip -c ../boot.img-ramdisk.gz | cpio -i
$ cd ../
Repack boot.img:
Code:
$ ../tools/mkbootfs ramdisk | ../tools/minigzip > boot.img-ramdisk-new.gz
$ ../tools/degas-mkbootimg --kernel boot.img-zImage
--ramdisk boot.img-ramdisk-new.gz --dt boot.img-dt
--signature boot.img-signature -o ../boot-new.img
$ cd ../
I'm not sure about boot image signature, you can try without --signature option. By comparing boot image to recovery image, I found a different signature and of course a different ramdisk but the rest is the same, including kernel and device tree table.
To confirm this tools reliability, you can unpack and then repack original boot/recovery image without modification. You will got two identical image, check it using a diff tool.
Generate kernel spesific device tree table:
Code:
$ tools/degas-dtbTool -o boot.img-dt-new -p kernel/scripts/dtc/ kernel/arch/arm/boot/dts/
Repack a new recovery as a flashable Odin:
Code:
$ tar -H ustar -c recovery-testkey.img > recovery-testkey.img.tar
$ md5sum -t recovery-testkey.img.tar >> recovery-testkey.img.tar
$ mv recovery-testkey.img.tar recovery-testkey.img.tar.md5
DISCLAIMER:
USE THIS TOOLS AT YOUR OWN RISK, I DON'T OWN TAB 4 7.0 FOR TESTING
Ketut P. Kumajaya, June 2014
XDA:DevDB Information
degas-mkbootimg, Tool/Utility for the Samsung Galaxy Tab 4
Contributors
ketut.kumajaya, Android Open Source Project, CyanogenMod Team, The Linux Foundation
Version Information
Status: Testing
Created 2014-06-17
Last Updated 2014-07-31
Android boot image:
Standard Android header:
Magic (8B)
kernel size (4B)
kernel addr (4B)
ramdisk size (4B)
ramdisk addr (4B)
2ndary size (4B)
2ndary addr (4B)
tags addr (4B)
page size (4B)
unused #1 (4B) (zero in standard Android)
unused #2 (4B) (zero in standard Android)
product name (16B)
kernel cmdline (512B)
id (8B)
Samsung Galaxy Tab 4 7.0 header:
Magic (8B, ANDROID!)
kernel size (4B)
kernel addr (4B, 0x10008000)
ramdisk size (4B)
ramdisk addr (4B, 0x11000000)
2ndary size (4B, 0x0)
2ndary addr (4B, 0x10f00000)
device tree size (4B, 534528)
unknown (4B, 0x02000000)
tags addr (4B, 0x10000100)
page size (4B, 2048)
product name (24B, empty)
kernel cmdline (512B, empty)
id (8B, empty)
Samsung Galaxy Tab 4 7.0 layout:
A. header (as above - 1 page)
B. kernel (n pages)
C. ramdisk (m pages)
D. second stage (o pages)
E. device tree table (started with PXA-DT magic, p pages)
F. signature (256 bytes)
Samsung Galaxy Tab 4 7.0 PXA1088 device tree format:
magic (6B, PXA-DT)
version (uint32)
num of DTBs (uint32)
platform id #1 (uint32)
soc rev #1 (uint32)
offset #1 (uint32)
size #1 (uint32)
...
platform id #Z (uint32)
soc rev #Z (uint32)
offset #Z (uint32)
size #Z (uint32)
0 ("zero")
padding
DTB #1
padding
...
DTB #Z
That's why standard tool fail to unpack this degas board boot.img
We need a brave Tab 4 7.0 owner here :laugh: Don't hesitate to ask me to repack a slight modified boot.img or a recovery repack with Google testkey so you can flash a signed flashable zip using stock recovery.
And let the games begin...Kernel check...Shoot for recovery tomorrow/later today.... Thanks bro Ive been killing myself over this
{
"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"
}
Great, a dead man back alive :laugh:
Device tree combiner tool added!
Can I use it on my tab 4 10.1 T530?
No. The tools that I share here special for Tab 4 7.0 PXA1088. For Qualcomm based platform, I think you can use standard CM boot tools (unpackbootimg, mkbootimg, and dtbToolCM).
I may be up for testing what are the risks?
Sent from my SM-T230NU using XDA Free mobile app
If you still need an idiot to brick his brand new 4.7, you can count on me
im in
im familiar with linux and what not so im in just let me know in a PM ill brick it
I don't see links to download the degas-unpackbootimg or the degas-dtbTool or for source code for these tools. At least you outlined the differences between the boot image formats in post 2 though.
Dees_Troy said:
I don't see links to download the degas-unpackbootimg or the degas-dtbTool or for source code for these tools. At least you outlined the differences between the boot image formats in post 2 though.
Click to expand...
Click to collapse
I managed to find what i believe is them here on github.
@Dees_Troy and Team Win Recovery Project, I almost forgot to say thank you for all your hard work
to make TWRP source code. Now i had compiled TWRP 2.8.0.0, and it seems working fine in my galaxy tab 7 SM-T231
mtp can detect, but still can't pullout backup at the moment. but it is not big problem fo me
@ketut.kumajaya thanks again for making degas unpackbootimg tools for pxa1088.
actually i was using it to unpack recoveryimage
mantap kali ah bro :good:
without you guys, i can't make my custom recovery
Thanks
Dees_Troy said:
I don't see links to download the degas-unpackbootimg or the degas-dtbTool or for source code for these tools. At least you outlined the differences between the boot image formats in post 2 though.
Click to expand...
Click to collapse
http://forum.xda-developers.com/devdb/project/?id=4629#downloads
ShinySide said:
And let the games begin...Kernel check...Shoot for recovery tomorrow/later today.... Thanks bro Ive been killing myself over this
Click to expand...
Click to collapse
Aside from using the degas tools, did you do anything special to make the kernel work? By special I mean did you do anything besides:
make ARCH=arm CROSS_COMPILE=arm-eabi- pxa1088_degaswifi_usa_defconfig
make ARCH=arm CROSS_COMPILE=arm-eabi- zImage
... and also possibly regenerate the device tree.
I was trying to compile & run the kernel, but it keeps getting stuck at the power-on screen (not boot animation). The kernel source is T230NUUE0ANE2, taken from the opensource center.
geseeker said:
Aside from using the degas tools, did you do anything special to make the kernel work? By special I mean did you do anything besides:
make ARCH=arm CROSS_COMPILE=arm-eabi- pxa1088_degaswifi_usa_defconfig
make ARCH=arm CROSS_COMPILE=arm-eabi- zImage
... and also possibly regenerate the device tree.
I was trying to compile & run the kernel, but it keeps getting stuck at the power-on screen (not boot animation). The kernel source is T230NUUE0ANE2, taken from the opensource center.
Click to expand...
Click to collapse
Just ran what was in the read me and used a Linaro toolchain. 4.7.4 I think. I havent messed with it much. Have it on my github but only have 2 commits pushed. stock source and update to the toolchain path but dont believe I did anything more then that.
Also dont know if you released it, but the modules are in/go in the boot.img
ShinySide said:
Just ran what was in the read me and used a Linaro toolchain. 4.7.4 I think. I havent messed with it much. Have it on my github but only have 2 commits pushed. stock source and update to the toolchain path but dont believe I did anything more then that.
Also dont know if you released it, but the modules are in/go in the boot.img
Click to expand...
Click to collapse
I guess the modules you referred to are generated by running `make modules`? How were you able to pack them into boot.img? I thought the only things that are in boot.img are the kernel (zImage), ramdisk, and the device tree, no?
geseeker said:
I guess the modules you referred to are generated by running `make modules`? How were you able to pack them into boot.img? I thought the only things that are in boot.img are the kernel (zImage), ramdisk, and the device tree, no?
Click to expand...
Click to collapse
After you compile the kernel, taek the zimage and modules (modules are built when you compile the kernel so in your kernel working folder do a search for ".ko" and youll find them all, then take the stock boot.img and use this to unpack, swap the zimage in and then do a search for .ko in the extracted boot.img folder and paste your new .ko's / modules in there. I say search for them because I cant remember if the directory is system/lib/modules or lib/modules in the boot.img and then repack it with the same tool
ShinySide said:
After you compile the kernel, taek the zimage and modules (modules are built when you compile the kernel so in your kernel working folder do a search for ".ko" and youll find them all, then take the stock boot.img and use this to unpack, swap the zimage in and then do a search for .ko in the extracted boot.img folder and paste your new .ko's / modules in there. I say search for them because I cant remember if the directory is system/lib/modules or lib/modules in the boot.img and then repack it with the same tool
Click to expand...
Click to collapse
I've got it working! The modules are actually in the ramdisk under /lib/modules, so you'd have to update the ramdisk as well... I see.
Thanks bro, for the quick reply!

[tool] ANDROID-ROM-REPACK-TOOLS

Note:I am sorry I can't post this in the Android development thread because my number of posts is low. Hopefully some mod can move it there.
Introduction
Since this project (Android_IMG_REPACK_TOOLS) is dead for 2 years now (last supported version is Marshmallow). I decided to do a new rom repacker that supports up to Android Oreo.
Supported OS
Linux
Supported Android Versions
android-5 (Lollipop)
android-wear-5
android-6 (Marshmallow)
android-7 (Nougat)
android-8 (Oreo)
android-9 (Pie) beta
Binaries included
append2simg
img2simg
simg2img
simg2simg
make_ext4fs (Google removed it for android 9. I will add a replacement in the future)
mkbootfs
mkbootimg
unpackbootimg (For android-wear-5, you can use the one in android-5)
sefcontext_compile
sefcontext_decompile
Usage
Check this post out for some use case. You'll need img2simg and make_ext4fs from my post.
sefcontext_compile and sefcontext_decompile:
ROMS since Android 7 (Nougat) come with a binary file_contexts but you need a text based file_contexts when you need to repackage the ROM. You'll need it for make_ext4fs. sefcontext_decompile converts the binary file_contexts into text version.
Code:
# file_contexts (human readable text file) -> file_contexts.bin (PCRE formatted binary file)
sefcontext_compile [-o <output_file>] <text_file>
# file_contexts.bin (PCRE formatted binary file) -> file_contexts (human readable text file)
sefcontext_decompile [-o <output_file>] <binary_file>
Source code
Repository
android-5
android-wear-5
android-6
android-7
android-8
android-9
Download links for Linux
Download page
android-5
android-wear-5
android-6
android-7
android-8
android-9
Change Log:
v3:
Added android-5 and android-wear-5 support
Added android-9 beta support
v2:
Added sefcontext_compile and sefcontext_decompile: converts between file_contexts.bin and file_contexts
Static linking to libc++: No need to install 3rd party libraries to use the binaries.
v1:
Added append2simg img2simg simg2img simg2simg make_ext4fs mkbootfs mkbootimg unpackbootimg
credits:
@A.S._id
android.googlesource
LineageOS
Created: 2018-03-16
Updated: 2018-08-18
[Placeholder]
[Placeholder2]
Can i extract a rom if i have only ssyetm. New. Dat??, i have file context. Bin in boot. Img can it be used?
I know usual extraction needs both these+system. Transfer. List but a rom which i m using have just this configuration.
what is simg2simg?
and how to make system.new.dat.br?
thanks for your work
zheshifandian said:
what is simg2simg?
and how to make system.new.dat.br?
thanks for your work
Click to expand...
Click to collapse
Use brtoli. Exe to make. Br from. Dat format
narshi shukla said:
Can i extract a rom if i have only ssyetm. New. Dat??, i have file context. Bin in boot. Img can it be used?
I know usual extraction needs both these+system. Transfer. List but a rom which i m using have just this configuration.
Click to expand...
Click to collapse
I believe this question is better suited in this thread. You'll need system.transfer.list in sdat2img.py which is provided over there. I haven't worked on a ROM that doesn't have system.transfer.list. Isn't system.transfer.list required for flashing the ROM?
Btw you need to convert file_context.bin to text format. There are a couple of closed source solutions here on xda. I am working on an open source version in my free time.
zheshifandian said:
what is simg2simg?
Click to expand...
Click to collapse
You can find answers to a lot of the questions you might have in the old project.
A.S._id said:
Yes, simg2simg can reduce file size by splitting into several parts, but it is usually not necessary, fastboot can flash and in this state
Click to expand...
Click to collapse
Awesomeness, easy and simple
hi bro i want extract oreo system.new.dat.br and also repack dat to .br in windows
please help me bro
and im unable to convert oreo file_context.bin to readable in windows
please help thanks in advance
New version available in Original Post.
Change log
v2:
Added sefcontext_compile and sefcontext_decompile: converts between file_contexts.bin and file_contexts
Static linking to libc++: No need to install 3rd party libraries to use the binaries.
marshharsha said:
hi bro i want extract oreo system.new.dat.br and also repack dat to .br in windows
please help me bro
and im unable to convert oreo file_context.bin to readable in windows
please help thanks in advance
Click to expand...
Click to collapse
Oreo ROMs come compressed by brotili. You can compile from source to get the executable or you can get the binaries directly from the release page (version 1.0). Use it to extract and repack .br.
I added a converter from file_context.bin to a readable format in the new version I just uploaded.
This project only supports Linux as of now. As for using it in Windows, you have 3 options,
Use a linux distro in VirtualBox (I currently use this option)
Install a linux bash shell in Windows 10
Build the project in Cygwin (hopefully someone can make a pull request and share it with the rest)
rkhat said:
Oreo ROMs come compressed by brotili. You can compile from source to get the executable or you can get the binaries directly from the release page (version 1.0). Use it to extract and repack .br.
I added a converter from file_context.bin to a readable format in the new version I just uploaded.
This project only supports Linux as of now. As for using it in Windows, you have 3 options,
Use a linux distro in VirtualBox (I currently use this option)
Install a linux bash shell in Windows 10
Build the project in Cygwin (hopefully someone can make a pull request and share it with the rest)
Click to expand...
Click to collapse
thanks brother for your kind reply can you give guide for make exe from brotli source? with java or c
thanks again
marshharsha said:
thanks brother for your kind reply can you give guide for make exe from brotli source? with java or c
thanks again
Click to expand...
Click to collapse
Just use a pre-built brotli from the release page (there is a window version). It doesn't matter that the executable is not the latest version as you only need to extract compress the .br file.
If you really need to build brotli for windows, just open scripts/appveyor.yml in the github repository. Decide which environment you want (I see they support 32-bit/64-bit versions for Visual Studio, Python, MinGW). Download the necessary software (python, mingw ...). Then run the commands in appveyor.yml using cmd in this order.
@rkhat
Hi and thanks for making the tools for us.
I am getting the below error when ./img2simg new-system.img news-system.img. I downloaded version for Nougat.
img2simg: /android-rom-repacker/external/platform/core/src/libsparse/sparse.c:153: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
Aborted
I am running Ubuntu. Do you know what might be the problem ?
sdeft said:
@rkhat
Hi and thanks for making the tools for us.
I am getting the below error when ./img2simg new-system.img news-system.img. I downloaded version for Nougat.
img2simg: /android-rom-repacker/external/platform/core/src/libsparse/sparse.c:153: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
Aborted
I am running Ubuntu. Do you know what might be the problem ?
Click to expand...
Click to collapse
Just tested a Nougat lineage ROM for Nexus 7 from here. No issues!
Are you sure you used this version for Nougat?
If you still have issues, can you link me the zipped ROM and more importantly the source you got it from so I can test it out? Thank you.
rkhat said:
Just tested a Nougat lineage ROM for Nexus 7 from here. No issues!
Are you sure you used this version for Nougat?
If you still have issues, can you link me the zipped ROM and more importantly the source you got it from so I can test it out? Thank you.
Click to expand...
Click to collapse
I think I found the issue. This is happening only when i perform it on the image created with
./make_ext4fs -s -l 3000M -a system new-system.img tmp/
If I just umount the image and then apply img2simg it works.
Is this strange or what ?
sdeft said:
I think I found the issue. This is happening only when i perform it on the image created with
./make_ext4fs -s -l 3000M -a system new-system.img tmp/
If I just umount the image and then apply img2simg it works.
Is this strange or what ?
Click to expand...
Click to collapse
Don't use "-s" (lowercase s) option. It only writes sparse headers in new-system.img. The file is only couple MBs instead of 3000MB you specified. I am curious how img2simg even worked.
Also, use "-S file_contexts" (uppercase S) option to apply the security contexts on files. The zipped ROM has file_contexts.bin (binary version) since Android Nougat. You'll need to convert it to text format. You can use the executable sefcontext_decompile included in my tools to convert file_contexts.bin to file_contexts.
rkhat said:
Don't use "-s" (lowercase s) option. It only writes sparse headers in new-system.img. The file is only couple MBs instead of 3000MB you specified. I am curious how img2simg even worked.
Also, use "-S file_contexts" (uppercase S) option to apply the security contexts on files. The zipped ROM has file_contexts.bin (binary version) since Android Nougat. You'll need to convert it to text format. You can use the executable sefcontext_decompile included in my tools to convert file_contexts.bin to file_contexts.
Click to expand...
Click to collapse
I am not using a zipped rom with file_contexts.bin, system.new.dat etc.
I am trying to mod a system.img from a fastboot rom for xiaomi. So far only managed to have the userdata.img working but system.img keeps giving me bootloops!. Will try your suggestion above...
build use cygwin window 7 x64
how build use cygwin on w7 x64? or can you make for windows too?
sorry for bad engglish
anggafzkdev99 said:
how build use cygwin on w7 x64? or can you make for windows too?
sorry for bad engglish
Click to expand...
Click to collapse
I don't use windows in this project. So you're on your own in building using cygwin
Alternatively, you can use Ubuntu on VirtualBox which is what I currently use.

Categories

Resources