[HOW-TO] ROM-HACKING: init.rc ext2-auto-mount / ROM Signing / ROM Kitchen - myTouch 3G, Magic Android Development

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

Related

android's init / working with .img files

hey everyone, this all started when i began to try and get my sd partitioned for apps. i have the stock rogers fw with haykuro's root based off cyangens recovery? anyway, i got the partition to work and all and even copied files over. my only problem is that the ext2 does not mount unless i do it manually from the terminal on device. i have come up with an init.rc file that i believe should work. currently it is in /etc
Code:
on boot
export PATH /data/busybox
mount -rw -t ext2 /dev/block/mntblk0p2 /system/sd
on device-added-/dev/block/mntblk0p2
mount -rw -t ext2 /dev/block/mntblk0p2 /system/sd
any ideas?
Tried lucids script to do everything?
http://forum.xda-developers.com/showthread.php?t=480582 I mean I know that rom you have has a adds2sd thing in it, but I can only speak with what I use and know. =)
i'll check it out, but my rom is stock. there is no apps2sd in it. i just partitioned and was going to set up some links when i realized the partition wasn't mounting on it's own. thanks for the link though
The init.rc isn't a shell script, and doesn't run normal commands - its built-in mount command has a different syntax from normal mount. Check out the source or other init.rc files for the syntax.
gwydionwaters said:
i'll check it out, but my rom is stock. there is no apps2sd in it. i just partitioned and was going to set up some links when i realized the partition wasn't mounting on it's own. thanks for the link though
Click to expand...
Click to collapse
Check your PM
i figured it out a little, i have noticed that the init i create is being overwritten when i reboot. i would assume perhaps i need to add the modified file into the system.img and then flash that version on? does that sound right to anyone?
The init is flashed during boot. Its in the boot.img. you can check the stickys to see how to crack one open and put it back together. Ill fix it for you this weekend as promised. Ill even show you what I did but I gotta get time at my computer. Patience my internet friend, patience.
Edit
Also check the "all you need to know" post by haykuro. Its the most recent thread started by him in this forum I believe
If you are using a stock rom did you get the modified mount.conf that supports partition mounts?
lol no i didn't know there was one. i did modify my mount.conf on my own and added the entry for the ext.
i'm having some serious trouble unpacking my boot image, and yes i have read all there is to read and then some. i originally tried unyaffs on the image i got from my nandroid back up i made before root, but it was claiming a broken image. so i made a current back up and tried that boot, the same problem. i figured maybe the nandroid backup utility was creating bad images so i went another route. i started on device and created an image of my boot mount
Code:
cat /dev/mtd/mtd2 > /sdcard/boot.img
i stripped off the header and kernel, saved the remainder as a raw file. then
Code:
gunzip -c boot | cpio -i
and it sort of works, maybe with errors and then asks for the name of archive 2 ..
cpio: Cannot identify format. Searching...
cpio: Cpio file name length 46200 is out of range
cpio: Invalid header, starting valid header search.
cpio: Cpio file name length 6960 is out of range
cpio: Cpio file name length 40367 is out of range
cpio: Cpio file name length 21330 is out of range
gunzip: /device/here/boot: decompression OK, trailing garbage ignored
cpio: End of archive volume 1 reached
ATTENTION! cpio archive volume change required.
Ready for archive volume: 2
Input archive name or "." to quit cpio.
Archive name >
Click to expand...
Click to collapse
and if i enter anything it can't find/read the file (the one i named of course) and if i quit there is nothing gained, no files or anything

removing apps2sd - questions

I've followed this guide from loccy, except for the last part where he uses vi editor in order to edit the apps2sd script...
http://forum.xda-developers.com/showpost.php?p=4353332&postcount=68
also when i install a fresh ROM, the app-private directory does not exist to begin with since i don't have any purchased .apk's installed in the /system/sd folder, so i basically just skipped all the steps for modifying the app-private folder... i did however create the proper folders in the /data folder for app-private and followed the corresponding commands... when i try to cp the file information from the SD to /data/app-private folder, i get a no such file or directory exists error, which i'm assuming happens because i have no private apps... i don't know if this is causing my problem, if so please let me know...
since I could never get VI editor to work properly in a windows command prompt, i adb pull the a2sd file from /system/bin and edited the file using notepad++, and adb push the file back... i verified that the file was pushed correctly and edited correctly by pulling it back again and verifying the changes were correctly made... i'm assuming not being able to use VI editor is probably whats causing my problems as i'm running windows 7 RTM, and notepad++ is possibly changing the file structure of the a2sd when i edit it on my machine...
i assumed busybox was installed cause if i run an invalid vi command, i get busybox reference information from the shell returned to me... i even went as far as installing my own instance of busybox to see if that would fix my VI editor problem, but that didn't help either... when i type #VI a2sd to edit the a2sd script file, i only get a partial amount of the actual script, some of it which comes out garbled, and i can't do anything, not press esc, not type an exit/reboot command, press j or k to move up and down... i can however type :q to exit the VI editor instance...
after pushing the a2sd script file after editing it with notepad++, my phone gets stuck on the first splash screen... unforutunately, i don't have a log i can provide to you guys, cause when i run adb logcat when the phone is booting, it just stays at waiting for device...
any help would be appreciated... if possible i would like to get this sorted out so maybe a script can be written for those who want to disable apps2sd like me...
Would be great if someone could upload a modified a2sd file with app2sd disabled, then we only put this file in update.zip file, sing it, and then make a fresh flash... Thats correct? or we need to change the update.zip structure?
ATM i am not at home then i can't try to use VI, but i sure that someone can upload the a2sd file modified
yah... after i finished writing my original post, i tried using VI again and noticed in the header of the a2sd script on jacherorom 1.4 that the a2sd script was written by cyanogen...
so, it was just a matter of taking the a2sd script from cyanogens 4.0.1 release, extracting his update.zip, taking the a2sd file from system/bin, and adb push the file to replace the existing file from your recovery image...
it worked like a charm... i'm currently running 230mb free on a fresh install... already i've noticed that its slightly faster than running off your ext for apps2sd on a class 6, but only time will telll... i'm gonna run this ROM through its courses and post my results... hopefully it doesn't slow down as much as using apps2sd, i'll post my results in a day or two
you can try just removing your ext2/3 partition. if the ROM does not detect a ext2/3 partition, it wont move hte apps to that partition thus no apps2sd.
motivecc said:
yah... after i finished writing my original post, i tried using VI again and noticed in the header of the a2sd script on jacherorom 1.4 that the a2sd script was written by cyanogen...
so, it was just a matter of taking the a2sd script from cyanogens 4.0.1 release, extracting his update.zip, taking the a2sd file from system/bin, and adb push the file to replace the existing file from your recovery image...
it worked like a charm... i'm currently running 230mb free on a fresh install... already i've noticed that its slightly faster than running off your ext for apps2sd on a class 6, but only time will telll... i'm gonna run this ROM through its courses and post my results... hopefully it doesn't slow down as much as using apps2sd, i'll post my results in a day or two
Click to expand...
Click to collapse
But you modified a2sd from cyanogens ROM or what? You put the modified one in the update.zip then fresh flash?
fridlack said:
But you modified a2sd from cyanogens ROM or what? You put the modified one in the update.zip then fresh flash?
Click to expand...
Click to collapse
nope, the a2sd script from cyanogen's 4.0.1 ROM automatically disables apps2sd if your have a fat32 only memory card, thus taking care of having to edit the script myself...
all i did was go into my recovery image, and do the following:
Code:
# go to the tools directory of your android sdk and run a push command
# the format of a push command goes as follows
# adb push <local directory of file> <directory of file on device>
# in my case i would have to type
adb push c:\androidsdk\androidsdk\a2sd /system/bin/a2sd
and thats it
by using the adb push command, i don't have to modify the update.zip file and go through the process of having to resign it... i find it easier to run this command to just replace the one file... i recommend doing this after a fresh install only of course...
motivecc said:
nope, the a2sd script from cyanogen's 4.0.1 ROM automatically disables apps2sd if your have a fat32 only memory card, thus taking care of having to edit the script myself...
all i did was go into my recovery image, and do the following:
Code:
# go to the tools directory of your android sdk and run a push command
# the format of a push command goes as follows
# adb push <local directory of file> <directory of file on device>
# in my case i would have to type
adb push c:\androidsdk\androidsdk\a2sd /system/bin/a2sd
and thats it
Click to expand...
Click to collapse
Thanks for the info, will give it a try
be careful what ROM you use it with... i would only suggest using it with any ROM that utilizes cyanogen's method of a2sd, as using a different one might brick or crash the phone... you can check by
Code:
adb pull /system/bin/ c:\<folder name here>
that will pull all your files to folder of your choice, and you can read the a2sd file by opening it with wordpad and seeing who made it... most likely its cyanogen anyway, but it doesn't hurt to check

[CUSTOM RECOVERY] Integrate GoogleApps into ROM's w/o Google Experience/AOSP =)

Soo,
I want to start a project to make a script which includes the Market in a "bare bone" ROM.
The goal is to have cyanogen to make ROM's without Google Experience and let the user run a script to reinclude the Market.
I have an idea how:
The user has to download a file from the HTC Website: The ADP1 Systemimage.
He places it into a folder in which is a script which unyaffs the image, copys the necesarry files and makes an update.zip out of it which can be flashed over the "bare bone-rom".
I don't know if this legal or not, but Google won't attack the end-user, but the one who provides software illegal.
But HTC has a license, so there shouldn't be a problem.
The end-user does something illegal I think, but he won't get into any trouble with google.
The hardest part is to find the necesarry files.
I diffed the folders of a market and non-market ROM and filtered out some unneeded parts.
Here's the list of which files to copy.
# Apps
cp system/app/BugReport.apk gfiles/app/BugReport.apk
cp system/app/checkin.apk gfiles/app/checkin.apk
cp system/app/Gmail.apk gfiles/app/Gmail.apk
cp system/app/GmailProvider.apk gfiles/app/GmailProvider.apk
cp system/app/GoogleApps.apk gfiles/app/GoogleApps.apk
cp system/app/GoogleContactsProvider.apk gfiles/app/GoogleContactsProvider.apk
cp system/app/GooglePartnerSetup.apk gfiles/app/GooglePartnerSetup.apk
cp system/app/GoogleSettingsProvider.apk gfiles/app/GoogleSettingsProvider.apk
cp system/app/GoogleSubscribedFeedsProvider.apk gfiles/app/xx.apk
cp system/app/GoogleSubscribedFeedsProvider.apk gfiles/app/GoogleSubscribedFeedsProvider.apk
cp system/app/gtalkservice.apk gfiles/app/gtalkservice.apk
cp system/app/ImProvider.apk gfiles/app/ImProvider.apk
cp system/app/MediaUploader.apk gfiles/app/MediaUploader.apk
cp system/app/NetworkLocation.apk gfiles/app/NetworkLocation.apk
cp system/app/SetupWizard.apk gfiles/app/SetupWizard.apk
cp system/app/Street.apk gfiles/app/Street.apk
cp system/app/Talk.apk gfiles/app/Talk.apk
cp system/app/Vending.apk gfiles/app/Vending.apk
cp system/app/VoiceDialer.apk gfiles/app/VoiceDialer.apk
cp system/app/VoiceSearch.apk gfiles/app/VoiceSearch.apk
cp system/app/YouTube.apk gfiles/app/YouTube.apk
# Framework
cp system/framework/com.google.android.gtalkservice.jar gfiles/framework/com.google.android.gtalkservice.jar
cp system/framework/com.google.android.maps.jar gfiles/framework/com.google.android.maps.jar
# Permissions
cp system/etc/permissions/com.google.android.gtalkservice.xml gfiles/etc/permissions/com.google.android.gtalkservice.xml
cp system/etc/permissions/com.google.android.maps.xml gfiles/etc/permissions/com.google.android.maps.xml
Click to expand...
Click to collapse
PLEASE ONLY DEV-TALK!
LINUX
The script for linuxusers is ready. It's attached.
Usage:
Go to the folder
chmod +x extract
./extract
You will need your device connected with a ROM without Google Apps, but root, and you'll need the drivers (usb rules) if it doesn't work from the start.
IT WILL TELL YOU TO DOWNLOAD A FILE, YOU HAVE TO GOOGLE FOR IT!
CUSTOM RECOVERY
Usage:
Place "signed-dream_devphone_userdebug-img-150275.zip" on your sdcard.
Boot into this recovery, adb into the device and run:
sh /sbin/gapps
It will do ALL automatically!
I hope I can later include it in the menu =)
Download: http://www.4shared.com/file/135537189/25541756/recoverynewimg.html
It's based on Amom_RA's great recovery!
Improved list for the backup and restore after flash or leave untouched strategies:
GOOGLE AND HTC STUFF (?)
/system/app/BugReport.apk
/system/app/checkin.apk
/system/app/Clicker.apk
/system/app/Gmail.apk
(easy to substitute with other mail client):
pop.gmail.com port 995 with SSL
smtp.gmail.com port 465 with SSL)
/system/app/GmailProvider.apk
/system/app/GoogleApps.apk
android/cupcake/packages/providers/GoogleContactsProvider is open source
/system/app/GoogleContactsProvider.apk
/system/app/GooglePartnerSetup.apk
/system/app/GoogleSettingsProvider.apk
android/cupcake/packages/providers/GoogleSubscribedFeedsProvider is open source
/system/app/GoogleSubscribedFeedsProvider.apk
/system/app/gtalkservice.apk
android/cupcake/packages/providers/ImProvider is open source
/system/app/ImProvider.apk
/system/app/MediaUploader.apk
/system/app/NetworkLocation.apk
/system/app/SetupWizard.apk
android/cupcake/packages/apps/Stk/src/com/android/stk is open source
/system/app/Stk.apk
/system/app/Street.apk
/system/app/Talk.apk
/system/app/TmoImPlugin.apk
/system/app/Vending.apk
android/cupcake/packages/apps/VoiceDialer is open source
/system/app/VoiceDialer.apk
/system/app/VoiceSearch.apk
/system/app/YouTube.apk
/system/etc/permissions/com.google.android.gtalkservice.xml
/system/etc/permissions/com.google.android.maps.xml
/system/framework/com.google.android.gtalkservice.jar
/system/framework/com.google.android.maps.jar
/system/framework/com.htc.framework.jar
/system/framework/com.htc.resources.apk
/system/lib/libcerttool_jni.so
Other closed source(?) files:
/system/bin/akmd
(/system/etc/AudioFilter.csv)
(/system/etc/AudioPara4.csv)
(/system/etc/AudioPreProcess.csv)
/system/etc/firmware/brf6300.bin
(/system/etc/gps.conf)
/system/etc/wifi/Fw1251r1c.bin
(/system/etc/wifi/tiwlan.ini)
/system/lib/libaudioeq.so
/system/lib/libgps.so
/system/lib/libhgl.so
/system/lib/libhtc_acoustic.so
/system/lib/libhtc_ril.so
/system/lib/libjni_pinyinime.so
/system/lib/libmm-adspsvc.so
/system/lib/libOmxCore.so
/system/lib/libOmxH264Dec.so
/system/lib/libOmxMpeg4Dec.so
/system/lib/libOmxVidEnc.so
/system/lib/libopencorehw.so
/system/lib/libpvasf.so
/system/lib/libpvasfreg.so
/system/lib/libqcamera.so
/system/lib/libspeech.so
/system/lib/hw/lights.goldfish.so
/system/lib/hw/lights.msm7k.so
/system/lib/hw/sensors.trout.so
WAREZ (?)
/system/app/HTC_IME.apk
/system/lib/libt9.so
/system/app/ PDFViewer.apk
/system/lib/libpdfreader.so
/data/app/Quickoffice_HTC_1.0.1.apk
/data/app/teeter.apk
also posted here http://forum.xda-developers.com/showthread.php?t=564303&page=6
Were gonna need Stk.apk it's for the sim card without that it's impossible to make calls.
And vending.apk is for Market and without that it is impossible to download the majority of apps.
I would suggest a different strategy that is even easier. Every user has this
files already on his rom, most (all?) of them are 1.5 based. So before
updating the phone with a cooked rom you have only to backup (tar)
the not redistributable files to the sdcard. After having flashed the coocked rom
you just need to untar them to the flash memory.
Z҉A҉L҉G҉O̚̕̚ said:
Were gonna need Stk.apk it's for the sim card without that it's impossible to make calls.
And vending.apk is for Market and without that it is impossible to download the majority of apps.
Click to expand...
Click to collapse
Stk.apk is for the Sim menu. You can make calls even if you delete it from your rom
farmatito said:
I would suggest a different strategy that is even easier. Every user has this
files already on his rom, most (all?) of them are 1.5 based. So before
updating the phone with a cooked rom you have only to backup (tar)
the not redistributable files to the sdcard. After having flashed the coocked rom
you just need to untar them to the flash memory.
Click to expand...
Click to collapse
The problem with that is that the apk's have odexes and resource id's that must match the build number to actually work even Cyanogen said that.
And regarding the keep-proprietary-apps-on-device-for-custom-rom install, with all the odexing and resource id mismatches... Ugh.
Click to expand...
Click to collapse
I'm building the AOSP android-1.5_r3 now and will load it onto my device and will try to push the files to it.
Please wait for the results.
If I have success, I'll start making a script which automates the process.
maxisma said:
I'm building the AOSP android-1.5_r3 now and will load it onto my device and will try to push the files to it.
Please wait for the results.
If I have success, I'll start making a script which automates the process.
Click to expand...
Click to collapse
Good luck and good speed.
Z҉A҉L҉G҉O̚̕̚ said:
The problem with that is that the apk's have odexes and resource id's that must match the build number to actually work even Cyanogen said that.
Click to expand...
Click to collapse
If i recall correctly JF made a tool to convert odex files to dex files which could then be repacked in the apk. Don't know if this could be run on the phone tough.
SUCCESS! I found the needed files, got market working on AOSP!
It's the list above (first post).
I'm writing a script now ;-)
Edit:
Script for Linux users is done, testing it now and looking for bugs, will then make a windows-one.
Ok, script is in the first post.
Couldn't this script run from within a recovery image with little if no changes?
i.e. consider this install procedure for a new ROM
1) push update.zip for new ROM to SD card
2) push signed-dream_devphone_userdebug-img-150275.zip to SD (I suspect most people would just have it milling about their SD card in the end!)
3) wipe
4) apply update.zip
5) run (obviously slightly modded) script in recovery before rebooting and running ROM for first time
There'd need to be some kind of unzip capacity within the recovery image, otherwise, there doesn't seem to be anything you're doing in your script that couldn't be done on the handset itself.
Loccy said:
Couldn't this script run from within a recovery image with little if no changes?
i.e. consider this install procedure for a new ROM
1) push update.zip for new ROM to SD card
2) push signed-dream_devphone_userdebug-img-150275.zip to SD (I suspect most people would just have it milling about their SD card in the end!)
3) wipe
4) apply update.zip
5) run (obviously slightly modded) script in recovery before rebooting and running ROM for first time
There'd need to be some kind of unzip capacity within the recovery image, otherwise, there doesn't seem to be anything you're doing in your script that couldn't be done on the handset itself.
Click to expand...
Click to collapse
Yeah, you're right!
But the unzip process would last much longer on this little, little handset.
But ok i'll make a script
EDIT:
Have written a script, untested.
# Mounting
mount sdcard
mount system
# Chmod the files
chmod +x sbin/unyaffs
# Unzip Image
mkdir /sdcard/system
mv /sdcard/signed-dream_devphone_userdebug-img-150275.zip /sdcard/system/signed-dream_devphone_userdebug-img-150275.zip
unzip /sdcard/system/signed-dream_devphone_userdebug-img-150275.zip
# Remove not needed files, move & unyaffs the system
cd /sdcard/system
rm boot.img
rm recovery.img
rm userdata.img
rm android-info.txt
./sbin/unyaffs /sdcard/system/system.img
rm system.img
# Copy the needed files & create folders
cd /sdcard
mkdir gfiles
mkdir gfiles/app
mkdir gfiles/etc
mkdir gfiles/etc/permissions
mkdir gfiles/framework
# Apps
cp system/app/BugReport.apk gfiles/app/BugReport.apk
cp system/app/checkin.apk gfiles/app/checkin.apk
cp system/app/Gmail.apk gfiles/app/Gmail.apk
cp system/app/GmailProvider.apk gfiles/app/GmailProvider.apk
cp system/app/GoogleApps.apk gfiles/app/GoogleApps.apk
cp system/app/GoogleContactsProvider.apk gfiles/app/GoogleContactsProvider.apk
cp system/app/GooglePartnerSetup.apk gfiles/app/GooglePartnerSetup.apk
cp system/app/GoogleSettingsProvider.apk gfiles/app/GoogleSettingsProvider.apk
cp system/app/GoogleSubscribedFeedsProvider.apk gfiles/app/GoogleSubscribedFeedsProvider.apk
cp system/app/gtalkservice.apk gfiles/app/gtalkservice.apk
cp system/app/ImProvider.apk gfiles/app/ImProvider.apk
cp system/app/MediaUploader.apk gfiles/app/MediaUploader.apk
cp system/app/NetworkLocation.apk gfiles/app/NetworkLocation.apk
cp system/app/SetupWizard.apk gfiles/app/SetupWizard.apk
cp system/app/Street.apk gfiles/app/Street.apk
cp system/app/Talk.apk gfiles/app/Talk.apk
cp system/app/Vending.apk gfiles/app/Vending.apk
cp system/app/VoiceDialer.apk gfiles/app/VoiceDialer.apk
cp system/app/VoiceSearch.apk gfiles/app/VoiceSearch.apk
cp system/app/YouTube.apk gfiles/app/YouTube.apk
# Framework
cp system/framework/com.google.android.gtalkservice.jar gfiles/framework/com.google.android.gtalkservice.jar
cp system/framework/com.google.android.maps.jar gfiles/framework/com.google.android.maps.jar
# Permissions
cp system/etc/permissions/com.google.android.gtalkservice.xml gfiles/etc/permissions/com.google.android.gtalkservice.xml
cp system/etc/permissions/com.google.android.maps.xml gfiles/etc/permissions/com.google.android.maps.xml
# Put back the ADPimg
mv /sdcard/system/signed-dream_devphone_userdebug-img-150275.zip /sdcard/signed-dream_devphone_userdebug-img-150275.zip
#Push the files to the device & reboot it
cp -r /sdcard/system/* /system/
echo "Please reboot!"
Click to expand...
Click to collapse
Code:
cp system/app/GoogleSubscribedFeedsProvider.apk gfiles/app/xx.apk
cp system/app/GoogleSubscribedFeedsProvider.apk gfiles/app/GoogleSubscribedFeedsProvider.apk
Think there is typo error in the first line.
Could be a good thing to set explicitely the permissions and ownership of the files.
I think the last line should be
Code:
cp -r /gfiles/* /system/
rt ?
Yap, there is 1 line too much @farmatito, thanks, will fix that!
@sureshg:
I rewrite the script for the recovery.. thanks!
Another possible way to do this is to make a script that makes an update.zip file from HTC's yaffs file.
It would only consists of the apk's and libraries we need to modify (market, IM, Maps, whatever) which would make flashing it faster on the device. And it would also be flashable with Cyanogen's bootloader after we flash an AOSP build since we can flash any .zip file with it.
However, I would like to be able to back up the new market and all associated libraries before trying it in case I wanna switch back
@ maxisma: Thanks for taking this in a positive direction. I was thinking along the same lines, and just posted the below to another thread before I saw this thread:
It looks to me as though Google is bluffing. Here is copyright law that, IMHO, gives every user the right to make and use a backup: COPYRIGHT LAW Just because Google say something, doesn't mean it is true.
I believe the solution to this whole mess is very simple. Here is the roadmap:
1) Cyanogen makes a list of all the closed source apps that need to be left out of the ROM.
2) Some kind person(s) write an app that the user can run to backup the list of files, signs and zips it so that it can be flashed later. Let's call that app "GoogleBack," and make it freely available here (and on the Market?).
3) Cyanogen produces each new ROM without the proprietary files that are on the backup list.
4) User runs "GoogleBack" one time and resulting googleback.zip is stored on /sdcard (root directory).
5) User installs new CM update.zip from Recovery as usual.
6) User also flashes googleback.zip while still in Recovery.
7) User reboots as usual, and now has a new ROM, complete with Google's precious proprietary apps.
8) Everybody goes home happy.
Alternatively, Cyanogen could add a step to the reboot process (home+back) that runs a script to copy the backup files from the backup file (and maybe also run fix_permissions if necessary). This would make that first reboot a longer process, but it would get the job done.
We need to get busy on a solution. This whole issue is just a speed-bump on the Android highway.
I think you are absolutely on the right track. Keep up the good work. Thanks also to everyone else who is making this happen.
use of deviceinstalled official rom
Hi,
why not use the already installed software on the user device. The update.zip of the custom rom could rely on the vanilla stock firmware and do all the needed patching and homebrew additions on base of the stock rom during first boot. So enduser has to flash an official rom first, unit is in an well known state and the dev update.zip just does the conversion to the custom rom during first boot.
I think the end user may not be allowed to run these modification software but he won't be punished. Don't know if it is legal to redistribute a rom which does the patching but that would be the same problem of redistributing software which does a merge of two roms on the enduser side.
Greetings Lopiuh
stellarman said:
@ maxisma: Thanks for taking this in a positive direction. I was thinking along the same lines, and just posted the below to another thread before I saw this thread:
It looks to me as though Google is bluffing. Here is copyright law that, IMHO, gives every user the right to make and use a backup: COPYRIGHT LAW Just because Google say something, doesn't mean it is true.
I believe the solution to this whole mess is very simple. Here is the roadmap:
1) Cyanogen makes a list of all the closed source apps that need to be left out of the ROM.
2) Some kind person(s) write an app that the user can run to backup the list of files, signs and zips it so that it can be flashed later. Let's call that app "GoogleBack," and make it freely available here (and on the Market?).
3) Cyanogen produces each new ROM without the proprietary files that are on the backup list.
4) User runs "GoogleBack" one time and resulting googleback.zip is stored on /sdcard (root directory).
5) User installs new CM update.zip from Recovery as usual.
6) User also flashes googleback.zip while still in Recovery.
7) User reboots as usual, and now has a new ROM, complete with Google's precious proprietary apps.
8) Everybody goes home happy.
Alternatively, Cyanogen could add a step to the reboot process (home+back) that runs a script to copy the backup files from the backup file (and maybe also run fix_permissions if necessary). This would make that first reboot a longer process, but it would get the job done.
We need to get busy on a solution. This whole issue is just a speed-bump on the Android highway.
I think you are absolutely on the right track. Keep up the good work. Thanks also to everyone else who is making this happen.
Click to expand...
Click to collapse
This is almost exactly what I was talking about (except I was thinking that the "GoogleBack" zip should be made on a computer since it would be faster to make) and that we could use HTC's official provided yaffs image (because they are licensed to distribute it) instead of the ones from an existing phone.

CUSTOM Script on Custom Roms

hey,
whenever i flash a new rom i edit the zip to replace keylayouts, apps in /system and /data , bootscreens and some other stuff......
i now want to symlink some directories with a script which will be loaded during rom flash because otherwise i would need a pc to access it through adb...
the script i want FOR NOW (i may use it for other things in the future)
is about symlinking the
/system/customize/resource/bootanimation.zip to /data/local/bootanimation.zip
/system/customize/resource/android_audio.mp3 to /data/local/android_audio.mp3
i can do this through adb as i said but i'd prefer it to be done automatically by a script during flash.... i know the commands to use but i need a way to implement the script into the rom.....
i think it's like the a2sd+ script but i am not sure....
if anyone knows please help me
you need to split open your boot.img and modify the init.rc (the file where services are initialised at Android startup)
See this link for notes on working with the boot.img
you can create the symlinks directly in this file, have a look at the syntax and you should be able to work it out. The ln command doesn't work though, use the format:
Code:
symlink /system/customize/resource/bootanimation.zip /data/local/bootanimation.zip
Or you can create a dummy 'service' which executes a file on your filesystem (like /etc/rc.local) and put your "ln -s" commands in there.
Why not just create a custom update.zip with your changes only, then you can apply it after flashing any rom.
Klutsh said:
Why not just create a custom update.zip with your changes only, then you can apply it after flashing any rom.
Click to expand...
Click to collapse
How would you do this?
Say I wanted an update.zip that would remove plurk and add a certain app. How would I go about creating that?
removing and adding is easy with the update signer app.....i just want to add a script that symlinks directories at boot in order to avoid the use of a pc.....i tried the trick st0kes said and i am waiting for the flashing now to complete and send my feedback
nope it didn't work.....is there any specific place to put the command ????
i put it at the very end of the init.rc file
ok after a lot of reading i created a service which runs a folder with scripts...where i have the script that symlinks the files.....
service myscripts /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/myscript.d
oneshot
Click to expand...
Click to collapse
this is the service code
and here is the code i have into the "bootanimation" script which is inside the myscript.d folder
#!/system/bin/sh
mount /system
mount /data
ln -s /system/customize/resource/bootanimation.zip /data/local/bootanimation.zip
ln -s /system/customize/resource/android_audio.mp3 /data/local/android_audio.mp3
Click to expand...
Click to collapse
what am i doing wrong here ????? please someone with knowledge enlighten me!! the script does not run
damn....it's been a long night and still haven't found a way to do it !!!!!!
i tried all the followings:
1) added a file called "myscript" (it contained two lines with the symlink commands) in init.d folder in order to execute when the boot is complete - FAILED
2) added the same file into another folder and added a service at the bottom of the init.rc file that called it
service myscript /system/etc/myscripts/myscript
oneshot
Click to expand...
Click to collapse
-FAILED
3) added the SYMLINK commands into the init.rc file
a)at the bottom -FAILED
b) before the bootanim, bootsound services -FAILED
c) before the bootcomplete = 1 value in init.rc -FAILED
d) after sysinit execution in init.rc -FAILED
e) before sysinit execution in init.rc - FAILED
f) at the top after some lines of code in init.rc - FAILED
i read that HTC change the boot process and to run custom scripts at boot you must add their commands in "bootcomplete.bravo.rc"
i tried that too but FAILED again....i think this is logical cause these scripts are executed after the boot and just when the phone is gonna show the pin dialog....
i think it's something to do with the init.rc file...but i dunno what else to add....
is there anything i have to mount in order to symlink ???? add busybox to something or anything ??????
PLEASE someone with success at scripting like a2sd+ please help me
Try naming your script
Code:
03BootAnim
and place it in
Code:
/system/etc/init.d
Also don't forget to chmod +x it
how to chmod +x ??? nvm i did it...i am now signing it to try it
in adb
Code:
adb shell chmod +x /system/etc/init.d/03BootAnim
chmod 755 does the same, makes it executable by the system
Klutsh said:
Try naming your script
Code:
03BootAnim
and place it in
Code:
/system/etc/init.d
Also don't forget to chmod +x it
Click to expand...
Click to collapse
hey klutsh i tried what you said but it didn't work...
look i created the file
Code:
03BootAnim
and placed it into the
Code:
/system/etc/init.d
the commands i have into the file are these
Code:
#!/system/bin/sh
ln -s /data/local/bootanimation.zip /system/customize/resource/bootanimation.zip
ln -s /data/local/android_audio.mp3 /system/customize/resource/android_audio.mp3
ok i edited the commands like these but no result too.....
Code:
#!/system/bin/sh
busybox mount /system
busybox mount /data
busybox ln -s /data/local/bootanimation.zip /system/customize/resource/bootanimation.zip
busybox ln -s /data/local/android_audio.mp3 /system/customize/resource/android_audio.mp3
i checked with the
Code:
ls -l /system/etc/init.d
command and the permissions are all the same (they are all enabled i think, -rwxr-xr-x )
i wiped everything, flashed, rebooted but no bootanimation!!! the default android logo with the moving shade appears (i have deleted the animation in the system/customize/resource folder in order for the symlink to work)
what am i doing wrong ???? is there something with the script ?
I'm trying to get this working, and so far it is running before the bootanimation, but I get
Code:
run-parts: can't execute '/system/etc/init.d/03BootAnim': No such file or directory
Yet it is available...
what commands do you have in yours ????
maybe a reboot will fix it o yours since it will rescan ?
edit: hey klutsh i logcated my boot and i see that the symlinks do not work cause it says that /system/customize/resource/bootanimation.zip and android_audio.mp3 directories are read-only file systems
That's the problem then.
Already got a fix that you apply once only to a flashed rom then the boot anim runs from /data/local and can be replaced.
http://www.asificanrememberthat.com/DeLite/BootAmin_to_Data.zip
Flash that after any Sense rom that normally has bootanimation in /system/customize
It will delete the 2 files in /system/customize/resource
flash my own bootanimation to /data/local
create the required symlinks that survive reboot's.
You can then just replace the files in /data/local as needed.
as i see you made it with the update sign and packager isn't it ????
nice idea....
BUT why can't we access /system files through boot ???? is there any way to get root access at booting ???
THANKS YOU VERY MUCH for the great effort you made....
is there a way to implement the update-script into the 03BootAnim in order not to have to flah anything ????
the reson i want this is cause i am cooking my roms on my own and i want them to have all i need inside....not having to flash mod1, mod2 etc
It's a feature of the desire, no write access to /system unless in recovery.
You can just take those bit's from my update-script and add them to your own rom's script.
oh yes...this is what i was asking i have tow update-scripts though, one old and one in the android.new folder
i am using dsixda kitchen....in which should i put it ??? does it matter where is it?
edit: found it....signing to flash
HURRAYYYYYYYYYYYYYYYYYYYYYYY
hey klutsh i thank you a lot.....
it was so easy to do it just copy paste the update-script but we (I) took the hard way of READ-ONLY file system....anw i learned A LOT (if you think that i am reading 15hours constantly about this)
PROBLEM SOLVED
You can delete the android.new folder, it isn't used.

[Recovery][WIP] ARecovery

DO NOT FLASH ANYTHING FOUND HERE YET!!!
FOR DEVELOPMENT AND SHARING PURPOSES ONLY
if you flash anything before we say it's ok to, we take no resopnsibility...​
the purpose of this thread is to get all of the devs together and working on this. this is a great method of getting us a fully functional recovery without needing the bootloader unlocked. this will work on a number of motorola devices as well.
Preface
ok, the bootstrap recovery works, however, without being able to boot directly into the recovery from a power up state, it makes actual "recovery" difficult. the bootstrap recovery is great, and nitro did an awesome job with it as well as adapting it to the atrix 2 with ninja-like quickness. but i would like to build onto his awesome work and expand it's functionality.
the purpose of ARecovery is to provide a fully functional recovery that you can boot directly into, like you can with any clockworkmod recovery device that has a locked bootloader.
there has been a couple different ways this has been achieved on other devices, some will actually use an sdcard as a recovery partition, others have used a hijacked boot file to launch recovery. the hijacked boot file worked great on the xperia line of phones, so this is the method i am using.
i have had some help from doomlord putting this together, and he is one of the top xperia devs. he has given me some guidance on how the hijack boot could work on the atrix 2 and i am in the process of putting this together. so whatever comes of this project, we owe it all to doomlord
The Plan
what i plan to do, is actually use nitro's bootstrap recovery to initially flash the ARecovery package, this will move the files i plan on using for the hijack boot.
The files that will initially be flashed will be the hijacked boot file, the redirected file and the arecovery package.
the hijacked boot file is emc_mgt_tool, this file is called early on in the boot sequence in init.mapphone_utms.rc. this file will be replaced with this code (which is a work in progress and i will update this script as i work on it):
Code:
#!/system/bin/sh
cat /dev/input/event3 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck ]
then
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /cache
umount -l /data
# Mount recovery partition
cd /
rm -r etc
# stock files will need to be added to arecovery.tar
rm -r /sbin
# stock files will need to be added to arecovery.tar
tar -xf /system/xbin/arecovery.tar
# Umount /system
umount -l /system
# chroot
chroot / /init
fi
# Continue normal booting
/system/bin/enc_mgt_tool2
exit
this script at boot will be activated with a hardware keypress, if triggered, the ARecovery process will start. if not triggered, boot will continue by being passed to the redirected file.
Progress
Pretty much where i am at right now, is still pretty much the beginning. stock system files need to be added to the arecovery.tar and the hijack script needs work. i will continue working on this until an sbf is found. when the sbf is found, i will start testing this.
doomlord has pretty much said that when we get an sbf, let him know and he'll help put this together.
and again, this will work on a number of motorola devices, so the more devs in on this, the better.
i attached arecovery_flash.zip. this is the initial flash package that contains the ARecovery stuff.
DO NOT FLASH THIS!!!​
do not flash
version .01 download
Change Log:
11-16-2011
The start
11-16-2011 version .01
added stock sbin and etc to recovery.tar
added redirect file
Take a look at this a see what you think?
http://hash-of-codes.blogspot.com/p/how-to-safestrap.html
JRW 28 said:
Take a look at this a see what you think?
http://hash-of-codes.blogspot.com/p/how-to-safestrap.html
Click to expand...
Click to collapse
even this would need to be built basically the same way as we are doing here

Categories

Resources