AOSP: Architecture

Previously I wrote an article for getting your own copy of the AOSP source, AOSP: Download, I thought before we go a head and build a ROM it would be worth having a quick run through of the AOSP architecture so we can understand where we should be making our changes if/when we want to. 

Below is the high level architecture diagram of the AOSP provided by the AOSP website.

AOSP Architecture
AOSP Architecture

As you can see we have multiple layers within the system, they are:

Application Framework Used primarily by developers to create Android Apps. 
Binder IPC This layer allows for Inter-Process Communication (IPC). That is it allows Apps to cross process boundaries, similar to COM in Windows. 
System Services A collection of co-operating services which should be thought of as modular focused components. There are two groups of services, as shown above, System and Media services.
Hardware Abstraction Layer (HAL) As the name suggests this is an abstraction layer between Android and the underlying Hardware. The HAL defines an interface that must be implemented by hardware vendors.
Linux Kernel Android is built on top of the Linux Kernel and as with most distributions Android patches the Kernel to meet its needs.

This is a very quick introduction to the different layers of the AOSP and I’ll go into more detail for each layer in future posts and as we go along but I think this gives you a good idea of what to expect. Next we’ll build a ROM and run it in an emulator.

Android is a trademark of Google LLC.

AOSP: Download

I wrote a Bitcoin Node setup post recently (hopefully you had a go?) and thought I’d show you how to setup an Android Open Source Project (AOSP) development environment and how to download the AOSP. 

This tutorial will be for a Ubuntu 18.04 machine only. Other systems should be ok, such as ElementaryOS or newer versions of Ubuntu, but I’ve not tried any other. Feel free to get in touch if there is an OS you’d like me to demonstrate or if you’re having any issues

First things first, open a terminal using ctrl+tab+t and type the following:

sudo apt-get update

Followed by:

sudo apt-get upgrade

Once they are done we will have an up to date machine and should be good to get stuck into setting up for AOSP.

Our plan is to get the official AOSP source on our machines, if you want to check it out now you can visit for more on what we’re going to download.

If you popped by the link you’ll see there are a lot of repos available to you. Don’t manually download each one, we’ll get to that using the repo tool.

We need to install some packages to get our machine ready, so run:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip

Let’s install repo then:

sudo apt-get install curl
mkdir ~/bin
curl > ~/bin/repo

Now that we have the repo tool we need to make it executable

chmod a+x ~/bin/repo

Incase you run into any problems I had to update my repo so it called python3 instead of python. To do this navigate to ~/bin, open repo, and run edit the first line from

#!/usr/bin/env python


#!/usr/bin/env python3

This tool will allow us to pull from multiple git repos to create our Android™ distribution.

We tell it the repos we want to pull using a manifest.xml file, which describes the projects to pull and their locations.

Now we want to get git, run the following:

sudo apt-get install git

Moving on to the reason we are here getting ourselves a copy of the AOSP:

First, lets create our directory.

mkdir -p ~/android/android-9.0.0_r50

Next up, navigate to the new directory

cd ~/android/android-9.0.0_r50

Then download the version of the source you want, see below for more details

repo init -u -b android-9.0.0_r50

Then finally sync it, this will take a while.

repo sync

Same as above and worth considering is using the -j flag with your sync, it allows you to sync repos in parallel. By default it will do 4 parallel downloads.

To get a different version of the AOSP visit and pick the one you’re after. Simply update ‘android-9.0.0_r50’ above with the Tag of the build you choose.

Great, so now we have our Android™ repos downloaded. 

We’ll leave it at that for this post but I’ll be putting another out soon where we will build and create our own Android™ Distribution to run on an emulator.


Android is a trademark of Google LLC.

Bitcoin: Getting a Core Node

I’ve recently become interested in Blockchain technologies and thought I’d get involved with Bitcoin and go from there. 

The experience has been really enjoyable and I’ve learned quite a bit. So figured I’d pass that on to others who were interested and wanted to start by showing you how to set up your own Bitcoin Core Node. 

Bitcoin Core implements all parts of Bitcoin. The first implementation was made by Satoshi Nakamoto before the completion of the WhitePaper and was known as “Bitcoin” or “Satoshi Client”. Since its release, it has been heavily modded and improved and is now known as Bitcoin Core and is the reference implementation for the bitcoin system. Essentially this means we should refer to Bitcoin Core on how parts of the tech should be implemented.

For the purposes of this post, I just want to show you how to set up your own Bitcoin Core node by pulling down the source code, building it, and running your own Node.

First, we want to set up our development environment, I’ll be running on a Ubuntu 18.04 virtual machine. Ensure your box is up-to-date and has git installed (throughout this post I’m assuming you know the basics of version control).

Next, we want to get hold of the source code. There are a few ways to do this but I find the easiest is simply to clone the repo from GitHub. You’ll want to get a copy of the latest version. 

Open a terminal, navigate to a preferred directory and run the following:

git clone

Now we have the latest version of the bitcoin source code we’ll want to select the release (the latest) and provision our machines to build.

We can use the git tag command to get a list of available releases. 

In your terminal, run the following:

git tag

Choose the latest release shown and run the following:

git checkout <release>

You can confirm you have the correct version checkout by running:

git status

The result will contain the following:

HEAD detached at <release>
nothing to commit, working directory clean

Great stuff. We’ve got the correct release of the Bitcoin source code we want to build, now we just need to make sure our machine is provisioned to do so.

From the root of the repo navigate to the doc directory in here you will find instructions on how to provision your machine to build your node. As I’m on a Ubuntu machine I will use but there are instructions for macOS and Windows.

Open your instructions:


Ensure you read the instructions carefully to avoid any potential issues. As I’m on a Ubuntu machine I will follow those steps:

First, install the build requirements:

sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3

Then, install the dependencies:

sudo apt-get install libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-devsudo libminiupnpc-dev

Now our machines are provisioned we can start getting the build process moving.

First, we need to generate a collection of config scripts, these scripts will review your machine and discover the correct settings and that you have the correct dependencies for building. We can do this by running the autogen script found in the root of the repo.

Navigate to the repo root and run:


As part of the autogen step, we get a file called configure generated at the root. This file is used to automatically identify the required libraries and create a build script for your machine.

Let’s run that script then:


If you get the following error:

configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)

Check out this solution

Now, hopefully, that went smoothly!

Let’s compile, this will take some time, run:


If your machine can manage it would be worth adding parallel compilation using -j, e.g. make -j 2 will use two cores.

It is advised that you run the suite of unit tests available once compilation has completed. You can do this by running:

make check

Finally, we need to install the executables on our system by running the following command:

sudo make install

That’s it for building Bitcoin Core, we can now run it.

To run our node we use the following command:


Though for now at least I recommend running:

bitcoind -printtoconsole

The addition of -printtoconsole will feed output to the console soo you start to get an idea of what is happening.

Congratulations, you now have your own bitcoin core node up and running, it will take quite a while to get up to date with the current ecosystem.

To make sure you are aware of the full implications of running a bitcoin node I recommend you check out this link.

This post is for educational purposes only and I do not make any recommendations on whether you should or should not run a bitcoin node. The risks and costs associated must be weighted by yourself.