[GUIDE/DEV] Microsoft Android "Emulator" - Miscellaneous Android Development

I can't find much of any information on hacking the microsoft android emulator. Ideally, I'd like to get it working with superuser, exposed, etc, so it can be a fully functional way to see how android itself and apps work in different environments, all from my desktop. Also, I can just play around with stuff that I wouldn't touch on my tablet for fear of bricking it. I like playing with things.
Disclaimer: I'm not interested in maintaining anything, but as mentioned above, I can't find any information. Therefore, I'm simply posting what information I have here, in the hopes it will interest someone else enough to take a harder look at it. My original post was over here, but I've expanded beyond simply adding supersu to the image.
Things I can't do:
- Install superuser
- Install Xposed
- Install Google Play for anything more recent than KitKat
- Install recovery scripts
Things I can do:
- Run commands as root.
- Install Google Play Services on KitKat
- Change the screen resolution
- Change the amount of internal disk space
- Change the amount of memory and cpu cores available.
- Install busybox
- Flash simple scripts that don't require recent versions of cwm/twrp/other modern recovery.
----------------------------------------
Background information: The Microsoft Android "Emulator" is actually a HyperV virtual machine. When you install it, it enables the HyperV virtualization service in windows*. The effect of this is that instead of running android by emulating an arm processor, it runs android natively, with far better performance, by using Microsoft's hypervisor that's built into windows (win8+). You can work with it with Visual Studio and with Android Studio, but I don't use either much, so I can't help you with that. You can download it from Visual Studio if you want to (VS 2015 is free), or you can download a standalone version. I don't know if there's a difference between the two.
* I'm not sure if it installs the HyperV GUI as well, as I already use HyperV for other things and had it already installed. If you need to do so, you can install the GUI by going to add-remove windows features in the control panel ('appwiz.cpl' from the control panel).
----------------------------------------
Modifying the properties of the emulated system.
Configuration file location: After you create a device, the .cfg file for it will be located in %localappdata%\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices
To change the resolution: So far, I haven't identified any supported resolutions other than those listed in the device profiles list. So far, supported resolutions that I've used successfully are 480x800, 720x1080. You can edit the .cfg file for the specific device that you want to change the resolution of, and change the `device.screen.resolution=` line to any supported (see previous) resolution.
To change the size of the internal storage, follow the instructions here. You'll need an ubuntu cd; minimal install cd is fine if you have slow internet/computer or low ram.
To change the amount of ram or processors allocated to the virtual machine: Open Hyper-V manager, right-click the appropriate VM and click settings.
- Change the ram allocation by clicking Memory in the list at left. I do not know what happens if you try using Dynamic Memory; if it works, it should be more memory-efficient, but I left that alone. Now update the `device.vm.ram.size=` line in the .cfg file.
- Change the cpu allocation by clicking the Processor field. Please note that if you have hyper-threading, you should only use half your logical processors as cpus; the hyperthreaded 'cores' won't work as well (according to information online; you can check number of logical processors in windows task manager's performance tab). Now update the 'device.vm.cpu.count=' line in the .cfg file
----------------------------------------
Info on "recovery" and "flashing" - Installing google play
So far, I have only managed to get Google Play Services working on KitKat. I can't get it to work on Lollipop or Marshmallow (and haven't tried earlier versions at all); the virtual machine does *not* have a recovery or fastboot because of the way it works, and I haven't figured out any way of installing such. Instead, there's a simple shell file called install_zip.sh. It does not work with modern flashable zips that require TWRP/CWM; it only works with the old style zip designed for a specific architecture. As such, opengapps flashable zips will not work.
To install Google Play Services on KitKat (4.4.4)
1. Inside the emulator, open the browser and go to http://www.teamandroid.com/gapps/ and download the file linked under Gapps CyanogenMod 11.
2. Open the window the the android VM from the Hyper-V Manager to get console access. If you have ADB installed locally, you can use that in the future, but getting the VM's shared IP requires terminal access anyways (run `ip addr` as root inside the emulator to get the list of IPs).
3. Run `adb shell` to get access to the root shell (yes, it's that easy).
4. Run `install_zip.sh /sdcard/Downloads/gapps-kk-20140105-signed.zip` (or whatever the name/path for the downloaded gapps file is).
5. It should complete successfully. Now type exit to exit the adb shell, and close the hyper-v console window (the android emulator will continue running).
6. Click the 'X' at the top right of the Emulator to shut down/close the VM
7. Start the emulator back up. You should now have access to Google Play Services.
----------------------------------------
Busybox
The emulator does not come with a preinstalled copy of busybox. It does come with the android toolbox, but this has only a very minimal amount of commands in it. The instructions below are for installing stericson's busybox.
1. Get a copy of stericson's busybox from somewhere--your personal device, etc, it doesn't matter. The easiest way is to either install it on a real android device and grab it with airdroid (or other), or to use a play store scanner to get it. The file name will probably be something like stericson.busybox.apk.
2. Rename it to .zip so you can access the contents.
3. Extract the busybox-x86.png file from the 'assets' folder inside the zip, and rename it to `busybox`.
4. In the Android Emulator, click the >> button for tools, and click the sdcard header. Choose a folder (a new one on your dekstop will do) and tell it to pull the contents of the sdcard to the folder.
5. Move the busybox file into the Download folder that you just pulled from the sdcard. If you created a folder for this, you can delete it now.
6. Back in the android emulator, push the folder structure back into the sdcard; this will move the busybox onto the emulator.
7. Open the HyperV console for the emulator or open a terminal app in the android emulator (installing it is up to you)
8. Run `adb shell` to get a root prompt.
9. Run `mount -o rw,remount /system` to remount the system partition as writable
10. Run `cp /sdcard/Download/busybox /system/xbin` to copy the busybox binary over
11. Run `chmod 777 /system/xbin/busybox` to make the busybox binary executable.
12. Run `busybox --install /system/xbin` to copy the busybox binary for all the included applets. I think the -s paramter will symlink the applets to the main binary instead, but I'm not sure.
13. Type exit in the adb shell.
14. You can now run busybox commands in the terminal, and use apps that require busybox to be installed.
Now that you have busybox installed, you can use unzip, etc.
----------------------------------------
Hacking the OS itself.
The android emulator uses a VHD file for the disks. I've mounted the vhd file inside an ubuntu server to play with, and discovered several things about the way it works. The first partition is the boot partition, it contains 3 files:
- kernel - the android/linux kernel
- ramdisk - the ramdisk for the root filesystem. gzipped cpio archive.
- cmdline - the kernel parameters(? not sure what to call this)
I've tried modifying the ramdisk to add the init files for the superuser, but this doesn't seem to work properly; when I boot up the vhd file, I can open the console with hyper-v manager (the android emulator machines show up there automatically), and when it gets to the ramdisk, it says so--then the caps/num/scroll lights start flashing and it hangs. I haven't gotten any further than that at this time.

Related

GUIDES & FAQs [Android]: ADB Workshop by Adrynalyne and Guide by Captainkrtek

DO NOT POST IN THIS THREAD BEFORE READING THE WHOLE POST
PLEASE ADD GUIDES TO COMMON ISSUES YOURSELVES
To my recollection, the previous WM Guides thread was successful.. so we'll be moving on to android as well - from beginner to pro.
I hope this thread will provide answers to a decent percentage of your questions.
Please hold until guide collecting is finished..
In the meanwhile you are ALL invited to send me links or full guides to add to this thread.. remember, we are all about sharing.
COMING SOON! (in the meanwhile, you've got a great battery life guide at http://forum.xda-developers.com/showthread.php?t=471521 - be sure to thank BruceElliot for it!)
also, if you decide to post a guide, please keep the guide as neat as possible, with a title containing the LEVEL ([BEGINNER], [INTERMEDIATE], [PRO]) and the commonly searched words so that people who look for it can find it easily. (if you can, use the same color (dark orange) and same size (4) and Bold.. for the main title.. tho that's not a must )
post #2. [BEGINNERS+INTERMEDIATE] Replacing System Files using Android Commander
post #3. [EVERYONE] ADB Workshop by Adrynalyne and Guide by Captainkrtek
post #4. [QUICK FAQ's] Common QnA's for beginners by Timmymarsh (work in progress)
[BEGINNERS] Replacing system files using Android Commander
Replacing system files using Android Commander:
(This post was formally based in the HD2's RTL support thread and revolved around our need to replace frameworks)
so:
1. Download the android SDK from: http://dl.google.com/android/android...08-windows.zip
2. EXTRACT(!!!) the android-sdk-windows to c:\
(make sure you extract the dir - not run the setup from inside the zip file)
3. install Android Commander from http://androidcommander.com
4. Connect your device and make sure it's set to Debugging mode in /settings/applications/development/
5. You might have to set a dir containing your adb.exe file. set it to c:\android-sdk-windows\tools\
6. You will see a Total Commander-like interface. you can then copy the framework.jar file to the correct directory (there's no difference between SD android builds and androids in ROM - the system dir will be shown the same way)
a. Yes, you can replace/delete system files while android is running.
b. (for androids running from SD) Any file copied to /sdcard/android/root/system/X will be copied to /system/X in the system file. The sdcard/android root dir is JUST LIKE your root in ROM androids.
c. Make sure you either created a backup or verified a match in any other way before replacing files like frameworks, zimage, modules, etc.. your android might not boot afterwards (I keep all system.ext2 files backed up so that i can restore them incase i screw something up.)
enjoy
[EVERYONE] ADB Workshop by Adrynalyne and Guide by Captainkrtek
This following guide was rewritten by Captainkrtek, please make sure to thank him for it
Original Post:
(http://forum.xda-developers.com/showthread.php?t=879701)
This workshop was held in #android-learning on irc.freenode.net by XDA Member Adrynalyne. All credit to him for this guide, I simply am taking it and turning it into a guide. Here we go!
You can find the raw IRC log here
Good evening folks, and welcome to my ADB workshop. This is by no means a full explanation on the subject, but more of a crash course to help folks get up to speed, and get more from their devices. There may be some things you already know here, so please be patient and respect those who do not.
Reference Files
http://adrynalyne.us/files/How to install adb.pdf
http://adrynalyne.us/files/Using ADB.pdf
So, lets just start with the basics.
What is ADB?
ADB stands for the android debugging bridge and is used for testing and debugging purposes by developers.
However, we like to get more out of our devices, and its a great way to fix things.
Knowing adb can mean the difference between a paperweight and a working phone.
So, to start with, we will look at installing ADB.
Generally speaking, the Sun/Oracle JDK is required to run all SDK functions.
ADB is but one tool in the SDK arsenal.
So, we begin by downloading and installing the JDK. This can be found here:
https://cds.sun.com/is-bin/[email protected]_Developer
Choose your OS, download and install. I recommend that 64 bit users use the regular x86/32 bit version as well.
Moving ahead, we download the Windows sdk from here:
http://dl.google.com/android/installer_r08-windows.exe
Due to already installing JDK, you won't be stopped by the install process.
Now, if you notice, I installed it to:
C:\android-sdk-windows
I did this because it makes things easier when setting up path variables.
I encourage everyone to do the same, but obviously it is not required.
So, this SDK is handy, but is only good up to 2.2. We want the latest and greatest! (Well I do)
So, we navigate to:
C:\android-sdk-windows\
and we run SDK Manager.exe
If you notice in your PDF file for installing adb, you will notice that you can update, and I made a choice not to include earlier sdk versions.
I won't go into full detail on that, but depending on the version of SDK you have, 8 or 9, it WILL make a difference in using adb.
By default, for version 8 adb.exe resides in C:\android-sdk-windows\tools
By default, for version 9 adb.exe resides in C:\android-sdk-windows\platform-tools
We will assume version 9 in this guide
Really, the SDK is installed and adb is usable right now, but in my humble opinion, its not enough
I like the ability to use adb in ANY directory on my machine.
To do this, we edit Windows's environment variables.
Specifically, the system path.
To do this, we click on start, or the orb (depending on OS), and right click on Computer, left clicking on properties in the menu.
If its windows XP, I believe it brings you into advanced system properties immediatly. Vista and 7 need a second step.
On the left hand side, as you notice I have highlighted in the pdf, left click advanced system settings.
Under advanced tab, we left click environment variables...
There are two boxes here.
We are concerned with system variables, however.
So we scroll down the list and highlight path and click edit.
Ignoring all the extra stuff in here, make sure you are at the end of the line, and type
Code:
;C:\android-sdk-windows\platform-tools
The semicolon allows us to separate it
from the previous path statement.
Click ok all the way out.
We now have ADB setup globally. We can use cmd.exe (I use powershell) and no matter what directory we are in, adb is recognized.
If it is not, make certain you entered the path into system variables, and made no typos.
If you installed to a different location, you will need to adjust the path accordingly.
This concludes the section on installing the Android SDK to use ADB.
This next section will be on using ADB, so please open that pdf now.
Now, this applies to any OS, not just Windows.
Well, with the exception of the USB drivers.
I will not go too much into that, but if you take a look at the PDF, it goes through installing usb drivers for the sdk, and how to download them.
Fiarly straightforward, in that rspect.
Now, to setup our phones to use with the SDK and ADB, we must change some settings.
First, we go to menu softkey, then settings.
We scroll down to Applications and tap it.
Under Development, we will check Enable USB Debugging. Please note the SGS phones are different in this respect.
The USB cable must be unplugged before enabling or disabling this setting.
Once this is done, we are now ready to play with adb
One quick note: If you get device not found/conencted, please reboot your phone. DJ05 has a quirk in it where ADBD randomly crashes on boot.
A reboot will fix this
ADBD= ADB Daemon
Ok, continuing on.
Lets look at installing applications. This is also known as sideloading.
Unlike installing from the SD card, it does not require unknown sources to be enabled.
The command for this is
Code:
adb install packagename
This assumes that you are working from the directory where the file is located.
This will install the application to /data/app.
It will also show sometimes useful errors if install fails.
That is not something you will see from the Android GUI.
Now, a lot of us have probably deleted files with apps like Root Explorer. While this isn't really a bad thing, it leaves behind databases and data for the application removed.
This is where the 0kb applicaiton entries come from.
If you take that application entry name, you can uninstall the extra data via adb.
First we go to the adb shell which logs into the phone.
Code:
adb shell
If we end up with a $, we will want admin rights, in many cases. This is not one of them, I don't beleive.
To get admin rights, you want to type
Code:
su
Look at your phone if this is the first time, it may prompt you to allow access. Else you will get permission denied.
If you are not rooted, this will not work either.
Ok, now that we are logged in, we will type
Code:
pm uninstall packagename
where packagename is the name of the 0kb listing.
Now this seems like a pain in the a** and I agree.
HOWEVER
There will be a time where Manage applications crashes when you try to uninstall it from the phone. In this case, a factory reset, or this method is the only effective way to fix the problem.
Moving on.
How many of us have removed system applications or renamed them? Did you know that you can simply disable them from the system?
Code:
adb shell
su
pm disable appllicationname
This will disable it, and the system will ignore it.
This can be seen as safer than deleting or renaming things, but your mileage may vary.
On the other hand, you can also re-enable these applications.
Code:
adb shell
su
pm enable applicationname
Please note: Not all applications will properly re-enable. I believe a factory reset or reinstall of said application will fix the issue.
Also, application names are absolutely case sensitive.
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Ok, a lot of us tweak and mod our phones and turning off the device to get to clockwork recovery, or battery pulls, or multiple button holds to get into Download mode are troublesome and annoying at best.
ADB can help us here.
Here, we do not need to be logged into the shell
If we want to merely reboot the phone:
Code:
adb reboot
If we want to go to recovery (works well with voodoo5)
Code:
adb reboot recovery
If we want to go to Download Mode because we need Odin, heaven forbid:
Code:
adb reboot download
Its instant. No waiting on animations or anything else.
Its also handy if Android has locked up, but yet still works in adb.
I for one hate taking my case off to battery pull.
So now we move on to pushing and pulling files.
Sometimes, I don't feel like mounting my sd card to copy a file over to my phone.
I can use this command to push a file straight to my sd card:
Code:
adb push filename /pathtodirectoryonphone
So for instance, if I have test.txt that I want to send, I would type:
Code:
adb push test.txt /sdcard/
and there it goes.
Ok moving on
Pushing files can be done to any directory, however, some are protected.
For instance, /system is going to give you a permission denied or a read only filesystem error.
To get around this, the easiest thing to do is push the file to your sdcard, then log into the shell:
Code:
adb shell
Code:
su
We will then mount the system as writable
Code:
mount -o rw,remount /dev/block/stl9 /system
Then we can use something like
Code:
cp /sdcard/test.txt /system/app/test.txt
cp stands for copy
and it requires the path of the file and destination path. The name of the file is optional
When you copy it, you can rename it to whatever you like.
For instance, if we wanted to backup a file
Code:
cp /sdcard/test.txt /sdcard/backuptest.txt
Now, lets assume you do not have busybox installed.
You non rooted users will not.
Then you must use a slightly more complicated command called dd
This is used like this:
Code:
dd if=/sdcard/test.txt of=/system/app/test.txt
if is for inputfile
of= output file
Not every user friendly, but probably one of the safer copy commands.
Ok, moving on to pulling files.
Lets say you want to get a file from your phone, to modify, backup, etc.
To do this, we simply use adb in this manner:
Code:
adb pull /pathtofile/filename destinationname
For instance, if I wanted to backup ADW launcher in system/app
I would do this
Code:
adb pull /system/app/ADWLaucnher.apk ADWLauncher.apk
And it will pull the file from the phone and put it in the current directory.
Like above, you can specifcy where it goes.
pushing files to the sdcard, it seems prudent to talk about changing permissions.
sdcards are typically fat32, which destroys permisisons, and Android is heavily permission based.
So if you push an application to your sd card, then try to copy it to /system/app/ bad things are going to happen, or the app may not even show up.
So in that case, we use something called chmod.
This is used in this manner
Code:
adb shell
su
chmod 755 /pathtoapplication/applicationname
Keep in mind
you dont want to do this while its still on your sd card.
an example
Code:
adb shell
su
chmod 755 /system/app/ADWLauncher.apk
755 is good for applications and script files.
Just a couple more topics to cover.
Lets go over deleting files.
This becomes especially handy for removing rogue applications.
To do this, we must be in the adb shell.
Code:
adb shell
su
rm /system/app/ADWLauncher.apk
You may need to remount system as writable with:
Code:
mount -o rw,remount /dev/block/stl9 /system
That applies when using chmod as well.
So what I did above was delete ADW Launcher from system/app
However, what if I wanted to delete the entire contents of a directory?
Same thing as before, except
Code:
adb shell
rm -f /data/dalvik-cache/*.*
I just cleared my dalvik-cache with that command
very quick, very effective.
If you just tried that, please reboot your phone now
Ok....this leaves us with the final topic: logcat
logcat allows us to log what the OS is doing, and possibly delve information for when things are not working
its quite simple Reading it is another.
To use logcat
Code:
adb shell
logcat
To logcat to a certain file do
Code:
adb shell
logcat > /sdcard/logcat.txt
Now we let the log settle down to a reasonable amount of data coming in and not a wall of scrolling, then start the app in question. When it gives an error, we hit ctrl-C and kill the adb shell session.
This should have captured enough data to see the error. Now, I prepared an example. A user came to me on IRC, and Google Maps was force closing. Clearing data didnt fix it, Clearing dalvik-cache, and fix permissions did not fix it. In this case, the user did not know how to use adb So I had him grab an app called alogcat from the market and email me the log. This is also a very valid method.
this file explains what the problem was, and highlights what to look for as an example.
http://adrynalyne.us/files/logcat.pdf
___________________________________________________________________
This concludes the guide from Adrynalyne, there will be more workshops such as this one in irc.freenode.net #android-learning.
Thanks to everyone in #samsung-fascinate !
QUICK FAQ's
sources: Q&A Section, The Weekly Q&A Section by XDA News Writers (thanks guys)
Q: ‘Is there any way to block specific apps from using my data connection?’
A: Try the Droid Wall application.
Q: ‘I read how you can make changes in the build.prop file on my Android device. How exactly do I get to it?’
A: Install ASTRO file manager, browse to /system, long press on build.prop – Edit – Copy. Press on the home icon then Edit icon – Paste. Connect sd card, edit it, and paste it over from where you copied build.prop
Q: What happens if I update my phone? will I need to re-root it and get the ROM again? will all of my applications get erased? If so, is there a way around this?
A: You will lose your root, but not apps if it is just an update.
Q: I just tried to flash a ROM from recovery on my Android phone and got “Verification Failed, Installation Aborted” What happened?
A: Before you can flash a custom ROM the .zip file must be digitally signed in the ROM kitchen, if unzipped and re-zipped it will lose its verification, this happens often using the Safari browser as it likes to decompress .zip’s. Or if your download is corrupted (download the ROM again) it will fail the Verification.
Q - HTC Location Widget shows "map data unavailable"
A - On the widget, click the pin/then click the windows button/click get more/scroll to download maps/download relevant map (care, maybe a big file). Now exit and click onto map, your location should now be visible :)
Q:So, I moved all the apps on the SD, but is still not enough. How can I free some memory? I could delete the cache of the older upgrade or something else?
A:Do you have pictures and videos? If so, check if they are on the SD card and not on your internal memory. Cleaning your cache helps, and try deleting your text messages threads.
Q: ‘What exactly is a kernel and what are the benefits in changing it?’
A: A kernel is a bridge between the applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources – the communication between hardware and software components. Flashing different kernels gives you different operating speeds, better battery life, the ability to overclock, and more.
Android control other device with IOIO Board.
It use ADB.
http://androidcontrol.blogspot.com/2011/10/ioio-board-for-android-control-io.html
timmymarsh said:
QUICK FAQ's
sources: Q&A Section, The Weekly Q&A Section by XDA News Writers (thanks guys)
Q: ‘Is there any way to block specific apps from using my data connection?’
A: Try the Droid Wall application.
Q: ‘I read how you can make changes in the build.prop file on my Android device. How exactly do I get to it?’
A: Install ASTRO file manager, browse to /system, long press on build.prop – Edit – Copy. Press on the home icon then Edit icon – Paste. Connect sd card, edit it, and paste it over from where you copied build.prop
Q: What happens if I update my phone? will I need to re-root it and get the ROM again? will all of my applications get erased? If so, is there a way around this?
A: You will lose your root, but not apps if it is just an update.
Q: I just tried to flash a ROM from recovery on my Android phone and got “Verification Failed, Installation Aborted” What happened?
A: Before you can flash a custom ROM the .zip file must be digitally signed in the ROM kitchen, if unzipped and re-zipped it will lose its verification, this happens often using the Safari browser as it likes to decompress .zip’s. Or if your download is corrupted (download the ROM again) it will fail the Verification.
Q - HTC Location Widget shows "map data unavailable"
A - On the widget, click the pin/then click the windows button/click get more/scroll to download maps/download relevant map (care, maybe a big file). Now exit and click onto map, your location should now be visible :)
Q:So, I moved all the apps on the SD, but is still not enough. How can I free some memory? I could delete the cache of the older upgrade or something else?
A:Do you have pictures and videos? If so, check if they are on the SD card and not on your internal memory. Cleaning your cache helps, and try deleting your text messages threads.
Q: ‘What exactly is a kernel and what are the benefits in changing it?’
A: A kernel is a bridge between the applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources – the communication between hardware and software components. Flashing different kernels gives you different operating speeds, better battery life, the ability to overclock, and more.
Click to expand...
Click to collapse
Thank you for your patience and taking the time to answer those questions. I loved your simple and easily digestible format.
There is a note
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Click to expand...
Click to collapse
this note is all wrong..
1. linNUX is not *NIX.
2. Mac OS-X is a *NIX OS, it is based upon UNIX, they use their own variant called Darwin. Darwin does not require capitolization.
3. The word should be POSIX. Linux is POSIX compliant and POSIX defines the capitolization standardards
soft brick
Taioba said:
Is there any way to use ADB even though I can not enable USB debugging by the android?
I have an Atrix with soft-brick. How can I restore a file (framework-res.apk) knowing that my USB debugging is off?
I can enable ADB via fastboot?
Thanks!
Click to expand...
Click to collapse
I found this for atrix 4g....
http://forum.xda-developers.com/showthread.php?t=965546
hope it helps
knoknot said:
i have a bricked s2 not so sure how to go about reviving it via adb
Click to expand...
Click to collapse
check this thread
http://forum.xda-developers.com/showthread.php?t=1237815
thanks. searched for that
Thanks for it.
Great Guys............ :good:
Thanks for sharing.
Thanks for sharing this guild :d, i am new member for reccod
Great job~ Sometimes could be used this.
I'm using Windows 10 RTM and I've set the path, yet I still get the "unrecognized application" error in the command console. What am I missing?
Nevermind, a restart fixed it. Used to be you didn't have to.... sheesh.
nir36 said:
Replacing system files using Android Commander:
(This post was formally based in the HD2's RTL support thread and revolved around our need to replace frameworks)
so:
1. Download the android SDK from: http://dl.google.com/android/android...08-windows.zip
2. EXTRACT(!!!) the android-sdk-windows to c:\
(make sure you extract the dir - not run the setup from inside the zip file)
3. install Android Commander from http://androidcommander.com
4. Connect your device and make sure it's set to Debugging mode in /settings/applications/development/
5. You might have to set a dir containing your adb.exe file. set it to c:\android-sdk-windows\tools\
6. You will see a Total Commander-like interface. you can then copy the framework.jar file to the correct directory (there's no difference between SD android builds and androids in ROM - the system dir will be shown the same way)
a. Yes, you can replace/delete system files while android is running.
b. (for androids running from SD) Any file copied to /sdcard/android/root/system/X will be copied to /system/X in the system file. The sdcard/android root dir is JUST LIKE your root in ROM androids.
c. Make sure you either created a backup or verified a match in any other way before replacing files like frameworks, zimage, modules, etc.. your android might not boot afterwards (I keep all system.ext2 files backed up so that i can restore them incase i screw something up.)
enjoy
Click to expand...
Click to collapse
Thanks, this Guide is very informative
Help with LG D722
I'm using LG D722 phone and I somehow unlocked bootloader and installed twrp recovery. I backed up Lollipop that's what I'm using and i want to restore custom ROM
I know I need to install Google Apps after installing Custom ROM. But Do I also need to install Modem files on my device ? Because I can't find them on XDA Forums. Please give me a link or something. The help is not just appreciated but seriously needed.
Success. Thanks
Hello, I walk testing one recovery but I'm booting before flashing, the question is, will the recovery feel same when booted vs flashed? I've booted and used to flash a pair of zips but felt very laggy and bugged although did the work right. Thanks
Edit: solved, tried myself
Sent from my SHIELD Tablet K1 using XDA-Developers mobile app
http://forum.xda-developers.com/showthread.php?t=872128&page=2

Market on Emulator

Hi everyone! It's my first post. Did the "Noob video" kind of emerge from a frustration with new users?
Purpose
I want to run the Android Market on Android 2.3 inside the emulator, since I don't want to register a Google account on my phone. I donwload the apps there and transfer them to my phone.
Situation
I successfully set up an AVD with 1.6 and 2.3 where the Market seems to run flawlessly. However, it's not really deterministic what conditions lead to a running Market [1]. I want to be able to make all modifications of the SDK images and APKs myself in order to run the market. I consulted several guides already [2]:
Varun's How to: Install Android market on Emulator <hxxp://blog.varunkumar.me/2010/11/how-to-install-android-market-in-google.html>
Anything simple: How to use Android Market on Android Emulator 2.2 <hxxp://anythingsimple.blogspot.com/2010/09/how-to-use-android-market-on-android.html>
Tech-Recipes: How Do I Install the Android Market on Android SDK <hxxp://w#w.tech-recipes.com/rx/10004/accessing-android-market-from-android-sdk/>
CareAce: How to fix "protected" Android Market app <hxxp://w#w.careace.net/2010/06/16/how-to-fix-protected-android-market-app/>
All files I used are provided.
What I did
I followed the guide by Varun and it worked quite well, but it really worked only after I changed ro.secure=1 and ro.allow.mock.location=0 in default.prop (located in ramdisk.img).
Create a new AVD. Config.ini:
Code:
hw.lcd.density=160
hw.gps=yes
hw.camera=yes
hw.ramSize=256
sdcard.size=256M
Edit build.prop (see attachment, original values are commented with ###)
Install Vending.apk and GoogleServicesFramework.apk
Delete SdkSetup.apk
ro.secure=1 and ro.allow.mock.location=0
When using GSF provided by Varun, the Market runs fine. When I use the GSF from my phone, it doesn't work. So, my two questions:
What exactly does a running market depend on? (Only fingerprint and gsf?)
Is the GSF by Varun the original or a patched variant?
How could my version of the GSF be modified to work?
Attachments
CRC32 values are in parantheses.
com.android.vending.apk (6502c750)
Original Market v2.3.6 as downloaded by the Market Updater
Vending_Adi.apk (a51aa807)
Above patched on byte basis [3] (no re-assembling, modification directly in classes.dex for minimal deviation from original).
Installed on my working AVD.
GoogleServicesFramework_htc.apk (3f770666)
Version 2.2.1
I pulled this file from my HTC Desire Z with Android 2.2.1
GoogleServicesFramework_varun.apk (6b3ea386)
Version 2.2
Available from Varun's guide
[1] A non-running Market only shows TerraTime on the home screen and games like PapiWall and PapiStep.
[2] Sorry for the obfuscation of the links. It's because this is my first post.
[3] I will explain every modification in detail, if asked for.
I've been trying to get the market working on the emulator "properly" for days.
Can you find protected apps such as g-mon or dr droid?
If yes PLEASE can you post a detailed howto?
It could be that they fixed it with the latest packages, judging from comments on some blog entries on the subject, so don't update your SDK before making a backup!
Thanks in advance,
- MF
How did u change "ro.secure=1 and ro.allow.mock.location=0" ?
MFighter said:
Can you find protected apps such as g-mon or dr droid?
If yes PLEASE can you post a detailed howto?
Click to expand...
Click to collapse
Edit build.prop in "system.img" before running emulator.
1) copy "%SDK%\platforms\android-10\images\system.img" "%userprofile%\.android\avd\%AVD%.avd\system.img"
2) open this file with binary file editor,
3) search "# begin build properties" or "23 20 62 65 67 69 6E 20 62 75 69 6C 64 20 70 72",
4) rewrite build.prop's content with real device's.
mrawekul said:
Edit build.prop in "system.img" before running emulator.
1) copy "%SDK%\platforms\android-10\images\system.img" "%userprofile%\.android\avd\%AVD%.avd\system.img"
2) open this file with binary file editor,
3) search "# begin build properties" or "23 20 62 65 67 69 6E 20 62 75 69 6C 64 20 70 72",
4) rewrite build.prop's content with real device's.
Click to expand...
Click to collapse
Don't suppose you would be willing to share your system.img file. I understand most of this but I tried to edit the system.img with no success. And there is no ramdisk.img in the avd folder. Can you help me out? I've tried everything. All I want to do is be able to download apps from the market so I can install on my tablet which is a Pandigital Planet and some of the apps don't show up on the market.
Persisting system.img and trying to make Android Market application to work
Actually, there is a way to persist system partition.
Built-in command line help shows that there is an optional persistent system-qemu.img. If it worked, all the hoops below would be not necessary.
If it try to create system-qemu.img in .avd directory as a copy of system.img from one the platforms in the SDK, emulator fails with an error
Code:
ko:Missing initial system image path!
. My guess is that emulator was deliberately crippled to not support persistent /system partition out of the box. If someone has a method to make system-qemu.img to actually work, please post.
I quickly looked through the emulator sources, the patch to enable system-qemu.img would be a pretty easy task for someone who has built android emulator from sources at least once. Any volunteers?
Read on for a hack to get system-qemu.img functionality.
When emulator starts, it creates a copy of system.img in %temp%/AndroidEmulator with some random name like TMP9323.tmp. If you do
Code:
adb -e remount
to mount /system as rw, you will get the writable system, but with an empty free space. Everything you do to /system is saved into this .tmp file.
The next trick is to start emulator instance with more virtual sectors than there are actually are in the stock system.img. You do that by starting emulator with the aptly named emulator command like so
Code:
emulator @AvdName -partition-size 256
If look later at free space with df, you will get something like this
Code:
adb -e shell df
Filesystem Size Used Free Blksize
/dev 252M 32K 252M 4096
/mnt/asec 252M 0K 252M 4096
/mnt/obb 252M 0K 252M 4096
/system 248M 96M 151M 4096
/data 248M 34M 213M 4096
/cache 64M 1M 62M 4096
/mnt/sdcard 252M 1K 252M 512
/mnt/secure/asec 252M 1K 252M 512
Note that you now have some free space in /system.
Later you do
Code:
adb remount
from your host shell. This is essentially the same as running
Code:
#mount -o remount,rw /dev/block/mtdblock0 /system
from emulator shell.
Now you get the fully writable /system filesystem. You can copy with
Code:
adb push
any files you like into the /system and they will be successfully written.
After you are happy with your new /system, from
Code:
adb -e shell
you sync filesystems and make system read-only:
Code:
#sync
#mount -o remount,ro /dev/block/mtdblock0 /system
After that you can hot copy the .tmp to some other place and close the emulator with an [x] button from the window title bar. I do not use snapshots, so closing emulator is akin to removing the battery from a real device.
And using snapshots to get a "persistent" /system is impossible without rebooting. Currently it is not possible to shutdown via emulated power button (F7). The emulator manual says just to close the emulator window. If you do that with snapshots enabled, you will get into the state you were when you closed the window. Also it is not possible to reboot, as there are no documented way to reset the virtual processor. The reboot command does not work. It just hangs the emulator-arm.exe with 100% use of the CPU core it happens to run on. That is another observation for emulator was deliberately crippled or not developed to a point when resetting the virtual processor is possible.
Later you put your .tmp file into your .avd directory with a name of system.img. And when you start your emulator (even from AVD Manager GUI) you will get your new /system.
If you later need to make some modification to /system, you need to go through all the steps again.
When starting emulator with a new /system for the first time, I recommend to check "Wipe user data" to recreate the file and directory structure in the /data partition, especially if you pushed new .apk files into /system/app or pushed some other system wide components like .jar (framework) or .so (library) files.
Wiping a /data partition can be a lengthy process because it leads to recreation of dalvik-cache, the most CPU demanding process. In most cases, you can avoid the /data wipe. But if you push Google Apps to a pristine AVD, you should do a wipe so that Google initialization program with "Touch Droid to begin" kicks in. It is a first step screen the user sees at least on a real, Google "enhanced" device based on Android 2.3.
You can even observe how userdata-qemu.img file gets bigger as dalvik-cache and other parts of /data get populated. You may even use the
Code:
top
command to see the processes on the emulated device.
If you are running emulator from the command line you can add -wipe-data option to wipe the /data partition.
Optionally you can remove cache.img from .avd directory to clear the cache. cache.img will be recreated from scratch in this case.
After all these manipulations, the only way to launch AVD would be from command line as -partition-size 256 must be specified every time, otherwise you will get a kernel panic when mounting the /system partition.
The GUI option "Ideal size of system partition" is actually ignored. Its value is not copied into hardware-qemu.ini from config.ini, but stays at the size of initial system.img. Just another observation that emulator was deliberately crippled.
If emulator hangs with textual (not graphical) "A N D R O I D" on its screen, it is likely that the new system.img is corrupted and/or the partition size of 256MB has not been specified for not stock system.img. You can verify this by launching AVD from the command line with -show-kernel option to get all the kernel output in real time. You will likely find a kernel panic there.
If emulator hangs with a graphical ANDROID animation (aka boot loop), you can use
Code:
adb -e logcat
tool to look for any errors in the start up process. Examples below.
But that was an easy part. Now we need to install Vending.apk and its dependencies.
As my goal is Android 2.3.3, as it is a close to current majority of real devices as it can be. I tried to work with the version of Google Apps for CyanogenMod. I own an HTC Desire with CyanogneMod 7.1-nightly. I downloaded the initial gapps-gb-20110828-signed.zip from the link in CM wiki. This .zip, when flashed through recovery works without any issues on CM. Also I pulled from HTC Desire an updated Android Market .apk. Also I generated a demo app which shows a text edit and a button, but does nothing just to check that .apks can be installed both as system and 3rd party apps.
Here is what I tried.
0. Started with a Google API (API Level 10) emulator images. Pushed unpacked gapps. Everything worked: initial Google account registration, Talk, Maps, Latitude, Navigaton, Places, News and Weather (widget + app), Search (including widget). But not Market. There were no icon for it. Fail.
1. Started with Android 2.3.3 (API Level 10) emulator images. Pushed unpacked gapps. Got a boot loop with an exception in logcat related to contacts migration/upgrade. Strange, Google API 10 image may have something that plain image does not have. Fail.
2. Started with Android 2.3.3 (API Level 10) emulator images. Pushed upgraded Vending.apk to /system/app. No Market icon after a reset. Even with data wipe. Fail.
3. Started with a Google API (API Level 10) emulator images. Tried to install through adb the latest Vending.apk as a third-party app. adb install failed with "INSTALL_FAILED_ALREADY_EXISTS". Fail.
4. Started with a Google API (API Level 10) emulator images. Deleted /system/app/SdkSetup.apk. Tried to install latest Vending.apk with adb. Same result as in 3. Fail.
5. Started with a Google API (API Level 10) emulator images. Deleted /system/app/SdkSetup.apk. Pushed latest Vending.apk to /system/app. After reboot no icon. Also pushed own app, it got the icon. Vending.apk got no entry in /data/dalvik-cache, but demo app got it. Something prevents the Vending.apk to be recognized as a valid app. Fail.
6. Same as 5, but pushed not as Vending.apk, but as foobar.apk. Same result. No icon after reboot, no entry in dalvik-cache. Fail.
Spent the last 4 hours for figuring out the method for /system persistence and Vending.apk experiments.
Some possible reasons for Market Application to not show up in dalvik cache and no icon in launcher application list:
1. Some metadata in .apk prevents it from being processed. SDK level?
2. Crypto keys mismatch. Firmware signing keys != .apk signing keys.
3. Apk contents conflict with something existing in the firmware. (INSTALL_FAILED_ALREADY_EXISTS).
4. Permission issues.
5. System image configuration variables like ro.secure and ro.allow.mock.location.
The next step for me would be to read 3 books:
1. Learning Android.
2. Application Security for the Android Platform
3. Android Forensics: Investigation, Analysis and Mobile Security for Google Android
As I plan to fork or contribute to pffmod (http://forum.xda-developers.com/showthread.php?t=996726), I had to read them anyway.
If someone has a working method to put recent Android Market into Android 2.3.3 (API level 10) or Google API (API level 10) emulator images, please post.
nice information M4rketSqueezer and geckoneer! may be try to change the property ro.config.nocheckin=yes? i have 2.1 emulator with market now..same method as M4rketSqueezer
I don't have my device yet and want to take advantage of what few apps are still 49 cents.
I've been trying to follow this method today and when I get to the pulling build.prop part I get a cmd error saying adb is not recognized as an internal or external command.
I'm not sure what I did wrong :\
I've download the image referenced in this article at techdroid.kbeanie.com/2011/01/android-market-on-emulator-22.html. This post is merely for 2.2, but I managed to extract their googleservicesframework.apk and vending.apk from inside the image(using adb pull while the emulator is running). I then created a normal 2.3 AVD, started it from the command line with -partition-size 100, pushed the pak files I just extracted from 2.2, and followed geckoneer's hints for getting the system image that contained the pushed apk files. Now having that image with the market apk files, I ran that image inside the emulator and got the market running successfully. Once you start the market for the first time it'll run you through the google account registration wizard. Once you complete with an account, you'll have the market running and I tried searching and downloading applications from it. I've attached the two apk files for convenience.
Two points are noteworthy here: I had to change /system/build.prop inside the system image to one of the real supported models in google market at support.google.com/googleplay/bin/answer.py?hl=en&answer=1727131. I extracted the file from my mobile which was Samsung galaxy mini GT-S5570. I had to replace some of the values(especially those related to the model and manufacturer) in build.prop inside the emulator with those from my mobile.
The second point is that, after I exit the market(with several back-button presses till I get to the home screen) or restart the emulator. It seems the market isn't working properly. By working properly I mean that when I search for something in the search box, it just reports the number of matched results it found for my search(like saying 543 matches or so), without actually displaying the result. So far the only fix I managed to find to this was by restarting the emulator from the command line with -wipe-data; this repeats the google account registration process when I try to run the market again, and it's once again running effectively just after the registration, but it'll get crippled soon if I exit it or restart the emulator. This seems like an annoyance, but other than that the image works fine.

Ubuntu / Backtrack on Android [Complete Solution]

This guide had been on the Thunderbolt forum for quite some time and I decided it was time to share with the rest of the community
Having reviewed almost every other option I can safely and honestly say this is the most simplified, thorough, and customizable install available since its original launch. I will gladly retract this statement when it becomes false, but until then...
Installing Ubuntu onto Thunderbolt/Droid/Droid2/Etc:
Create a folder on the sdcard named ext2ubuntu, which is /sdcard/ext2ubuntu when listed in terminal or adb
Required files for Ubuntu install:
Ubuntu.sh http://db.tt/KgDNlMtb
Custom Packages for AutoConfig:
Coming soon
You will also want to download either an ubuntu image or archive. The major difference is that the image must be the same size as your ubuntu installation, so they are larger downloads, or need to be resized before you use them.
Ubuntu Prebuilt tar and img downloads:
(img: Extract only ubuntu.img and place in /sdcard/ext2ubuntu)
(tar: Rename, if desired, and put archive in /sdcard/ext2ubuntu)
10.04: http://android-cruft.googlecode.com/files/lucid-on-android-0.1.tar
(This image DOES need to be resized, see next post)
10.10 img: http://www.megaupload.com/?d=56AT71WD
(This image file does NOT need to be resized)
11.04 tar: http://db.tt/fuzoy8Te
Backtrack img: http://bit.ly/kJweA9
Borrowed from http://forum.xda-developers.com/showthread.php?t=1146255
(This image file does NOT need to be resized)
How to build your own Ubuntu Image:
http://androlinux.com/android-ubuntu-development/how-to-build-chroot-arm-ubuntu-images-for-android/
Notice:
The ubuntu mount folder is symlinked to /system/sd-ext allowing access to it there also.
First off you should have a running ubuntu install on your computer or at least a live cd running to create the ext2 partition.
Use gparted to add a 4gb (or whatever size you want) ext2 partition to your sdcard. I did this while the phone was mounted in disk drive mode, so you dont need to take the card out.
Ubuntu: Get gparted in synaptics or in terminal enter:
Code:
sudo apt-get install gparted
Widows: *Paragon Partition Manager*
If you do not need to partition, skip this step.
Use adb to run /sdcard/ext2ubuntu/ubuntu.sh
Code:
adb shell
su
sh /sdcard/ext2ubuntu/ubuntu.sh
Or from terminal (only supported on some ROMs)
Code:
su
bash /sdcard/ext2ubuntu/ubuntu.sh
All required scripts will download and install themselves automatically. Currently only ubuntu.sh and the chosen ubuntu image need to be placed in /sdcard/ext2ubuntu for proper install. Scripts include an autoupdate feature that will also keep them current.
Follow the instructions and select the appropriate options for your system configuration and download choices.
You can now open terminal and type "bootubuntu" to test install
A new Sdcard Direct option was added allowing user to replace the installed scripts with a unified "ubuntu" command that runs the scripts directly from the sdcard. This option was offered due to the frequency of updates to allow the user to simply replace the files in /sdcard/ext2ubuntu with newer versions that would run without any further steps.
If you get a localhost prompt, you are in but still need a couple things to move past command line.
Here is where we part from borrowed and modified instructions that recommend lxde and ice and all the dinky handheld ubuntu shells, and move to the Thunderbolt method.
Update vs Restore scripts: Update will base what scripts are put in system on the ones currently there, while restore determines what scripts are currently available on the sdcard.
For automatic installation of ubuntu applications, you will want to enter these commands next:
Code:
su
backubuntu
4
Choose your options
To view your ubuntu desktop, you will want a vnc viewer for android. I use real vnc, but android-vnc-viewer is free and has all the same features (i just liked the layout of realvnc)
The address for ubuntu is 127.0.0.1
The port is 5901
The password is the tightvncserver one you set.
i recommend making a folder named android in "your mounted ubuntu folder"/home/ for your personal files since /root is your local folder, but causes permission issues.
From your new ubuntu you can use synaptics and download eclipse there, but it can also be downloaded from the localhost prompt using "apt-get install eclipse" I also recommend downloading the android-sdk. To run the sdk from the localhost prompt, simply cd to the android-sdk directory and issue the command:
Code:
tools/android update sdk -u -s
and if you want to specify the downloads performed add
Code:
-t [specific items such as platform, platform-tool]
If you need help with any commands you can add
Code:
-h
to your existing command
The htc kitchen can be downloaded from ubuntu using the same instructions found: http://forum.xda-developers.com/showthread.php?t=633246
After it is installed, you have the option to launch this kitchen either from inside your ubuntu install, or from the localhost prompt, which avoids having to run vnc to use it.
A compiler toolchain is available http://www.codesourcery.com/sgpp/lite/arm by choosing download the latest release. I use gnu/linux even though it seems to be eabi included in the android source, but I have never used it to be sure. I have been told this one is a lot easier to use anyway.
I recommend backing up the ext2 once everything is done. This can be done by (entering "exit" at the localhost prompt and then) entering "backubuntu" in terminal.
backubuntu can also update newly downloaded scripts without having to use root explorer or worry about permissions. Just put any new versions in your sdcard/ubuntu folder and select the update option.
This replaces the ubuntu2.img with your backup so you dont have to "apt-get" everything over again. This will also save your tightvnc password so make sure you remember it.
Sent from my ADR6400L using Tapatalk
Screenshots:
https://picasaweb.google.com/110545...authkey=Gv1sRgCLDd48n2oMWzpAE&feat=directlink
References:
Personal insanity and the inability to accept whats already available
http://code.google.com/p/android-cruft/wiki/LucidWithAndroid
http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-android/
http://forum.cyanogenmod.com/topic/15702-ubuntu-on-your-g2-anyone/
http://forum.xda-developers.com/showthread.php?t=633246
http://www.codesourcery.com/sgpp/lite/arm
http://forum.xda-developers.com/showthread.php?t=987740
http://androidclone.com/forums/showthread.php?tid=23
Sent from my ADR6400L using Tapatalk

BootBuddy - Run Boot Scripts from SDcard (a safe alternative to init.d)

INTRODUCTION:
Boot Buddy will allow you to run Linux shell scripts when your Android device is booting up. It will run your scripts early in the boot process, before the home screen appears.
The intended audience is generally intermediate to advanced users, and those who want to play with shell scripting on their device.
FEATURES:
BootBuddy is similar to init.d scripts, but with a core difference that it stores boot scripts on your SDcard instead of the internal system. This allows for several interesting enhancements. Feature listing-
Much more Safe than init.d. If you have a script that is malfunctioning, just boot with the sdcard out, and put the sdcard back in after your device reaches home screen. Your device is Saved, No Problem!
Boot Buddy is designed from the start to run scripts right from your SDcard. Just download any scripts to your boot_buddy_scripts directory and they're ready to run. (No more screwing around with permissions and files in your /system/etc/init.d/*)
SDcard storage allows you to copy a script to another device, or multiple devices easily.
Boot Buddy's author has several years of scripting and programming experience. It is streamlined, fast, and doesn't perform worthless functions like repeatedly logging the authors name and time (*hint to a t-init author*).
Clear goals of making operation simple, intuitive, and clean.
If you're currently using an "init.d" solution, BootBuddy can integrate seamlessly with it.
If you try BootBuddy and you don't like it, the installer also works as an uninstaller for easy clean removal.
BootBuddy is Open Source GNU GPL. Open for anyone to modify and improve upon.
As a developer, I make software to operate the way I would want if I were an end user, because I actually do use it, and I am an end user like you.
REQUIREMENTS:
Android 4.0 and up
Rooted device
An sdcard
Script Manager Free (or any other app that can run scripts as root)
Boot Buddy Installer bb_install.sh
INSTALL:
Start Script Manager, and allow/grant root access.
Navigate to the bb_install.sh file.
Tap on the file to show the menu options.
At the top, highlight the "Su" icon.
On the top-left, tap "Run".
The script will run quickly. It will automatically detect your sdcard location and create a folder on your sdcard named "boot_buddy_scripts". In that folder, you put the scripts you want to run at system boot. A log file will be kept at /data/boot_buddy.log
If you need your scripts to run in order, they are ordered by filename using the busybox "sort" program. They will run in alphabetical order using this format 0-9A-Za-z.
YOUR FIRST SCRIPTS: (OPTIONAL)
Here are a couple example scripts you may use.
The Android /system is normally mounted with read-only permissions by default. We will change that with the first script listed below. It will cause /system to be remounted to read-write permissions during boot.
The second script will create a file at every boot named /mnt/sdcard/sys_mount_info.txt. That txt file will give us information about how /system is currently mounted.
Download the file 00rw_system.sh into your boot_buddy_scripts folder.
Download the file 99sys_mount_info.sh into your boot_buddy_scripts folder.
Reboot your phone.
That's it, you just installed 2 new scripts and had them run at boot. It's Really just that simple to add startup scripts to your system.
To verify they are running, use any text viewer to open the file /mnt/sdcard/sys_mount_info.txt. It may show more than one line of text. There should be a line similar to this:
/dev/block/(device specific text) /system (fstype) rw,(more text)
The rw means that /system was successfully remounted as read-write during boot.
At any time you can delete either script if you choose. Easy!
UNINSTALL:
If for any reason you find you don't want or don't like Boot Buddy, you can cleanly uninstall it using the installer bb_install.sh. These instructions are almost identical to installing. (All match the installation steps, except step 4)
Start Script Manager, and allow/grant root access.
Navigate to the bb_install.sh file.
Tap on the file to show the menu options.
Type --uninstall in the text area labeled Arguments.
At the top, highlight the "Su" icon.
On the top-left, tap "Run".
Boot Buddy will be uninstalled. It will not remove the contents of your boot_buddy_scripts folder. If you have an "init.d" system installed, it will cleanly remove only Boot Buddy parts and leave the rest.
MUST READ
ADVANCED NOTES:
Boot Buddy will Not cause harm to your system, but it may not work on custom roms. Also, it may fail to detect the real location of your SDcard. It requires that /system/etc/install-recovery.sh is run during the boot process, and that file will be created if it does not exist. Also the file /data/boot_buddy.sh will be created. The script /system/etc/install-recovery.sh will run /data/boot_buddy.sh. The script /data/boot_buddy.sh will run the scripts on your sdcard. The file /data/boot_buddy.log will log any script output.
For Windows and Mac users- If you download the installer to your pc first, do not edit the installer with a text editor. Your computer will add hidden markers at the ends of each line that will prevent the installer from running. If you want to edit it, you should do so on a Linux pc or directly on your Android device.
Tell us about your results!!!
BootBuddy source code: http://github.com/Sepero/bootbuddy
NOTE : I AM NOT A DEVELOPER I AM ONLY SHARING THIS. So Try On Your Own Risk. I Can't Help Anything.
Credits :
[email protected]
Script mgr says I'm not root, despite me in a root terminal elsewhere. wtf ?? ...
I'm not root in script mgr., even though I'm showing up as root in terminal.
I've installed Super user (chains sd ), just in case the App doesn't support my other Supersu App or similar.
I've utilised the su icon and run.
I did tick run as executable.
No reboot tried.
What am I missing ??
Please advise.
I give you 5 stars to the thread
Almost first!!! haha.... this is awesome dude this could be HUGE.
Steve Eligoyo said:
I'm not root in script mgr., even though I'm showing up as root in terminal.
I've installed Super user (chains sd ), just in case the App doesn't support my other Supersu App or similar.
I've utilised the su icon and run.
I did tick run as executable.
No reboot tried.
What am I missing ??
Please advise.
Click to expand...
Click to collapse
You must to select root when start on script mgr, you have skull head with crossed bones
Steps to complete failure: Page 96 ?? ...
Here are the steps I've taken to get kicked in the teeth:
Boot phone > menu > script mgr. > start > scroll to file (in this case bb _install.sh ) > open file > tick su ( tried boot and bgr several times, nada amigo ) as instructions state > run > unexpected oper error: your not root > rinse and repeat sixty times > open terminal > su > Works just fine > Post my question on xda in the WTF Thread
Update:
After creating the directories and files needed to make this train wreck into a working setup, (obviously a few are missing here, working on it), I reopened script mgr and browsed the file system, which shows bb _install.sh file (and the other two in this
Thread as well) with the green su skull and crossbones with the boot dot next to those skulls, yet the apps shell /console says oper error - Your not root.
Again, I open terminal, su > enter > Viola!, I'm root.
I've installed the sdcard v. of script mgr as well and I get a message stating /data/system/xbin does not exist.
I'll likely need to tweak the script mgr settings to /sdcard 0/externalsd /directory bind /system /xbin/bb _install.sh - something like that.
Still doesn't explain why the app is putting the brakes on root terminal in the nag screen.
Any ideas ??
MAN THANK YOU !!!! as a noob i couldn´t get init.d to work right. so i tried your script on the xperia z3c with stock 4.4.4
to make it compatible with z3c you need to edit the file /data/boot-buddy.sh after the installation
and replace both
/boot_buddy_scripts/
with
/storage/emulated/legacy/boot_buddy_scripts/
or
/storage/sdcard1/boot_buddy_scripts/
or another prefered location
then make a new folder boot_buddy_scripts in the location.
really it executes the scripts way before the apps are starting , this is so nice and will be on my phones from now on !
edit: i also now changed the log file creation to the sd card for quick access (most filebrowsers open there by default)..
the logfile is major awesome btw if something didn´t go right , its easy to debug , thanx alot again
Won't install says I don't have busybox. I have it but it has to go in system bin instead of xbin. Amy way to get this working?

[GUIDE] Ubuntu in a chroot on the Galaxy S4 - now with Native Booting!

Notice (4/16/14): I'm no longer here. I've said "goodbye" to AT&T and their locked bootloader schemes. I'm voting with my wallet - I've sold my I337 and switched to T-Mobile. My apologies to the community, but you're now on your own here.
Intro/About/Requirements:
This thread started as a guide for people who wanted to run Ubuntu in a chroot, and then connecting to it locally with a VNC client. This method has been used countless times on other devices, with many thanks to @zacthespack and his his group, LinuxonAndroid. Unfortunately, this method did not work out-of-the-box on my device, so I tweaked things to work with the Galaxy S4 and posted them here in this thread.
However, the most people immediately noticed that with this method the performance is not great, and some applications can't work in a headless environment. With a comment made by zackthespack, I began researching what it would take to get Ubuntu to write directly to the device's framebuffer. After a few months, I not only managed to accomplish this, but also developed a way to get the Galaxy S4 to boot directly into Ubuntu. As far as I have seen, both of these are a "first" for this handset.
All of these methods require root. The VNC Chroot does not require a custom kernel, but the other methods require a custom-built kernel. For the I337 (AT&T) handset, this can pose a problem if you have bootloaders that are MF3+. If you're using MDB/MDL bootloaders still, you shouldn't have a problem with this and you can Loki the custom kernel without issue.
Depending on your ROM and/or Kernel, you may also need a new version of BusyBox installed, even for the VNC method. You'll find a few apps on the Play Store that can do this for you. Beware that some of them are not easily reversible (such as TinyBox), so if you're stuck on MF3 with no way to create/restore a nandroid/system backup, you should be careful.
Click to expand...
Click to collapse
Disclaimers:
Following this guide and/or flashing anything I've provided to your device is your own responsibility. If something breaks, you break your device, or something explodes, I can't be held liable (I'll help correct any situations you may put yourself in, however). I claim no rights to any proprietary software or intellectual property included in this post or the packages contained herein. By using any of this software, you agree to whatever licenses/agreements that the creators may have included with their software. If you use any of this stuff in your own project, please provide credit where credit is due. For example, if you take my u.sh script and adapt it to some new device (i.e. Galaxy S 5), please at least mention where it came from.
Click to expand...
Click to collapse
VNC Chroot Method (original):
This method is loosely based on this thread for the Galaxy S3 and the ubuntu.sh script there. It didn't work for the S4, but I've made several tweaks to it, simplifying it a ton, and otherwise getting it to work perfectly on my S4. I've tried this using my AT&T Galaxy S4 (SGH-I337) on both the MDL build and the MF3 build - both seem to work great.
Instructions:
Download the Ubuntu 13.04 Small v1 image here.
Create a folder on your sdcard labeled "ubuntu" by whatever means you want to.
Extract the ubuntu.img from your downloaded zip into this folder.
Download my version of the ubuntu.sh and place it on the root of your sdcard.
Open the script in a text editor and read through it. Never run a script like this on your android without first knowing what it does - especially when the author is telling you that you need root. If you're happy with it, proceed.
Install an terminal emulator of your choice. I personally used this one, and technically an adb shell will work too (but you'll be tethered to your PC...).
Install a VNC Client of your choice. I personally used this one, but there might be better/faster ones out there.
Open the terminal emulator, and execute the following commands:
Code:
su
sh /sdcard/ubuntu.sh
If you see a bunch of errors and get dumped back at the "[email protected]:/ # " prompt, then something went wrong. Report your errors in this thread. Remember, this requires root (and the "su" command to get there, of course).
You'll be prompted for some setup parameters, which you can save at the end for later. Just answer each question and press Enter after each:
You'll need to provide a new password for the "ubuntu" user. A simple passwords like "ubuntu" works, unless you want some security.
Start VNC server? (y/n) - always choose "y". We need this to interact with the device.
SSH server? Optional. If you use it, you should enable it.
Screen size: Enter whatever you want. I personally used 960x540 (one quarter of the S4's screen size) so that I could actually interact with things using the touch screen.
Save settings as defaults? - You might not want to do this until you have a screen size that works best for you.
Once you see the prompt, "[email protected]:~# " - you're in! You now have Ubuntu running in a chroot. As the on-screen instructions suggest, type "exit" at this prompt to end the chroot and Ubuntu. It is recommended to do this when you are done so that the ubuntu.sh script can clean up after itself (unmounting things, etc.).
Leave your terminal emulator app running! Use your Home button to return home and leave it running.
Open you VNC client and connect with the following settings:
Nickname: (whatever you want)
Password: ubuntu
Address: localhost
Port: 5900 (default)
Username: (leave blank)
Color Format: 24-bit color (you can use lower if you want better performance)
Connect. For the VNC app I used, I had to zoom in to make the screen fit correctly (use pinch-to-zoom, and then use the "+" button on-screen). Also, you can play around with the Input Mode some if you wish.
Enjoy Ubuntu!
As you can see, it's not terribly complicated to get this up and running. Once you have set it up the first time, it's a lot smoother from then on out. The script is designed to allow you to use the external SDCard if you wish. Just use place the ubuntu.img in an "ubuntu" folder on your external SDCard, drop the ubuntu.sh on the root of the external SDCard, and use "sh /mnt/extSdCard/ubuntu.sh" instead (don't forget "su"!).
Click to expand...
Click to collapse
Freedreno Chroot Method (NEW):
This long-winded tutorial will explain how you can setup Xubuntu-desktop in a chroot. Before attempting any of this, you should read through all the steps and be sure you're comfortable performing the steps needed.
This requires roughly 2GB free space on your /data partition - the actual finished install is about 1.4GB, but it will require some extra space while it installs Freedreno and other components. HINT: Keep in mind that your /data partition is shared with your internal sdcard (your internal sdcard gets whatever space is leftover at the end of the /data partition), so you can get an idea how much free space you have by looking at how much space your internal sdcard has available.
Instructions:
Step 0 (option A) - Build Custom Kernel
You will need to install a custom kernel that has specific options enabled in the configuration, along with a few patched files in the source code. This list of changes is based on a delta from the stock I337 MF3 kernel, available at http://opensource.samsung.com/. You should be able to apply these changes to "any" kernel that you can build from source, so this documentation may apply to devices other than the I337.
Kernel Mods:
Required config changes:
Code:
CONFIG_DEVTMPFS=y
# CONFIG_DEVTMPFS_MOUNT is not set
CONFIG_DRM=y
CONFIG_MSM_KGSL_DRM=y
# CONFIG_KGSL_PER_PROCESS_PAGE_TABLE is not set
# CONFIG_MSM_KGSL_PAGE_TABLE_COUNT is not set
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_MSM_TRIPLE_BUFFER=y
CONFIG_FB_MSM_DEFAULT_DEPTH_BGRA8888=y
# CONFIG_FB_MSM_DEFAULT_DEPTH_RGBA8888 is not set
Fix for Wi-Fi problems when using MF3 kernel on UCUAMDL bootloaders (i.e. "unadulterated" or "neutered"):
Code:
CONFIG_PROC_AVC=y
Required Patches to kernel source code:
https://github.com/freedreno/kernel-msm/commit/4c0281745f8c85707be88acebb557aca0b8f1dba
https://github.com/freedreno/kernel-msm/commit/228f65d48d4855d903e3b4642179dfa14eedd040
https://github.com/freedreno/kernel-msm/commit/54b510b2e6bccf08fdf3a8ad00a62b27c2f8c1e6
Additional changes required for sudo to work (added 10-25-13 in v4):
Code:
# Samsung Rooting Restriction Feature
#
# CONFIG_SEC_RESTRICT_ROOTING is not set
# CONFIG_SEC_RESTRICT_SETUID is not set
# CONFIG_SEC_RESTRICT_FORK is not set
# CONFIG_SEC_RESTRICT_ROOTING_LOG is not set
Additional changes to the initramfs required for sudo to work (added 10-25-13 in v4):
Edit fstab.qcom, remove the nosuid, part of the line that references userdata.
Step 0 (option B) - Download Custom Kernel Instead
Don't want to compile your own kernel from source? If you have the I337, you can use mine! As mentioned above, this kernel is based on the original MF3 source from Samsung, with the modifications listed above. If you are stuck with MF3+ bootloaders on your I337, you will not be able to install this kernel directly (at the time of this writing). MDB/MDL bootloaders are fine, but you will need to flash loki-doki afterwards (this kernel is not pre-lokified!). This kernel might work with other similar variants (such as the M919), but I haven't tested this on anything except my own I337 daily-driver. YMMV. If you run into issues, you might need to wipe cache/dalvik. This will likely only work with TouchWiz-based ROMs (I have not tried it with AOSP). Here's some downloads for you:
mf3-freedreno-android-boot-v4.zip - CWM/TWRP flashable zip.
- Boots to android, allows Ubuntu with Freedreno to work in a chroot.
- Compiled with the original (slightly modified) MF3 initramfs and "mf3-freedreno-minimum-zImage-v4" (below).
- Includes minimal configuration changes described above, plus the WiFi fix part.
mf3-freedreno-minimum-zImage-v4 - Just the MF3 kernel itself with minimal changes to get the chroot to work.
mf3-freedreno-minimum-config-v4 - Yeah, that's right. I'm providing the .config files I used for all of this.
Step 0.5 - Install the Kernel
Before you can start up the chroot properly, you'll need to have the custom kernel installed. You don't want the "ubuntu-boot" version right now, because you don't have an Ubuntu install to boot to. If you're using my pre-built kernel, first flash mf3-freedreno-android-boot-v4.zip and then flash loki-doki.zip.
Step 1 - Companion Files
Download this file: mf3-freedreno-companions-v4.zip - Non-flashable zip. This includes the script files, which you should promptly read through both u.sh and launch.sh. It is always good practice to read through any script file you get from the internet, making sure it's doing what you would expect it to. Also check out CREDITS.txt, which includes information about the included upstart-dummy.tar.gz and start-stop-daemon files.
Extract the companion files .zip and place its contents on the root of your internal sdcard (/sdcard/). Don't extract the contents of upstart-dummy.tar.gz. This is your $src directory. You can change this if you wish (see script for details).
Step 2 - Install/Configure Ubuntu
Install an terminal emulator of your choice. I personally used this one, and technically an adb shell will work too (but you'll be tethered to your PC...). At the console/shell, type the following two commands:
Code:
su
sh /sdcard/u.sh bash
The script will download Ubuntu Core and install Freedreno, upstart-dummy, and lubuntu-desktop. Total download size will be around 425MB. Total install time will vary, but count on it taking at least 45 minutes to install and configure everything. At the very end, you'll be prompted to enter a password for the new user "ubuntu".
Step 2.5 - Exit ubuntu
When you see the message "Type 'exit' (without quotes) to leave ubuntu," the install is complete. You'll notice that your prompt changed to "[email protected]". This is the easiest way to confirm that you're actually inside the ubuntu chroot. Type exit and hit Enter to get back to android.
Step 3 - Fire it up!
From now on, you can start Ubuntu using u.sh in any of these three ways:
sh /sdcard/u.sh - This will make initial prep, STOP android (black screen), launch the chroot, install/configure if needed, and will execute "service lightdm start". This will give you the greeter and you can login as "ubuntu". If the lightdm service stops for whatever reason (see info about the home button below), the script will continue by exiting the chroot and rebooting your device.
[*]sh /sdcard/u.sh bash - Same as above, except that it will not stop android, not startx (will give bash shell instead), and will not reboot your phone when you exit the shell.
[*]sh /sdcard/u.sh destroy - This will do exactly as it sounds - destroy your ubuntu installation. This will unmount your /sdcard from ubuntu (if still mounted somehow) and then recursively delete your ubuntu installation. If you change the source or destination directories in the main script, you should be careful deleting things.
NOTE: Remember to ALWAYS run any these from a root shell, whether via terminal emulator, via adb shell, or using SManager (or similar).
Step 4 - Note the Home Button and Touchpad
Take note that any time you have X running via lightdm, the hardware Home button will kill the X server. This is intentional, and will exit the chroot and reboot your phone. You'll also notice that currently, the touchscreen acts like a giant touchpad (like on a laptop). Use two fingers to right-click or scroll. Direct touchscreen input is not available at this time due to a segmentation fault that evdev causes when used on this device in a chroot.
Step 5 - (optional) Make Changes and Do it All Over Again
Customize the crap out of it! Edit my u.sh, launch.sh or xorg.conf and have fun. If you find great improvements, please post them in this thread! In future revisions, I might include them. Things should be well documented within the scripts. You might even change the bit at the end of launch.sh that starts "service lightdm start&" instead of "startx" - this would give you the greeter and let you login as the user "ubuntu" if you want. Also note that those three files are the only ones that must remain in your $src directory if you wish to continue to run this as a chroot. By the way, booting directly to Ubuntu after it is installed does not require any of the companion files anymore.
Click to expand...
Click to collapse
Native Boot Method (NEW):
This part of the tutorial is for those who wish to take things a step further and boot your device directly into Xubuntu-desktop. This will require that you setup the Freedreno chroot properly, and then you'll be installing a new boot.img. While this doesn't replace your /system partition, you won't be able to boot directly into Android while you have this boot.img installed.
Instructions:
Step 1 - Install Ubuntu
Basically, you need to perform all the steps for the Freedreno Chroot method, and get that up and running first. All you're doing here is swapping out your kernel.
Step 2 (option A) - Build Custom Kernel
You'll need all of the kernel customizations included in the freedreno chroot method, plus these listed below:
NOTE: You will need some proprietary blobs, which can be found on your device in the /etc/firmware directory.
Config changes to enable booting directly into Ubuntu (beyond replacing the initramfs...):
Code:
CONFIG_EXTRA_FIRMWARE_="audience-es325-fw.bin a300_pm4.fw a300_pfp.fw vidc_1080p.fw"
CONFIG_CMDLINE="console=tty0 fbcon=vc:0-3"
# CONFIG_CMDLINE_FROM_BOOTLOADER is not set
CONFIG_CMDLINE_EXTEND=y
# CONFIG_CMDLINE_FORCE is not set
Optional config changes to enable the framebuffer console when booting directly into Ubuntu - useful for debugging.
Code:
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_FRAMEBUFFER_CONSOLE=m
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set
NOTE: You will need to grab some .ko files that are created, which must be loaded in the following order:
Code:
insmod /ko/font.ko
insmod /ko/softcursor.ko
insmod /ko/bitblit.ko
insmod /ko/fbcon.ko
I recommend that you include these four lines into the init script that is included in the ubuntu ramdisk. These can go pretty much anywhere after the ". /scripts/functions" part, but before it calls out to run-init. Also, don't forget to drop those .ko files into a new /ko directory in the initramfs. If you want to load these with modprobe, I'll leave that up to you (good luck).
Replace the entire ramdisk/initramfs:
At this time, I'm not going to provide instructions on how to do this. You'll need this mako boot.img straight from Ubuntu, repacked with the zImage created here. For what it's worth, the re-pack tool I'm using includes --cmdline 'androidboot.hardware=qcom user_debug=31 zcache', but I'm not sure if that's needed (especially considering our kernel seems to use qcache?). Anyways, good luck.
Step 2 (option B) - Download Custom Kernel Instead
Again, if you don't want to compile your own kernel from source, you can download mine and use it. The same warnings and restrictions apply as they do in Step 0 (option B) of the Freedreno Chroot method. And here's your downloads:
mf3-freedreno-ubuntu-boot-v4.zip - CWM/TWRP flashable zip.
- Boots to Ubuntu directly, but only if your Ubuntu install is located at /data/ubuntu (Default).
- Compiled with the original MF3 initramfs and "mf3-freedreno-everything-zImage-v4" (below).
- Includes all configuration changes described above.
mf3-freedreno-everything-zImage-v4 - Just the MF3 kernel itself with all changes for both chroot and direct booting to Ubuntu.
mf3-freedreno-everything-config-v4 - Yet again, I'm providing my complete .config file for this.
Step 3 - Install the Kernel
Here's the easy part. Flash your completed boot.img, flash loki-doki, and reboot. If you're using my pre-built kernel, first flash mf3-freedreno-ubuntu-boot-v4.zip and then flash loki-doki.zip.
Click to expand...
Click to collapse
Flashable Zip Method (NEWEST):
It's finally finished: a flashable .zip that you can use to dump a pre-built rootfs onto your data partition. This will still require that you flash one of the two custom kernels (whether for chroot or native booting), but it will allow you to skip the whole build/install process.
ubuntu-install-v4.zip - CWM/TWRP flashable .zip. Requires approx 2GB free space on your data partition during install, and the final install size is approximately 1.3GB (may want more free space to add your own programs/etc.). Output folder is /data/ubuntu. This can be changed in u.sh, but heed the warnings within!
Instructions:
Instructions for Chroot-style Ubuntu:
Download the "companions" .zip and extract its contents to the root of /sdcard.
Download the "ubuntu-install" .zip to your internal or external SDCard.
Download the "mf3-freedreno-android-boot" .zip to your internal or external SDCard.
Make a nandroid backup of your phone, and store it on an external SDCard or your computer. Always a good idea to have this.
Install the "ubuntu-install" and "mf3-freedreno-android-boot" .zip files, followed by loki-doki.zip if you need that for your device (e.g. I337).
Restart and resume with Step3 of the Freedreno Chroot Method.
Instructions for Native Boot Ubuntu:
Download the "ubuntu-install" .zip to your internal or external SDCard.
Download the "mf3-freedreno-ubuntu-boot" .zip to your internal or external SDCard.
Install the "ubuntu-install" and "mf3-freedreno-ubuntu-boot" .zip files, followed by loki-doki.zip if you need that for your device (e.g. I337).
Restart and let it start into Ubuntu!
NOTE: The username is "ubuntu" and the password is also "ubuntu" - it is highly recommended that you change this ASAP.
Click to expand...
Click to collapse
Known Issues/Bugs:
Below is the list of known issues that I can think of, from the top of my head. This will probably be updated later as everyone points stuff out. Some issues only apply to some of the methods, so the applicable methods are listed in parenthesis after each.
Sound has not been tested (freedreno/native)
3D graphics or OpenGL support has not been tested (all)
Some applications don't work in a headless environment (vnc)
Some applications don't like to run as root, such as chromium (freedreno) lightdm is working in companions-v3, so no need to login as root anymore
Onboard is not working (freedreno/native) fixed in companions-v3
sudo does not work (all) fixed in kernel-v4 for freedreno/native, but problem remains for (vnc) if you are not using a custom kernel
A few kernel Oops's (native)
Shutdown menu doesn't always work (freedreno/native) fixed partly in companions-v4 - proper locale settings seem to allow the shutdown menu to work once you are logged in
Performance issues due to VNC connection (vnc)
No 3G/WiFi/network connection that I'm aware of... (native)
No control over 3G/WiFi/network/bluetooth yet (all)
Xorg's normal touchscreen driver evdev causes segmentation faults (freedreno/native)
Working on a possibly trying to get fbdev to work natively without Freedreno for simplicity (freedreno/native)
Anything you'd normally expect from a phone does not exist (freedreno/native)
Screen rotation (with or without accelerometer) doesn't work yet (freedreno/native)
HDMI/MHL output remains untested at this time. I got it to briefly work once, but I need to revisit this. (freedreno/native)
Many more to come, I'm sure...
Click to expand...
Click to collapse
To-Do:
Add mirrors to the download links.
Add a CWM/TWRP-flashable .zip that just dumps a clean Ubuntu install onto your data partition. This should be easy enough. completed!
Fix some of the bugs above.
Simplify the launch.sh and xorg.conf files. The u.sh script seems pretty solid.
Develop a method that works with only fbdev. This method might eliminate the possibility of 3D acceleration, but should enable screen rotation and other nifty things.
Possibly look into getting kexec (or similar) to work on the Galaxy S4 to offer a dual-boot option. Low priority at the moment, because flashing a kernel back and forth is pretty easy stuff.
Get Ubuntu Touch to work. This would eliminate a lot of bugs. I mostly need to just buckle-down and build CM10.1 from source, and then slowly visit each step of the Ubuntu Touch boot process.... Ugh.
Rebuild Freedreno to try to get Mesa/Gallium3D working properly. I'm probably going to need a lot of help from Rob Clark on this one!
More to come...
Click to expand...
Click to collapse
Revision History:
[11-13] mf3-freedreno-companions-v2.zip - Updated launch.sh: added some error checking and fixed the Freedreno build process.
[11-15] mf3-freedreno-companions-v3.zip - Updated launch.sh to include onboard and English language. Removed florence and xvkbd. Removed .keyb script. Added sudo. Simplified upstart-dummy, and included new upstart-dummy.tar.gz. Prepped for new flashable .zip method.
[11-26] mf3-freedreno-companions-v4.zip - Updated launch.sh: included fix for onboard so that it should work anytime lightdm is launched, added some bits for sudo to work, and home button now kills lightdm (not just the Xsession); Updated u.sh: Added check for root, added notes about sudo and nosuid.
[11-26] mf3-freedreno-android-boot-v4.zip & mf3-freedreno-ubuntu-boot-v4.zip - Finally fixed sudo! See kernel mods sections for details.
[11-26] ubuntu-install-v4.zip - rebuilt with new companions.
Click to expand...
Click to collapse
Aou said:
Check out this app: SManager (Script Manager). It makes running the ubuntu.sh or u.sh a whole lot easier, plus you can send it into the background (vnc method only). Just remember to jump back into SManager later, use the Menu Key and open the console to be able to kill the ubuntu.sh. You can also add "bash" as an additional argument (freedreno method only). This seems to be an effective replacement for the Terminal Emulator. Don't forget to choose the "su" option to run either script as root.
Click to expand...
Click to collapse
I have literally spent hundreds of hours working on this project, and many more hours documenting it thoroughly - just so that I could share it with all of you. If you found this guide, custom kernel or scripts to be beneficial, please hit the THANKS button on this post.
This mostly works, but I think I may have made an error. I see it starting the sshd, but not VNC server. I can call vncserver, but when launching the vnc client app I just get stuck at "Establishing Handshake" until it times out. This differs from when I don't call vncserver, where I get immediately connection refused.
I'm going to redownload the image and start from scratch, but the image isn't very friendly when I'm trying to figure out how to rerun the initial configuration script...
On my S4 running OTA-MF3 with root, this didn't work for me until i used Busybox Installer from the market. Tried internal and external without it, neither worked. Only thing that looked like an error after that was
Code:
chown: cannot access '/external-sd/': no such file or directory
but this only showed the first time I ran it. Opened VNC connection just fine from my computer to the phone, and though there was slight graphics glitching (orange and red boxes on desktop) it worked just fine and they didn't interfere. Thanks for this!
Tsaukpaetra said:
This mostly works, but I think I may have made an error. I see it starting the sshd, but not VNC server. I can call vncserver, but when launching the vnc client app I just get stuck at "Establishing Handshake" until it times out. This differs from when I don't call vncserver, where I get immediately connection refused.
I'm going to redownload the image and start from scratch, but the image isn't very friendly when I'm trying to figure out how to rerun the initial configuration script...
Click to expand...
Click to collapse
It's not, I agree. I found that the easiest way to clear the configuration and start anew is to do the following from the "[email protected]" prompt (that is, within ubuntu):
Code:
rm /root/DONOTDELETE.txt
rm /root/cfg/linux.config
DeadlySin9 said:
On my S4 running OTA-MF3 with root, this didn't work for me until i used Busybox Installer from the market. Tried internal and external without it, neither worked. Only thing that looked like an error after that was
Code:
chown: cannot access '/external-sd/': no such file or directory
but this only showed the first time I ran it. Opened VNC connection just fine from my computer to the phone, and though there was slight graphics glitching (orange and red boxes on desktop) it worked just fine and they didn't interfere. Thanks for this!
Click to expand...
Click to collapse
Interesting. I looked through the image's init.sh, and found something that's relatively new (wasn't in beta):
Code:
# Fix for sdcard read/write permissions by Barry flanagan
chown ubuntu /external-sd/
As far as I can tell, that message is harmless. It's only included in the initial configuration, as it's in the section:
Code:
if [ ! -f /root/DONOTDELETE.txt ]
As for the need to download/install the BusyBox installer, that's not surprising at all. I've had so much trouble BusyBox ever since I switched to MF3. I might include this as an extra step in the OP - thank you.
You kidding right...does this really work? To cool, thanks Aou. Great work.
TheAxman said:
You kidding right...does this really work? To cool, thanks Aou. Great work.
Click to expand...
Click to collapse
Yessir, it does indeed work! The S4 handles it very nicely with the extra RAM & CPU it has to spare, so the only limiting factor is VNC. If someone could devise a way to get Ubuntu to draw directly on the screen from within that Chroot, that would be perfect. I don't think it's really possible by design, but this might be the closest we get to running native linux on the I337 until we see some unlocked bootloaders.
Thanks
Aou said:
Yessir, it does indeed work! The S4 handles it very nicely with the extra RAM & CPU it has to spare, so the only limiting factor is VNC. If someone could devise a way to get Ubuntu to draw directly on the screen from within that Chroot, that would be perfect. I don't think it's really possible by design, but this might be the closest we get to running native linux on the I337 until we see some unlocked bootloaders.
Thanks
Click to expand...
Click to collapse
In fact I am currently working on getting xorg to write to androids frame buffer which will mean no more vnc
Sent from my Nexus 4 using xda premium
zacthespack said:
In fact I am currently working on getting xorg to write to androids frame buffer which will mean no more vnc
Sent from my Nexus 4 using xda premium
Click to expand...
Click to collapse
You, sir, are the man. thank you so much for working on this! I threw $10 at you to help fund the skittles/cheetos/carrots/beer/pizza/whatever it takes to help you along.
Added a couple things to the OP. Looks like pure-stock roms will indeed need BusyBox installed, by some means or another. Also, found SManager, which makes executing the ubuntu.sh script much, much easier.
The second script that allows me to launch ubuntu, but the first that allows me to get a real X server on my vnc. Thank you so much !
PS: Why am I unable to install wine ?
"Package wine is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source"
This is working pretty good, slow though, do I have it setup right, or did I miss something?
TheAxman said:
This is working pretty good, slow though, do I have it setup right, or did I miss something?
Click to expand...
Click to collapse
I have found it to run a bit slow, and with regular crashing of GUI programs too. Is it just slow or unusable? You can always try closing other apps besides terminal and VNC, or try to VNC from a computer even.
tboss1995 said:
The second script that allows me to launch ubuntu, but the first that allows me to get a real X server on my vnc. Thank you so much !
PS: Why am I unable to install wine ?
"Package wine is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source"
Click to expand...
Click to collapse
Looks like you're not the only one. Check out this thread on the LinuxOnAndroid site:
http://forum.linuxonandroid.org/index.php?topic=268.0
TheAxman said:
This is working pretty good, slow though, do I have it setup right, or did I miss something?
Click to expand...
Click to collapse
DeadlySin9 said:
I have found it to run a bit slow, and with regular crashing of GUI programs too. Is it just slow or unusable? You can always try closing other apps besides terminal and VNC, or try to VNC from a computer even.
Click to expand...
Click to collapse
Most of the slowness comes from interacting with it via VNC, it would seem. Hard to compare to anything else, considering VNC is all we've got at the moment. I wonder if @zacthespack can shed some light on this. As he mentioned before, he's working on getting it to draw directly to the Android screen. I'm certainly not going to ask for any status updates, but I'm wondering if he can confirm that we'd see a speed increase without VNC...
EDIT: Also, as I use it more, I am noticing the app crashes too (such as Chromium). Could just be something in the 13.04 image, but also could be because we're running this all on ARM architecture.
Aou said:
Looks like you're not the only one. Check out this thread on the LinuxOnAndroid site:
http://forum.linuxonandroid.org/index.php?topic=268.0
Most of the slowness comes from interacting with it via VNC, it would seem. Hard to compare to anything else, considering VNC is all we've got at the moment. I wonder if @zacthespack can shed some light on this. As he mentioned before, he's working on getting it to draw directly to the Android screen. I'm certainly not going to ask for any status updates, but I'm wondering if he can confirm that we'd see a speed increase without VNC...
Click to expand...
Click to collapse
RE installing WINE, sure you can install the ARM verson but Wine is not a emulator (infact WINE stands for Wine Is Not a Emulator) so you can only run ARM compiled windows software.
Yest there is a good speed increase, as with VNC xorg writes to the vnc server and passes it to the vnc client to then render on the screen.
With the new method xorg just writes to Androids frame buffer, no inbetween man.
And it can get even faster once we have graphics accelerations although not all chip sets will get that.
zacthespack said:
RE installing WINE, sure you can install the ARM verson but Wine is not a emulator (infact WINE stands for Wine Is Not a Emulator) so you can only run ARM compiled windows software.
Click to expand...
Click to collapse
Good point, forgot about that. It's really just a big package of Windows dependencies, responding to API calls, etc. The software that Wine runs is still sending stuff to/from the processor directly, therefore it would have to be compiled for ARM.
I wonder what Windows8 programs are available that are compiled for ARM (because of the Microsoft Surface and all...).
Aou said:
Good point, forgot about that. It's really just a big package of Windows dependencies, responding to API calls, etc. The software that Wine runs is still sending stuff to/from the processor directly, therefore it would have to be compiled for ARM.
I wonder what Windows8 programs are available that are compiled for ARM (because of the Microsoft Surface and all...).
Click to expand...
Click to collapse
There's plenty or ARM software within the built in app store, but I'm not sure where they install to or how one would go about extracting them. I have it on desktop and it shows what processors it runs on. Can't wait for the straight to screen function though
Also, I'm going to see if a different image is more stable. Chromium was the most obvious crashing for me and others generally crashed.
DeadlySin9 said:
There's plenty or ARM software within the built in app store, but I'm not sure where they install to or how one would go about extracting them. I have it on desktop and it shows what processors it runs on. Can't wait for the straight to screen function though
Also, I'm going to see if a different image is more stable. Chromium was the most obvious crashing for me and others generally crashed.
Click to expand...
Click to collapse
I noticed that with 12.04, it doesn't seem to connect to Xorg or something, because when you use VNC, it only shows a grey screen with a cross cursor. Same for both "Lite" and "Full" packages. Haven't tried older (10.x) packages of Ubuntu.
The other Linux images should work just fine. Optionally, you can edit the ubuntu.sh script to be more appropriate, but it should theoretically work the same (unless the init.sh is located elsewhere inside the image...).
I tried the Ubuntu 10 image and the Debian image but ubuntu didn't run vnc (vncserver not found or something) and debian kept saying I didn't have permissions.
It appears chromium is incredibly unstable on this image, so I've uninstalled it.
I'm currently working on trying to get Minecraft to work, but ever since 1.6.2 and this new launcher, it's incredibly difficult to modify the client files and such. Something is going wrong with liblwjgl.so. I can get the launcher to work correctly, but when it goes to load the game, it can't find liblwjgl.so and says that it might be because of 32bit vs ARM. I did get lwjgl installed correctly, and pulled the ARM version of the .so and stuck it in [what I believe was] the right .jar file, but it still has the error.
I'll keep you all posted. If I can get this to work, and if zacthespack can get xorg to draw on the android screen, ... :good:
EDIT:
Found out that every time the launcher runs minecraft, it downloads several libraries and other crap to run the game, to keep itself current and to support multiple versions, yada, yada. Unfortunately, this means that it downloads https://s3.amazonaws.com/Minecraft..../2.9.0/lwjgl-platform-2.9.0-natives-linux.jar every time you click Play, and overwrites any custom one you might have (i.e. one with ARM libraries inside). I tried revoking write access to the file, but then the launcher aborts the launch because it can't overwrite the file.
Any suggestions?
EDIT #2:
Well, the easy solution was to modify the file, run the launcher, disconnect mobile data temporarily, and then launch the game ("couldn't connect to server .... have local copy of file .... assuming it's good...."). No more errors about that stupid library file. However, the game immediately crashes now with an error report. Investigating this now. PROGRESS!
Problem
I'm aware I may need to modify the script in order to accommodate my setup, but I figured I'd post here first before changing anything in case someone else had a similar problem and came up with the solution.
I followed all the instructions, except I want to boot from an external USB stick (mounted using StickMount).
I reviewed the script, dropped it on the root of the USB stick, and copied the unzipped image to a folder named ubuntu.
Here is the output when I run the script:
Making mount points and mounting to them...
mount: mounting /dev/loop20 on /data/local/ubmnt failed: Operation not supported
mount: mounting devpts on /data/local/ubmnt/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/ubmnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/ubmnt/sys failed: No such file or directory
Connecting to /sdcard...
mount: mounting /sdcard on /data/local/ubmnt/sdcard failed: No such file or directory
Putting in some settings...
net.ipv4.ip_forward = 1
/sdcard/usbStorage/sda1/ubuntu.sh[19]: can't create /data/local/ubmnt/etc/resolv.conf: No such file or directory
/sdcard/usbStorage/sda1/ubuntu.sh[20]: can't create /data/local/ubmnt/etc/resolv.conf: No such file or directory
/sdcard/usbStorage/sda1/ubuntu.sh[21]: can't create /data/local/ubmnt/etc/hosts: No such file or directory
ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
(You will see an error about wlan0 if your WiFi is disabled. Safe to ignore.)
----------------- OKAY, starting Ubuntu! -----------------
chroot: can't execute '/root/init.sh': No such file or directory
----------------- Ubuntu has exited! -----------------
Cleaning up - unmounting everything and removing what we made...
umount: can't forcibly umount /data/local/ubmnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/ubmnt/sys: No such file or directory
umount: can't forcibly umount /data/local/ubmnt/proc: No such file or directory
umount: can't forcibly umount /data/local/ubmnt/sdcard: No such file or directory
umount: can't forcibly umount /data/local/ubmnt: Invalid argument
Welcome back to your android.
Click to expand...
Click to collapse
I am running as root, BusyBox free has been installed. My terminal app has been granted root privileges. The path to the USB stick is sdcard/usbStorage/sda1.
Any help/guidance would be greatly appreciated! :fingers-crossed:

Categories

Resources