Related
Hi @all,
This is a unofficial ROM of gingerbread for use in LG-P500 mobile devices.
NO Support by LG and after flashing you can't connect with this ROM to the LG PC-Suite for updates. If you want update a original firmware, u have to flash
a original ROM deployed by LG.
Please, do not ask when i release a build. If a build is ready to test, i upload the ROM and you'll see a download link in THIS post.
For general questions, please look here
Current state of Gingerbread ROM by andy572 (Version 2.3.4 Codename Phoenix)
previous rom for download based on CM7 has been removed, i dont support the latest rom from now.
Latest Changes
* light text color bug fixed
* gallery3D app: pinch to zoom fixed
* gallery3D app: loading a bit slow - fixed
* kernel: wifi not working, kernel module is broken - fixed
* kernel: kernel doesnt support clear ram feature in settings - fixed
* expanded statusbar bugs fixed
* new lockscreen implemented
* modified gps.conf
* modified apns-conf.xml
* network provider search fixed
* contact import from sim card fixed
* crash in contacts app fixed (app was FC'ing when swipe over the tabs on the top)
Very known bugs:
- If no default ringtone is choosen in settings menu, android choose one for u and change this randomly
- FM Radio and USB-/WiFi theasering not working (maybe with 3rd party apps)
- strong pixelation/color banding issues in wallpapers and picture gallery app
- Airplane-, Vibrate modes and audio volume settings change gets not detected in expanded statusbar view toggles
- rom is only working with old baseband and clockwork mod recovery
INSTALL
1.) Install ClockwordMod Recovery, old AmonRA isnt supported anymore.
2.) Flash the ROM file
3.) If you're coming from any other than THIS rom, YOU NEED TO DO A COMPLETE WIPE before reboot!!!
Download
http://www.phoenix-android.com (Android 2.3.4 Phoenix)
Further information:
The new rom is based on CodeAurora's Android Gingerbread, CM7 and android open source code (2.3.4 and 2.3.5).
Many thanks to franco for the cool kernel tips and the funny after work days
Sources
CodeAurora
Phoenix-Android
Whats next coming?
* Electron Beam feature is causing black screen: FIXED (Feature permanent disabled)
* allow swipe in contacts/phone app on call log
* optimize webkit code
* modify music app
* modify and bugfix launcher app again
* modify and bugfix camera app
* modify and bugfix fm radio app
* fix bluetooth audio
Greets from Munich/Germany
Andy
ooh, nice to have someone interested of doing that!
It's nice to have some people interesting in developing a gingerbread custom rom for our optimus P500. I would help if i knew what you need. I don't know what you are talking about so... Sorry
Hi,
i'm talking about to bring up a gingerbread installtion to our mobile.
All what i have is a ready compiled android 2.3.1 without a kernel and without LG addons, there are (possibly) required to boot the phone to gingerbread.
i've tryed yesterday and today to boot with a mix from froyo, but this does not works - even if i disabled some hardware, the system needs some information from modules build by LG - it boots only when gingerbread is flashed over froyo without a complete wipe, nothing but the launcher is working
After a wipe, the system loops around while booting and bringe lot of permission errors in logcat.
Did you look in this thread : http://forum.xda-developers.com/showthread.php?t=901247 ?
There is a kernel and it could help you
Thank you dark-k, but i don't search a kernel but peoples they are interested to help building
i am not a dev but i know how linux works and i got a p500 so if u need help u can count with me buddy.
andy572 said:
All what i have is a ready compiled android 2.3.1 without a kernel and without LG addons, there are (possibly) required to boot the phone to gingerbread.
Click to expand...
Click to collapse
hi can you tell me how to i can compile a clean complete version of android without kernel?
thanks
How about this kernel? The dev says it's supposed to be compatible with any rom.
http://forum.xda-developers.com/showthread.php?t=866774&page=9
How to compile android 2.3.3:
1.) If you use a windows system, install VirtualBox 4.x and than Ubuntu 10.10 Desktop Edition as guest OS (its the smallest version and is enough for compilings)
Attention: Android compiling requires lot of free space.
My Ubuntu virtual harddrives size is 30GB, partitions are 10GB, 512MB (SWAP) and 19.5GB. During install, mount the 10GB partition on /, the 19.5GB partition on /home.
1.1) Prepare user
to have easier system access, we act as root - so set a new password to root and change the current user:
Code:
sudo passwd root
Enter the new password to root and change user:
Code:
su -
1.2) change the shell to bash
Ubuntu 10.10 has a symlink in /bin/sh - this links not to the bash which is required by android to compile:
Code:
rm /bin/sh && ln -s /bin/bash /bin/sh
2.) Install required compilers and software:
Code:
apt-get install build-essential automake autoconf binutils libncurses5-dev xorg-dev git-core gnupg flex bison gperf zlib1g-dev
3.) Prepare home directory
Code:
mkdir -p /home/android/bin
cd /home/android
3.) Install JAVA
- Download latest java-1.6 (it's required by gingerbread to build java apps) from Oracle site:
https://cds.sun.com/is-bin/[email protected]_Developer and select Linux (not Linux64!!!)
Copy file jdk-6u23-linux-i586.bin to /home/android and exec the file:
Code:
./jdk-6u23-linux-i586.bin
and type "yes" to accept the license.
After install, move the new directory to /usr/lib/jvm:
Code:
mkdir -p /usr/lib/jvm && mv jdk1.6.0_23 /usr/lib/jvm
rm -rf jdk1.6.0_23
4.) Adopt JVM and user's bin path to all users env:
Code:
echo 'export PATH=$PATH:/home/android/bin:/usr/lib/jvm/jdk1.6.0_23/bin' >> /etc/profile
echo 'export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_23' >> /etc/profile
echo 'export ANDROID_JAVA_HOME=$JAVA_HOME' >> /etc/profile
source /etc/profile
5.) Download Android 2.3.3
Code:
curl http://android.git.kernel.org/repo > bin/repo
chmod a+x bin/repo
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync
6.) Compiling Android 2.3.3
To build a final release on a 32bit machine, we must modify some files and use the target option "user" (default is "eng", which is only a debug build for the emulator).
Attention
following code must be run in root of your repo:
Code:
source build/envsetup.sh
lunch thunderg-user
make -j2
After a build time of 1-2 hours, we have in folder out/target/product/generic our images: system.img,ramdisk.img and userdata.img and in folder prebuild/linux-x86/toolchain our android arm-eabi to compile kernel and so on.
If any goes wrong, please post here - it's possible that i have forgot to post some...
awesome walkthrough
andy572 said:
How to compile android 2.3.1:
1.) If you use a windows system, install VirtualBox 4.x and than Ubuntu 10.10 Desktop Edition as guest OS (its the smallest version and is enough for compilings)
Attention: Android compiling requires lot of free space.
My Ubuntu virtual harddrives size is 30GB, partitions are 10GB, 512MB (SWAP) and 19.5GB. During install, mount the 10GB partition on /, the 19.5GB partition on /home.
1.1) Prepare user
to have easier system access, we act as root - so set a new password to root and change the current user:
Code:
sudo passwd root
Enter the new password to root and change user:
Code:
su -
1.2) change the shell to bash
Ubuntu 10.10 has a symlink in /bin/sh - this links not to the bash which is required by android to compile:
Code:
rm /bin/sh && ln -s /bin/bash /bin/sh
2.) Install required compilers and software:
Code:
apt-get install build-essential automake autoconf binutils libncurses5-dev xorg-dev git-core gnupg flex bison gperf zlib1g-dev
3.) Prepare home directory
Code:
mkdir -p /home/android/bin
cd /home/android
3.) Install JAVA
- Download latest java-1.6 (it's required by gingerbread to build java apps) from Oracle site:
https://cds.sun.com/is-bin/[email protected]_Developer and select Linux (not Linux64!!!)
Copy file jdk-6u23-linux-i586.bin to /home/android and exec the file:
Code:
./jdk-6u23-linux-i586.bin
and type "yes" to accept the license.
After install, move the new directory to /usr/lib/jvm:
Code:
mkdir -p /usr/lib/jvm && mv jdk1.6.0_23 /usr/lib/jvm
rm -rf jdk1.6.0_23
4.) Adopt JVM and user's bin path to all users env:
Code:
echo 'export PATH=$PATH:/home/android/bin:/usr/lib/jvm/jdk1.6.0_23/bin' >> /etc/profile
echo 'export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_23' >> /etc/profile
echo 'export ANDROID_JAVA_HOME=$JAVA_HOME' >> /etc/profile
source /etc/profile
5.) Download Android 2.3.1
Code:
curl http://android.git.kernel.org/repo > bin/repo
chmod a+x bin/repo
repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread
repo sync
6.) Compiling Android 2.3.1
To build a final release on a 32bit machine, we must modify some files and use the target option "user" (default is "eng", which is only a debug build for the emulator):
Code:
source build/envsetup.sh
$find . -name '*.mk' | xargs sed -i 's/-m64//g'
export TARGET_BUILD_VARIANT=user
lunch
make
After a build time of 3 hours, we have in folder out/target/product/generic our images: system.img,ramdisk.img and userdata.img and in folder prebuild/linux-x86/toolchain our android arm-eabi to compile kernel and so on.
If any goes wrong, please post here - it's possible that i have forgot to post some...
Click to expand...
Click to collapse
gonna start workin later tonight gonna upload it soon.
Problems ... problems ... more problems
Today, i've merged the LG P500 Froyo source with gingerbread to get the required LG libraries and bin's, but i get over and over compiler errors.
LG didn't provide the complete source to froyo, so many definitions in C-Header files are missig
I've fixed many of these errors, but the end result is a linker error because of missing libraries there are not provided in source code.
I'll try to compile a froyo to test out if this errors only comes with gingerbread.
...Where is my time ????
I have succesfully compile and boot CyanogenMod 7. But everything slow, 3d driver don't work (same as with Legend). Tried to use N1 driver but it crashes, seems it compiled as armv7.
mik_os said:
I have succesfully compile and boot CyanogenMod 7. But everything slow, 3d driver don't work (same as with Legend). Tried to use N1 driver but it crashes, seems it compiled as armv7.
Click to expand...
Click to collapse
Can you share with us??
MAybe we can help you to boost the system.
i didnt have much sleep last night alot of trouble gonna reinstall windows 7 then repack the img gonna post it later its 9:33 here in germany
Du sollst doch Nachts schlafen und nicht am PC sitzen *lol*
FROYO doesn't compile - same problem as to import LG FROYO sources to Gingerbread.
Error:
make: *** No rule to make target `out/target/product/generic/obj/STATIC_LIBRARIES/liblgdrmexpat_intermediates/liblgdrmexpat.a', needed by `out/target/product/generic/obj/SHARED_LIBRARIES/liblgdrmwbxml_intermediates/LINKED/liblgdrmwbxml.so'. Stop.
upd: wifi work
You can find sources at
Code:
https://github.com/mik9
BUT it's dirty (based on htc legend) and not full. I continue work.
Awesome job, you can count on me for any help you need, lol like tester or something
Sent from my LG-P500 using XDA App
ALL ABOUT ANDROID SOFTWARE DEVELOPMENT KIT\ANDROID VIRTUAL DEVICE(SDK\AVD)
What we are going to learn?
What is Android SDK?
Installing SDK
Creating and Managing AVDs
Configuring ADB on your Computer
Root your Android Emulator
Thats It!
Part 1 - What is Android SDK?
Android Software Development Kit (abbreviation Android SDK) is an application which allows users to run and manage Virtual Android Emulator.
The Android Software Development Kit (SDK) includes a comprehensive set of development tools. These include a debugger, libraries, a handset emulator based on QEMU, documentation, sample code, and tutorials. Currently supported development platforms include computers running Linux (any modern desktop Linux distribution), Mac OS X 10.5.8 or later, Windows XP or later. The officially supported integrated development environment (IDE) is Eclipse using the Android Development Tools (ADT) Plugin, though IntelliJ IDEA IDE (all editions) fully supports Android development out of the box, and NetBeans IDE also supports Android development via a plugin. Additionally, developers may use any text editor to edit Java and XML files, then use command line tools (Java Development Kit and Apache Ant are required) to create, build and debug Android applications as well as control attached Android devices (e.g., triggering a reboot, installing software package(s) remotely).
Enhancements to Android's SDK go hand in hand with the overall Android platform development. The SDK also supports older versions of the Android platform in case developers wish to target their applications at older devices. Development tools are downloadable components, so after one has downloaded the latest version and platform, older platforms and tools can also be downloaded for compatibility testing.
Android applications are packaged in .apk format and stored under /data/app folder on the Android OS (the folder is accessible only to the root user for security reasons). APK package contains .dex files (compiled byte code files called Dalvik executables), resource files, etc.
Source :- Wikipedia
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click to expand...
Click to collapse
Part 2 - Installing SDK and AVD Manager
Make sure you have JAVA Installed.....otherwise NOTHING will work...
WINDOWS
1. Download the SDK setup from here > http://developer.android.com/sdk/index.html
2. Install the SDK and choose a short directory to install (C:\....).
3. After you have installed your SDK, Open It and Check Mark the following package :- Tools
4. Wait for it to Download...It will take some time...Be patient...
Click to expand...
Click to collapse
MAC
Go here to get a guide on HOW TO INSTALL SDK ON MAC
Click to expand...
Click to collapse
Here is a video Guide too
Click to expand...
Click to collapse
LINUX
Go here to get a guide on HOW TO INSTALL SDK ON LINUX
Click to expand...
Click to collapse
Part 3 - Creating and Managing AVDs
1. Go to your android-sdk directory and start/run "SDK Manager.exe"
2. Select the platform that you want to download.
3. Click on "Install X Packages" where "X" is the no. of packages you have selected to download.
4. After downloading has finished which will take around 30 minutes on a descent speed internet select "Tools" from the Main Menu bar
at the top of the window and select Manage AVDs..........
5. A New window will open which is the AVD MANAGER.
6. In the Android Virtual Devices tab SELECT "New" to create a new AVD.
7. Enter the following things:
AVD NAME: Type the desired name that you want for your AVD
Device: Select the AVD resolution as per the device options
Target: Select the Android version you downloaded
CPU/ABI: Select Intel Atom (x86) for 32-bit and ARM (armeabi-v7) for 64-bit.
Keyboard: Check this box if you want to use your keyboard in the AVD
Skin: Check this box if you want to get the hardware buttons
Front Camera: Use this option if you have a webcam and want to use it in the AVD
Back Camera: Use this option if you have a webcam and want to use it in the AVD
Memory Options
RAM: Set this to 768 (maximum for Windows user) or 1024 (maximum for Ubuntu users
VM Heap: Set this to 100
Internel Storage: Set this to 4 and Select "GiB" from this drop down list from side by.
SD Card: Select "Size" and Enter 4 and Select "GiB" from this drop down list from side by.
Emulation Options
Snapshot: Just check mark this option. (Not really neccessary)
Use Host GPU: Check mark this option if you want to use the computers graphics.
*****NOTE: REMEMBER THESE TWO OPTIONS ("SNAPSHOT" and "USE HOST GPU") CANNOT BE USED SIMULTANEOUSLY. IT WILL GIVE YOU AN ERROR.*****
7. Now click OK and wait for few seconds. It will come up with a dialog box which will show you the details of the AVD you created and a message that your AVD has been created.
8. Running the AVD
Highlight the AVD you have created and click "Start..." on the left of the window.
and ENJOYYYY......
Click to expand...
Click to collapse
Part 4 - Configuring ADB on your Computer
Configuring ADB (Android Debug Bridge) on your Windows allows you to run adb from anywhere. Hence you always do not have to "cd" to the android-sdk directory.
1. Right click on "My Computer" and select "Properties".
2. Go to "Advanced system settings" and open "Environment Variables".
3. Now under System Variables, click "New"
and enter the following details:-
Variable name: Type in ADB.....
Variable Value: Type here the path of your ADB preceeded by a ";" (SEMI-COLON)
FOR EG: If the path to your ADB is (by default) "C:\Program Files\Android\android-sdk\platform-tools\adb.exe"
THEN YOUR variable path would be :" ;C:\Program Files\Android\android-sdk\platform-tools\adb.exe "
AND CLICK "OK".....
4. After having done with this Search for "Path" in System Variables.
5. Double click on it to edit "Variable Value" and add these lines at the end of it:-
;<PATH_TO_YOUR_ADB> where "<PATH_TO_YOUR_ADB>" is the directory where your ADB is located.
6. Save all these changes by clicking "OK".... and you are done .........
NOW YOU CAN TYPE "adb" ANYWHERE IN CMD AND IT WILL RECOGNIZE IT AS A PROGRAM....
Click to expand...
Click to collapse
Part 5 - Root Your Android Emulator
Want to get more fun on your Android Emulator.....
GET IT ROOTED....
NOTE: YOU MUST HAVE ADB CONFIGURED....... I HAVE TESTED THIS ROOTING METHOD ON API LEVEL 16 ( JELLY BEAN 4.1.2) AND IT WORKS ABSOLUTELY FINE NOT SURE ABOUT OTHERS.....
1. Download the ROOT package from here.
2. Extract the package to somewhere like desktop.
3. Browse to your android-sdk/tools directory and Hold Shift and then right click to get an Advanced Menu. Click on "Open Command Window Here" and type the following command:-
Code:
emulator -avd <YOUR_AVD_NAME> -partition-size 512
NOTE:- DO NOT CLOSE THE COMMAND PROMPT WINDOW OTHERWISE THE EMULATOR WILL CLOSE
4. Now go to Desktop and again hold Shift and right click and Select "Open Command Window Here" and type the following commands one by one:-
Code:
adb connect 127.0.0.1:5554
adb root
adb remount
adb push Superuser.apk /system/app/
adb push su /system/bin/su
adb push su /system/sbin/su
adb push su /system/xbin/su
adb shell chmod 6755 /system/bin/su
adb shell chmod 6755 /system/sbin/su
adb shell chmod 6755 /system/xbin/su
adb kill-server
adb start-server
YOHO............... We are now rooted haha
Click to expand...
Click to collapse
Want to know anything more....Just post it here.....and I'll help you back....
Have I missed something....Please remind me....
Hi
Thanks for this, exactly what i was looking for.
But I find that after I have expanded the /system partition when i restart the AVD it starts with a 211M sized partition. unless i start it from the command line.
Is there any way to change the ini file or the avd manager to start it with 512M /system ?
Also the SU didn't work, I had to grab one of my working phone.. (there was a hex error code)
/system/bin/sh: /system/xbin/su: not executable: magic 7F45
actually spoke way to early no I find the /system partition doesn't save a cross reboots
last edit.
found http://www.ehalm.at/avd-4.3-gapps.php?l=en
has a pre built 4.3 system img with all the goodies installed
Hello and thanks for your OP.
Do you have the binaries for Intel? Intel emulators being way faster, I'd rather root an intel AVD than use ARM.
Also, is there a way to make SU survive reboots? It's very annoying to have to repeat those steps each time.
error: device not found
Thanks for this guide. Had me thinking of how to connect a AVD to adb since there is no USB to physically plug in.
I did try the loopback address, with the right port, but that is as far as I have got:
Code:
[email protected]:~/Build/android-sdk-linux/tools$ sudo adb connect 127.0.0.1:5554
[sudo] password for joel:
connected to 127.0.0.1:5554
[email protected]:~/Build/android-sdk-linux/tools$ sudo adb root
error: device not found
[email protected]:~/Build/android-sdk-linux/tools$ sudo adb devices
List of devices attached
[email protected]:~/Build/android-sdk-linux/tools$
Is there anything I am doing wrong? I know your guide (mostly) is for windows, but it would seem strange for me to emulate Android in an emulated Windows environment (running Debian GNU/Linux v7).
UPDATE: Figured it out, once I used the ./adb command in platform-tools.
Now tested up to downloading AOSP and make toolbox you should be all set
Please give thanks to this thread: https://forum.xda-developers.com/newreply.php?do=newreply&p=43622764
Warning: I hacked my way through this stuff a few weeks ago I am not an expert!
How to compile Android Open Source Code modules
I don't compile C code on Windows machines I have no idea about that.
Notice
This guide is a quick and dirty how to make a module. It will not cover finalizing setting up the source codes for your device. It is only my goal to enable you to compile binaries such as grep, toolbox, dumpstate, dalvikvm, jack and etc.
===>] Setup Ubuntu 64bit [<===Unplug that Windows drive, plug in a fresh hard drive and install Ubuntu latest/greatest. Ignore the recommendation to downgrade gnu make!, for now.
Open a terminal and issue these commands (warning ppa repository for OpenJDK 7 is said to have a security issue?, isn't being updated?.. whatevs it works)
Code:
sudo apt-get update
sudo apt-get upgrade
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get install openjdk-7-jdk
sudo apt-get install openjdk-8-jdk
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng
(choose Java 1.7 in the following way)
Code:
sudo update-alternatives --config java
(let me know if I missed anything please)
"Tried the Android SDK only it is missing too many things we need as a developer"
===>] Setup Android Studio SDK & NDK [<===Installation Paths:
*** I install to /home/username/Android and /home/username/Android/Sdk and /home/username/Android/Sdk/ndk-bundle ***
NOTE: from here forward username will == droidvoider
Note: Android Studio IDE isn't necessary only the SDK & NDK are needed to compile AOSP.
Install Android Studio Proper: (don't worry about setting up paths we will cover that, just install it)
https://developer.android.com/studio/install.html
or
SDK Only:
Typically we install these things manually by creating the directory then just unzipping the files there.
https://developer.android.com/studio/index.html#linux-bundle (scroll down for sdk only)
Code:
mkdir /home/droidvoider/Android
mkdir /home/droidvoider/Android/Sdk
(then unzip the sdk zip to that directory. I recommend the file explorer copy/paste right click uncompress and done.)
https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
Install NDK through the SDK Manger:
(from terminal 'studio.sh' and then configure, and then sdk manger --- if this is hard to figure out tell me I will elaborate)
or
Manually Install Native Development Kit -- 'c programming support'
Download the Native Development Kit from Google: https://developer.android.com/ndk/downloads/index.html
Code:
mkdir /home/droidvoider/Android/Sdk/ndk-bundle
Then just unzip the ndk files into the directory we created above.
===>] Setup your toolchain [<===** This example is arm64-v8a aarch64 **
1. Navigate to /home/droidvoider/Android/Sdk/ndk-bundle/build/tools and then open a terminal "right click open area"
2. mkdir /home/droidvoider/toolchains
3. ./make_standalone_toolchain.py --arch arm64 --api 23 --stl=libc++ --install-dir /home/mm/toolchains/aarch64-linux-android-4.9
4. cd /home/droidvoider
5. gedit .bashrc and morph this in at the bottom.. (AND edit or replace the existing PATH variable)
DON'T just PASTE IN *my* $PATH export!! I included my entire path statements to show you.
Code:
export PATH=$PATH:/usr/local/android-studio/bin:/home/droidvoider/Android/Sdk/platform-tools:/home/droidvoider/Android/Sdk/ndk-bundle:/home/droidvoider/Android/Sdk/tools
I feel this is human readable, for example change Android_Build_Out to be on your desktop instead if you want.
Code:
export PATH=$PATH:/home/droidvoider/toolchains/aarch64-linux-android-4.9
export NDK=/home/droidvoider/Android/Sdk/ndk-bundle
export SYSROOT=$NDK/platforms/android-23/arch-arm64
export TARGET=aarch64-linux-android
export HOST=$TARGET
export BUILD=x86_64-linux
export ANDROID_NDK_BIN=/home/droidvoider/toolchains/aarch64-linux-android-4.9/bin
export CC=$ANDROID_NDK_BIN/aarch64-linux-android-gcc-4.9
export CPP=$ANDROID_NDK_BIN/aarch64-linux-android-g++
export AR=$ANDROID_NDK_BIN/aarch64-linux-android-ar
export OUT_DIR_COMMON_BASE=/home/droidvoider/Android_Build_Out
Note: You might want to setup an alternate toolchain also but this is all of the puzzle pieces.
===>] Google's version of this How To -- Just for reference [<===https://source.android.com/source/requirements.html
https://source.android.com/source/initializing.html
===>] Install the repo tool [<===https://source.android.com/source/downloading.html
(don't type repo init or repo sync --- I will be taking back over from there on the next page)
Added Repair Notes -- Not part of the install!
Have you accidentally installed or removed something you shouldn't have? (welcome to development, here try this before reinstall)
sudo apt-get clean
sudo apt-get update
sudo apt-get install -f
sudo dpkg -a --configure
sudo apt-get dist-upgrade
sudo apt-get install -f
sudo dpkg -a --configure
Selecting the correct AOSP branch and downloading it.
Tested up to downloading AOSP and make toolbox -- you should be all set
===>] Match your build number to it's AOSP sources [<===preface: You can get this from your device if you're on the same build id as your the available source code from your vendor for your device. Otherwise you need to open the AP file from the firmware that matches those available sources to extract the system.img, to extract build.prop. I explain how to open a system.img file below under retrieving your hardware drivers. build.prop is in the main directory of system.img
(Many times the build number is the same. For me I believe all of MM builds are using this number.)
Assumes sources match current device, worked out true in my case
1. Plug in your device and get it connected. (DEVELOPER OPTIONS|USB DEBUGGING) and select allow on device
2. Retrieve the build number that matches the available sources for your device.
From your ubuntu terminal retrieve the build id using this command:
Code:
adb shell getprop | grep 'ro.build.id'
Yields something similar to this: [ro.build.id]: [MMB29K]
3. Match it up to the Nexus build numbers (This info is for AT&T Note 5 Marshmallow MMB29K, get your specific build number!)
https://source.android.com/source/build-numbers.html#source-code-tags-and-builds
MMB29K android-6.0.1_r1 Marshmallow Nexus 5, Nexus 5X, Nexus 6, Nexus 7 (flo/deb), Nexus 9 (volantis/volantisg)
===>] Bring down a specific AOSP source branch [<===
4. Make a directory for the source code.
Code:
mkdir /home/droidvoider/Desktop/AOSP_Android_6.01_r1
5.
Code:
cd /home/droidvoider/Desktop/AOSP_Android_6.01_r1
6. Bring down the sources, this one is approximately 13 gigabytes
Code:
repo init --depth=1 -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r1
repo sync
===>] I'm not sure the rest of this is needed [<===For compiling toolbox the remainder wasn't needed.. But I have a large list of things to do so I can't test each item. If you can't compile a specific module continue reading.
===>] Merge Vendor sources & AOSP sources [<===
7. Download the available sources for your device. In this example I downloaded PE6 Marshmallow sources for AT&T Note 5:
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=SM-N920A
8. Read the readme file from the sources platform zip to understand how to merge them into the AOSP sources. For the 2 Samsungs I've worked with the idea is to replace any directory that already exists. But if there is just one file such as core.mk only replace the one file. Then edit the .mk files as described in your readme. (and/or take info from cyanogen/lineagos) -- <I can help more, ask>
note: you probably don't need to take the configs from LineageOS and put them into your .mk files. However, if you do need to get more configs then you should get a big fat message when you type make 'modulename'. At first only edit .mk files as described by vendor device source readme file.
===>] Merge in Hardware drivers and etc [<===possibly unnecessary depends what you're doing
9. Obtain a copy of the firmware for your device that matches the version of the source code you are able to download from your vendor.
for me that was Build Number: MMB29K.N920AUCU2BPE6 but your mileage will almost certainly vary!
10. Download https://github.com/anestisb/android-simg2img
11. Unzip it right in your download folder, open the folder and then 'open in terminal'
12. Make it and then move it a directory in your path. Warning: My command puts in in the Ubuntu default /bin folder.
Code:
make
sudo mv append2simg img2simg simg2img simg2simg simg_dump.py /bin
13. Uncompress the AP file from the matching firmware and extract the system.img into it's own directory
then select that folder, right click, open in terminal
Code:
simg2img system.img sys.raw
mkdir sys
sudo mount -t ext4 -o loop sys.raw sys/
14. A drive mounted, look on your task bar it should've wiggled too. Copy the etc and vendor folders into the main folder of the sources we are merging
===>] Listing and building modules [<===Navigate to the folder where you download the sources "/home/droidvoider/Desktop/AOSP_Android_6.01_r1" and open in terminal.
Code:
make modules -- list the available modules
make <module name> -- builds a specific module
example: make dumpstate
description: Will build everything needed for dumpstate and place it in the folder we specified in our export (above step). The final build line will read install and detail the final output folder
Example successful output:
[CODE]
Install: /home/droidvoider/Android_Build_Out/Android_6.01_r1/target/product/generic/system/bin/dumpstate
===>] Android Build System, basic intro [<===Notice: I built this how to to answer the same question from 3 people regarding working with toolbox and the dirtycow exploit. So I decided to give a direct example of using toolbox.c from farm-root
#ifdef
Our makefile is Android.mk and that's where we link things together. If you look at the Android.mk file for farm-root you will notice bridge.c is used 3 different times called different 'module' names. bridge_pull, bridge_push, bridge_pull_boot. Each of these will be binaries of those names.
Inside bridge.c you will see #ifdef FARM_PULL and then you will see #else and further you will see #endif which you may have noticed matches inside the Android.mk file for the bridge modules -DFARM_PULL -DFARM_BOOT <== Notice the double define on bridge_pull_boot
toolbox.c
toolbox.c is going to be the same way. You will need to copy shared.h and shared.c into the directory where toolbox.c resides. Then edit the Android.mk, in our example:
1. Navigate to this directory and open: system/core/toolbox/Android.mk
2. CTRL + F and search for "LOCAL_MODULE := toolbox"
3. Add: LOCAL_CFLAGS += -DFARM_PULL -DFARM_BOOT (in this example add one, both or even new ones you created)
4. Navigate to the main directory of the sources, you should see a Makefile and a build_64bit.sh
5. from terminal: make toolbox
Note: I think from here you can Google it out in a few minutes if that is not the case please let me know.
Working with C cross platformUbuntu is Linux based just like Android and this makes testing blocks of code extremely easy. You of course can't use Android headers and in some rare cases you can't test the code on Ubuntu at all but in most cases you can. When I want to design something for Android I open gedit and save it as a .c file. Then I compile it using gcc -o mycode mycode.c There's plenty of examples on using gcc with linux but just understand you can do it all. Then before too much work test it on Android. (helpful commands at end of post)
My advice really is to build out your small blocks of code on your linux box but then paste them into your Android program folder, edit your Android.mk, add it to your Makefile including your 'push' section so that you can simply type make push to test it.
I am in fact trying to encourage you to learn C and not so much trying to encourage you to hack things. But I know that interest/passion is what teaches, not my words and not someone else's curriculum. So in that spirit I will do my best to give examples to help you with 'whatever' it is you are passionate about. Let me know what's missing.
Don't forget to compile for Android first
Before you can test your code you will have compiled it using the cross compiler for Android. ndk-build, or the correct gcc cross compiler. (Personally I put the .c file into a directory with Android.mk and a Makefile then just type make to build it to Android)
see examples section I will add a couple examples.
Android Developer Bridge -- a developers tool
adb is included with the Android SDK along with some other tools. Some of those tools are fastboot for unlocking bootloaders and another way of flashing. There is monitor which is a cool tool for remotely viewing processes, logcat, memory dumps and etc.
But pointedly what we will use the most is simply adb.
Using adb to test your code on locked down Android systems
Shell has fairly high privileges, you may not be aware but you can execute binaries and bash scripts. We use /data/local/tmp/ for these things. You can create a directory, add or remove files, execute your binaries and even execute shell scripts using sh script.sh
ndk-build places the binary in libs/(arch type) .. For a quick test you can just open a terminal in that directory then:
Code:
adb push mybinary /data/local/tmp/
adb shell
cd data/local/tmp
chmod 777 mybinary
./mybinary
Added:
Examples of basic make files for Android.
happy coding
If you get an errorPlease reissue the command but pipe the output to a file.
make toolbox > /home/droidvoider/Desktop/build_toolbox-output.txt
zip that up with your source code, including your customized header files and attach it to this thread.
puzzles are fun but I like all the pieces
droidvoider said:
Tested up to downloading AOSP and make toolbox -- you should be all set
===>] Match your build number to it's AOSP sources [<===preface: You can get this from your device if you're on the same build id as your the available source code from your vendor for your device. Otherwise you need to open the AP file from the firmware that matches those available sources to extract the system.img, to extract build.prop. I explain how to open a system.img file below under retrieving your hardware drivers. build.prop is in the main directory of system.img
(Many times the build number is the same. For me I believe all of MM builds are using this number.)
Assumes sources match current device, worked out true in my case
1. Plug in your device and get it connected. (DEVELOPER OPTIONS|USB DEBUGGING) and select allow on device
2. Retrieve the build number that matches the available sources for your device.
From your ubuntu terminal retrieve the build id using this command:
Code:
adb shell getprop | grep 'ro.build.id'
Yields something similar to this: [ro.build.id]: [MMB29K]
3. Match it up to the Nexus build numbers (This info is for AT&T Note 5 Marshmallow MMB29K, get your specific build number!)
https://source.android.com/source/build-numbers.html#source-code-tags-and-builds
MMB29K android-6.0.1_r1 Marshmallow Nexus 5, Nexus 5X, Nexus 6, Nexus 7 (flo/deb), Nexus 9 (volantis/volantisg)
===>] Bring down a specific AOSP source branch [<===
4. Make a directory for the source code.
Code:
mkdir /home/droidvoider/Desktop/AOSP_Android_6.01_r1
5.
Code:
cd /home/droidvoider/Desktop/AOSP_Android_6.01_r1
6. Bring down the sources, this one is approximately 13 gigabytes
Code:
repo init --depth=1 -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r1
repo sync
===>] I'm not sure the rest of this is needed [<===For compiling toolbox the remainder wasn't needed.. But I have a large list of things to do so I can't test each item. If you can't compile a specific module continue reading.
===>] Merge Vendor sources & AOSP sources [<===
7. Download the available sources for your device. In this example I downloaded PE6 Marshmallow sources for AT&T Note 5:
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=SM-N920A
8. Read the readme file from the sources platform zip to understand how to merge them into the AOSP sources. For the 2 Samsungs I've worked with the idea is to replace any directory that already exists. But if there is just one file such as core.mk only replace the one file. Then edit the .mk files as described in your readme. (and/or take info from cyanogen/lineagos) -- <I can help more, ask>
note: you probably don't need to take the configs from LineageOS and put them into your .mk files. However, if you do need to get more configs then you should get a big fat message when you type make 'modulename'. At first only edit .mk files as described by vendor device source readme file.
===>] Merge in Hardware drivers and etc [<===possibly unnecessary depends what you're doing
9. Obtain a copy of the firmware for your device that matches the version of the source code you are able to download from your vendor.
for me that was Build Number: MMB29K.N920AUCU2BPE6 but your mileage will almost certainly vary!
10. Download https://github.com/anestisb/android-simg2img
11. Unzip it right in your download folder, open the folder and then 'open in terminal'
12. Make it and then move it a directory in your path. Warning: My command puts in in the Ubuntu default /bin folder.
Code:
make
sudo mv append2simg img2simg simg2img simg2simg simg_dump.py /bin
13. Uncompress the AP file from the matching firmware and extract the system.img into it's own directory
then select that folder, right click, open in terminal
Code:
simg2img system.img sys.raw
mkdir sys
sudo mount -t ext4 -o loop sys.raw sys/
14. A drive mounted, look on your task bar it should've wiggled too. Copy the etc and vendor folders into the main folder of the sources we are merging
Click to expand...
Click to collapse
And where is exactly the main folder? Sorry, Im just confused
DigitalDoraemon said:
And where is exactly the main folder? Sorry, Im just confused
Click to expand...
Click to collapse
it's no problem this stuff isn't easy to just figure out on your own. remember to substitute droidvoider for your ubuntu user name
In this example my sources are on my desktop in a folder named Android_6.01_r1
Sources for toolbox for example:
/home/droidvoider/Desktop/Android_6.01_r1/system/core/toolbox/<sources will be here including Android.mk>
Script for modules, including toolbox
/home/droidvoider/Desktop/Android_6.01_r1/Makefile <--- this is our modules script, if you will
<open a terminal in the above folder then use that Makefile like so>
make toolbox <---- this will compile only what is needed to compile the module 'toolbox' (this takes a minute)
Out export folder we decided in ./home/droidvoider/bashrc
/home/droidvoider/Android_Build_Out/Android_6.01_r1/target/product/generic/system/bin
Anybody, please compile grep utility for arm and x86... Minimum Platform Version Android 4.0.3, API Level - 15
Thanks
Great & useful .
I was trying to add a shortcut for running applications by command but didn't found the correct syntax here, after some digging (and luck), I decided to share it :
(must run with system privileges)
For MM :
Code:
am start -n com.android.settings/com.android.settings.SubSettings -e :settings:show_fragment com.android.settings.applications.RunningServices
ps : kitkat was using android instead of settings and ProcessStatsUi instead of RunningServices :
Code:
am start -n com.android.settings/com.android.settings.SubSettings -e :[COLOR="Red"][B]android[/B][/COLOR]:show_fragment com.android.settings.applications.[COLOR="Red"][B]ProcessStatsUi[/B][/COLOR]
ps2 : lollipop users were having force closes with kitkat command so I assume it's working with MM one, but test it to be sure.
See this page for a list of extras (android 6.0.1) (some requires additionnal argument thus will force close settings app if used alone)
I don't have nougat so it could be different again (navigate to the appropriate section and test)
I am trying to connect a gdb session to my avd device.
I created an avd for pixel 3 hardware running Android 7.1.1 armeabi-v7a.
My concern is that I am not able to connect a gdb session to it.
I researched thoroughly but could not find the solution. The closest I came was this post (can't post the url being a new user) which tells to do the following :-
-> create an avd.
-> run the avd in the emulator with the -s flag which opens a gdbserver on TCP port 1234 and also specifies to use the goldfish kernel. [I want to use the same kernel which came with the system image]
-> Add the following line to .gdbinit file. (add-auto-load-safe-path <path>/goldfish/scripts/gdb/vmlinux-gdb.py) [I downloaded and compiled the goldfish kernel for arm target but do not find the vmlinux-gdb.py file].
Can somebody please advise how can I proceed.