[9001][SCRIPTS] The making of ... an ODIN installable package [2011-12-21] - Galaxy S Plus I9001 Android Development

Hi all,
Based on the instructions broodplank posted in the Cranium thread (here), I created some scripts to automate the entire process. Not sure whether you find it useful, but here it is.
If you want to do it directly on your device with an cwm-installable zip, please go to this topic:
The making of ... an ODIN installable package with CWM
It will create a zipped version of the md5-tar file of the package compatible with Odin.
Instructions
1. Build your ROM using packages in the forum. Add new apps, change battery, etc., etc. till your satisfied. Make sure not to add sensitive data (user credentials etc)
2. Download a base-ROM like XXKPS and put the following files in the BaseRom folder:
adsp.mbn
amss.mbn
boot.img
cache.img.ext4
preload.img.ext4
3. Boot your device
4. Make sure you have BusyBox installed
5. Connect your device with USB, make sure your sdcard is not mounted on the PC
6. Make sure you have enough space on the internal sdcard; at least 1,84 GB:
system.img.ext4 = 532 MB
tar file = 644 MB
base rom = 100 MB
md5 file = 644 MB
(it would be possible to delete tar file, but I perfer to be safe than sorry)
7. Start BuildOdin.cmd
Thanks to broodplank1337 I now also created some scripts to do it through Cygwin. After rethinking this I could have done it easier by invoking the cygwin commands directly, but for now I am doing it through the shell . See attached.
Downloads... see next post
Regards,
Nika.

Downloads
Just the scripts:
http://forum.xda-developers.com/attachment.php?attachmentid=821537&stc=1&d=1324250313
File that includes BaseRom XXKPS (80 MB):
http://www.multiupload.com/FYGRD3LDFG

What it does...
Here's a little more explanation of what the script does:
BuildOdin.cmd allows minor customization:
ROMName = name of the ROM you are creating (CraniumRC5 in my case)
BaseRomFolder = location it takes the BaseRom files from (default = BaseRom)
TempBuildFolder = location on device it will use to build your ROM (default = /sdcard/BuildRom, I guess you can also use your /sdcard/external_sd - haven't tested it)
It will execute the following scripts:
adb-PushBaseromSdcard.cmd - this will push the files from your baserom folder to the build folder on the device
adb-ExtractRom.cmd - will dump your raw ROM data to files
adb-MakeImageShell.cmd - will create a tempfile that contains the shell commands that will be executed for tarring and md5-ing the ROM
adb-GetRom.cmd - will retrieve the ROM and make a zip-file. It retrieves the ROM and renames it to a time/date based file, this may need some customization in some cases as the date/time naming depends on regional settings...
Any questions? Any tips and tricks to make this better? Let me know!
Regards,
Nika.

Wow! Thanks man, very nice! You can create the tar/md5 on your computer by just copying the files from your sdcard to /home/username in cygwin folder then use the same commands

Thank you! Do I have to use Linux or Windows is good?
edit: I've understood by myself , thanks again for your work

broodplank1337 said:
Wow! Thanks man, very nice! You can create the tar/md5 on your computer by just copying the files from your sdcard to /home/username in cygwin folder then use the same commands
Click to expand...
Click to collapse
Thanks, I'll try cygwin. I tried unxutils, but that added an CRLF instead of LF only at the end of the file and rendered the checksum invalid

nikagl said:
Thanks, I'll try cygwin. I tried unxutils, but that added an CRLF instead of LF only at the end of the file and rendered the checksum invalid
Click to expand...
Click to collapse
Maybe if you invoke a dos2unix? Or 'perl -i -p -e 's/\r//' <your .md5 file>?

wintel_mac said:
Maybe if you invoke a dos2unix? Or 'perl -i -p -e 's/\r//' <your .md5 file>?
Click to expand...
Click to collapse
Good thinking, I did try manually changing the file using a hex-editor but that didn't work and wouldn't be a good permanent fix for something automatic.
I'll try soon ...

Thanks to broodplank1337 I now also created some scripts to do it through Cygwin. After rethinking this I could have done it easier by invoking the cygwin commands directly, but for now I am doing it through the shell . See post #1

nikagl said:
Thanks to broodplank1337 I now also created some scripts to do it through Cygwin. After rethinking this I could have done it easier by invoking the cygwin commands directly, but for now I am doing it through the shell . See post #1
Click to expand...
Click to collapse
Very nice addition! I will use the script for sure

This script also helps in making odin flashables, just posting it as a support to ur work

First thanks for this!
After flashing, the recovery starts and tries to install an update.zip but this fails. I think it doesn't influence the whole falshing process in a bad way. But is there a possibility to skip the installation of the update.zip after flashing an own ROM with Odin.
What is this update.zip exactly doing?

crybert said:
First thanks for this!
After flashing, the recovery starts and tries to install an update.zip but this fails. I think it doesn't influence the whole falshing process in a bad way. But is there a possibility to skip the installation of the update.zip after flashing an own ROM with Odin.
What is this update.zip exactly doing?
Click to expand...
Click to collapse
ah... the Android with the exclamation mark, right? Good question! How do the stock ROMs from Samsung do that? We could off course try to install a dummy update.zip, I think they're the same as the other CWM scripts (ie. Edify scripts)?
By the way, I have only followed the instructions of Broodplank who took them from some other location again (I guess from another phone developer section and simply replaced the right mount points in the instructions) - so I have no idea either

Here's broodplank's previous comment about this:
broodplank1337 said:
normally on a stock rom it installs update.zip after the first boot so if you flash the custom recovery.img it gets conflicted somehow
Click to expand...
Click to collapse
So I guess we could also use the recovery.img from the original xxkps but in that case you'd have to add CWM recovery manually after flashing... it all depends on preference One other option could be to use the stuff from the FeaModRecovery_1.2.tar?

Yes it seems it's a forced option. I always get that after every odin flash. so I'm thinking about using that update.zip to install apps after flashing with odin. This "bug" might even become handy!

broodplank1337 said:
Yes it seems it's a forced option. I always get that after every odin flash. so I'm thinking about using that update.zip to install apps after flashing with odin. This "bug" might even become handy!
Click to expand...
Click to collapse
You're right that sounds really good. But where can I find this update.zip in an Odin-Package?

crybert said:
You're right that sounds really good. But where can I find this update.zip in an Odin-Package?
Click to expand...
Click to collapse
Yep.. that's what I wanna know also I think we can test by placing an update.zip in every directory and then make every separate update.zip unpack an unique file like this:
the one in /sdcard extracts /sdcard/1
the one in /system extracts /sdcard/2
the one in /data extracts /sdcard/3
or
the one in /sdcard extracts /sdcard/present
the one in /system extracts /system/present
the one in /data extracts /data/present
I think that's they way we could test it, I don't think there is an other option available where the zip could be, maybe even on external_sdcard, but that doesn't make sense since not everybody has one..

Could it be that this update.zip is the "sec_csc.zip" which is included in cache.img.ext4. This would make sense. Because this is an flashable zip.
Updater-Script Code
Code:
assert(getprop("ro.product.device") == "GT-P1000" ||
getprop("ro.build.product") == "GT-P1000" ||
getprop("ro.product.device") == "GT-I9000" ||
getprop("ro.build.product") == "GT-I9000" ||
getprop("ro.product.device") == "SC-02B" ||
getprop("ro.build.product") == "SC-02B" ||
getprop("ro.product.device") == "GT-I9003" ||
getprop("ro.build.product") == "GT-I9003" ||
getprop("ro.product.device") == "GT-I9001" ||
getprop("ro.build.product") == "GT-I9001"
);
show_progress(0.100000, 0);
show_progress(0.500000, 0);
# format("MTD", "system");
# mount("MTD", "system", "/system");
package_extract_dir("system", "/system");
# unmount("/system");
EDIT: In cache.img.ext4 is a folder called recovery.
recovery includes the following files:
command
sec_csc.zip
in command is the following:
Code:
--update_package=CACHE:recovery/sec_csc.zip
--wipe_cache
So I would say there is really a possibilty to flash something with this command and a zip file in this folder.

crybert said:
Could it be that this update.zip is the "sec_csc.zip" which is included in cache.img.ext4. This would make sense. Because this is an flashable zip.
Updater-Script Code
Code:
assert(getprop("ro.product.device") == "GT-P1000" ||
getprop("ro.build.product") == "GT-P1000" ||
getprop("ro.product.device") == "GT-I9000" ||
getprop("ro.build.product") == "GT-I9000" ||
getprop("ro.product.device") == "SC-02B" ||
getprop("ro.build.product") == "SC-02B" ||
getprop("ro.product.device") == "GT-I9003" ||
getprop("ro.build.product") == "GT-I9003" ||
getprop("ro.product.device") == "GT-I9001" ||
getprop("ro.build.product") == "GT-I9001"
);
show_progress(0.100000, 0);
show_progress(0.500000, 0);
# format("MTD", "system");
# mount("MTD", "system", "/system");
package_extract_dir("system", "/system");
# unmount("/system");
Click to expand...
Click to collapse
Awesome find!!! Gonna try this soon!

I noticed that too, but as the cache file contains the correct script and csc zip I doubt it's that file. Plus, that cache image is also in the stock rom...Last but not least, be careful modifying stuff in csc as that could kill your phone afaik
I have also unpacked the recovery.img from the xxkps and cranium rom (the latter one has the android too after installing my odin package ) but neither contain an update.zip. The big question is what the Odin installers of a stock rom does differently compared to the combination of stock and custom rom the way we make the odin packages. It has to be something in system.img.ext4, recovery.img or boot.img as those are the ones we "custom created" compared to the stock rom...
I'll unpack boot.img too to see what is in there
Regards,
Nika.

Related

[Q] difficulty reinstalling ROM

I've got a Galaxy SGH-1897 "captivate".
I've been running various kernels and ROMs for quite a while now. I'm handy with linux and adb and I can flash things with heimdall.
Whelp, I saw that CM7.1 finally had a version for my captivate, so I installed it last night with Clockwork mod recovery. All went well with the install, but the system seemed buggy, or at least I was having some problems. One was that I couldn't seem to get all my user data restored through Titanium backup like I've been able to after other installs. So, having fun and walking along, I thought, oh, well what I want to do is restore back to 2.2 and my old rom (which was "Torch 2.1 or something"). Anyway, I booted into recovery then told CWM to restore. It errored out and tried to reboot, but couldn't get past the startup screen.
So, I used the volume-up-down plug-in-usb trick to get back into download mode. Then I used heimdall to flash the overstock kernel and CWM (http://cmw.22aaf3.com/aries/sgh-i896/root/) all went well. Now, I have the issue that I can't seem to go ahead and reinstall a new (or old) ROM. If I try to do a "restore", I get the error that I can't mount /system, installation aborts. The error says "file already exists", so I'm trying to figure a way to unmount /system before trying it, but so far no luck (maybe I can flash busybox and get su and get the job done). Alternatively, I've been trying to flash CM7 again, but that installation errors out with "Status 7", and seems to be failing some assert statement.
I'd love any advice. Let me know if you need more detail or if this is in the wrong forum.
---------- Post added at 03:48 PM ---------- Previous post was at 03:19 PM ----------
Just following up with more info here.
It seems like "Status 7" happens when the software one is trying to install is intended for some other hardware. I'm trying to verify this now.
Looking at the output of my error, all of the asserts seem true. getprop("ro.product.device") == "captivate" ...
getprop keeps wanting "captivate" or "captivatemtd" or "SGH-I896" or "SGH-I897" it seems. And that's no surprise, I'm using a captivate. I'm not sure what the "mtd" part is about yet. And I'm pretty sure my device is an I897.
Now I'm trying to isolate which statements are causing assert to fail. I'm using grep and find on the update-cm-7.1.0-RC1-Captivate.signed.zip archive to try to locate some clues. Any ideas?
---------- Post added at 04:30 PM ---------- Previous post was at 03:48 PM ----------
Okay, now I'm thinking that I'm simply barking up the wrong tree with the assert statements and the Status 7 error. From what I can tell, I'm trying to install captivate software on a captivate, so maybe this error message is spurious. Especially considering the fact that other tasks such as "restore" also seem to be failing, but with a more general sort of error.
When I use clockworkmod recovery to go to "recover" then I select my latest backup point, I get to wait abit during md5 checks then:
Code:
E:Can't mount /dev/block/st19 to /system with parameters auto llw,check=no
(File exists)
Error mounting /system/!
Skipping format ...
E:Can't mount /dev/block/st19 to system with parameters auto llw,check=no
(File exists)
Can't mount /system/!
So, 'file exists' seems to mean that the /system directory is mounted when it shouldn't already be, or else the install script should unmount it before it starts but has failed there. In either case, maybe this is a permissions issue. Does the recovery OS need privileges it doesn't have? Is there some way to flash busybox/su using heimdall or adb? Does that seem like my problem?
not permissions, still no progress
Maybe I'm posting in the wrong forum ... ?
Let me know if there's some other group (irc?) which might have ideas?
So, it seems that the problem isn't permissions. At least insofar as I found in the ClockworkMod Recovery settings a selection to install su. So, that seemed to go fine, but afterwards I'm still getting "cannot mount /system/!" when I try to do a restore.
Still stumped. Looking for ideas.
Same error on SGSI
I've got the same error on my Samsung Galaxy S.
But I can't even boot the device, it freezes on the first boot screen, I've installed the cyanogenmod but, when I've tried to install the MIUI this problem appears and know, I can't do nothing.
When I try to install the cyanogenmod or the MIUI I get the following error:
assert(getprop("ro.product.device") == "galaxysb" || getprop("ro.build.product") == "galaxysb" || getprop("ro.product.board") == "galaxysb" ||
getprop("ro.product.device") == "galaxysbmtd" || getprop("ro.build.product") == "galaxysbmtd" || getprop("ro.product.board") == "galaxysbmtd" ||
getprop("ro.product.device") == "GT-I9000B" || getprop("ro.build.product") == "R8GT-I9000B00at" || getprop("ro.product.board") == "GT-I9000B"
Click to expand...
Click to collapse
If I enable the signature verification I get this error:
E:failed to verify whole-file signature
E:signature verification failed
Installation aborted
Click to expand...
Click to collapse
Did you fix your problem?
Someone else have any clue?
Thanks.
I've solved this problem I just changed a file updater-script located at /META-INF/com/google/android/ of the cyanogenmod zip file.
I've simple delete the lines that make a reference to my device.
tic-tac-toe said:
I've solved this problem I just changed a file updater-script located at /META-INF/com/google/android/ of the cyanogenmod zip file.
I've simple delete the lines that make a reference to my device.
Click to expand...
Click to collapse
how did u do that? did you just access the ROM zip file and edited it from there

How to convert an rfs Rom to Ext4.

Hey guys, I am wanting to use a 2.3.6 stock rom with my Cwm but i need to first convert the filesystem from rfs to ext4. How do i do that? Thanks
Sent from my GT-S5670 using XDA App
I am actually wanting the same thing...
Same here, anyone care to share how it can be made ?
not very hard ,just extract initramfs.cpio from the zImage ,add this line
CONFIG_EXT4_FS=y in filesystems,then change Mount points in init.rc of Ramdisk
and then Format All Dev Blocks e.g. System,Data,Cache to ext4 !!
how to extract zimage..............or how to open zzimage ????? plz help
i followed this guide http://forum.xda-developers.com/showthread.php?t=777380
I did from step 4 to 11 smoothly
At step 1 i had a file called zImage( no extension but icon is CPIO)
I change zImage to initramfs.cpio and run this command
Code:
cat initramfs.cpio | cpio -i --no-absolute-filenames
Result
Code:
cpio: Removing leading `/' from member names
dev
cpio: dev/console: Cannot mknod: Operation not permitted
dev/console
root
1 block
and 2 folder
In Dev folder have a file with 0 byte
Dont bash me cause i have just started with ubuntu 2 day
And where can i find how to make pre-install rom with ext4 support?
Im on GT s5670 with stock DXKT4
Priyank Patel said:
how to extract zimage..............or how to open zzimage ????? plz help
Click to expand...
Click to collapse
can anyone tell?
Gendows said:
can anyone tell?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=5447589
Download the attacked file and do step 8 whit your boot.img
@pratyush.creed
u need to do something to the zimage in boot.img ? what if i take zimage and the modules from an ext4 rom (of the same base) and put it in the rfs rom? will it work?
I really need to know how to make a pre-install rom with ext4 support.
Anyone
May I answer a question?
U can open your updater-script from META-INF with notepad++
Write like this For converting your system:
Code:
unmount("/system");
unmount("/cache");
unmount("/data");
ui_print("[ ] Formatting system with ext4");
format("ext4", "EMMC", "/dev/block/stl12");
ui_print("[ ] Formatting cache with ext4");
format("ext4", "EMMC", "/dev/block/stl14");
ui_print("[ ] Formatting data with ext4");
format("ext4", "EMMC", "/dev/block/stl13");
*(ui_print) is command for notes. So, U may not care about it
Thx. I hope it can help ya, guyz!
Delanoister said:
May I answer a question?
U can open your updater-script from META-INF with notepad++
Write like this For converting your system:
Code:
unmount("/system");
unmount("/cache");
unmount("/data");
ui_print("[ ] Formatting system with ext4");
format("ext4", "EMMC", "/dev/block/stl12");
ui_print("[ ] Formatting cache with ext4");
format("ext4", "EMMC", "/dev/block/stl14");
ui_print("[ ] Formatting data with ext4");
format("ext4", "EMMC", "/dev/block/stl13");
*(ui_print) is command for notes. So, U may not care about it
Thx. I hope it can help ya, guyz!
Click to expand...
Click to collapse
Ya u need d lines from script n boot.img of an ext4 rom for not editing zimage
Not exactly what i want. I want to learn how to build kernel support ext4 from stock rom.
When search around i see some way to:
+Unpack boot.img
+Add ext4.ko , jdb2.ko to ramdisk and edit init.rc with new mount point.
+Repack boot.img
I flash new boot.img, phone work fine but i dont know if it supports ext4 ^^
And other guide is compile kernel from source is provided by samsung. Oh god with this way i have to learn java, c @#^%!
Maybe i should go to some class
Anyway thank you very much. Have a good day.

[Q] can we fastboot?

can we get into fast boot, im stuck at not being able to format my /data parition due to a denied permission on packages.xml. i searched everywhere and one person had this problem but it was on a different device and they fixed it by 'fastboot erase userdata'
help?
No. You cannot fastboot. That seems like a Nexus-only sorta thing. Sadly.
If you are lucky, you have SBKv1 and can use nvflash with your device in APX-mode.
Anyway. You should be able to format /data within CWM. If you get permissions issues there, something is terribly wrong.
Try hooking it up to a pc and connecting via adb.
In that case you should be able to get an adb shell and have the option to clean up manully.
josteink said:
No. You cannot fastboot. That seems like a Nexus-only sorta thing. Sadly.
If you are lucky, you have SBKv1 and can use nvflash with your device in APX-mode.
Anyway. You should be able to format /data within CWM. If you get permissions issues there, something is terribly wrong.
Try hooking it up to a pc and connecting via adb.
In that case you should be able to get an adb shell and have the option to clean up manully.
Click to expand...
Click to collapse
i have SBKv2, and i tried adb in recovery. the file gets permission denied when trying to delete it, and i cant SU in adb, which is weird.
i can get it up and running, but everything acts weird even the launcher, i tried doing a tibackup restore of system too, but everything is jacked, things just work weird, home button doesnt work. only back. quick launch widgets are gone. says apps are installed that are not installed.
i tried thinking of creating a edify script that would kill the data partition with busybox, think that might work?
Code:
assert(getprop("ro.product.device") == "tf101" || getprop("ro.build.product") == "tf101");
show_progress(0.500000, 0);
format("MTD", "userdata");
mount("MTD", "userdata", "/data");
delete_recursive("/data/system");
run_program("/sbin/busybox", "rm", "-rf", "/data/*");
run_program("/sbin/busybox", "umount", "/data");
BlueHarford said:
i have SBKv2, and i tried adb in recovery. the file gets permission denied when trying to delete it, and i cant SU in adb, which is weird.
i can get it up and running, but everything acts weird even the launcher, i tried doing a tibackup restore of system too, but everything is jacked, things just work weird, home button doesnt work. only back. quick launch widgets are gone. says apps are installed that are not installed.
i tried thinking of creating a edify script that would kill the data partition with busybox, think that might work?
Code:
assert(getprop("ro.product.device") == "tf101" || getprop("ro.build.product") == "tf101");
show_progress(0.500000, 0);
format("MTD", "userdata");
mount("MTD", "userdata", "/data");
delete_recursive("/data/system");
run_program("/sbin/busybox", "rm", "-rf", "/data/*");
run_program("/sbin/busybox", "umount", "/data");
Click to expand...
Click to collapse
Tried Adb fRom normal not our CWM? If you haven't tried the latter I would recommend trying that first.
Sent from my Galaxy Nexus using Tapatalk
josteink said:
Tried Adb fRom normal not our CWM? If you haven't tried the latter I would recommend trying that first.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
you mean boot into the rom and use adb in there?
Tegra chipsets work a little different. I'm not the best tool in the drawer when it comes to development but NVFlash is almost just like fastboot. When in NVFlash move, you do similar commands such as "nvflash command"... syntax aside.
Check out some of the "SUPERWIPE" tools, both NVFLASH and CWM methods. You might be able to deconstruct one into formatting just the partition you need.
BlueHarford said:
you mean boot into the rom and use adb in there?
Click to expand...
Click to collapse
I mean boot into recovery and use adb there,

[INTRODUCTION] Updater script

Hi guys this is a small intro to updater script by a newbie for a newbie to understand more and more what it has and what it means:highfive::highfive::highfive:
now what is the updater-script and update-binary present in the META-INF>com>google>android in any flashable zip package
1. updater-script - it is just a text file which contains all the commands which tells the clockworkmod what to do with the given
zip file. the updater-script is written in the edify scripting language.
2. update-binary - it is a binary which is requiered by the clockworkmod to translate the human readable format of the updater-
script to machine readable format for execution of the updater-script in our device.
exploring the updater-script:
now let's start exploring the updater-script !
1. open the updater script with notepad++ (strongly recommended)
2. now i will try and explain commands generally used in the updater-script,
assert(getprop("ro.product.device") == "ST15i" || getprop("ro.build.product") == "ST15i" ||
getprop("ro.product.device") == "ST15a" || getprop("ro.build.product") == "ST15a" ||
getprop("ro.product.device") == "smultron" || getprop("ro.build.product") == "smultron");
the above bunch of lines checks the device model to confirm that the zip file is flashed on the device
for which it is specifically created for. These bunch of lines are very important because it prevents
flashing of zip file which is not intended for the device hence avoiding any problems due to flashing
the wrong zip. for example the above lines checks for the value of "ro.product.device" and
"ro.build.product"in the build.prop file of the already existing rom in the device, if any of the three
defined values ST15i, ST15a, smultron are found it will continue with the next line of updater-script
otherwise flashing gets aborted with error in getprop.
format("yaffs2", "MTD", "system", "/system");
the above command explains itself, it is used to format the specified partition
syntax explanation:
format - the main command to direct the cwm to format using the following parameters
"yaffs2" - filesystem type used in the device
"MTD" - type of the partition used in the file system
"system" - location of the partition to be formatted
"/system" - name of the partition to be formatted
ui_print("Format Completed");
the above command is also self explanatory, it directs the cwm to display the following text
enclosed in double quotes in the user interface (display).
after succesful formatting it displays "Format Completed" in the device screen.
mount("yaffs2", "MTD", "system", "/system");
the mount command directs the cwm to mount the following file system and the following partition
the syntax is just as explained in the format command except that this command mounts the
defined partition whereas the format command formats the defined partition.
let's review what we have done till now,
1. we have checked the device to confirm that this is the device for which we created the zip.
2. we have formatted the system partition of the device.(this is only done when a new complete rom is being flashed, for flashing mods you
should never format the system partition!)
3. we have mounted the system partition of the device.
now let's continue,
package_extract_dir("system", "/system");
this command searches for the directory (folder) named "system" in the root of the zip file and
copies all the content of the "system" folder from the zip file into the "/system" partition
which is already mounted by the previous mount command.
remember the structure of the file system in the zip file and the "/system" partition of the device must be always identical.
for eg., you have created a mod by editing the systemUI.apk and you want to flash it, the system UI.apk resides in "/system/app"
so the structure of the file system in the update zip should be "/system/app/systemUI.apk"
ie., the update zip should contain folder named "system" at the root of it and folder named "app" inside the "system" folder and the
modded "systemUI.apk" must be placed inside the "app" folder.
package_extract_file("autoroot.sh", "/tmp/autoroot.sh");
this command searches for the file named "autoroot.sh" in the root of the zip file and
copies the file to "/tmp" folder and names it as "autoroot.sh" (here it does not change the name)
symlink("mksh", "/system/bin/sh");
the above command creates a symlink.
okay, now let's see about symlinks,
symlink is nothing but shortcuts, for example if a file is requiered in two different places instead of copy pasting the file
in two different locations, the file is copied to one of the two locations and in the other location a shortcut to the file(symlink)
is created. the source and the symlink can have different names (actually this is the prime use of symlinks).
to explain in a noob friendly manner,
take the above symlink, it creates a shortcut(symlink) for the command "mksh" and places it in the path of the operating system.
the shortcut(symlink) directs to the file "/system/bin/sh" , so whenever the os gets a request to execute the "mksh" command, the actual
binary that gets excuted will be "/system/bin/sh" .
creating symlinks saves a lot of space because instead of copying the whole file and placing it in requiered places we are just
creating shortcuts which directs to the source file which can be placed anywhere in the file system (generally placed in the path of the os).
set_perm_recursive(0, 0, 0755, 0644, "/system");
the above command is used to set permission recursively for the files and folders present inside a folder (in this case for "/system" folder).
syntax explanation:
0 - uid - it defines that the following permission is set for the user id 0 .
0 - gid - it defines that the following permission is set for the group id 0 .
0775 - dirmode - it defines that 0775 permission to set to directories contained within the specified directory.
0644 - filemode - it defines that 0644 permission to set to files contained within the specified directory.
"/system" - target directory to set the above mentioned permissions.
set_perm(0, 3003, 06755, "/system/bin/ip");
the above command is used to set permission for a individual file (in this case for "/system/bin/ip" file).
syntax explanation:
0 - uid - it defines that the following permission is set for the user id 0 .
3003 - gid - it defines that the following permission is set for the group id 3003 .
06775 - it defines that 06775 permission to set to the specific file.
"/system/bin/ip" - target file to set the above mentioned permissions.
run_program("/tmp/autoroot.sh");
remember the file autoroot.sh from package_extract_file command?
that file is supposed to be a shell script, the above command directs cwm to execute the "autoroot.sh" shell script present in "/tmp" folder.
unmount("/system");
the unmount command directs the cwm to unmount the following partition
the syntax is just as explained in the mount command except that this command unmounts the
defined partition whereas the mount command mounts the defined partition.
Okay now going into slightly complex and/or not widely used updater-script commands,
Ifelse
Syntax:
Ifelse(condition),(do_this),(else_do_this);
Example:
ifelse mount("yaffs2", "MTD", "system", "/system") == "system", ui_print("Mounted!"), ui_print("Mount Failed!");
Ifelse command can be explained simply as asking the system to do something based on the result of a condition.
From the example:
The ifelse command would attempt to mount the MTD partition named "system" to "/system".
If the mounting process succeeds (the condition), the script will display "Mounted!", else it will display "Mount Failed!"
abort()
It just abort's the script execution
Note: it is usually paired with some other command for example the getprop command or with ifelse.
Independently specifying abort() in the updater-script will kill the script abruptly right there so use this command carefully.
ALWAYS LEAVE A BLANK LINE AT THE END OF THE update-script (if the code contains 50 lines then 51 lines should be visible
in the notepad++ including a blank line after the end of the script)
ALWAYS REMEMBER TO SET THE EOL (end of line) CONVERSION OF updater-script
IN UNIX FORMAT BEFORE SAVING (notepad++ > edit > EOL conversion > UNIX format)
the above mentioned commands are just basic edify scripting commands which are generally used in updater-script.
for detailed scripting and coding in edify scripting language check out the following sources:
source of update-binary
introdution to edify
http://forum.xda-developers.com/wiki...cript_language
scratchpad-documenting-edify-commands-for-android-updater-scritps
http://forum.xda-developers.com/show....php?t=1290062
Broken Links!!!
source of update-binary
introdution to edify
http://forum.xda-developers.com/wiki...cript_language
scratchpad-documenting-edify-commands-for-android-updater-scritps
http://forum.xda-developers.com/show....php?t=1290062[/QUOTE]
broken links!!! :silly:
Dude cut the reply short
Sent from my Droid Bionic using xda app-developers app
Sorry brother! i mean these links are not working!!
Current Device : MT11i Xperia Neo V
ROM : Xperia Ultimate HD ™
Build Number : 2.0.3
Kernel : Suave Kernel
Root Status : Rooted
Bootloader : Unlocked
Previous Devices : Samsung Galaxy Y
GT-5360(Sold)
Sent from my MT11i using XDA Premium HD app
tharu_roxx said:
Sorry brother! i mean these links are not working!!
Sent from my MT11i using XDA Premium HD app
Click to expand...
Click to collapse
Dont quote large posts on a whole...be specific...if u dont be specific..it may annoy others and even may affect the beauty of XDA... Next time do take a note of this....
Now please modify ur post..and keep only those links that u were referring to...
-via my "Galaxy Royale"
First i noticed it dude! When um gonna edit it, xda doesn't allowed me(as i was a new member) now it's ok....thanx!!!
Current Device : MT11i Xperia Neo V
ROM : Xperia Ultimate HD ™
Build Number : 2.0.3
Kernel : Suave Kernel
Root Status : Rooted
Bootloader : Unlocked
Previous Devices : Samsung Galaxy Y
GT-5360(Sold)
Sent from my MT11i using XDA Premium HD app
kartiknnn said:
Dude cut the reply short
Sent from my Droid Bionic using xda app-developers app
Click to expand...
Click to collapse
Thanks kartik for the thread...
Learnt some new stuff...thank you...
I would suggest u to add some ready made zips with standard updater scripts... So that people can use them for faster modding...
What say?
Sent from my GT-I9103 using xda app-developers app
bhargav143 said:
Thanks kartik for the thread...
Learnt some new stuff...thank you...
I would suggest u to add some ready made zips with standard updater scripts... So that people can use them for faster modding...
What say?
Sent from my GT-I9103 using xda app-developers app
Click to expand...
Click to collapse
Try these threads
http://forum.xda-developers.com/showthread.php?t=1561463
http://forum.xda-developers.com/showthread.php?t=732957
Hit thanks if i helped!!
Current Device : MT11i Xperia Neo V
ROM : Xperia Ultimate HD ™
Build Number : 2.0.3
Kernel : Suave Kernel
Root Status : Rooted
Bootloader : Unlocked
Previous Devices : Samsung Galaxy Y
GT-5360(Sold)
Sent from my MT11i using XDA Premium HD app
Lemme see guys will try and upload them today
Sent from my GT-I9103 using xda premium
kartiknnn said:
Dude cut the reply short
Sent from my Droid Bionic using xda app-developers app
Click to expand...
Click to collapse
dont you have your exams buddy..
Sent from my GT-I9103 using xda premium
Yup formative 2 be exact
Sent from my GT-I9103 using xda premium
Where to get the update-binary file from???
prohank said:
Where to get the update-binary file from???
Click to expand...
Click to collapse
Read the second paragraph.
Sent from my CM10.1-powered GT-I9103
2. update-binary - it is a binary which is requiered by the clockworkmod to translate the human readable format of the updater-
script to machine readable format for execution of the updater-script in our device.
Click to expand...
Click to collapse
you mean this one?
It says what it is but where to get it from?
prohank said:
you mean this one?
It says what it is but where to get it from?
Click to expand...
Click to collapse
its in any CWM zip of Galaxy R. check in Meta-info/...../Android
prohank said:
you mean this one?
It says what it is but where to get it from?
Click to expand...
Click to collapse
This:
now what is the updater-script and update-binary present in the META-INF>com>google>android in any flashable zip package
Click to expand...
Click to collapse
Sent from my CM10.1-powered GT-I9103

Make your own updater-script!

To create updater-script or to edit updater-script you need Notepad++ (don’t use notepad). Download it from Here and install in your pc
updater-script is located in Meta-inf/com/google/android/updater-script
To create your own updater-script
Open notepad++ and from file menu select new and create the commands and create your own updater-script with this tutorial
After typing the commands save it as all types(*.*) and name it as updater-script and click save and put it in folder Meta-inf/com/google/android/updater-script
In this tutorial i will explain you all commands used in updater-script so that you can edit or create updater-script
ui_print – This command prints the prints the word inside the quotations
Example – ui_print(“xolo – next level”); prints xolo next level in your cwm recovery
mount – This command mounts the partition, if you want to add files to system partition you have to mount system partition, data for data partition
To mount system - mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “/system”);
Here mmcblk0p5 is the name of system partition for mtk 6589 chipsets (this name varies from device to device)
To mount data - mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “/data”); (partition name varies from device to device)
format - This command formats the partition specified
It is highly recommended to include this command to format system and data if you are making updater-script for ROM
To Format system - format(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “0″);(partition name varies from device to device)
To Format data - format(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “0″);(partition name varies from device to device)
package_extract_dir(” “, “/”) – This command extracts all the files from the folder mentioned inside first quotation to the partition or directory inside second quotation
For system - package_extract_dir(“system”, “/system”);
(this copies all files from system folder in zip to system partition in phone)
For data - package_extract_dir(“data”, “/data”);
package_extract_file(” “,”/”) - This command extract the single file inside between first quotation from zip to the partition or directory inside second quotation
symlink – This command creates links to its executable files
Here is an example
for super su binaries - symlink(“/system/xbin/su”, “/system/bin/su”);
set_perm_recursive - This command sets permission for folders
here android uses unix permission system
in unix
4 – read
2 – write
1 – execute
so
rwx is 4+2+1 = 7
rw is 4+2 = 6
rx is 4+1 = 5
Example - set_perm_recursive(0, 0, 0755, 0644, “/system”);
In this 0 is a user id for owner that refers to root. It means that permission owner for system folder. and 0 is root user means it unrestricted access to system. it is given in order to run programs to run properly
second 0 also refers to root. but here it refers to group id 0
we are only seeing about folders because “set_perm_recursive” is a command that sets permission to folders
next 0755 it means rwxr-xr-x permission has been given to system folder and rw-r-r is set for all folders inside system folder
set_perm – This command sets permission for a specific file
Example - set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pairing.conf”);
here the 1000 refers to user id system and 0640 is rw-r—–
and this command sets the permission rw-r—– for the file auto_pairing.conf
unmount – This command unmounts the partition
Example - unmount(“/system”); – unmounts system
General rule in updater-script – all commands should end with semi colon ; otherwise it will show error and if cwm or twrp shows status 7 error the error is in updater-script:laugh:
try fixing it by going through this thread
Use zipme app from Playstore to Make .Zip Flashable Files....
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Zeuscluts said:
Use zipme app from Playstore to Make .Zip Flashable Files....
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Click to expand...
Click to collapse
i use kitchen always
anyways thanks for the info :good:
and do you know any app to decompile in phone like apk multitool in pc?
Renaming is the Option
pradeepxtremehacker said:
i use kitchen always
anyways thanks for the info :good:
and do you know any app to decompile in phone like apk multitool in pc?
Click to expand...
Click to collapse
Bro its not possible,
but if you rename the .apk to .zip
you can decompile it,
but you need a PC to recompile.
Eg
sms.apk to sms.zip
then just Unzip sms.zip
you can get the Details.
Zeuscluts said:
Bro its not possible,
but if you rename the .apk to .zip
you can decompile it,
but you need a PC to recompile.
Eg
sms.apk to sms.zip
then just Unzip sms.zip
you can get the Details.
Click to expand...
Click to collapse
bro i think you are saying like extract
in fact we no need even to rename to extract we can directly extract with es file explorer from .apk but when we extract the xml will not be editable it will show like boxes
i am asking like a app like apk multi tool
No not Possible in Mobile.
Yet
Hope anyone Make this Possible In Future.
:Fingercrossed:
Let's Hope for the Better. ..
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
OK thanks
Sent from my GT-I9070 using xda app-developers app
I have a question, i and my friend both port the rom for HTC One International to HTC One J (the japan variant of HTC One) and we edit the updater-script the same way but then my friend's rom can be flashed without any error and my, it's stuck at format step, the log file say:
Code:
format() expects 4 args, got 5
format() expects 4 args, got 5
here is the command line that was corrupted:
HTML:
format("ext4", "EMMC", "/dev/block/mmcblk0p38", "0", "/system")
my friend use the same and he has no error @@
Can you tell me why i can't make the rom to be able to flashed
Very helpful... Thanks.
KuroKeita said:
I have a question, i and my friend both port the rom for HTC One International to HTC One J (the japan variant of HTC One) and we edit the updater-script the same way but then my friend's rom can be flashed without any error and my, it's stuck at format step, the log file say:
Code:
format() expects 4 args, got 5
format() expects 4 args, got 5
here is the command line that was corrupted:
HTML:
format("ext4", "EMMC", "/dev/block/mmcblk0p38", "0", "/system")
my friend use the same and he has no error @@
Can you tell me why i can't make the rom to be able to flashed
Click to expand...
Click to collapse
The format command depends on the update-binary you are using. If you use the one your friend is using it will probably work with the existing command. If you would like to keep using your existing update-binary, change the above line to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p38");
SuperR. said:
The format command depends on the update-binary you are using. If you use the one your friend is using it will probably work with the existing command. If you would like to keep using your existing update-binary, change the above line to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p38");
Click to expand...
Click to collapse
Yeah, i changed to that and the rom was flashed properly, thanks guys
Sent from my HTC J One using Tapatalk
Zeuscluts said:
No not Possible in Mobile.
Yet
Hope anyone Make this Possible In Future.
:Fingercrossed:
Let's Hope for the Better. ..
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Click to expand...
Click to collapse
Yes I think so. Even Stericson's NinjaMorph can't do it.
Hello. I am making a flashable zip that flashes a modified build.prop. i dont know much about how to do it. the screenshot attached below, shows the code i already have. All i want is an updater script that will delete the build.prop and replace it with the modified one.
[HELP] generic updater script
I do have a "strange" question: is possible to update (overwrite) just specific files/dir ?
This could allow to make "generic" roms for a whole class of devices (for example all MT65xx).
Thanks in advice for any suggestion you can provide.
How to delete files in order to replace them with new ones? You didn't specify any commands for that one.
Sent from my Nokia_XL
I need help porting a ROM that always gives me status 7 and error setting permissions.
I think it is having problems identifying my device and I might've erased the get_prop commands.
Any help?
thank you
Hey. was wondering if you had any idea what im doind wrong by this log:
AROMA INSTALLER version 2.70B6
(c) 2013 by amarullz xda-developers
ROM Name : Project Unity
ROM Version : Google Apps
ROM Author : LiquidSmokeX64
Device : Any Device
Start at : Sat Aug 9 19:34:06 2014
Installing Google Core Apps
Mounting system...
Copying files...
Extract: /system/app/GoogleContactsSyncAdapter.apk
Extract: /system/etc/permissions/com.google.android.ble.xml
Extract: /system/etc/permissions/com.google.android.camera2.xml
Extract: /system/etc/permissions/com.google.android.maps.xml
Extract: /system/etc/permissions/com.google.android.media.effects.xml
Extract: /system/etc/permissions/com.google.widevine.software.drm.xml
Extract: /system/etc/permissions/features.xml
Extract: /system/etc/preferred-apps/google.xml
Extract: /system/framework/com.google.android.ble.jar
Extract: /system/framework/com.google.android.camera2.jar
Extract: /system/framework/com.google.android.maps.jar
Extract: /system/framework/com.google.android.media.effects.jar
Extract: /system/framework/com.google.widevine.software.drm.jar
Extract: /system/lib/libAppDataSearch.so
Extract: /system/lib/libconscrypt_gmscore_jni.so
Extract: /system/lib/libgames_rtmp_jni.so
Extract: /system/lib/libgcastv2_base.so
Extract: /system/lib/libgcastv2_support.so
Extract: /system/lib/libgmscore.so
Extract: /system/lib/libgoogle_hotword_jni.so
Extract: /system/lib/libgoogle_recognizer_jni_l.so
Extract: /system/lib/libjgcastservice.so
Fixing Permissions...
Installing Google Chrome
package_extract_file: can't open /system/app/Chrome.apk for write: Read-only file system
package_extract_file: can't open /system/lib/libchrome.1985.128.so for write: Read-only file system
Installing Cloud Print
package_extract_file: can't open /system/app/CloudPrint.apk for write: Read-only file system
Installing Google Play Music
package_extract_file: can't open /system/app/Music2.apk for write: Read-only file system
Installing Gmail
package_extract_file: can't open /system/app/Gmail.apk for write: Read-only file system
Installing YouTube
package_extract_file: can't open /system/app/YouTube.apk for write: Read-only file system
package_extract_file: can't open /system/lib/libm2ts_player.so for write: Read-only file system
Fixing permissions again...
Finished
script result was [@Finished]
Installer Sucessfull (Status 0)
End at : Sat Aug 9 19:34:06 2014
Problems with script
Greetings, I am new to the forum and have a question, I use a program to change my boot image, this generates me an update.zip and works perfect, but using as a basis the same script and copy any file to the same path, the script does nothing at all.
this is the script that changes the boot image
ui_print("Flashing logo...");
show_progress(0.200000, 0);
package_extract_file("logo.bin", "/dev/logo");
ui_print("Patched!");
ui_print("");
ui_print("Now you can reboot your phone");
Click to expand...
Click to collapse
and this is my script
ui_print("Flashing logo...");
show_progress(0.200000, 0);
package_extract_file("test.txt", "/dev/test.txt");
ui_print("Patched!");
ui_print("");
ui_print("Now you can reboot your phone");
Click to expand...
Click to collapse
i don't see what the problem is, any ideas?
Gorgonitte said:
Greetings, I am new to the forum and have a question, I use a program to change my boot image, this generates me an update.zip and works perfect, but using as a basis the same script and copy any file to the same path, the script does nothing at all.
this is the script that changes the boot image
and this is my script
i don't see what the problem is, any ideas?
Click to expand...
Click to collapse
if understood correctly, your script should extract to /tmp/scriptname.sh or /temp/scriptname.sh
after which your updater script in you meta-inf/com/google/android directory of your update.zip
need to include instruction to set permission and execute the script that actually performs the function.
m

Categories

Resources