Up and Running


1. Easier then I thought.

2. Personal Updates


As of now, this was not difficult at all.  Booting up and finished boot.  To be honest, this wasn’t difficult. I’m not saying there were not problems, because as always, there were.  But it went smooth.  As in…  I did it in about two hours Monday.

So some tips for future/others.

Most important command:

make mrproper

Now, this lil’ bit of command cleans up your mistakes.  You will make mistakes.  Luckily, this command also takes about 10 seconds to run.  So no big deal.  This saved me countless of times and lots of time.  I am pretty thorough with my work, so I like to make sure everything is at least some-what back to the start/normalized.  I don’t like having a chance that what I did won’t be reproducible because one file was where it wasn’t normally because of a previous mistake.  So I highly recommend and love this snippet of a command.

Beyond that, I found it most difficult of what commands to run.  Going off memory, I believe it was along the lines of:

ARCH=arm SUBARCH=arm CROSS_COMPILE=arm-eabi make goldfish_defconfig

This allows you to set the variables temporarily, makes the config file, then you can run a normal “make”.
That’s really all you need to do after you download the goldfish kernel and you’re golden ;).
Personal Changes

So, my own development machine has changed a lot.  Previously, I had a rule about not working on my own machine, but downloading the Android source takes about 12 hours, building takes more hours, and the kernel takes about as long, so I’d be lucky if someone didn’t turn off the computer in a local lab while this went on.  So that rule, for the time being, is scrapped.  But I’ve also noticed, everyone uses Linux.  I have nothing against Linux, I think it’s great, and to be honest (After using it for a weekend), I’ll be happy about it (Besides the no Spotify support, that irks me, and no, Wine does not count as I get pop up overlays and those are annoying too).  But I don’t mean everyone uses Linux as in, everyone should use it, or that if you don’t use it, it’s bad.  I just mean, every documentation is built off the idea that the end user is using Linux.  Further, if you have a problem?  Guess what, their is a solution.  I remember back in middle school when I first installed Linux, finding solutions was…  awkward.  Every solution wasn’t much of a solution as it was an idea towards a possible solution, which combined with me being about thirteen (Is that middle school?), heck if I could put two and two together in a terminal, I didn’t even know about man pages!

So, no more tangent, I now am running Linux.  Ubuntu 12 (I don’t like it, but again, many projects are geared towards Ubuntu, also lots of support) is now my primary OS, but I still have Windows 7 for now, in case I need to recover something.  I’ll give a list of my favorite command line and other utilities on Ubuntu, but I already have several that keep me sane.

Also, I’m an Emacs user.  I do use Eclipse for personal projects, but for most of my programming, I’ll be trying to use Emacs.  How bad it has gotten?  I’ve done the cut/paste command in a web browser…  Ctrl – W is close tab for most browsers, so that got old fast.  This was a goal of mine sense school started though, and as of now, I love Emacs, and I know I don’t even know half of it.

Back to programming though!  I have built and got Jelly Bean working on this new machine all in one swoop.  No problems.  Same goes with the Goldfish kernel, also, no problem.  Further, I’m trying to pick up Open Source.  I’ll give another update of that when I actually complete something though.

I’ll be meeting with Dr. Mateti to discuss what to do next tomorrow.  Until then… Yeah!


Hold It – Problems

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.

  1. You need 64 bit version of Linux, and not 32 bit.
  2. Virtual machines require a BIOS setting to run 64 bit (Part of number 1).
  3. On a virtual machine, memory is limited.  Therefore, it won’t build correctly all the time.
  4. Mint vs Ubuntu? Which to use?
  5. What do I do when it’s all downloaded and built?
  6. envsetup.sh, important, but when?
  7. 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

My error:

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.

Now What?

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:

source build/envsetup.sh

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:

  1. Build it seprately
  2. Try a pre-made kernel
  3. Build Generic
  4. Build Goldfish
  5. 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.

Downloading and Building Jelly Bean

Obviously the first step to my assignment was to download and build Jelly Bean.


1.  Permissions on certain machines.

2. Which lead to a problem with Java 1.7 is installed, and you need 1.6 in order to build and run the make.

3.  The time it takes for everything to download is slow.  I mean, it took 10+ hours and multiple repo sync’s.

Permissions on Machines

Obviously the school wouldn’t give me admin rights on the computers, however, I just needed to run (I believe) only one command and I could have finished up the make process on their machines.  The problem is, I couldn’t actually run “sudo update-alternatives –config java” to change from 1.7 to 1.6 (More on that later).  Further, a lot of what I did do up until the actual download (That went surprisingly smoothly on the machine in the lab) seemed a bit backwards because I had to find workarounds between security setings.  By the end after about three hours, I gave up on figuring out the Java problem and decided I’d try it all on a virtual the next day and see if I could get it to work on my own machine.

I ended up using Linux Mint as it’s based on Ubuntu, has more of the programs needed (Except for I found two specifically [bison and flex] and decided to just run their Ubuntu 12.04 lines:

sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386

This worked perfectly fine on my virtual, even without the following linker line, I assume that the machine already had libgl set up, so no biggy.

Anyways, after this (And as I type this out), the build is running with the make.  This brings a smaller problem, as to what number to put after the j in the “make -j#” command.  I personally used 4 as it’s on a virtual and I didn’t want to really slow down my computer.  But regardless, it’s building right now, so good!

Java 1.7 can not be used for the Jelly Bean build, Java 1.6 is needed

So this was an odd problem to me (Makes sense, with some methods being deprecated and from the warning message it actually used Java 1.5, not 1.6, but 1.6 was backwards compatible enough to work), and it is what ultimately made me use a virtual machine rather than doing it in the lab.  The general solution was to just download the binary file, run, and do the update alternatives snippet (See above).  This worked, however a little tip for future reference, you need to actually put the .bin in the /usr/bin and then chmod and execute it there (This allows it to be in your path).  You can then do an update.  However, I highly recomend following this post here by codingchyne. It’s what I followed, worked perfect. After this, it already set up the Java 1.6, so no need for the update alternatives.


So, this is where I feel a lot of newbies might be a bit surprised, and Dr. Mateti actually warned me about to begin with.  This process takes… Long.  As in, it took my 8-15 hours to actually update the repository.  This is on about a decent connection.  However, in the labs, I was getting a very fast connection (Friday evening, Saturday afternoon), so it only took about an hour there.

Now the build.  As I said earlier, I already started the build.  It’s been going at it for about an hour now, so obviously this is going to take some time.  I use -j4, which means I’m using 4 threads on my PC to build this.  In the lab, I want to try this again using -j32 and see if it really will finish this up in about two hours.  Lastly, Dr. Mateti brought up that he wants the system to allow distributed computing, and I’d love to see how that works and perhaps push this to -j128 or some other amount that would make it build in only minutes.  Maybe later on I can show a graph of speeds to thread numbers.

So what now?

Obviously, the build has to finish, and hopefully without errors.  If it does, then awesome.  If not, then no big deal, I have to talk to Dr. Mateti and see if I can get the Java versions switched so I can do this on there, and that’s where I’ll be doing most of my work.  After this, I believe that I’ll be working on pruning, or as I’m looking it up, kernel work (Which I’m actually really interested in).  This is probably going to take most of my time, and hopefully I can post updates on what I’m doing to the kernel and why.  We’ll see though, the build might not even work, then we’re back at step one!

Hello, World!

I’m starting out with a research position as of now with a professor in order to learn more and pretty much obtain real experience rather than just a normal class room setting.

Basically, the subject matter is going to be computer science, along with mobile security.  Mobile, meaning Android, means my first task is to build a ROM.  The end goal is to actually produce a fully functional ROM that others may install on their own machine.  In this blog, I’ll be posting updates whenever I do work on the project.  As I’m still in school, I can’t dedicate a lot of time to this, however my goal is to upkeep ten hours a week on this project, with most of my work being done on weekends.  I’ll try to update every Monday and possible Wednesday or Thursday (Depending on when I work).  Hopefully all works out, and this becomes something.


I’ll also be posting about food, and what I cook.  Being in college, I won’t be making fancy schmancy meals, but I’ll be making some delicious stuff as time goes on.  I love to cook, and listen to music, and the great thing is, cooking and listening music can be done together! Just like programming and music ;).  Things always work out!

Lastly, I do small mini-projects on my own.  As of now, I’m creating two Android apps (Both of which I’ll post about and problems that occurred during development) and hopefully they’ll get done within the school year (That’s the plan).  The plan is, weekends are a mix day, do both my own projects and research stuff, where-as through the week I do more of the research stuff and app development when I’m free and need a break.  Sort-a my personal 20% project. Last, I hope to start learning Go/golang.