[Q] Couple of questions about ROM development - Android Software Development

Hello!
First of all, thanks to all you repliers!
I'd really like to know a few things creating a ROM:
1. how can I create an update.zip starting from a system.img? (I know how to sign) In case can I simply install the img and then push /system changes, like root or busybox?
2. how can I install busybox manually? Can I create a script which does the job for me (i.e. busybox --install command at first boot then delete the script itself), avoiding me to write loads of symlinks?
3. when I've created an update.zip, is it easy to root the ROM? I mean, just push su and SuperUser.apk? Or I need a particular boot.img?
Thanks

elegos said:
Hello!
First of all, thanks to all you repliers!
I'd really like to know a few things creating a ROM:
1. how can I create an update.zip starting from a system.img? (I know how to sign) In case can I simply install the img and then push /system changes, like root or busybox?
Click to expand...
Click to collapse
Clockwork Recovery won't install system image files for some reason. You'll need to dump the yaffs2 filesystem then zip it up into the update.zip, then use an updater-script to set unix permissions (zip doesn't preserve these). Also, there's no need to sign the update.zip. It's only meaningful to the device's firmware if it is signed by the device's manufacturer.
elegos said:
Hello!
2. how can I install busybox manually? Can I create a script which does the job for me (i.e. busybox --install command at first boot then delete the script itself), avoiding me to write loads of symlinks?
Click to expand...
Click to collapse
Certainly. You can add a script and call it from updater-script during the install.
elegos said:
Hello!
3. when I've created an update.zip, is it easy to root the ROM? I mean, just push su and SuperUser.apk? Or I need a particular boot.img?
Thanks
Click to expand...
Click to collapse
Boot image is irrelevant to a properly rooted system. Just adding SuperUser should be sufficient.

That's cool!
1. as of the system.img, I see there is a system folder too - is that just enought zipping it?
2. may you please tell me how to call a script within an edify updater-script please?
3. thanks

I don't understand. You have a system.img and a system folder? In what? What are you starting from? If you use a zipped system, you WILL need to set unix permissions, symlinks and modes as these are NOT preserved in a zip file.
As far as calling scripts, something like this:
run_program PACKAGE:installbusybox.sh

Related

[UPDATE 22/08/12] ROM Cooking Guide (One Package)

This is how I made ROM, I'll try to write the steps as simple as I can. For advanced users only!
Update 22/08/11:
Revised packaging steps.
Update 13/08/11:
Removed unwanted method for ROM cooking.
Update 04/08/11:
Modified extract and repack ROM guide and added extracting system.rfs guide.
Things you need:
Base firmware
Archiver software (7zip recommended)
Any Linux environment to build ROM or Cygwin
APK Manager to optimize and decompile *.apk files
MagicISO (Optional) if you want to extract system.rfs
And the last thing is... You need enough experience in android world
So, here is the steps to cook a ROM:
Flash your phone with your desired base firmware
Make required modifications
Pull system.rfs from your phone by running this command on adb shell or Terminal Emulator:
Code:
dd if=/dev/stl12 of=/sdcard/system.rfs
Extract any *.tar.md5 files from your base firmware to your working folder with 7zip
Replace the current system.rfs with your modified one
EDIT: Pack your ROM by running this code via terminal or just pack it with 7zip/WinRAR as *.tar
Code:
tar -H ustar -c * >> ROMNAME.tar
change ROMNAME to your desired, well, ROM name.
Here is (yet) useful guide to modify your ROM.
Extract system files on system.rfs to make modding easier:
Extract PDA file (*.tar.md5) files with 7zip
Open system.rfs with MagicISO
To extract it, just drag and drop
NOTE: Never edit your ROM with MagicISO because the file permissions will be ignored, use MagicISO only for extracting files from system.rfs
Deodex, and Zipalign (optimize) your ROM apk files:
Ready to use deodex + root for KPN: http://forum.xda-developers.com/showthread.php?t=1196230
Ready to use deodex + root for KPH and other firmware: http://forum.xda-developers.com/showthread.php?t=1118048
Open APK Manager
To zipalign your apk files, in apk manager folder /place-apk-here-to-batch-optimize put your:
framework-res.apk, twframework-res.apk and all system apk
but not these:
AxT9IME, Calculator, Camera, Email, MMS, Phone, Screen Capture, Settings, Swype, Thinkdroid, Voice search
Choose Choose option 15
Then choose both (zp)
Let it run and done.
Now put back the apk files where they belong in the ROM.
How to put these apk files to my ROM? Copy these files to appropriate locations, such as /system/app to your ROM's /system/app, and etc.
Another handy modification guide:
Unpack and repack boot.img - http://forum.xda-developers.com/showthread.php?t=1173427
Convert firmware filesystem to ext4 - http://forum.xda-developers.com/showthread.php?t=1202049
Overscroll glow for any firmware - http://forum.xda-developers.com/showthread.php?t=1215933"
Give thanks to all dev who made that possible!
If you have more guides to put here, please PM me.
Am I pertamax?
hehe..just kidding.
Nice Info....great share.
I would want the Fla.sh Rom :'(
Thats a gr8 share...Thank you...)
saiftheboss7 said:
I would want the Fla.sh Rom :'(
Click to expand...
Click to collapse
sorry... once again, I'm sorry, I can't continue my ROM
Helpful thread man!
Thanks!
Great job taking your time to make this! Unfortunately, i dont even know the basics but now I know where to check when I do
fla.sh said:
sorry... once again, I'm sorry, I can't continue my ROM
Click to expand...
Click to collapse
Hey!
THX man, nice thread. Very useful!
Just PM to MOD, that they close you previous thread, a bout fla.sh.ROM. Or ppl just waiting it and asking.
CHEERS!
i think the most troublesome problem i encounter is to repack system.rfs. yes it can be mounted in magiciso, but howto repack/compile it back?
an0nym0us_ said:
i think the most troublesome problem i encounter is to repack system.rfs. yes it can be mounted in magiciso, but howto repack/compile it back?
Click to expand...
Click to collapse
Just save it.
didnt work when i just save it. my device got bootloop
an0nym0us_ said:
didnt work when i just save it. my device got bootloop
Click to expand...
Click to collapse
What modification you've added to your ROM? Maybe that modification causing the problem...
fla.sh said:
What modification you've added to your ROM? Maybe that modification causing the problem...
Click to expand...
Click to collapse
As Linux, MagicISO read RFS image as a FAT filesystem. File permissions can not be maintained. A better way but need linux:
1. Mount system.rfs as FAT and mount it to /tmp/rfs
2. Make ext4 image, and mount it to /tmp/system
3. Copy /tmp/rfs contents to /tmp/system
4. Make modification inside /tmp/system
5. Fix file permissions inside /tmp/system
6. Umount both image
7. Make ODIN flashable image, contains system.rfs (now in ext4 format) and CF-Root-S5830 boot and recovery image (for ext4 support)
8. Boot to Windows and flash your new firmware using ODIN.
ketut.kumajaya said:
As Linux, MagicISO read RFS image as a FAT filesystem. File permissions can not be maintained. A better way but need linux:
1. Mount system.rfs as FAT and mount it to /tmp/rfs
2. Make ext4 image, and mount it to /tmp/system
3. Copy /tmp/rfs contents to /tmp/system
4. Make modification inside /tmp/system
5. Fix file permissions inside /tmp/system
6. Umount both image
7. Make ODIN flashable image, contains system.rfs (now in ext4 format) and CF-Root-S5830 boot and recovery image (for ext4 support)
8. Boot to Windows and flash your new firmware using ODIN.
Click to expand...
Click to collapse
I use this command to mount rfs:
Code:
mount -o loop system.rfs /some_dir
Can you share us the command?
now thats really informative. thanks
ROM unpacking and repacking gude has been corrected. Tested by me. If you have any problems, just ask here.
Thanks.
I think you should add the date of update in the title, so that everyone can know about the update...
BTW thanks for this amazing guide...
Love it!!!
After making changes to system.rfs, how to save it as .rfs again?
adiles said:
After making changes to system.rfs, how to save it as .rfs again?
Click to expand...
Click to collapse
Please take look at the first page, it's updated, you know?
After I created md5 file and selected it in odin, it says "invalid image type" and "invalid model binary". How to solve that? After that I continued, skipped these errors and flashed, my phone stopped at boot screen with text "Galaxy ACE....". Plz help me

How to create flashable zip from scratch?

Hi everyone,
I was wondering if someone could point me in the right direction to create a flashable ROM from *SCRATCH*. I have googled everything I can think of and everyone seems to have the same answer -- take someone else's zip file and just replace the files with your own, then tweak the updater-script if necessary.
This seems kind of bogus to me, but perhaps I don't quite understand edify scripting. Certainly doing this with amend scripting would work, but that was deprecated a long time ago so I would like to use edify. I think the root of the problem is that I don't understand what the update-binary file is all about.
Can someone please explain how to create a zip without just using someone else's and tweaking it? I recently updated my framework-res.apk file and put new battery icons and new charging animation in it. Then I pushed it back over to my phone with adb and it works great. I would really like to know how to create a flashable zip from this. Sure, I could just download someone else's zip file and then swap out their framework-res.apk file with mine but that doesn't teach me the real, underlying process.
I am a developer for my day job so I'm not new to this type of stuff, but I am new to Android development. I can create the directory structure necessary and place my signed apk file where it needs to go. Furthermore I can write the updater-script file myself (in edify syntax). But then I need to somehow generate the update-binary file before creating the final, flashable zip and signing it.
So how exactly do I create the update-binary file? Do I need to run my updater-script file through a compiler or something? Or maybe the update-binary file is universal for every flashable zip (though if this were the case, then why have the file in every zip -- just put it on every phone and then you don't need to bloat every flashable zip file with it).
Can someone please explain? Also, if you can do it without mentioning or requiring any Windows specific tools that would be great. I run Ubuntu so most of the Windows tools are useless to me (yes I know I could run a virtual machine, or use Wine, etc.). I prefer to do everything with Linux or some platform-independent way.
Thanks!
I use linux too (gentoo) and I make mine pretty much from scratch. Just create a working directory somewhere (I use /usr/src/[my_package_name]/) then create a directory layout just like you'd want to see on the android device. For your example make a directory called "system" and then "system/framework" then copy your framework-res.apk to system/framework/. Now make a META_INF directory, and add "com" then "google" then "android" (so you have [my_package_dir]/META_INF/com/google/android/ ). Now copy the updater_binary (this is basically the command interpreter for edify scripts--amend commands are built-in to the recovery system). Now make your script. FOr your example above, your realy only need a few commands: mount the system dir, then copy the package file(s) over:
Code:
mount("ext3", "EMMC", "/dev/block/mmcblk0p25", "/system");
package_extract_dir("system", "/system");
You'll need to know the details for the specific device to know what arguments to use for the mount command. The above is for an Inspire or DesireHD.
Now just zip it all up (from your base package's directory):
Code:
zip -r -o my_package_file.zip META_INF/ system/
the "-r" means "recursive" and "-o" tells it what output file to use. The remaining arguments are the files (or directories in this case) to zip up.
That's great information...actually more detailed than what I needed but it's always better to have too much than too little. You answered my main question though which is what is the point of the update-binary file. If it's an interpreter for edify scripts then that makes total sense that it would be included in every zip (and furthermore be the same in every zip). I still think it's a bit of a waste though (just build that interpreter into the Android kernel itself so that people don't have to copy it around everywhere), but I'm not the one in charge of this stuff.
I guess I'm off to create a zip of my battery icons then. I'm on an Evo by the way, and if I remember correctly /system is mounted on /dev/block/mtdblock3. No big deal though, I can always cat /proc/mounts in a shell to find out.
Thank you very much!
P.S. You can save a few keystrokes on the zip command by dropping the -o and even dropping the .zip extension. Just try:
Code:
zip -r my_package_file *

[Q] Easiest way to access /system/fonts on Windows?

Hi, all
I'm looking for a way to access /system/fonts from Windows computer so that people can change fonts for foreign language support. I know with a combination of noogie.img and linux computer, it is a piece of cake. But some people are scared to hear linux and I'm trying to guide them to work on Windows computer. Does CWM has those functions or is there any good windows application mounting linux partitions? Thanks a lot~
You can create a update.zip (for cwm) that copies the files to the system partition, so you don't have to mount the partition in windows.
mali100 said:
You can create a update.zip (for cwm) that copies the files to the system partition, so you don't have to mount the partition in windows.
Click to expand...
Click to collapse
That is awesome. Can you guide me how to write update.zip? I need following functions. Can you tell me those are doable?
1. update.zip can contain fonts
2. Delete specific system fonts
3. Copy user-specified fonts to /system/fonts
4. set permissions
Thanks a lot~
herofmm said:
That is awesome. Can you guide me how to write update.zip? I need following functions. Can you tell me those are doable?
1. update.zip can contain fonts
2. Delete specific system fonts
3. Copy user-specified fonts to /system/fonts
4. set permissions
Thanks a lot~
Click to expand...
Click to collapse
Yes, this is all doable. Take one of eded333's update.zips ( https://www.dropbox.com/s/errgjzp1a6ci09x/XU/XUFullTouch-PART-1-START.zip ) as base. Just change the updater script to your needs.
Android commander and adb -just need to remount the directory as rw.
Seems simpler than writing an SD card.

Auto mount or symlink at boot

Hello, is it possible to do that ?
Regards
Sure, you have a few options.
The best way (hardest):
-requires root and knowledge of the boot.img and ramdisk partitions of Android
-create the symlink or mountpoint by adding the necessary lines the /init.rc file.
Next best way (not hard if you have init.d support):
-requires root
-requires init.d support
-simply write a script to create your symlink/mountpoint, name it appropriately, and place it in the /system/etc/init.d directory.
-with init.d support, this will automatically run the script at boot and set the parameters you've outlined in said script.
The "other" method (avoid this if possible since it relies on loading an app on boot):
-requires root
-download Script Manager from the play store
-write a script to create your mountpoint or symlink
-configure Script Manager to execute the script on boot.
Hello
I found /init.rc, also found init.00.rc and init.01.rc, but i guess we are talking about the first one (init.rc)
I wasn't able to edit it with a text editor on my tf101, do i need something i don't have to edit it ? Or notepadd++ will be enough ?
In case i fail completly with this, is tasker able apply the line for me too ?
Thanks you for your time.
Regards
Magissia said:
Hello
I found /init.rc, also found init.00.rc and init.01.rc, but i guess we are talking about the first one (init.rc)
I wasn't able to edit it with a text editor on my tf101, do i need something i don't have to edit it ? Or notepadd++ will be enough ?
In case i fail completly with this, is tasker able apply the line for me too ?
Thanks you for your time.
Regards
Click to expand...
Click to collapse
The /init.rc can't be directly modified that way. Everything in the root filesystem "/", as well as the kernel zImage, are loaded at boot from the boot.img image. Therefore, any changes you make will just be reverted when you reboot because it reloads the original from the boot.img image. In order to modify /init.rc, you must pull your boot.img and then extract the files from it. Now you can add the necessary lines to it. After that, you re-combine everything back into the boot.img, and push it back to your device.
If all that sounds unfamiliar to you, you will have some reading to do. Most of this will need to be done on a linux machine too.
What ROM are you running? If you have init.d support, that would be the most straightforward way to accomplish your goals.
I'm running asus' rom .24 on a tf101
I don't know if it support init.d, didn't found this file on my device.
Regards
You can also use an app from here, XDA, called directory bind. It all depends what you're looking to do with those symlinks.
Sent from my Sprint Evo View 4G (PG41200) using Xparent Purple Tapatalk 2
Hello, i plan to move game data to sdcard and symlink it to the old internal place.
Also plan to symlink some folders to the movie folder
Regards
Then directory bind app is designed for just your need. All these solutions require rooting your device.
Sent from my HTCEVOV4G using Xparent Purple Tapatalk 2
I will look at this, thanks.
Directory bind run during boot or after boot ?(little delay before things get re symlinked ?)
Regards

[6045*] [TWRP] custom recovery 2.8.7.0

TWRP 2.8.7.0 custom recovery
thanx to user @Unjustified Dev we have TWRP custom recovery for our phone.
download HERE
So anyone who download the TWRP should send him a dollar for beer or at least thank him!
Of course you do everything on your own!
To test before installation (linux users need sudo before fastboot):
Code:
fastboot -i 0x1bbb boot twrp-2.8.7.0-idol3.img
To install (linux users need sudo before fastboot):
Code:
fastboot -i 0x1bbb flash recovery twrp-2.8.7.0-idol3.img
!BEFORE YOU START, PLEASE READ THIS!
And don´t forget to thank Famewolf for the tutorial, because this could save your phone when something go bad!​
Thanks, tried it. It worked.
I also just installed SU directly, bypassing the previous root thread.
1. Download the .zip package from here: https://download.chainfire.eu/696/SuperSU/UPDATE-SuperSU-v2.46.zip
2. Put it on the root of my SD card.
3. In TWRP click install and find the .zip.
Wonderful. Just a question: is this recovery for Idol 3 4.7 (6039) or 5.5 (6045) ?
Gynoid said:
Wonderful. Just a question: is this recovery for Idol 3 4.7 (6039) or 5.5 (6045) ?
Click to expand...
Click to collapse
It's for 6045. For 4.7 TWRP, see this post: http://forum.xda-developers.com/showpost.php?p=61976520&postcount=18
Thanks!
is it functional for backing up our system in TWRP?
@DallasCZ could you please provide the original link to TWRP. That was a bit unfair to upload it elsewhere as I tend to track the number of downloads.
Sent from my LGMS395 using Tapatalk
gecko702 said:
is it functional for backing up our system in TWRP?
Click to expand...
Click to collapse
Yes although to my knowledge noone has actually done a restore yet. He's fixing some minor bugs and will be releasing a new version at some point.
famewolf said:
Yes although to my knowledge noone has actually done a restore yet. He's fixing some minor bugs and will be releasing a new version at some point.
Click to expand...
Click to collapse
i am in touch with the dev and allready downloading the new build..will be soon on my google drive
Unjustified Dev said:
@DallasCZ could you please provide the original link to TWRP. That was a bit unfair to upload it elsewhere as I tend to track the number of downloads.
Sent from my LGMS395 using Tapatalk
Click to expand...
Click to collapse
sorry, i corrected the link...
Convert TWRP Backup into flashable rom zip
I found these instructions that explain how to take a TWRP backup and turn it into a flashable zip file. This would allow someone to create a "factory" rom pre-rooted to be flashed.
For TWRP Backup
Transfer the TWRP backup from Phone to PC.
You’ll see a file named system.ext4.win which is the System partition backup of your device. Rename it to system.ext4.tar (Changing its extension from .win to .tar)
Extract the system.ext4.tar using an archive software like Winrar or 7zip.
If your TWRP backup is not in compression mode, you will directly get the system folder, else you will get a file named system.ext4, which should be renamed again to system.ext4.tar and extract it to get the system folder.
Take the boot.emmc.win file and rename it to boot.img.
Now collect a META-INF folder from any custom ROM which is made for your device. Make sure you get the correct Meta-Inf folder, else the Zip won’t work and might worsen the condition of your device.
Select the META-INF, System folders and the boot.img and right click your mouse and select add to Archive.
In the Archive settings, choose the extension of the compressed file as Zip (Make sure of this part)
Now you can use this Zip file to flash it on your Custom recovery.
we dont have the meta-inf folder...there is one in the update i got, but i dont know if this id the right one.
and we dont have custom rom to get meta-inf from.
also the main thing is, that i cannot unpack the system win file when renamed to .tar i dunno why (i got latest 7-zip app).
DallasCZ said:
we dont have the meta-inf folder...there is one in the update i got, but i dont know if this id the right one.
and we dont have custom rom to get meta-inf from.
also the main thing is, that i cannot unpack the system win file when renamed to .tar i dunno why (i got latest 7-zip app).
Click to expand...
Click to collapse
What they primarily want is the "update-binary" which is device specific. I don't remember if the update had one....I did take apart an update-supersu.zip and it uses a script as it's update binary...thought about trying to convert that. Theoretically you could take a meta-inf for another device's rom...and use it's meta-inf making sure to replace the update-binary. It also has an installer script that tells it to mount system and data....extract files from the zip and where to put them. I learned a bit when I was trying to make an update.zip to fix my build.prop.
It untar'd fine for me on my linux pc:
[email protected]:/workarea/android/idol3/TWRP/BACKUPS/408adcbe/1970-01-01--22-28-53_LRX22G_release-keys/work > tar -xvf ../system.ext4.win000
tar: Removing leading `/' from member names
/system/app/
/system/app/AntHalService/
/system/app/AntHalService/AntHalService.apk
/system/app/AntHalService/arm64/
/system/app/AntHalService/arm64/AntHalService.odex
/system/app/BasicDreams/
/system/app/BasicDreams/BasicDreams.apk
/system/app/BasicDreams/arm64/
/system/app/BasicDreams/arm64/BasicDreams.odex
/system/app/Bluetooth/
/system/app/Bluetooth/Bluetooth.apk
/system/app/Bluetooth/arm/
/system/app/Bluetooth/arm/Bluetooth.odex
famewolf said:
What they primarily want is the "update-binary" which is device specific. I don't remember if the update had one....I did take apart an update-supersu.zip and it uses a script as it's update binary...thought about trying to convert that. Theoretically you could take a meta-inf for another device's rom...and use it's meta-inf making sure to replace the update-binary. It also has an installer script that tells it to mount system and data....extract files from the zip and where to put them. I learned a bit when I was trying to make an update.zip to fix my build.prop.
It untar'd fine for me on my linux pc:
[email protected]:/workarea/android/idol3/TWRP/BACKUPS/408adcbe/1970-01-01--22-28-53_LRX22G_release-keys/work > tar -xvf ../system.ext4.win000
tar: Removing leading `/' from member names
/system/app/
/system/app/AntHalService/
/system/app/AntHalService/AntHalService.apk
/system/app/AntHalService/arm64/
/system/app/AntHalService/arm64/AntHalService.odex
/system/app/BasicDreams/
/system/app/BasicDreams/BasicDreams.apk
/system/app/BasicDreams/arm64/
/system/app/BasicDreams/arm64/BasicDreams.odex
/system/app/Bluetooth/
/system/app/Bluetooth/Bluetooth.apk
/system/app/Bluetooth/arm/
/system/app/Bluetooth/arm/Bluetooth.odex
Click to expand...
Click to collapse
i allready build some roms for my older device, so i know what it is about.
For the proper rom zip you have to make the updater script with all the simlinks and metadata ...in the latest update there were no simlinks in the updater script...
without them you can brick your phone.
for example simlinks from 4.4.2 Os from zte V5
Code:
symlink("/data/misc/audio/mbhc.bin", "/system/etc/firmware/wcd9306/wcd9306_mbhc.bin");
symlink("/data/misc/audio/wcd9320_anc.bin", "/system/etc/firmware/wcd9306/wcd9306_anc.bin");
symlink("/persist/WCNSS_qcom_cfg.ini", "/system/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini");
symlink("/persist/WCNSS_qcom_wlan_nv.bin", "/system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin");
symlink("/system/lib/modules/pronto/pronto_wlan.ko", "/system/lib/modules/wlan.ko");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
this you cannot copy from another device....
Never mind. I installed the second build.
How do I boot into the custom recovery? Is it power up + power button on the Idol 3?
Acreo Aeneas said:
Never mind. I installed the second build.
How do I boot into the custom recovery? Is it power up + power button on the Idol 3?
Click to expand...
Click to collapse
Reboot or power on till you see the alcatel screen pop up....right away hold down up arrow and it should go into recovery.
Thank you so much...been waiting for this....
so now let ROM's start pouring in )))))))
Hmm odd. I had to reflash it. For some reason it didn't take the first time I flashed the second build TWRP to my Idol 3.
What partitions should I backup using TWRP? I'd assume: Boot, System, and Data? Should I include System Image too?
Acreo Aeneas said:
Hmm odd. I had to reflash it. For some reason it didn't take the first time I flash the second build TWRP to my Idol 3.
What partitions should I backup using TWRP? I'd assume: Boot, System, and Data? Should I include System Image too?
Click to expand...
Click to collapse
The default of boot, system and data should be fine for personal use however if you have not yet rooted please read here first! http://forum.xda-developers.com/idol-3/help/want-to-able-to-install-ota-updates-t3163745
So Awesome! best looking twrp Ive seen yet xD. Also, works well too. I havent tested backing up data, but I did a successful restore of the system and boot So far so good!

Categories

Resources