[dev]How to Un/Re/Pack a Boot.blob and unyaff a boot.img - Transformer TF300T Android Development

Technically i have to give credit to scott crossler
www.scottsroms.com
for showing me the method
and then i came upon turges
faq
Thanks Turge and Scott and whomever created these blobpacktools
but since i keep getting pms
and im sure you do to
scott
Here are the steps for repacking the boot.img. Some involve running the commands via cygwin, others involve running them via the Windows Command Prompt.
The instructions for installing cygwin, extracting and repacking the boot.img were found here: http://www.freeyourandroid.com/guide...ot-img-windows
Once you have setup cygwin, extract the attached files in a folder under your "home" folder in cygwin.
Also unzip blob tools into the same folder as your boot.blob
1.
Code:
copy boot.blob to the same folder and run the following via
the Windows Command Prompt to extract the boot.img from the boot.blob:
BlobUnpack.exe boot.blob
ren boot.blob.LNX boot.img
which will create boot.img
2.
Code:
From the cygwin bash terminal window,
switch to the same folder and run the following
to extract the ramdisk from the boot.img:
./extractboot boot.img
You now have an out/ramdisk folder
that contains the files you want to edit.
3.
Code:
Once done, repack the ramdisk and kernel into boot_new.img
with the following command (via cygwin once again):
./packboot
4.
Code:
then from the Command Prompt repack boot_new.img
into boot2.blob using the following:
blobpack -s boot2.blob LNX boot_new.img
5.
Code:
You can now flash the boot.blob to the staging
partition via a command in updater-script:
Code:
package_extract_file("/boot.blob", "/dev/block/mmcblk0p4");
or by using adb while in recovery/android:
Code:
dd if=/sdcard/boot2.blob of=/dev/block/mmcblk0p4

Lastly the rundown is like this
if you want to take a ota blob
and extract the contents for a raw base
and a raw kernel
1
take the ota and extract the blob file and place
in your folder with blobtools
2. then run
Code:
blobunpack.exe blob
Which now creates
Blob.APP =System.img (can be renamed system.img and unyaffed in the kitchen)or straight cygwin
Blob.sos=Recovery Img
Blob.Ebt=Bootloader information
Blob.Lnx=kernel (can also just be renamed boot.img and unyaffed in kitchen)
Blob.pt=Partition info
so to repack lets say your custom remade image
and your custom kernel
and a recovery of your choice
run
Code:
blobpack.exe -s blob lnx boot.img sos twrp.blob app system.img
then simply take the blob replace in the ota file
and flash in recovery
and it should flash a rom packed as a blob

Hi!
...also you can flash the new boot.blob via fastboot mode
>fastboot-i 0x0B05 flash boot boot.blob
:good:

Call me stupid, but what does repacking the boot.img do? I never pm'ed you, but what would we gain from this. a lil lost

unpacking a boot.img allows you to take a stock already built kernel
and make specific changes to the ramdisk
more specifically
default.prop
can make kernel insecure
debuggable
bootanimation enabled
blah blah blah
and init.rc
but also
cardhu
and goldfish.rc
and init.trace
and init.usb
then repacked and good to flash

seanzscreams said:
Lastly the rundown is like this
if you want to take a ota blob
and extract the contents for a raw base
and a raw kernel
1
take the ota and extract the blob file and place
in your folder with blobtools
2. then run
Code:
blobunpack.exe blob
Which now creates
Blob.APP =System.img (can be renamed system.img and unyaffed in the kitchen)or straight cygwin
Blob.sos=Recovery Img
Blob.Ebt=Bootloader information
Blob.Lnx=kernel (can also just be renamed boot.img and unyaffed in kitchen)
Blob.pt=Partition info
so to repack lets say your custom remade image
and your custom kernel
and a recovery of your choice
run
Code:
blobpack.exe -s blob lnx boot.img sos twrp.blob app system.img
then simply take the blob replace in the ota file
and flash in recovery
and it should flash a rom packed as a blob
Click to expand...
Click to collapse
Hi!
For a linux (Ubuntu) machine you can easily unpack blob.APP
> sudo mkdir mnt
> sudo mount -o loop blob.APP mnt
- now in your mnt directory , you will have /system ! :good:

Hi,
My TF300tl can't unlock bootloader. so can I use this way to pack custom ROM ( cm11, liplop...) as official ROM to flash for my tablet ?

konnichiwa said:
Hi,
My TF300tl can't unlock bootloader. so can I use this way to pack custom ROM ( cm11, liplop...) as official ROM to flash for my tablet ?
Click to expand...
Click to collapse
I wouldn't think so, as the ROM would have to be signed to be official

Related

stupid dev questions

so...i'm behide the curve on on this hero stuff (being a rom cook for the s200 i'm not complete clueless...but thats winmo)
Anyway i'm playing around and would love an answer on these from one of the resident dev's on here
1. i took boot.img from the RUU rom.zip of wwe 2.73.405.61, took the system.img, did the magic to create an update.zip, which seems to flash fine from a recovery rom BUT on reboot it's stuck on the Hero boot screen/logo, any clue as to where to look/debug (yes I did the wipe etc. etc. it must be something about the update.zip / boot.img i'm missing)
2. i assume there is still no way to re-sign the a changed RUU rom.zip ?
Thanks for your time !
1: extract the system with unyaffs
2: zip the contents of the extracted system
3: sign the resulting zip (androsign or whatever)
boot into recovery
4: copy over to sdcard
5: copy over boot.img also to sdcard
6: cat /dev/zero > /dev/mtd/mtd2
or
dd if=/dev/zero of=/dev/mtd/mtd2
whichever you prefer
7: flash_image boot /sdcard/boot.img
8: flash your update.zip or whatever you called it
9: wipe system (format DATA: & CACHE
OR
flash_image system system.img (might not work)
adwinp said:
1: extract the system with unyaffs
2: zip the contents of the extracted system
3: sign the resulting zip (androsign or whatever)
boot into recovery
4: copy over to sdcard
5: copy over boot.img also to sdcard
6: cat /dev/zero > /dev/mtd/mtd2
or
dd if=/dev/zero of=/dev/mtd/mtd2
whichever you prefer
7: flash_image boot /sdcard/boot.img
8: flash your update.zip or whatever you called it
9: wipe system (format DATA: & CACHE
OR
flash_image system system.img (might not work)
Click to expand...
Click to collapse
Thanks, i got that far, but rolling the whole thing (so boot.img + extracted system.img) into update.zip and flashing that from a recovery image is where it goes all tits up and doesn't boot, even tried without any changes and just taking the boot.img and system.img from a offical htc rom and creating an update.zip
so i must be doing something wrong but can't put my finger where it goes wrong.
anycase, i'll keep trying
thx
1: Did you sign your update.zip?
2: An update.zip usually contains an update script; did you write one too?
This is why I suggested you flash manually.
adwinp said:
1: Did you sign your update.zip?
2: An update.zip usually contains an update script; did you write one too?
This is why I suggested you flash manually.
Click to expand...
Click to collapse
both answers yes
still digging, but it could be that "something" in the update script isn't working, however i've copied one from a working rom, with the same results...
going through the script now....i'm sure it's something stupid and i'll smack my head later, but for now no go......thanks for your tips and time !
Edit:
is there something special you need to do with the boot.img if you just copy (unzip thats it) from a rom.zip and put it in the update.zip ??
Jesterz said:
Edit:
is there something special you need to do with the boot.img if you just copy (unzip thats it) from a rom.zip and put it in the update.zip ??
Click to expand...
Click to collapse
Either you push it to sdcard and
#flash_image boot /sdcard/boot.img
or
in the update.zip:
META-INF\com\google\android\update-script
where META-INF is a folder in the root, and update-script is a text file without file extension; its contents should be:
show_progress 0.1 0
write_raw_image PACKAGE:boot.img BOOT:
show_progress 0.1 10
So, the contents should be:
\META-INF\
com\
google\
android\update-script
\boot.img
zip all that into update.zip, and sign the zip.

[Q] Issues with Signing Android Factory Images, ROMs and OTA Files.

I am doing R&D on FOTA(Firmware Update Over the Air) using Nexus 7-Wifi(grouper). For which I followed the following steps.
1. Downloaded the android source from source.android.com for v 4.2.2_r1 and v 4.3_r1
2. Downloaded the binaries for grouper, extract it to my source folder.
3. Then I compiled the source code using following commands.
i. source build/envsetup.sh
ii. lunch full_grouper-userdebug
iii. make -j8 dist
4. After few tries, I had success in compiling the source for Nexus 7(grouper).
5. I got following files in $out/source_4.2.2/dist folder
-----------------------------------------------
adb*
android-common-carousel.jar
android-common.jar
android-info.txt
android-support-v13.jar
android-support-v4.jar
android-support-v7-gridlayout.jar
build.prop
com.android.nfc_extras.jar
fastboot*
full_grouper-apps-eng.root.zip
full_grouper-emulator-eng.root.zip
full_grouper-img-eng.root.zip
full_grouper-ota-eng.root.zip
full_grouper-symbols-eng.root.zip
full_grouper-target_files-eng.root.zip
gpl_source.tgz
guava.jar
installed-files.txt
jsr305.jar
mkbootfs*
mkbootimg*
mkyaffs2image*
mp4parser.jar
package-stats.txt
ramdisk.img
signapk.jar
vendor_owner_info.txt
-----------------------------------------------
6. Then I generated my own keys using /development/tools/make_key tool for media, testkey, releasekey, shared, platform.
Assume my keys are locate at /keys folder.
7. Then I created a signed target zip file using following command.
/source/build/tools/releasetools/sign_target_files_apks -v -p ../host/linux-x86 -d /keys full_grouper-target_files-eng.root.zip signed_target_files.zip
8. From signed target zip file I create
/source/build/tools/releasetools/img_from_target_files -v -p ../host/linux-x86 signed_target_files.zip signed_img_from_target_files.zip
9. Then I flashed the signed_img_from_target_files.zip using fastboot command using the following script:
----------------------------------------------------------------------
fastboot oem unlock
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata
fastboot reboot-bootloader
sleep 10
fastboot -w update signed_img_from_target_files.zip
----------------------------------------------------------------------
10. The device gets flashed well and is working, but I am getting an log while flashing in which it is unable to find boot.sig, system.sig and recovery.sig
11. Now the otacerts.zip file contains a testkey which is not the one that I signed it with.
file located at "/system/etc/security/otacerts.zip" on device.
12. Now since the otacerts.zip is signed with the default key it gives a mismatch error which I tried to flash an OTA update which is signed by the my custom key.
Now my doubt is:
How can I add boot.sig, recovery.sig and system.sig to signed_img_from_target_files.zip?
Is there anything I am doing wrong?
Does the recovery checks the current ROM keys from "/system/etc/security/otacerts.zip"?
What is the correct procedure to sign the OTA update?
i am posting this reply just for people who are looking for help too,
you need to explicitly define "BUILD_SECURE := true" in your device make file so that android/build/core/Makefile will use device/*/$(TARGET_DEVICE)/releasekey.x509.pem for OTA_PUBLIC_KEYS

looking for stock rom.zip for Tab 10.5 SM-T805 LTE

I would like to looking for the Stock rom.zip for Tab SM-805 LTE. but can't
please share me if you have or the link for downloading
Thanks so much!
No such thing. Stock firmware comes in a tar package.
samsung-updates.com or sammobile
crownvn said:
I would like to looking for the Stock rom.zip for Tab SM-805 LTE. but can't
please share me if you have or the link for downloading
Thanks so much!
Click to expand...
Click to collapse
You need to download the whole firmware package (which is a .tar archive), extract it, and get system.img
After that, you need to use (on a either linux OS or cygwin/VM with linux) simg2img to unpack the raw partition found in system.img
Code:
simg2img system.img system.raw
Next, you need to mount that raw partition to a premade folder
Code:
mkdir system_unpacked
sudo mount -t ext4 -o loop system.raw system_unpacked
You now have your stock rom unpacked. Pack the files found in system_unpacked in a .zip, add a propper META-INF with a propper updater script and that's all
P.S. Google is your friend in all this process!
P.P.S. if your tablet is already rooted, you can use flashfire on it to directly flash the system.img (as @ashyx mentioned in his great rooting guide)
All in all, good luck! Cheers!:good:

[GUIDE] Customize your OEM bootlogo (logo.img)

Hello, this guide is essentially the usage of the previously developed tool OP3TInject, ported to the Oneplus 3T by @Jo_Jo_2000 here.
OP3TInject works perfectly with Oneplus 5 bootlogo, grab your LOGO partition, unpack, edit bootlogos pictures, repack everything and flash to your phone.
I have tested this and it works on my phone, but you still have to USE THIS ON YOUR OWN RISK.
First, dump original logo.img from your phone, you can grab via adb:
open the adb shell on your pc:
Code:
adb shell
you need to be superuser to dump partitions:
Code:
su
list all partitions and find the one corresponding with LOGO (in my case sde18):
Code:
cd /dev/block/bootdevice/by-name
Code:
ls -all
dump LOGO partition (in my case sde18) to /sdcard/logo.img:
Code:
dd if=/dev/block/sde18 of=/sdcard/logo.img
exit from the shell and pull "logo.img" on your pc:
Code:
adb pull /sdcard/logo.img
you will find logo.img in the "adb.exe" directory.
Download OnePlus3TInjector.zip from the offical thread and extract somewere, place logo.img in the same directory.
Open a command prompt inside the folder with OP3TInject.exe & logo.img and execute:
Code:
OP3TInject -i logo.img -D
You will get bootlogo images in png format.
Modify as you like with image editor of your choice but do not change png format.
Execute in the same command prompt to repack logo.img:
Code:
OP3TInject -j fhd -i logo.img
You will get a new file called "modified.logo.bin".
To flash it on your phone i suggest you to edit the original OP5 bootlogo restore zip (download here) with 7zip replacing "logo.img" with the one you got from OP3TInject
(remember to rename from "modified.logo.bin" to "logo.img" before replacing the original one in the zip.)
Flash via TWRP and have fun!.
Huge thanks to @Jo_Jo_2000 and @makers_mark for all the work made on OP3Injector and OP3TInjector.
where can i get this for the oneplus 8t

Pre Rooted PATCHED_BOOT.IMG (10.0.4) for Magisk Root

Original tutorial located at https://forum.xda-developers.com/oneplus-7t/how-to/guide-how-to-root-oneplus-7t-twrp-t3979307
Hello all. Just providing this file for convenience. All credit goes to original author of the guides. This file is a pre-rooted, magisk patched boot.img for firmware version 10.0.4. Use this boot.img for flashing/booting if you are on version 10.0.4 and want to have root using magisk.
!!!I AM NOT RESPONSIBLE FOR ANY DAMAGE DONE TO YOUR DEVICE. USE COMMON SINCE AND YOU WILL BE OK!!​
STEP 1 - Put phone into fastboot mode
Code:
adb reboot fastboot
STEP 2 - Boot the patched boot.img. Download here
Code:
fastboot boot patched_boot_10.0.4.img
STEP 3 - Backup current boot.img. Open an adb shell and find which block device contains your boot partition and then using dd, make a copy of it.
Open ADB Shell
Code:
adb shell
then
Code:
su
Find boot partition
Code:
ls -lah /dev/block/bootdevice/by-name | grep -i boot
You will see something like this as output:
boot_a -> /dev/block/sde11
boot_b -> /dev/block/sde38
Make copy of boot partition(s)
Code:
dd if=/dev/sde11 of=/sdcard/boot_backup.img
DO THIS FOR BOTH BOOT PARTITIONS, LABEL ACCORDINGLY. JUST IN CASE!
Backup boot.img file(s) to PC
FROM YOUR PC, OPEN COMMAND PROMPT AND DO FOR BOTH IMAGES.
Code:
adb pull /sdcard/boot_backup.img
STEP 4 - Install magisk manager
Get magisk manager APK from here. Download the app-release.apk and install on phone.
Code:
adb install app-release.apk
STEP 5 - Open magisk manager and select Install -> Direct Install.
After you have completed the above steps, if everything worked correctly, and you followed the steps with common sense, everything should be good to go.
The download link is not working. Do you still have a patched 10.0.4 boot image?

Categories

Resources