How to edit android emlator kernel and ramdisk? - Android Q&A, Help & Troubleshooting

Hi
I need help with modifying android emulator kernel and ramdisk, or far better a custom rom for the emulator, I wanna know ho can I edit emulators kernels and ramdisks? like nox, memu or etc
As I wanted to do that, I decompressed my emulator's system.vmdk with 7zip, there was 2 img files and a non extension file :
Code:
0.img
1.img
2
I've extracted both img files, but the non extension file name "2" coudnl't be extracted and NotePad++ can't read it and I don't know what's that yet
the first img ( 0.img ) include 3 files without extension :
Code:
cmdline
kernel
ramdisk
that's what I got from cmdline file with NotePad++ :
Code:
root=/dev/ram0 init=/init androidboot.hardware=android_x86 quiet console=tty0 console=ttyS0 androidboot.console=tty0 ignore_loglevel cpuidle.off=1 oprofile.timer=1 oprofile.cpu_type=timer
but of course NotePad++ was unable to open kernel and ramdisk, is it any way to modify them?
and I've got these from extracting 1.img ( Headers Error show after extracting with 7zip ) :
Code:
[SYS]
[UNKNOWN]
app
bin
etc
fonts
framework
lib
lost+found
media
priv-app
usr
vendor
xbin
build.prop
I tried these ways but I couldn't succeed yet
1. I tried Oracle VM Virtual Box and VMware Workstation, installed an android os and tried to modify parameters there, but there was no luck and os couldn't start with emulator system.vmdk
2.I used [KITCHEN]Android Kernel Kitchen 0.3.1 to unpack the ramdisk and kernel file I explained above but there was not luck, also the kitchen coudln't extract those two img files, the I used 7zip
I know it's possible, because some one else did it months ago but I have no clue what he did and he don't tell any body what he did
I'm not a developer and yes I'm a noob at what I'm trying to learn and do, and that's why I'm here, so please help me to learn and do this

New question, is there any way to connect emulator to py usb debugging? I wanna use terminal emulator but is say device is offline

nobody helping, and I have a new question. I search a lot but I couldn't find any way, is it possible to flash a custom rom on emulators like nox ? or other emulator, there are tutorials but they use vmware, I want t flash a custom rom on emulators like nox, not virtual box or vmware, if some one knows please give me tut or help
there are threads with creating kernel, rom and etc for mobile, but I wanna do that on emulator, if some one knows, please help

Related

Android's .so files

OK, So I've gotten to breaking down and recompiling those pesky .dex files, but I've run into a new problem.
This is a noob question, I'm sure, but .so files look like unformatted, binary files. How do I open then, edit them, etc? I need to read whats going on in my libs. :-(
Are these X11? I'm running ubuntu 10.04 x64 - so those could be difficult.
ie - unreliable 64 bit support.
$ sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
Click to expand...
Click to collapse
They're native library files, so platform specific machine code I imagine. Look for an ARM disassembler. I'm not familiar with linux internals, so don't know how you find the entry points, but it obviously will be widely documented. Is it impossible to obtain the source code? Assuming most are written in C/C++, reverse engineering from the machine code is not something I'd describe as a pleasant experience. If the source was well written assembly language & not too big, it can be almost enjoyable I guess. But then TBH walking through a randomly selected programmer's source, let alone object, files scares me, in a Tim Burton inspired bad trip kinda way. If you can find the source, it will be an order of magnitude less painful.
Try IDA Decompiler, it should disassemble all so files!
Most of the libs are open source in the aosp. Some are proprietary blobs with the only solution to them being reverse engineering.
.so disassembly
i know how to disassemble it
you will need orion's easy apk disassembler and apk manager
i've tested it once and it worked, but thereĀ“s a problem, i dont know how to re-assemble
1- rename the file .so to .apk like "libtestlib.so" to "libtestlib.apk"
2- put in the folder "place-apk-here-for-modding" of apk manager
3- open script.bat (or something like this) from Apk manager
4- use extract apk option
in the beggining my images inside the lib was corrupted so i used step 5 to fix
5- use option optimise images inside to fix images
6- go to project folder and copy classes.dex file to the root of easy apk disassembler's folder
7- open EasyApkDisassembler.EN.bat and use the "DISASSEMBLY a classes.dex with smali" option
8- give a name to the folder (like "libtestlib")
9- it will create a folder (like "out_libtestlib") with the disassembled files
Orion's easy apk disassembler http://forum.xda-developers.com/showthread.php?p=5826401
Apk multi tool (almost the same as apk manager) http://forum.xda-developers.com/showthread.php?t=1310151
I've tried to open libsurfaceflinger.so from my device with 7zip, and it worked too
thats it
@gkillershots
not working
i renamed .so to .apk and used extract option but getted error :
Processing archive: C:\APKMultiTools\place-apk-here-for-modding\libnative-lib.apk
Error: Can not open file as archive
"An Error Occurred, Please Check The Log (option 26)"

Running a custom P500 ROM in the Emulator

This probably belongs in the developer section, but I don't have permission to post there yet)
This work is very preliminary. It isn't really anything more than a starting point right now. It DOES NOT yet provide a faithful representation of a custom ROM in the emulator.
Current status:
emulator running 2.6.29 kernel with a combination of frankenstein of the emulator and devoid-franco system image.
I've been working to get a custom ROM working in the Android SDK emulator. There are several reasons for this, but in the end, it makes it a lot easier to test out different tweaks to get the ROM working as I'd like (I need some functions provided on the P509 ROM that aren't provided on any custom ROMS, and reinstalling the APKs isn't sufficient). I spent a lot of time looking for a thread about this, but nothing I could find discusses the specifics of working with a P500 based device
Things I've learned:
a) you need a kernel specifically compiled for the emulator, and the ramdisk image needs to be built to work with an emulator. For the moment i am using the SDK kernel (2.6.29) and ramdisk image to get going
b) the p509 libraries aren't compatible with the emulator, I needed to copy the libraries from the supplied emulator image
Here are some notes I took. I'll try to flush this out more as I make further progress:
Tools you will need:
Android SDK and 2.2 platform files (android-8)
unyaffs
mkfs.yaffs2.x86
a copy of the ROM image to install (devoid.franco.v5 in my case)
before beginning you should build a stock 2.2 emulator env to ensure everything is working (from sdk/tools run):
android list targets
find the id for 2.2 (was '4' for me)
android create avd -n test-froyo -t 4
(I used all defaults, except I set the RAM to 512MB and screen to HVGA)
emulator -avd test-froyo -show-kernel
(this should eventually bring up a running froyo)
you'll need to know where the avd lives. In linux, it should be in ~/.android/avd/test-froyo
I'm working on linux, but this should work in Windows if you can find a compiled version of mkfs.yaffs2 for windows (I've seen a compiled unyaffs version out there)
1) unzip the rom image. it should create a system/ directory.
We should execute the updater-script here, but we'll take a short-cut:
chmod -R 655 system/
2) uncompress the platfrom system image:
in a new dir:
unyaffs <sdk path>/platforms/android-8/images/system.img
3) copy all files from system/ in step-2 to system/ in step-1
we should really need to do this, it is probably sufficient to run the updater-script and then copy the framework/, lib/ and a couple qemu files, but this is just to get things going.
4) make dbus.conf readable:
chmod 644 system/etc/dbus.conf
5) remove system/app/LGSetupWizard.apk
This app relies on custom classes in the firmware that aren't present in the emulator base system. I'm still trying to build a custom firmware.jar that has both.
6) build a new system.img
mkfs.yaffs2.x86 system system.img
7) copy the system image to your avd dir:
cp system.img ~/.android/avd/test-froyo
If everything has gone well, you can now startup the emulator and boot into franco's rom:
emulator -avd test-froyo -show-kernel
Because we copied too much stuff from the default system.img, we've lost his themes and mst of his tweaks, so it isn't really a faithful representation of the ROM at all, but we've cleared the 1st milestone of being able to boot up.
I also booted a stock P509 kernel this way with a few changes:
a) I used nandroid to get the system image, and then unyaffs2 to extract it)
b) I removed all odex files:
find system -name "*.odex" | xargs rm
Again, this isn't really a custom ROM, it is actually the emulator rom with additional apps and customizations. The goal is to get to as close as possible to running a true custom ROM
A few other notes:
the following framework files can be preserved from the custom ROM (no need to overwrite):
Code:
am.jari : ok
android.policy.jar : not ok
android.test.runner.jar : ok
bmgr.jar : ok
core.jar : ok
ext.jar : ok
framework.jar : not ok
framework-res.apk : not ok
framework-tests.jar : ok
ime.jar : ok
input.jar : ok
javax.obex.jar : ok
monkey.jar : ok
pm.jar : ok
services.jar : not ok
svc.jar : ok
framework.jar is the most important of the 'not-ok' ones as far as I can tell, and is missing several classes. I am currently working to build a services.jar that is a merge of the P500 and emulator classes.
Installing the p500 framework,.jar requires many files from system/lib, but once all dependencies are solved, you eventually end up with a segfault. I've been unable to debug that, and am not sure I want to. The goal is to get a running dalvik VM with all classes needed to run P500 apps.
First blood!!!

who can help me repack a boot.img

i have read the article http://forum.xda-developers.com/showthread.php?t=915808
i am a windows user,and i have install cgwin and perl
but i can not use unpack.boot.pl and repack.boot.pl(actually i donot know how to use it )
i unpack the boot.img by split_bootimg.pl by DOS
if anyboy can tell me how to use unpack-bootimg.pl and repack-bootimg.pl?
or help me repack the boot.img.the edited file of the boot.img i have upload to
http://cid-34cb0dc592eb3181.office.live.com/browse.aspx/.Public?uc=1
thanks
any body there?
Use dsixda android kitchen.
I run linux, but you have a perl script, so you need to run it through perl before it can work. So something like...
Code:
perl unpack.boot.pl [then the inputs for unpack.boot.pl]
I use cramfs tools so mine looks like
Code:
cramfsck -x bootextractedDIR boot.img
You can also get the dsixda android kitchen and dig through the files, since it does it too. The kitch is just a really complated cmd script, so somewhere in there you can find the command for how it extracts the boot.img
equalsP said:
I run linux, but you have a perl script, so you need to run it through perl before it can work. So something like...
Code:
perl unpack.boot.pl [then the inputs for unpack.boot.pl]
I use cramfs tools so mine looks like
Code:
cramfsck -x bootextractedDIR boot.img
You can also get the dsixda android kitchen and dig through the files, since it does it too. The kitch is just a really complated cmd script, so somewhere in there you can find the command for how it extracts the boot.img
Click to expand...
Click to collapse
But it can't pack it after unpacking: (
Need it to add kernel to bootimage. Can someone help ?
Sent from my HTC HD2 using XDA Premium App
Hello I've found this...
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
I could unpack the files. but mkbootfs and mkbootimg doesn't work for me. When I downloaded ROM kitchen, there files were present as mkbootfs.c and mkbootimg.c .Not sure how to make them executable
Tried compiling with gcc and also tried changing permissions using chmod. If you find anythng, please PM me...
Edit : Forgot to mention I run linux.
Okay now sorted it. Use repack_bootimg.pl tool .Download ROM kitchen and search for mkbootimg and mkbootfs tools. Copy and paste them to your working directory. Also copy all header files from dsidia ROM kitchen. Download Repack tool from web.
Use this command
perl repack-bootimg.pl <kernel> ramdisk directory.img
very happy to hear this.i will switch to my ubuntu and try again
Not work here. I have image boot from rk2918 device and pearl scripts not work for unpack.
How I can unpack?

[TOOL][DEV][LINUX ONLY] Fast java src decompiler

Hello !!!
I'm not a real developper but I manage to make a little tool FOR DEVS to accelerate java src decompile
I don't know if it can be useful, but I wanted to share it ...
I don't really create something, all the tools already exist, you know them all :
JD-GUI : Java decompiler
Dex2jar : useful tool to transform .dex in readable .jar to get java src
Why did I made this ?
I searched how to get java src, useful to build apk or even compile sources, but only found manual way.
Ok decompiling one or 2 files is not a big deal ... but when you need to decompile a whole rom ......
What can this tool do ?
getting the java src from an apk and / or a .jar (framework.jar for eg) dex2jar and jd-gui already allow it
can decompile several files (.jar and or .apk)
rename each file to is native name
How to use it ?
This tool only works on Linux
Download attached zip or here
Unzip the file in home folder The folder must be in home and musn't be renamed or it won't work properly
launch the dex.sh (double click in graphic or use ./dex.sh commande in terminal)
Follow the instructions
.classes files need to be associated to JD-GUI use this programm. If you don't know if they already are or not, don't worry let the command do it ...
For more information, I included lines to make .jar files open by JD-GUI.
If you don't need / want these files to be associated after you use this tool type in terminal
PHP:
cd ~/.gnome2/nautilus-scripts
sudo rm open-in-jd-gui.sh
This tool is not perfect ... firstly I made it for me ....but finally wanted to share it ...
if you like it just tell me and use it ... if you don't .... ok just tell me why I would improve it ...
Huge thanks to :
JD-GUI Developpers : http://java.decompiler.free.fr/?q=jdgui
DEX2JAR Developpers : http://code.google.com/p/dex2jar/
tommytomatoe : for his wonderful Android Utility and for the command lines that helped me more than a lot !!! :good:
this is really useful
especially to decompile stock sony jar/apk to port some java classes from their frameworks
@Tof37
Bro, please reupload file, link is down
Thanks
EDIT:
sorry, i am dumb. THX a lot!

Remix OS Hacked Graphics Upgrade!

Hello once again my name is Cat Stevens and I have done it again you should check out my previous posts. But let's stick with the task at hand. I have been trying to upgrade the graphics for a while now and thanks to Android Kitchen I have been able to unpack and repack ramdisks and initrd.images as well. First you need libGLESv3.so you need to unpack system image of Android x86_64 7.1 with Remix Tools and you will find it in the lib64 folder. Then you need to get Android Kitchen and cygwin for Windows 32 bit is OK. Then copy the contents of the android win tools folder and paste them into the cygwin bin folder. Read the commands when you download the Android Image Kitchen. Unpack the ramdisk.img and you have access to the root of RemixOS. In notepad open init.x86.rc and go to line 11 and will see # export EGL_DRIVERS egl_dri2. Then add to the end of the line drm libGL /system/Lib/egl/libGLES_mesa.so /system/egl/libGLESv3.so eglIs&Lt:Resource&gt:Linked EGL_RENDER_BUFFER EGLDisplay . It's a long line and remember the path in the line because that is where you will need to install your libs. Then alter what ever else you want to the default.prop and repack your ramdisk. When you repack your left with a cpio.gz file you need to use mv command. This is the command mv ramdisk.cpio.gz ramdisk.img. Then you are done. Take care my friends if someone has a ADB binary for 6.0.1 let me know I want to get the VNC going.
Well somebody shut down my ramdisk hack it doesn't work anymore. Next I would like to thank the folks at Bliss ROMS for their hard work Electric Juses creative name. This is a MOD for RemixOS Hacked. I recommend installing Mount Image File and EXT4 driver for Windows. It gives you true ROOT! First download and extract Bliss ROMS x86_64 iso then mount your system image. Copy media_codecs and ffmpeg xmls. You will find them in the etc folder and paste them to your etc folder in Remix OS. Then go back to Bliss and open the vendor folder and copy bin, lib and lib64 folders and paste them to your usr folder in Remix. Then to tie it all together open notepad++ and create a text file you will save as userinit.txt. Then rename it to userinit no extension. This is the script.
#!/system/bin/sh
/system/usr/bin/rtk_attach
Their is the script now paste it to etc/init.d folder in Remix OS system image. Then go to the build.prop file and change persist.sys.disp_density=240 then change ro.sf.lcd_density=240. Unmount the image and boot Remix OS it will take a little bit longer than usual to boot but you will notice the difference with the display and audio. KILLZ! I recommend you should check out SET TV it's a APK file and for$20.00 US a month you get 500 channels and here is the kicker you can install it on three devices anyways I figured it out thanks again to Bliss ROMS and this will truly make your Android x86 system image The Green Machine!

Categories

Resources