To keep everything short (I had a lot of problems from the build last time, and this is just what I’ve found thus far), to sum.
- You need 64 bit version of Linux, and not 32 bit.
- Virtual machines require a BIOS setting to run 64 bit (Part of number 1).
- On a virtual machine, memory is limited. Therefore, it won’t build correctly all the time.
- Mint vs Ubuntu? Which to use?
- What do I do when it’s all downloaded and built?
- envsetup.sh, important, but when?
- I have it downloaded, I can see the img files, but it still complains when I do this.
64 bit != 32 bit
I received the following error:
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: cannot execute binary file
So basically, you need to use 64 bit for Jelly Bean. And also, from what I’ve read (Not a lot, so not positive on this), also Ice Cream requires 64 bit to build also.
Virtual with 64 bit
VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot. Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.
Note, I do use Virtual Box, and this was a simple solution (Even though it requires a computer restart, which those who know me know I hate restarting my computer). Basically go in to BIOS, go to advanced, and enable the Virtualization.
-j4 Is Okay, Not Too Much
So, I was under the impression that the number you put after the 4 didn’t mean much. However, I was wrong; wrong wrong wrong. So basically, when I tried to build/make from source with -j4, it would conflict, or otherwise, not build a system.img (It did do the ramdisk.img and userdata.img). So, I read a bit online, and it seemed that not many people had this problem. I did however see someone mention that one of the errors that I came across often (When I built, I would do:
make -j# 2> ERROR_LOG.txt
so I’d get all my errors that occured and I can check on it later on rather than trying to catch glimpses in the hundred thousand lines or so) was caused by not having enough RAM. More significantly, someone wasn’t able to successfully build Android with -j4 on a machine with two gigs of RAM. Surprise surprise, I gave my virtual two gigs of RAM. So I changed this to -j1, and it finished, and from here, I saw that my img files were created.
Mint or Ubuntu
This isn’t about what’s better. As you might have read previously, I decided to use Mint. Why? It’s less bloated, it has more dependencies at the start (I understand this is a bit contradictory as bloated == more dependencies, but just ignore this flaw), and in my opinion, works better. However, after reading a lot of posts, everyone built the source using Ubuntu, so I decided to deal with the Unity bar and everything else that’s not needed, and use it. The reason I mention this, it could have been a factor in why it wasn’t working.
So now the source was good, I have my .img’s, and everything is going all well and dandy. Hard to actually find much on what to do once you’re done, and a likely reason, if we look at the pages, we see three lines on starting the emulator, of which, only one word in those lines is what you really need, emulator.
I start up my emulator (But I can’t, look at next section for that), and I get an error, surprise.
emulator: ERROR: You did not specify a virtual device name, and the system directory could not be found. If you are an Android SDK user, please use '@<name>' or '-avd <name>' to start a given virtual device (see -help-avd for details). Otherwise, follow the instructions in -help-disk-images to start the emulator
So, can’t be that easy. I look around, and see that I need to specify the .img files. So I try it:
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
And my kernel doesn’t work, it’s not there, doesn’t exist. So I decide to build it separately, but first…
So, I feel this file is a bit misunderstood. In that, I run it at the begining of the build, then I do the make, and all good. I then do ./emulator, doesn’t work. Doesn’t exist. Then I have to rerun the envsetup line:
Now it works, good. So remember, do this before and after! Also, a possible problem. If you have the SDK downloaded and set up, when doing ./emulator, it could be running the SDK, and NOT the built version. I didn't have this problem, but thought of it while working.
Still Complaining – Kernel Panic
So, finally, the kernel. It won’t work. I don’t know why. I just want to do my weekly posts. Also, I have some ideas:
- Build it seprately
- Try a pre-made kernel
- Build Generic
- Build Goldfish
- Re-make whole thing from scratch using -j1
And Alas I Am Done
So that’s it for now. Outside of this project, I’ve gotten some done with my other project. I’ll hopefully have something to show for it in two weeks. Going to be a busy weekend, so might not be able to work on my side projects too much.