Please Explain this Update Script - Vibrant Q&A, Help & Troubleshooting

now this is not that relevant to vibrant but i had no where else to post thats y its in Q/A section so please if someone knows help me out here
i just got a tablet and it has no support anywhere on the net yet , i got hold of an update from the manufacture, in the update it has this script
my questions are could someone please explain what is
nand_spl.bin used for?
x-boot.bin used for?
boot.img is for boot folder
system.img is system folder
userdata.img is user data folder
i am trying to extract recovery from it so i could flash the recovery to it, in case anything goes back i would re flash the original recovery
ui_print("Setup your device...");
ui_print("update nand_spl....");
format("MTD", "nand_spl");
package_extract_file("nand-spl.bin", "/tmp/nand-spl.bin");
write_raw_image("/tmp/nand-spl.bin","nand_spl");
ui_print("update xboot....");
format("MTD", "xboot");
package_extract_file("x-boot.bin", "/tmp/x-boot.bin");
write_raw_image("/tmp/x-boot.bin","xboot");
ui_print("update boot.img....");
set_progress("2");
show_progress("0.1", 1);
format("MTD", "boot");
package_extract_file("boot.img", "/tmp/boot.img");
write_raw_image("/tmp/boot.img","boot");
show_progress("0.1", 1);
ui_print("update system.img....");
set_progress("9");
show_progress("0.02", 1);
show_progress("0.02", 1);
show_progress("0.02", 1);
format("MTD", "system");
show_progress("0.02", 1);
show_progress("0.02", 1);
show_progress("0.02", 1);
package_extract_file("system.img", "/tmp/system.img");
show_progress("0.02", 1);
show_progress("0.02", 1);
show_progress("0.02", 1);
write_oob_image("/tmp/system.img","system");
show_progress("0.1", 1);
ui_print("update userdata.img....");
show_progress("0.1", 1);
show_progress("0.1", 1);
format("MTD", "userdata");
show_progress("0.1", 1);
show_progress("0.1", 1);
package_extract_file("userdata.img", "/tmp/userdata.img");
show_progress("0.1", 1);
write_oob_image("/tmp/userdata.img","userdata");
show_progress("0.1", 1);
ui_print("Done.");
set_progress("10");
show_progress("0.1", 1);

also when i run cat /proc/mtd
i get this
dev: size erasesize name
mtd0: 000400000 00080000 "misc"
mtd1: 000c00000 00080000 "recovery"
mtd2: 000c00000 00080000 "boot"
mtd3: 010000000 00080000 "system"
mtd4: 01f400000 00080000 "userdata"
mtd5: 008000000 00080000 "cache"
mtd6: 000400000 00080000 "kpanic"
mtd7: 004c00000 00080000 "storage"
mtd8: 001000000 00080000 "deviceID"
mtd9: 000100000 00080000 "nand_spl"
mtd10: 000f00000 00080000 "xboot"
now if i extract
cat /dev/mtd/mtd1 > /sdcard/img/recovery.img
is this recovery.img flashable?

Related

[Q] Mounting a partition in a update-script

Hello guys,
i want to write a update-script that makes some changes on the phone,
but before i can extract files, set symlinks, etc. i have to mount some partitions.
The format of the partitions is MTD, but i don´t know how to find out which block is for /system, /hidden, /data, etc. and where is the block?
I searched much in the internet, have read the instructions for edify-scripting and so on,
but i´ve never found it for MTD and never found how to find out which block is which partition.
I hope you can help
Every phone is different, so for you to get useful advice you need to state what you are using.
I've always found it very helpful to look at the updater script for custom ROMs since they have mount instructions for /system.
Sent from my HTC Desire S
BillGoss said:
Every phone is different, so for you to get useful advice you need to state what you are using.
I've always found it very helpful to look at the updater script for custom ROMs since they have mount instructions for /system.
Sent from my HTC Desire S
Click to expand...
Click to collapse
I realy have to thank you for your reply
I´m using a Motorola Motoluxe XT615 and the problem is, theres no custom ROM out there.
A friend has developt a awesome JB-Design for it and we know how to mount system, but anything else doesn´t work.
The command we´ve used:
Code:
run_program("/sbin/busybox", "mount", "/system");
Thats the output when i´m in /dev/block and enter command "ls":
Code:
dm-2
dm-1
dm-0
vold
mtdblock11
mtdblock10
mtdblock9
mtdblock8
mtdblock7
mtdblock6
mtdblock5
mtdblock4
mtdblock3
mtdblock2
mtdblock1
mtdblock0
loop7
loop6
loop5
loop4
loop3
loop2
loop1
loop0
mmcblk0p1
platform
mmcblk0
Maybe this is usefull, too. Output of command "cat /proc/mtd":
Code:
dev: size erasesize name
mtd0: 00700000 00020000 "boot"
mtd1: 00300000 00020000 "misc"
mtd2: 00300000 00020000 "misc2"
mtd3: 00200000 00020000 "splash"
mtd4: 00700000 00020000 "recovery"
mtd5: 00d00000 00020000 "ftm"
mtd6: 00d00000 00020000 "hidden"
mtd7: 01500000 00020000 "cda"
mtd8: 00060000 00020000 "dbgmsk"
mtd9: 16300000 00020000 "system"
mtd10: 0a000000 00020000 "cache"
mtd11: 183e0000 00020000 "userdata"
Well, that will work if a ROM with busybox is already installed.
Here's what's in the updater script for the HTC Desire S ROMs:
assert(getprop("ro.product.device") == "saga" || getprop("ro.build.product") == "saga");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/system");
...
format("ext4", "EMMC", "/dev/block/mmcblk0p25", "0", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/system");
package_extract_dir("system", "/system");
Nope this helps. I think you need to use MTD instead of EMMC. And, obviously mtdblock9 instead of mmcblk0p25.
Sent from my HTC Desire S
BillGoss said:
Well, that will work if a ROM with busybox is already installed.
Here's what's in the updater script for the HTC Desire S ROMs:
assert(getprop("ro.product.device") == "saga" || getprop("ro.build.product") == "saga");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/system");
...
format("ext4", "EMMC", "/dev/block/mmcblk0p25", "0", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/system");
package_extract_dir("system", "/system");
Nope this helps. I think you need to use MTD instead of EMMC. And, obviously mtdblock9 instead of mmcblk0p25.
Sent from my HTC Desire S
Click to expand...
Click to collapse
Finally i got it, thank you
It wasn´t even that hard. The right command is:
Code:
mount("MTD", "userdata", "/data");
mount("MTD", "system", "/system");
mount("MTD", "hidden", "/hidden");
Thanks for your help

Porting rom updater script help

So, i was looking for cyanogenmod 12.1 for mt6582 and i saw this CM 12.1 for sprout 8
my device is an oem with a specs of:
mt6582
8gb internal
1gb ram
I changed the updater script like this:
assert(getprop("ro.product.device") == "sprout" || getprop("ro.build.product") == "sprout" || getprop("ro.product.device") == "Flare S3" || getprop("ro.build.product") == "sprout8" || abort("This package is for device: sprout,sprout8; this device is " + getprop("ro.product.device") + ".");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
show_progress(.3, 0);
ui_print(" - Mounting /system...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
if is_mounted("/data") then
package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
else
show_progress(.3, 0);
ui_print(" - Mounting /data...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/data");
package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
unmount("/data");
endif;
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/mmcblk0p5", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");
show_progress(0.020000, 10);
show_progress(.3, 0);
ui_print(" - Mounting /system...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/mmcblk0p5");
show_progress(0.200000, 10);
Click to expand...
Click to collapse
I'm having blkdiscard error. Im using TWRP. Any help?
Bump, anyone?

Custom Rom for old Pantech P8000, can't mount "system".

My old trusty P8000 stopped reading it's sim card and I have to get a new phone, so I thought this would be the perfect time to do a little hacking on it.
I'm a total noob to android, I've managed to root the phone and install CWM.
I've also cooked up a custom rom in android kitchen, but I'm having some problems passing the proper mount command to the update-binary.
My updater script reads:
Code:
format("yaffs2", "MTD", "system");
mount("yaffs2", "MTD", "/dev/block/mtdblock5", "/system");
show_progress(0.500000, 0);
package_extract_dir("system", "/system");
When I run the update.zip in CWM it comes back with installation complete, but the log says unmount of system failed: no such volume.
Does anyone know the proper mount commands for these old MTD flash drives?
Yes I'm sure the "system" partition is /dev/block/mtdblock5
Code:
~ # cat /proc/mtd
dev: size erasesize name
mtd0: 008c0000 00040000 "boot"
mtd1: 008c0000 00040000 "recovery"
mtd2: 00f00000 00040000 "fota"
mtd3: 09880000 00040000 "cache"
mtd4: 002c0000 00040000 "persist"
mtd5: 0e940000 00040000 "system"
mtd6: 00280000 00040000 "splash"
mtd7: 20a00000 00040000 "userdata"
The format command only works if I use:
Code:
format("yaffs2", "MTD", "system");
It doesn't work as:
Code:
format("yaffs2", "MTD", "/system");
Something to do with the MTD partition table being hardcoded into the kernel.
Also, is there any way to view CWM installer logs other than from the advanced menu on the phone. I'm only able to see the last few lines of the log, and it doesn't give me any clue why "/system" doesn't mount.
Thanks for any advice you can offer.
Ok, I fond the answer in this thread http://forum.xda-developers.com/showpost.php?p=17594598&postcount=30
Code:
mount("yaffs2", "MTD", "system", "/system");
:laugh:

hello I want some help with modifying rom cm 13

I have researched how to modify rom cm 13 to be installed on any device
And having applied all the instructions meticulously :fingers-crossed:
What I still have an error in the installation of recovery
I suspect that the error in updater-script file
This is the file that you've modified it
Code:
assert(getprop("ro.product.device") == "j1pop3g" || getprop("ro.build.product") == "j1pop3g" || abort("This package is for device: j1pop3g; this device is " + getprop("ro.product.device") + "."););
ui_print("Target: samsung/j1pop3gjv/j1pop3g:4.4.4/KTU84P/J110HXXU0APD3:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
if is_mounted("/data") then
package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
else
mount("f2fs", "EMMC", "/dev/block/mmcblk0p26", "/data", "");
package_extract_file("META-INF/org/cyanogenmod/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
unmount("/data");
endif;
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/mmcblk0p24", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");
ui_print("Verifying the updated system image...");
if range_sha1("/dev/block/mmcblk0p24", "34,0,32770,32841,32843,33310,65535,65536,65538,98304,98306,98377,98379,98846,131071,131072,131074,163840,163842,163913,163915,164382,196607,196608,196610,229376,229378,229449,229451,229918,242027,262144,262146,262613,268543") == "78bc7cc69b723be97505fae5a10f33da9e2d457f" then
if range_sha1("/dev/block/mmcblk0p24", "42,32770,32841,32843,33310,65535,65536,65538,66050,97792,98304,98306,98377,98379,98846,131071,131072,131074,131586,163328,163840,163842,163913,163915,164382,196607,196608,196610,197122,228864,229376,229378,229449,229451,229918,242027,242539,261632,262144,262146,262613,268543,268544") == "8a123b7047923c07b2557d9e700ace3006757cca" then
ui_print("Verified the updated system image.");
else
abort("system partition has unexpected non-zero contents after OTA update");
endif;
else
abort("system partition has unexpected contents after OTA update");
endif;
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/mmcblk0p2");
show_progress(0.200000, 10);
Note:
I modified it to a phone
samsung j1 j110h
:silly::silly::silly::silly::silly:
Try ro compile pac rom for the device from
https://forum.xda-developers.com/showthread.php?t=2662325&page=36
Goode luck??

TWRP error :6

Hello xda
So today i just wanted to make a flashable update zip
And now, when i flash the zip in twrp, i'm getting:
Updater process ended with ERROR: 6
My update-script looks like this:
HTML Code:
(!less_than_int(1492929452, getprop("ro.build.date.utc"))) || abort("E3003: Can't install this package (Sun Apr 23 06:37:32 UTC 2017) over newer build (" + getprop("ro.build.date") + ").");
this device is " + getprop("ro.product.device") + ".");
ui_print("Target: xiaomi/mido/mido:7.0/NRD90M/7.2.9:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
if is_mounted("/data") then
package_extract_file("META-INF/org/lineageos/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
else
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/userdata", "/data", "");
package_extract_file("META-INF/org/lineageos/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
unmount("/data");
endif;
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
set_progress(1.000000);
Click to expand...
Click to collapse
The only thing what i wanna do is that the /system gets mounted, then, the system should install, and then, /system should be unmounted.
Can someone help me? I have a Redmi Note 4X and TWRP 3.1.0.0. Thanks.

Categories

Resources