Make your own updater-script! - General Topics

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

Related

[HOW-TO] ROM-HACKING: init.rc ext2-auto-mount / ROM Signing / ROM Kitchen

AS MENTIONED IN THE INTRODUCTION TEXT THIS HAS ONLY BEEN TESTED ON AMON RA ROM 1.6.2 BUT SHOULD REALLY WORK ON ANY ROM THAT HAS NO EXT2 AUTO-MOUNT. AND YEAH THIS WHOLE PROCESS HAS BEEN DONE ON A 32a BOARD. FOR THOSE THAT TRY THIS ON OTHER ROMS LET ME KNOW HOW IT GOES.
I've searched and shuffled through the entire forum and made inquiries to ROM authors without much light being shed on this issue. I doubt I am the only one who has been looking for a way of doing this so I decided to do a small HOW-TO. Here I will explain step by step as to how you can implement a script to be part of your ROM that will auto mount an ext2 partition on boot up if such partition is present. I have included all the tools I've used in order to pull this off, and as the title suggests this has only been done on Amon Ra's latest 1.6.2 ROM. In order to follow these instructions you are expected to allready have set up an adb enviroment on your linux box and for the signing process to work you must have sun-java present, the gnu java wont work. And of course a microSD card with an ext2 partition
1. Download install.sh to your home directory
Code:
wget http://www.grindhouse.no/androidtools/install.sh
chmod a+x install.sh
2. Now execute the install.sh script which will create a directory to work in and download a tool and script package and unpack it.
Code:
./install.sh
When the install.sh script is done you need to move the mkbootimg preferebly to your tools directory of your SDK.
Code:
mv toolstomove/mkbootimg <path/to/sdk/tools/mkbootimg>
3. Unpack the RA1.6.2 ROM into a directory in your home dir. In this HOW-TO we will use directory name "ra1.6.2" as an example through out the entire process.
4. Copy the boot.img from ra1.6.2 to the ROM-cooker dir
Code:
cp $HOME/ra1.6.2/boot.img $HOME/ROM-cooker/boot.img
cd $HOME/ROM-cooker
5. Use unpack.pl to extract the ramdisk from the boot image. I've modified the script a little so it automates the entire process and decompresses the ramdisk to a directory
Code:
./unpack boot.img
6. Now you can either replace the init.rc file here with the one I've included in this package or you can add these lines by yourself. In wich case do the following
Code:
cd boot.img-ramdisk
pico init.rc
Press CTRL+w and then CTRL+t and input 27. hit enter. This will take you to line 27 of init.rc so you can add a line right before the init process remounts the rootfs in read-only mode. Add following line:
Code:
mkdir /sdext2 0771 system system
Now scroll down to the end of the init.rc file and add the following:
Code:
service mountsdext2 /system/bin/mountsd
user root
group root
oneshot
7. You have now edited (or replaced) your init.rc file and prepared it to execute a script on boot that will detect an ext2 partition and boot it if there is one to be found. Now you have to make the mountsd script a part of the ROM. Do the following:
Code:
cd $HOME/ROM-cooker
mv toolstomove/mountsd $HOME/ra1.6.2/system/bin/mountsd
rm -rf toolstomove
8. Now that the init.rc file is sorted out and mountsd has been placed in /system/bin of the ROM so it is time to re-pack the boot.img:
Code:
cd $HOME/ROM-cooker
./repack boot.img-kernel boot.img-ramdisk boot.img
rm $HOME/ra1.6.2/boot.img
mv boot.img $HOME/ra1.6.2/boot.img
9. Your ROM now has a new boot image with an updated init.rc and the /system/bin dir has the script needed to auto-mount the microsd ext2. Now you must re-zip the ROM and sign it. Do the following:
Code:
cd $HOME/ra1.6.2
zip -r update.zip *
mv update.zip $HOME/ROM-cooker/update.zip
cd $HOME/ROM-cooker
./sign.pl update.zip
10. The ROM is now signed and you now have a file called update-signed.zip. Connect the phone to your computer and execute thus:
Code:
./push update-signed.zip
11. Now you are ready to flash the modified ROM which will auto-mount an ext2 partition on your microSD. There is no need to wipe before flashing. If you have no prior experience with ROM flashing or whatever just backup your current install. If you're using OpenHOME or anything similar, nothing will be changed or damaged but if you're using MontAlbert's themes with the ROM you will have to flash them again after flashing this modified ROM.
Code:
adb reboot recovery
12. Flash from choose zip and of course choose update-signed.zip. Reboot. After the system boots up again you can now check whats what with either one of the commands:
Code:
[email protected]:~$ adb shell mount | grep sdext2
/dev/block/mmcblk0p2 on /sdext2 type ext2 (rw,noatime,nodiratime,errors=continue)
[email protected]:~/boot$ adb shell busybox df -h | grep sdext2
/dev/block/mmcblk0p2 893.7M 13.0K 846.0M 0% /sdext2
13. Voila! Your RA 1.6.2 ROM now detects and mounts your microSD ext2 partition on boot. Woohoo?
I hope the HOW-TO was easy reading and that you have succeeded in hacking up your ROM. I know that certain ROMs have this as a built-in function but Amon Ra's does not. But since alot of people including myself use his ROM because of the high speed and stability I thought I should contribute to his project and add a cool (and missed?) function to it.
Mind you that you can use the ROM-cooker set to further adjust and hack up the ROM as you see fit. Happy learning!
Very nice!
Now the question many people will ask : why would you automount ext2 if you don't use apps2sd ?
I personally have ubuntu on my ext2 And besides this approach can be used for a number of things, people who have had the need, or wanted to experiment with init.rc doing things on boot, the mountsd script can easily be altered to do what ever needed.
For me its been a learning curve finding these things out, so by sharing it I may spare some people breaking their backs over this whole init.rc thing. people may want to modify init.rc for whatever reason, so I'm sure people wont have a problem finding a way of putting this to use, and its a subject that isnt all that covered on the forum .. and hey .. at least they get a rom kitchen out of the whole shabang
Very interesting! Thank you.
I used your unpack-program to unpack a recovery-image. It seems to work fine. What I am trying to do is change the state the recovery-image returns the phone to. Would it be possible to just replace your mountsd-script with, for example, a script that installs apps? Or is there a better way to do what Im trying to achieve?
Cheers,
edit: I noticed that on the emulator it is sufficient to just place an apk-file in "data/app" to get it installed. Could it be possible that this is all I need a script to do? :O or could I hurt my poor phone by doing so you think?
sandis84 said:
edit: I noticed that on the emulator it is sufficient to just place an apk-file in "data/app" to get it installed. Could it be possible that this is all I need a script to do? :O or could I hurt my poor phone by doing so you think?
Click to expand...
Click to collapse
That's indeed all you need to do.
Hi!
So I tried to create a signed update.zip, but it failed. It didnt create a "update-script"-file, so my device refused to install it. I wrote my own "update-script"-file, but then it complained "no digest" for the file. How do I solve this?
post the contents of your script people might see whats up
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
sitimber said:
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
Click to expand...
Click to collapse
Says where its at in the first line : )
Code:
wget http://www.grindhouse.no/androidtools/install.sh
But now that I checked, I have to apologize, I see I have a missed payment with my hosting, I'll fix that within the day. Also sorry I havent been answering the few questions here I've been afk cause of surgery.
sitimber said:
post the contents of your script people might see whats up
Click to expand...
Click to collapse
well, I looked in another "update-script" file and found this:
assert compatible_with("0.2") == "true"
assert getprop("ro.product.device") == "dream" || getprop("ro.build.product") == "dream"
show_progress 0.5 0
write_radio_image PACKAGE:radio.img
show_progress 0.5 10
Click to expand...
Click to collapse
So I figured that nothing was essential other then the line "write_radio_image PACKAGE:radio.img". Also ofcourse I made sure it contained the name of my image-file instead of "radio.img". This gave me the "no digest" message, so now I feel unsure on how to create a working update.zip.
edit:
SOLVED! How silly of me. When you sign the update, a hash of each file is put in manifest.mf. Since I added the update-script after signing the file, ofcourse the digest(hash) was missing. Now everything works alot better and I can proceed... until I get stuck again
Cheers,
edit2:
Just to get a better understanding, what exactly does each line do here? Or where can I read about this?
Code:
service mountsdext2 /system/bin/mountsd
user root
group root
oneshot
edit3:
Ok, so I have experimentet, but I still dont manage to solve those last steps. I tried to edit init.rc and just add "mkdir /testdir 0000 system system" where the other directories were created. I then repacked it, zipped it, signed it, put it on my sdcard, started up a custom recovery, installed the update and rebooted. Everything seems to work fine. But when I start adb and check around, I dont see the "testdir"-directory. Also when I check in init.rc my line is gone. Do you guys have an idea of where I went wrong?
sitimber said:
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
Click to expand...
Click to collapse
it doesnot necesarily have to be linux ...you can also do it in windows using cygwin and dsxda's android rom kitchen

How do I make my own update.zip from my Nexus S ROM?

How do I make a update.zip on my phone from my whole system folder?
I want to start making cyanogenmod ROMs
Can I edit their update.zip's ? Or do I have to resign them? I used to make odin roms...
1) Create an empty folder (eg. C:\workdir)
2) Create C:\workdir\system\app folder
-- load all your apks in here
3) Create C:\workdir\system\lib folder
-- if the apk needs libraries referenced
4) Create C:\workdir\META-INF\com\google\android folder
5) Create the update-script script and put that in the \com\google\android folder ^
Code:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
oneblanklinethatdoesn'tparseinthiscodeblock...
Put the extra white line at the bottom of the update-script.
6) Compress the contents of C:\workdir folder to a zip
7) Sign the workdir.zip file
Code:
java -jar signapk.jar certificate.pem key.pk8 myupdate.zip update.zip
If you don't know howto sign your zip file: http://www.londatiga.net/it/how-to-sign-apk-zip-files/
Now you have a workdir.zip file (rename it to update.zip if you want). You can flash this through CWM, it will replace the contents of your workdir/system/app with the files in /system/app.
Greetz
Dude i get update failed to flashh....i think its becuz of the script and put the white line staff...........im trying to install more than one app ...any help on the script for more than one app

[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

[Noob Friendly][Guide] How to extract .ext4 file while using linux !

There may be alot of guides out there how to make flashable zip of your ftf released by Sony ! But extracting ext4 files can be a headache !
I tried searching alot ! learned alot ! there were so many information that a Noob(like me) can be so much confused !
You can extract .ext4 file on windows also but that may cause BOOTLOOP also ! [PERSONAL EXPERIENCE]
So here are the simple steps to extract .ext4 files easily in linux !
1) open terminal
2) type
sudo nautilus
Click to expand...
Click to collapse
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
sudo mount -o loop /root/desktop/system.ext4 /home/USERNAME/Desktop/mounted
Click to expand...
Click to collapse
(Basic Structure of that command is: sudo mount flag loop ext4 directory mounted directory !)
HERE;
/root/desktop/system.ext4 is the directory of .ext4 file
/home/USERNAME/Desktop/mounted is the directory of destination folder !
AND DONE ! You can grab those files and put in system folder of your zip file !
NOTE THAT: THIS EXTRACTED DATA WILL BE ODEXED !
ShivangDave said:
...
Click to expand...
Click to collapse
Hi, This was the guide which i was really looking for but unfortunately the code is not working for me in can you please check it again ?
Edit: Thanks it worked ! Great. The explanation for the code given by you helped me solving it ! Thanks a lot bro
M4ST3R-V said:
Hi, This was the guide which i was really looking for but unfortunately the code is not working for me in can you please check it again ?
Edit: Thanks it worked ! Great. The explanation for the code given by you helped me solving it ! Thanks a lot bro
Click to expand...
Click to collapse
Glad to hear that
ShivangDave said:
Glad to hear that
Click to expand...
Click to collapse
desktop is spelled with a capital D
thank you! using today this noob guide, very helpfull!!!
Buddy..I wanna try making a zip from ftf.
So I have extracted the system.sin into a folder system...
Now I need meta-inf to be kept along with system into a zip right....
So if I go wrong somewhere will I brick my phone..
Also can I simply delete all the unwanted apps from apps folder?
Please..I know you are a guy who knows all these stuff..I saw many guides,yet I am afraid if somethin bad will happen to my device..
Plz help me... I need you badly.
Hit the thanks button..it does not cost you anything.
it's worth something for me...
sent from my Sony Xperia e dual
mathewsj114 said:
Buddy..I wanna try making a zip from ftf.
So I have extracted the system.sin into a folder system...
Now I need meta-inf to be kept along with system into a zip right....
So if I go wrong somewhere will I brick my phone..
Also can I simply delete all the unwanted apps from apps folder?
Please..I know you are a guy who knows all these stuff..I saw many guides,yet I am afraid if somethin bad will happen to my device..
Plz help me... I need you badly.
Hit the thanks button..it does not cost you anything.
it's worth something for me...
sent from my Sony Xperia e dual
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=2183077
ShivangDave said:
There may be alot of guides out there how to make flashable zip of your ftf released by Sony ! But extracting ext4 files can be a headache !
I tried searching alot ! learned alot ! there were so many information that a Noob(like me) can be so much confused !
You can extract .ext4 file on windows also but that may cause BOOTLOOP also ! [PERSONAL EXPERIENCE]
So here are the simple steps to extract .ext4 files easily in linux !
1) open terminal
2) type
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
(Basic Structure of that command is: sudo mount flag loop ext4 directory mounted directory !)
HERE;
/root/desktop/system.ext4 is the directory of .ext4 file
/home/USERNAME/Desktop/mounted is the directory of destination folder !
AND DONE ! You can grab those files and put in system folder of your zip file !
NOTE THAT: THIS EXTRACTED DATA WILL BE ODEXED !
Click to expand...
Click to collapse
nautilus is just for ubuntu, mention that you need to swap nautilus with your file manager if you're using a different distro other than ubuntu(e.g lubuntu= pcmanfm )
Also when using GUI and sudo, it's best to use gksudo instead of sudo.
Hi,
It works fine, so thanks for that, but I end up with a ''volume of 682 MB''. Unmounting and ejecting doesn't work and simply deleting it, also won't work. Does anyone have any idea how to remove this ''device'' from my system? It's quite annoying and takes in space.
Thanks!
Never mind , a reboot fixed it...
Sent from my C1505 using XDA Premium 4 mobile app
ShivangDave said:
1) open terminal
2) type
Code:
sudo nautilus
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
Code:
sudo mount -o loop /root/desktop/system.ext4 /home/USERNAME/Desktop/mounted
Click to expand...
Click to collapse
First off let me say that I am in no way a Linux user, but I tend to be quite resourceful when it comes to researching. This one is beginning to stump me. Second, I am using crunchbang {a Debian (Wheezy)} build and therefore I had to modify the coding a little bit.
This is what I did just to even get it to accept my query without issues
Code:
sudo nautilus
This pulled up my Desktop in File Manager with root privileges. I created the mounted folder and put the system.img.ext4 in the Desktop location. Debian, or crunchbang, does not have a physical Desktop for placing files, as far as I have learned, just this folder located in the root folder. Anyways, after doing those two things I did this
Code:
sudo mount -t ext4 /root/Desktop/system.img.ext4 /root/Desktop/mounted
This was the first code I tried that didn't return any error about the location, fs, or anything. Feeling hopeful that I had finally figured out and was going to be able to access my system.img I look at my Desktop folder and open up the mounted folder, what do I see? Lost+Found folder with nothing in it, and a hidden folder called .Trash-0 which contains two folders "files" and "info". "files" contains a folder just like the non-hidden lost+found with nothing in it and the "info" folder which contains an 0byte file titled lost+foundinfo. My system file is over 2GB in size, so I am at a standstill because I do not know how to proceed.
jacodaburr said:
First off let me say that I am in no way a Linux user, but I tend to be quite resourceful when it comes to researching. This one is beginning to stump me. Second, I am using crunchbang {a Debian (Wheezy)} build and therefore I had to modify the coding a little bit.
This is what I did just to even get it to accept my query without issues
Code:
sudo nautilus
This pulled up my Desktop in File Manager with root privileges. I created the mounted folder and put the system.img.ext4 in the Desktop location. Debian, or crunchbang, does not have a physical Desktop for placing files, as far as I have learned, just this folder located in the root folder. Anyways, after doing those two things I did this
Code:
sudo mount -t ext4 /root/Desktop/system.img.ext4 /root/Desktop/mounted
This was the first code I tried that didn't return any error about the location, fs, or anything. Feeling hopeful that I had finally figured out and was going to be able to access my system.img I look at my Desktop folder and open up the mounted folder, what do I see? Lost+Found folder with nothing in it, and a hidden folder called .Trash-0 which contains two folders "files" and "info". "files" contains a folder just like the non-hidden lost+found with nothing in it and the "info" folder which contains an 0byte file titled lost+foundinfo. My system file is over 2GB in size, so I am at a standstill because I do not know how to proceed.
Click to expand...
Click to collapse
change the directory if possible, and change the command according to it.. Because I'm in no way a crunchbang user let me know if i can help in any other way though...
sudo mount flag loop ext4directory mounteddirectory
ShivangDave said:
change the directory if possible, and change the command according to it.. Because I'm in no way a crunchbang user let me know if i can help in any other way though...
sudo mount flag loop ext4directory mounteddirectory
Click to expand...
Click to collapse
trying to use that code with flag and/or loop returns this
Code:
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems
mount -l : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
mount -a [-t|-O] ... : mount all stuff from /etc/fstab
mount device : mount device at the known place
mount directory : mount known device here
mount -t type dev dir : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir
or move a subtree:
mount --move olddir newdir
One can change the type of mount containing the directory dir:
mount --make-shared dir
mount --make-slave dir
mount --make-private dir
mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
mount --make-rshared dir
mount --make-rslave dir
mount --make-rprivate dir
mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using -L label or by uuid, using -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say man 8 mount .

[MOD][ATT][4.4] Remove unsafe volume warning

I did this for myself, and thought I would share. I got tired of the "Raise volume above safe level?" warning, and I removed it. I like to learn, so rather than use the existing xposed framework mod, I built a flashable zip to make the change via framework-res.apk.
WARNING: I AM NOT RESPONSIBLE IF YOU MESS UP YOUR PHONE
Prerequisite:
ATT Moto X running stock official 4.4 kitkat (140.44.5)
TWRP or CWM (safestrap for those who don't have an unlocked bootloader, thanks Hashcode)
backup all of your data in case something goes horribly wrong
Instructions:
using your choice of file manager, backup /system/framework/framework-res.apk
Download or copy flashable zip (below) to sdcard
Reboot to [safestrap] TWRP recovery
flash zip file
Below are the 'broad strokes' of how I did this in linux: (Each of these steps below require various skills, and my intent is not to do too much 'hand holding.')
DUMP AND DECOMPILE framework-res.apk
make sure java 7 is installed
download/extract apktool_2.0.0b7.jar (thanks brut.all)
move /system/framework/framework-res.apk to apktool directory
install framework: java -jar apktool_2.0.0b7.jar if framework-res.apk
dump framework-res.apk: java -jar apktool_2.0.0b7.jar d framework-res.apk
--
CHANGE SETTING IN TWO FILES:
edit this file: framework-res/res/values/bools.xml
search for the line with this info: config_safe_media_volume_enabled
change the value to: false
repeat with framework-res/res/values-mcc310/bools.xml
--
DELETE DIRECTORY STRUCTURE (not sure why framework wouldn't compile with this, but it is unused on AT&T phones)
delete this directory: framework-res/values-mcc310-1
--
RECOMPILE AND COPY EXISTING SIGNATURE:
recompile: java -jar apktool_2.0.0b7.jar b framework-res -o framework-res-new.apk
move META-INF structure from inside the original framework-res.apk to the new framework-res-new.apk (I used 7z)
--
ZIPALIGN NEW FILE:
zipalign -f -v 4 framework-res-new.apk framework-res.apk
--
CREATE FLASHABLE ZIP WITH NEW framework-res.apk
you can use mine as a template and just replace my framework-res.apk under /system/framework
TWRP/CWM flashable zip: http://www.androidfilehost.com/?fid=23252070760973197
(Replaces /system/framework/framework-res.apk with my modified version.)
Trying this now on my Rogers ATT KK based Moto X. Ill update soon.
Updated script brakes at device check.
Sent from my XT1058 using XDA Premium 4 mobile app
slimdizzy said:
Updated script brakes at device check.
Sent from my XT1058 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Do you mean the updater-script in the flashable zip? If so, you can modify those checks for your phone if you can see the error. I used twrp->advanced->copy logs to /sdcard to see the error messages.
Ctrl-Freak said:
Do you mean the updater-script in the flashable zip? If so, you can modify those checks for your phone if you can see the error. I used twrp->advanced->copy logs to /sdcard to see the error messages.
Click to expand...
Click to collapse
Will do. Ill post shortly.
Update:
Installing '/sdcard/motox-att-140.44.5-framework-res-1.zip'...
Checking for MD5 file...
I:Cannot find file /sdcard/motox-att-140.44.5-framework-res-1.zip.md5
Skipping MD5 check: no MD5 file found.
I:Zip does not contain SELinux file_contexts file in its root.
script aborted: This package is for "ghost" devices; this is a "xt1060".
This package is for "ghost" devices; this is a "xt1060".
E:Error executing updater binary in zip '/sdcard/motox-att-140.44.5-framework-res-1.zip'
My build.prop shows 1058 for the record.
slimdizzy said:
Will do. Ill post shortly.
Update:
Installing '/sdcard/motox-att-140.44.5-framework-res-1.zip'...
Checking for MD5 file...
I:Cannot find file /sdcard/motox-att-140.44.5-framework-res-1.zip.md5
Skipping MD5 check: no MD5 file found.
I:Zip does not contain SELinux file_contexts file in its root.
script aborted: This package is for "ghost" devices; this is a "xt1060".
This package is for "ghost" devices; this is a "xt1060".
E:Error executing updater binary in zip '/sdcard/motox-att-140.44.5-framework-res-1.zip'
My build.prop shows 1058 for the record.
Click to expand...
Click to collapse
Did you build this from your Rogers framework? (If not, keep in mind my framework-res if from an AT&T phone. I have no idea if there are any differences.)
To continue, you can edit the updater-script and make the change from "ghost to "xt1060".
I have a rogers phone but ATT firmware. This is just what happens when I flash your zip. Your updated script asks for a 1058, which is my model but breaks and says my device is a 1060. That is nowhere in my prop. This should flash no problem and it doesn't. I even tried to manually overwrite using root explorer and my phone wouldn't boot after. I replaced original file and all is well.
Sent from my XT1058 using XDA Premium 4 mobile app
Thanks, this worked like a charm for my Moto G.
I used Advanced ApkTool v2.0.0 to decompile 'framework-res.apk',
I used Notepad++ to set all 'config_safe_media_volume_enabled' entries to false,
After the recompilation, I extracted the content of the original 'framework-res.apk' with 7-zip, and just replaced 'resources.arsc' with the modified one. (can be found in the '\build\apk' directory)
Recompressed again with 7-zip (compression level: store) and used adb to replace the file:
adb push framework-res.apk /sdcard/Download/framework-res.apk
adb shell
Code:
su
mount -o remount,rw -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system
mv /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cat /sdcard/Download/framework-res.apk > /system/framework/framework-res.apk
chmod 644 /system/framework/framework-res.apk
sync
reboot

Categories

Resources