Tools and articles

Some of our articles and tools that we use in everyday work

In our work, we pay great attention to education, and to explore new areas of development, which would increase the level of knowledge, not only our employees, but also all the people who are interested in developing in various spheres.

As the processing of this section will be filled with more and more new information and possible we will keep you informed of the new publications

Make your Android for BeagleBoard In this article I want to tell about the process of building Android for ARM controllers. I hope that this article will be useful, not only for developer, but also for the sophisticated user. done Mostly I would like to show how the actual building process takes place, of operating system for mobile devices. As a laboratory rat, I chose BeagleBoard-xM. It's one of debug boards, which is highly suitable for such tasks. Moreover, it has HDMI and S-VIDEO outputs, in order to "feel" the result. As well as 4 USB ports, which are sufficient to connect keyboard, mouse etc. In my experiments, I used BeadaFrame bought on Ebay, however this is not necessarily required, other than that, any "tv" will do. Thus our board will download with microSD, but to build Android we will need a Linux machine, for example Ubuntu 13.04-AMD x64, it's quite possible to use a virtual machine, however it is reccommended to ensure that the virtual machine has access to MMC device, i.e. the actual microSD card, and for a start we will need to install the following packets:
sudo apt-get install aptitude
sudo aptitude install ia32-libs

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 curl
For our Android it will be needed to build 3 basic things:
  • the actual operating system kernel-a binary file, which will be uploaded by the loader
  • the loader in our case will be u-boot, u-boot, although it is possible to use x-loader
  • filesystem
For our work, let's create a work directory, for example: /home/ubuntu/Adroid/
mkdir /home/ubuntu/Android
cd /home/ubuntu/Android
And immediately let's add this directory into pathname:
export PATH=/home/ubuntu/Android:$PATH
If git is not installed on your virtual machine, then it will be necessary to install it:
sudo apt-get install git

git config --global ""
git config --global "You Name"

Initializing a repository:

Now we will have to obtain the initial code of actual Android, from which subsequently we will be building the actual kernel of the operating system and filesystem. To do this, inside our work directory /home/ubuntu/Adroid, Android let's carry out the following command:
curl > androidrepo
As a result, we receive androidrepo androidrepo file,with which we will work with the repository. For this, we indicate the rights for executable file for androidrepo.
chmod a+x androidrepo
Then, inside our work directory, we create a catalog for initial code:
mkdir /home/ubuntu/Android/source
cd /home/ubuntu/Android/source
and initiate repository:
androidrepo  init -u git:// -m rowboat-jb-am37x.xml
After successful initation, we carry out synchronization with repository
androidrepo sync
Synchronization is quite a long process, as it contains not only source code of the kernel, but also filesystem, as well as a comiler, with which both loader and kernel will be built. By the end of synchronization, we should see information about successful completion of synchronization, such as this: Syncing work tree: 100% (261/261), done. Now, before build, we should set path to the compiler, using which we will be building kernel and loader. The actual compiler is inside the repository in directory, prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin, so we set a path to it in variable PATH.
export PATH=/home/ubuntu/Android/source/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
At this point, our preliminary work is complete.

Building loader

As mentioned earlier, we will be using u-boot as loader. For build, we will need to create a clone of u-boot repository, in our workfolder:
git clone git:// u-boot
We build our loader, the first command distclean during first build we can skip. For u-boot build, arm-eabi-gcc compiler is used, which is already installed.
сd u-boot-main

make CROSS_COMPILE=arm-eabi- distclean
make CROSS_COMPILE=arm-eabi- omap3_beagle_config
make CROSS_COMPILE=arm-eabi-
Result of loader build are 2 files MLO, and u-boot.bin. Both these files are located in the root of u-boot directory. For convenience, we move them elsewhere, e.g. build build catalog.

Building the kernel

Now to start actual kernel build. Physically it's one uImage file, which is in reality a Linux kernel. But before starting build, we need to install Java SE 1.6. And precisely version 1.6, which can be installed from repository:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
or as described in this article. Then, to build the kernel, we need to go to kernel directory, inside Android repository. In our case: /home/ubuntu/Adroid/source/kernel, and like in u-boot example, we carry out build:
make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
make ARCH=arm CROSS_COMPILE=arm-eabi- omap3_beagle_android_defconfig
make ARCH=arm CROSS_COMPILE=arm-eabi- uImage
It must be noted, that omap3_beagle_android_defconfig is taken from kernel/arch/arm/configs, catalog, which is located in the kernel configuration. It is possible to change, add or select suitable configuration for specific hardware. Result of build, will end up in kernel/arch/arm/boot folder, or in our case /home/ubuntu/Adroid/source/kernel/arch/arm/boot, from where we take uImage file, that is the actual kernel, and we transfer it into the build directory, which is convenient.

Build the file system

This is the last stage of our operating system build, in order to proceed, we need to go to the repository root, and build it:
make TARGET_PRODUCT=beagleboard droid
It takes quite a long time to build filesystem, and requires about 20Gb of diskspace. After actual filesystem build is complete, we need to obtain an archive, which will contain all the required files.
make TARGET_PRODUCT=beagleboard fs_tarball
After completion of archive build, we obtain footfs.tar.bz2, which is located in out directory: /home/ubuntu/Adroid/source/out/target/product/beagleboard/rootfs.tar.bz2, And thus contains the Android filesystem. All system files are found here, applications, and utilities which are part of the operating system.

System configuration

The actual configuration process is quite simple, and to make it easier, let's use Rowboat Tools from Texas Instruments. We will need configuration file of loader boot.scr, which contains settings of loader's variables. We download and extract the actual
cd /home/ubuntu/Android/
tar -xvzf RowboatTools-JB.tar.gz
We are interested in mkbootscr, which is located in catalog RowboatTools-JB/am37x/mk-bootscr. If we look into the file, we see such strings:
setenv bootargs ''console=ttyO2,115200n8 androidboot.console=ttyO2 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait init=/init ip=off omap_vout.vid1_static_vrfb_alloc=y vram=8M omapfb.vram=0:8M omapdss.def_disp=dvi omapfb.mode=dvi:1024x768-16''
That is the setting of loader's variables, i.e. we need to set screen resolution different to “by default”, thus we should change the value dvi:1024x768-16, and carry out mkbootscr. As a result, we receive boot.scr with our settings. We won't be able to modify boot.scr right away, because it carries information about control amount, which should of course, match with the actual file size.

Setting and downloading

The actual board, as most devices on ARM controllers can be downloaded from NAND memory, SD/MMC или USB/RS-232. In our case, we will download with MMC. Firstly it's safer than upgrade of NAND memory, secondly, in my opinion, it's more convenient for demonstration purposes. Thus we will need MMC, preferably from 2 to 8Gb. We connect MMC to the Linux machine, and prepare the filesystem. Boot drive of MMC should contain minimum two partitions. The first, FAT16, let's call it boot, from which actual download of u-boot and operating system will take place, and second, Ext4, on which will be located our filesystem, let's call it rootfs. To simplify creation of filesystem, I prepared a small bash script, just for simplicity. If controller doesn't find the boot sector, our platform won't be able to download.
#!/bin/bash -e

if ! [ $(id -u) = 0 ] ; then
	echo "This script should be run as sudo user or root"
	exit 1




# Umount existion partitions
echo "Unmounting partitions"
mountpoints=$(mount | grep -v none | grep "$mmcdisk" | wc -l)

for ((i=1;i<=${mountpoints};i++))
    currentdisk=$(mount | grep -v none | grep "$mmcdisk" | tail -1 | awk ''{print $1}'')
    umount ${currentdisk} >/dev/null 2>&1 || true

dd if=/dev/zero of=${mmcdisk} bs=1M count=16

# Create partition table
LC_ALL=C sfdisk --force --in-order --Linux --unit M "${mmcdisk}" <<-__EOF__


partprobe ${mmcdisk}

# Setup partitions
echo "Setup partitions"
LC_ALL=C fdisk -l "${mmcdisk}"

LC_ALL=C mkfs.vfat -F 16 ${mmcdisk}p1 -n ${label_boot}

LC_ALL=C mkfs.ext4 ${mmcdisk}p2 -L ${label_rootfs}
For function of script, as argument, the name of MMC device needs to be transferred, e.g. /dev/mmcblk0. Be careful with the name of the device as the actual script does not check whether it's MMC or HDD disk. After creating boot drive, we just need to correctly copy the built files. To do this, we copy the actual uImage, u-boot.bin and MLO into boot partition, as well as boot.scr configuration file. Onto second partition: rootfs, we need to extract the archive with our rootfs.tar.bz2. Our freshly built Android is ready, we disassemble our microSD, insert target device, and switch on power supply. Sometimes we need to press reset, key and the very first upload requires more time than usual. But it's a "cold start".


In such way looks the process of Android build for mobile telephones and tablet computers, perhaps only deployment process on target device is different. But for debug boards such as BeagleBoard and BeagleBone etc. only device configurations vary.

New comment:

News and Events

This report describes the basic principles of working with the MQ services, particularly RabbitMQ use C#
  1. MQ Services — an overview of where the services are used and which one is best to choose?
  2. RabbitMQ — installation and configuration
  3. Push-messaging use RabbitMQ and .NET C#
  4. Integration with other platforms
  5. Alternatives and what to expect next?
More details...
This report describes how to run ASP.NET code on a virtual server for $ 5 per month, and why you should not do
  1. Why choose ASP.NET
  2. Why save on the server, if it can be hosted in Azure?
  3. How to run a container locally and remotely
  4. Practical recommendations
More details...