Before we build there are some changes I should mention. Before Android 7.0 (Nougat) was released the build was done using GNU Make. Unfortunately, due to the size and complexity of Android this build system became slow, error prone, unscalable, and difficult to test. So from Android 7.0 the build is now done by the Soong build system (prior to Android 7.0 I hadn’t used Soong). Which itself makes use of Kati and Ninja.
Kati is an clone of the GNU make tool with the goal of speeding up Android builds. The developers say it currently doesn’t do that but it does convert our Makefile to a Ninja file.
Ninja on the other hand is a small build system which focuses on speed. The developers of this tool say Ninja differs from other build systems in two ways. The first is it is designed to have the input files generated by a higher level build system and to run build as fast as possible.
Given one of the reasons AOSP changed to this system was they were concerned about speed thats a good statement to make. If you’d like to learn more about this then check out the AOSP Build System article which goes into more details about this (certainly required if you want to understand the system indepth).
Lets build ourselves an AOSP ROM. Make sure you’re in a terminal and navigate to the directory you downloaded your AOSP to.
First we need to initialise our environment, this (as the name indicates) sets up our build environment for Android by defining a series of commands. In the root directory of the AOSP source, run:
You should see the following output
Now we can run hmm to get the list of commands we can use. Feel free to run that now to see what are available. The main ones that you’ll use are as follows:
Displays the product-name and build_variants to build. You need to select the one you want to build.
Runs builds from the top of the tree. You can use this to build the whole source or provide arguements to build specific targets.
Builds all the modules in the current directory, including their dependencies.
Builds all the modules in the supplied directories, including their dependencies.
Changes directory to the AOSP source root.
Now we can run lunch and select the target we want to build.
All of the build targets will be shown as BUILD-BUILDTYPE. BUILD is the codename for the target product and BUILDTYPE is the target build variant.
The buildtype will be one of the following:
Limited access; suited for production
Like user but with root access and debug capability; preferred for debugging
Development configuration with additional debugging tools
So lets make our selection, run:
You should get a lunch menu of BUILD-BUILDTYPE configurations to pick from. I will select aosp_arm-eng as this will give us a useful build for the emulator.
Please note this will NOT run on your device so if you’re looking at other sources do no try to flash this.
You can now build so run:
m can run with parallel tasks using the -jN argument, where N will be the task count. You don’t have to provide the argument and the build system will assign it for you for your system if you don’t.
This will take a while so grab a coffee or something and come back to it in a bit.
So long as nothing when wrong you should now be ready to run you newly built Android distribution in an emulator by running:
Congratulations, you’ve just built the AOSP and ran it. In the future we’ll take a look at where we need to look to modify the different layers depending on what it is we are looking to do and how we can build a distribution to run on a commercial device.
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
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 https://android.googlesource.com/ 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:
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 https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds 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.
Apologies this post has taken longer than I expected to get out. Its a bit different from the others as its about a specific project.
I decided to give making the Magic Mirror a go. It was my first (and I expect not my last) DIY project and I must say I really enjoyed doing it. I’ve been wanting to do it for a while but as with many people the first road block instantly made me move onto the next thing to do. Not very productive right?
So this time round when the urge to make it took me I put myself on the spot, I told my fiance I’d make it for her as a gift for her birthday, though I didn’t tell her exactly what it was only that I was making something myself.
So what is the Magic Mirror? If you haven’t checked out the above link I’d recommend you do they can probably explain it better than me. Essentially it’s a mirror that gives you information, be it the time, weather, news headlines, and a lot more. The image below shows my end product :
What I needed to make the Magic Mirror was:
A Raspberry Pi
A Two-way / See through mirror
The monitor I used was Iiyama ProLite E2207WS, mainly because I’ve had it for years and wasn’t doing anything with it.
First thing I needed to do was get the frame off it, which wasn’t as bad as I thought it would be. Was quite worried I’d end up damaging the buttons but it worked out well. You do definitely need to be careful not to damage them as you may not be able to use the monitor if you do.
If you don’t have a monitor lying around make sure you get one where the HDMI connector would not be facing the wall. They should be facing towards the floor if the monitor was standing up right. Another useful option for the monitor would be to ensure it has a USB port capable of powering a Raspberry Pi, that way you only need to worry about one cable. Unfortunately for me my monitor did not have a USB port so I have two cables on display.
I think it’s recommended you use the Raspberry Pi 3 to make the Magic Mirror but again I had a Raspberry PI 2 Model B+ lying about the house that I wanted to do something with. So instead of buying a new Raspberry Pi I just used that instead (and now have an excuse to get the Pi 3). There wasn’t really much to this bit to be fair, those behind the Magic Mirror software make it very easy to get things installed and moving, this is what you need to do:
Generally its considered best practice to ensure your OS is up to date before you get started.
This will pull down and install everything we need to get the MagicMirror up and running. Once complete you should be presented with the MagicMirror UI.
The next thing you can do is modify the configuration slightly to better suit your needs. For example
Update the news feeds to a provider of your choice
Update the weather to your location or one you are interested in
Update the Calendar to your own
You can also add additional modules:
For information on this please check out the GitHub page here
Now finally for the Pi we need to make sure the Magic Mirror starts for us on boot. It is recommended to use PM2 for this.
Setting up PM2
First, we need to install it; so run the following from terminal:
sudo npm install -g pm2
Second, we need ensure PM2 starts on boot; run:
Once that is finished, run the command it shows you.
Next up we need to add a start script for our Magic Mirror, it is recommended to put this script in the Magic Mirror directory (and its just cleaner)
If you’re not experienced with ‘vi’ try ‘nano‘ instead. Now we want to add our startup commands
DISPLAY=:0 npm stat
Save and close vi. Ensure script is executable by running:
chmod a+x mm.sh
Now lets start MagicMirror using PM2; run:
pm2 start mm.sh
MagicMirror should now start up. Once it does press the super key + tab to navigate back to your terminal and run the following to ensure PM2 starts your MagicMirror on boot.
That’s it, our software side of things is complete next up lets check out the Mirror itself.
The mirror was one of the things that stopped me going forward in the past. I’d spoken to a local Mirror shop and they made it sound like getting the two way sheet/glass was going to be really difficult. Annoyingly if I’d just taken a look on the web I’d have found it. This time round I took to Amazon a tried to hunt something down, luckily I found a seller called Sign Materials Direct who sold something along the lines that I needed.
Unfortunately they didn’t sell it the size I needed as the sheet needs to match the monitor. Luckily, again, however someone had had a similar issue as me and had asked the question about customisation. Turns out they can cut the material to “any shape or size” you need. So I got in touch with them at the email address in the link (who got back to me very quickly) and within a few days I had my custom cut sheet that fit perfectly.
If you’re in the UK I would highly recommend you give them a try, I was really happy with the price and speed.
Also best to add I’m not affiliated with Sign Materials Direct, just a happy customer.
At first I was thinking I might make the frame myself as I was going to have to make a housing unit to put the monitor in and then attach it to the frame anyway. Then I realised, I am neither a carpenter nor an artist and threw that idea a way.
We have a large Mirror in our living room and thought getting a matching frame would look quite good. So off to the local Mirror shop I went again, that’s where the larger mirror came from, and that was a no go as their supplier doesn’t do custom sizes. But moving on anyway I gave the internet a go and found a company who make custom frames and thought they looked really nice. So I got the frame from there.
Now I was a bit worried about was may be I’d measured something wrong or had typed something wrong, made a “school boy error” or one of the pieces didn’t fit right etc. But nope it was all good, the frame and Mirror fit perfectly.
The next step was to get some decent wood and cut it to house the monitor and Raspberry Pi. I didn’t have a saw so this was a pretty good excuse to get an over the top tool for the job right?
The wood I used was Redwood planed timber, apparently normally used for door frames. But did the job quite nicely in this instance. Unfortunately I didn’t take any pictures for that part which may have been the most interesting, wood cuttings everywhere and a large circular saw.
Anyway I ended up with a bit more than I needed, mainly because I cut one piece slightly too small so had to go buy some more. Though I’m sure I’ll be needing to cut it for a shelf or something… or to just cut it. So got the wood cut to the right size, screwed the pieces together, and painted the whole thing white. Eventually, once dried, got the housing unit attached to the back of the frame with perhaps a few too many screws than was needed but better safe than sorry right?
One thing I would add if you decided to do this yourself, I can’t imagine the unit would get too hot but I drilled two large(ish) holes into the top of the housing unit to allow some kind of air flow just in case. I’m not planning on leaving it powered on all the time but I would say it’s worth putting the holes there.
On the wall
The final job, getting it on the wall. This step was easier to do than I thought it would be as the wall had a large screw in it already for the Magic Mirror to rest on all I needed to add was something to stabilise it. This was done by adding some 90° hooks to the underside of the Housing unit to give the overall structure more support. I may add some more hooks to the top of the housing unit to make sure but it is certainly well secure now.
Well thanks for sticking all the way through this post. I know it’s not my normal style but I thought I might try adding this as it’s the first project I gave a go and am quite pleased with the results. The fiance really likes it so that’s good.
With all the modules available for the Magic Mirror and no doubt some more really cool ones that will come out the in future I’m going to add to what I’ve got so far. Things like facial recognition, Alexa integration, calendar notifications, and there’s plenty more.
Hopefully you decide to give it a go yourself and if there’s anything I can help with please get in touch.
Hey all, so today I’m going to give you a quick run through for setting up a development environment using Visual Studio 2017 Community on Windows 10. There will be a tutorial on how to do this on a Linux environment with a different IDE but for now as I will be focusing on Visual Studio for development.
Not much else to say there, let’s get into it…
Up to date Windows 10
The first thing we want to do is ensure that our Windows 10 development machine is up to date.
This can be found in Settings -> Update & Security -> Windows Update
Download Visual Studio 2017
Now we are happy our machine is up to date next we want to download the Visual Studio 2017 installer. So the next thing we want to do is download Visual Studio 2017
There are other versions available for those with the required Key or Subscription level, they are:
Visual Studio 2017 Professional
Visual Studio 2017 Enterprise
We will only be looking at Community Edition, but the steps will be the same.
Install Visual Studio 2017 Community Edition
Once you’ve downloaded Visual Studio lets install it
Double click on the installer
You’ll find it in your Downloads folder normally set to ‘C:\Users\<Your Username>\Downloads’
You may need to approve the installation via the User Account Control authorisation window. I assume as you are here you’re happy to install Visual Studio 2017, so click ‘Yes’
Next up will be to review Microsoft’s Privacy Statement and Software Licence Terms
Pretty standard stuff.
The Installer will then fetch and install some additional dependencies
So, now we get to configure our Development Environment. For our purposes I’m only going to choose those components we MAY want to use in the future, that is components I intend to use in any posts I make. You can, of course, install any components you wish outside of my choices. So we will want:
.NET desktop development
Desktop development with C++
Universal Windows Platform development
ASP.NET and web development
Data storage and processing
Mobile development with .NET
Visual Studio extension development
.NET Core cross-platform development
NOTE: You will need to ensure you have enough space to install the components. Please see the red box the above image it shows the ‘Total space required’ for your configuration.
You can change where you want the installation to go, see the green box in the above image
In some cases, some of the components will have a set installation path which you cannot change.
That’s it, for now at least, the Visual Studio Installer will now install Visual Studio, this will take a little while. Could be worth grabbing a brew or something and if you haven’t done so already check out some of my other posts.
Start Visual Studio 2017 Community Edition
Great, so Visual Studio should now be installed for you, I recommend you restart your machine but it’s not necessary. Let’s open Visual Studio now then, there’s a couple of ways to do this:
Open the Start Menu using the Windows key
Scroll to ‘V’ named apps
You will see ‘Visual Studio 2017’, click it.
Navigate to your desktop, press Windows Key + D
Double click, ‘Visual Studio 2017’
Open the Start Menu by pressing the ‘Windows Key’
Type ‘Visual Studio 2017’
Visual Studio 2017 will now be in the Start Menu Best match options
There will be some configuration we need to do as part of our first startup
You’ll be asked to sign in to your Microsoft account if you have one.
If you don’t, I’d recommend you get one and sign into it.
If you do, sign in
Especially if you have an MSDN subscription
Next up and nearing the end, some simple IDE configuring
Leave Development Settings as ‘General’
Though feel free to look into this in more detail and selection and option more suitable for your plans
Then choose your Color Theme
We are done, Visual Studio 2017 will now be installed and you can take a look round if you want.
Hopefully, my steps were useful and you managed to install it. If you have any problems feel free to get in touch and I’ll help in any way I can (though I imagine you’ll likely google any issues).
Next up then we’ll make a very simple C# application, should be out shortly.