I've got a spare Nexus 5, and I've decided to play along and try to build android for it. However, when I try to boot what I've built, it shows only the 'Google Logo and open padlock' splashscren, and does nothing more.
My steps in building the whole android os:
Kernel:
I download msm kernel from git, then I check out remotes/origin/android-msm-hammerhead-3.4-marshmallow-mr1 branch, then I build the kernel in following way:
export PATH=/home/netaro/Android/AndroidSourceCode/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/:$PATH
cd MSMKernel
export ARCH=arm
export CROSS_COMPILE=arm-linux-androideabi-
make clean
make hammerhead_defconfig
make CONFIG_NO_ERROR_ON_MISMATCH=y CONFIG_FRAME_WARN=0
Then, I copy arch/arm/boot/Image and arch/arm/boot/zImage-dtb to where android source code lives, to device/lge/hammerhead-kernel directory.
Then, I build android by doing following steps ->
. ./build/envsetup.sh
make clean
lunch 19
#tried selecting kernel by this variable, but changes nothing, won't boot
#export TARGET_PREBUILT_KERNEL=/home/netaro/Android/MSMKernel/arch/arm/boot/zImage-dtb
make updatepackage -j4
After it all builds, I unzip out/target/product/hammerhead/aosp-hammerhead...zip package, boot the phone to fastboot, and fastboot flash each element:
fastboot flash boot boot.img
fastboot flash system.img
fastboot flash cache cache.img
fastboot flash recovery recovery.img
fastboot flash userdata userfata.img
Then, I select Start in bootloader, and it stops on the 'Google with open padlock' screen... Android source code is synced to a marshmallow source code via repo sync (I don't remember the name right now).
So, what am I doing wrong? Is there something I'm missing?
Okay, seem solved. It seems like qcom-hammerhead-... binaries from google's "Binaries for Nexus Devices" site are required to make it work. Download qcom-hammerhead-... from there, unpack to where source code lives, and rebuild.
Related
Screen of death; my version
I have 4 problems with this screen
1.) I have absolutely downloaded all the requirements
2.) my phone is on developer mode and connected to my laptop but isn't being read
3.) I can't create emulators in android studio
4.) I have added the paths to my env variables...
I'm running on an aspire one of with 2gb Ram...
what do I do different with these same PC specs to get coding?
Well First Of All Enable USB Debugging In Your Phone And See if It Shows Your Device Now.
Now In You Your Command Line Run This
flutter doctor --android --licenses
It will automatically install all the required License And You Are Good to go
AS for CommandLine Tools error Navigate to SDK Folder in your Command by entering
cd "Path of your sdk"
and After That hit this line
"--install cmdline-tools;latest"
I repeat navigate to your sdk folder and then hit this command and you are good to go.
And personally I won't suggest you to install the emulator as you said your ram is of 2gb Then it will Lag alot better turn on usb Debugging and try it on your phone !!
I downloaded AOSP on Ubuntu, made changes and built it for x86_64 (lunch aosp_x86_64-eng).
The changes are in package android.media.
Can I test the changes on the emulator on Ubuntu? Do I need to build the emulator?
(I am not using Android Studio. I build AOSP and start the emulator on the command line.)
Option 1: the framework and push the jar
make framework
adb root
adb remount
adb sync
adb reboot
Option 2:
Full make and flash via fastboot
I downloaded a third-party ROM, and I want to run it on the emulator first before flash it into the phone. Here is the contents of cm-11-20140911-NIGHTLY-p3110.zip:
1. boot.img
2. file_contexts
3. META-INF/
4. recovery/
5. system/
I unpacked boot.img using the script unpack-bootimg.pl and get boot.img-kernel, and boot.img-ramdisk.cpio.gz. Then I repacked the system using the make_ext4fs and got system.img.
I created an AVD and execute:
emulator -system ~/cm11/system_new.img -ramdisk ~/cm11/boot.img-ramdisk.cpio.gz -kernel ~/cm11/boot.img-kernel -avd and442
but all I got is nothing, the emulator screen is just black. There is no log message from adb -s emulator-5554.
Now I am confused:
can the third-party ROM be tested by the emulator?
Am I doing the right way?
Yeah, why not.
We can flash a third-party ROM on Android AVD. But first you must know the following things:
1. The Android Emulator is itself a device, like your Moto G or Xperia
2. Every ROM is device-specific (supports a device-specific Kernel)
(on many sites/blogs you got information like you have to replace system.img file from .android\avd\avdname.avd, but it is technically incorrect, because you also require ramdisk.img.)
To do this, you need to create your own AOSP repository by downloading the particular repository and have to build your own .img files)
You can do it in two ways:
replace files system.img and ramdisk.img from location .android\avd\avdname.avd
Build your own AOSP. Before... make in "lunch" select target as: Emulator (like: genericX86), i.e., generate all emulator specific .img files
I have tried many things. It's a bit critical, but interesting. The following links may help you:
To run your cooked ROM on Emulator (link down. Try this, from archive.org).
To Create AOSP Project
I compiled source code referring to http://source.android.com/source/building-running.html and downloaded apt binaries for my Nexus 4g s .I did following after building:
fastboot flash recovery recovery.img
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot erase userdata
fastboot erase cache
Now, I cannot see anything on my phone. What could be wrong? Wasn't the source I built suitable for my device? But, I am pretty sure I have downloaded correct source code and binaries.
To rescue your device back, use fast boot to flash the factory image back.
To check why you have this issue, please check:
If you did not see ANYTHING after reboot, your boot.img (contains kernel) is not correct
If you just see the boot animation but it goes on forever, your system.img is not correct
You should:
Make sure you have download the correct source code and switch to the correct branch
Make sure you are using the correct build configuration by lunch and select correct product
The AOSP does not contains everything, you have to download or pull out from your old system to get the proprietary binaries.
I'm extending a custom Android kernel fork that originated as a 2.2
Froyo kernel. The build process itself is no problem; just type "make"
and its done. But I'm not sure of what I need to do to make the new
kernel known to other tools in the Android SDK; particularly
the emulator, adb, and the Eclipse debugger.
I've tried various things such as running the emulator with -system and
-userdata arguments on the command line, and these appear to work,
although I hit sporatic problems that leave me unsure. A common problem
I've seen is that sometimes apps "hang", displaying their UI but
refusing to go away even when the home or menu buttons are clicked. I've
tried turning off caching. But the real problem here is that I don't
have a good mental model of how kernel builds should be conveyed to
the SDK.
Should I be copying the build results (.img files) to
~/.android/ perhaps? Or to somewhere in the
SDK folder?
A working recipe would be nice, but better yet would be a
understanding of how the kernel build and SDK tools work together.
For example http://source.android.com/source/using-eclipse.html is
great for recipes but I still don't see how adb and emulator know
where to load .img files from.
When you've built android image the android webpage recommends to run it with emulator command. But you can run the built image in this way because android envsetup command has specified some paths before. For instance, to test my built image I run command:
out/host/linux-x86/bin/emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilt/android-arm/kernel/kernel-qemu -sdcard sdcard.img -skindir sdk/emulator/skins -skin WVGA800 -scale 0.7 -memory 512 -partition-size 1024
So as you can see I specify all the images and all the paths explicitly. This is command to run image in emulator. Out folder is created during the build in your android source root folder.
P.S. Kernel usually refers to Linux kernel of Android. In your case, I think you have changed Android framework.
I've composed a full answer based on the invaluable clues Yury provided. The solution was to add these settings to my .bashrc. The tools (emulator, adb, ddms) in eclipse use these settings to pick up stuff from ANDROID_TARGET_OUT instead of getting them from the prebuilt copies inside the SDK. The CACHE stuff is the standard recommendation.
# Android SDK Build settings
export ANDROID_HOME="/Volumes/DroidImg/android-sdk-macosx"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export ANDROID_SDK_BASE="$ANDROID_HOME"
export ANDROID_SDK_HOME="$ANDROID_HOME"
export ANDROID_TARGET_OUT="/Volumes/DroidImg/Droid-Kernel/out/target/product/generic"
export USE_CCACHE=1
export CCACHE_DIR="/Volumes/DroidImg/CCACHE_DIR"
ulimit -S -n 1024
Finally, copy the .classpath provided with the SDK as documented on the wiki into the root of the kernel distribution, and "import existing files" into Eclipse. All Java components should now open and build properly in the package explorer. Very handy for exploring but don't forget you have to use ordinary make to build this stuff for real.
/Volumes/DroidImg is a case-preserving disk image I made for MAC-OS work; change this part of the path to suit.