Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting started with Udoo

You're reading from   Getting started with Udoo Become an efficient maker by designing and building amazing prototypes with the UDOO platform and Android

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781784391942
Length 206 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Emanuele Palazzetti Emanuele Palazzetti
Author Profile Icon Emanuele Palazzetti
Emanuele Palazzetti
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Downloading and installing Android

We have an idea about a list of UDOO components that we may use to start building amazing projects. However, before we continue, we need to configure our board to run the Android operating system and also our development environment so that we can start writing and deploying our first application.

Note

All prototypes you build in this book are based on Android KitKat 4.4.2 that is the latest supported version at the time of this writing. During the course of this book you will build many projects that make use of the Android Support Library to ensure compatibility with newer Android versions that the UDOO board will support.

The UDOO board doesn't have internal storage or a built-in boot program because it relies on external storage, a microSD card, in which you can install a bootloader and a compatible operating system. The easiest way to create a bootable microSD card, is to download and copy a precompiled image, though it's possible to create a clean operating system using released binaries and kernel sources.

http://www.udoo.org/downloads/ points to the official UDOO download page that contains the links for all the available precompiled images.

Among Linux images, we can find and download the latest supported version of Android KitKat 4.4.2. As stated earlier, UDOO comes in two different versions with dual and quad processors so we must download the right version, according to the owned platform.

Installing from Windows

To install the Android image from Windows, you need some extra tools to unpack and copy the image into the microSD card. The downloaded .zip file is in 7-Zip compression format, so you need to install a third-party unarchive program such as 7-Zip. When the extracting process is done, we have an uncompressed .img file ready for copy on an empty card.

To write the uncompressed image into our microSD card, perform the following steps:

  1. Insert your microSD card in the built-in slot reader or external card reader.
  2. Format the card using the FAT32 filesystem.
  3. To write the image on the micsoSD card, we need to use the Win32DiskImager tool. Download it from http://sourceforge.net/projects/win32diskimager/.
  4. Run the application, but bear in mind that if we are using Windows 7 or Window 8.x, we have to right-click on Win32DiskImager.exe executable and be sure to select the Run as administrator option from the context menu.
  5. Win32DiskImager is a tool that writes raw disk images using low-level instructions. This means that you need to exactly follow the next steps and be really sure that you correctly select the output device. If this option is wrong, you might lose all your data from an unwanted storage memory.
  6. Once the application starts, you can see the main window, as illustrated in the following screenshot:
    Installing from Windows
  7. From the application's main window, in the Image File box, choose the .img file previously extracted.
  8. Select the microSD drive accurately on the Device dropdown and bear in mind that if we use the wrong drive, we can destroy all our data on the computer's hard disk.
  9. Click on the Write button and wait for the process to complete in order to have a bootable Android operating system in the microSD card.

Installing from Mac OS X

To install the Android image from Mac OS X, we need a third-party tool to unpack the downloaded .zip file, because it's in 7-Zip compression format and we can't use the built-in unarchive software. We have to download software such as Keka, which is freely available at http://www.kekaosx.com/.

If we love the Mac OS X terminal, we can use the Homebrew package manager that is available at http://brew.sh/.

In this case, from the command line, we can simply install the p7zip package and use the 7za utility to unpack the file as follows:

brew install p7zip
7za x [path_to_zip_file]

To proceed and write the uncompressed image into our microSD card, perform the following steps:

  1. Launch the Terminal application and enter into the folder in which we have downloaded and extracted the Android image. Assuming Downloads is the name of that folder, we can issue the following command:
    cd Downloads
    
  2. Get the list of all mounted devices with the following command:
    df -h
    
  3. The list of all systems and internal hard drive partitions will be similar to the following screenshot:
    Installing from Mac OS X
  4. Connect the microSD card using the built-in or external card reader.
  5. Format the microSD card through the Disk Utility application that is already available in our system. Launch it and select the correct disk from the list on the left.
  6. From the main panel of the window, choose the Erase tab from the upper menu and select the MS-DOS (FAT) filesystem in the Format dropdown. When you are ready, click on the Erase button.
  7. From the Terminal application, launch the previous command again:
    df –h
    
  8. The list of mounted partitions has been changed, as we see in the following screenshot:
    Installing from Mac OS X
  9. We can assume that the missing device, during the first run, is our microSD card, so we have to bear in mind the new value under the Filesystem column. If you look at the previous screenshot, our partition name is /dev/disk1s1 while it isn't /dev/disk0s2 because it's our hard disk.
  10. Once we have found the correct partition, we have to unmount it using the following command:
    sudo diskutil unmount /dev/[partition_name]
    
  11. To write the image into the microSD card, we must find the raw disk device so that we can erase and write the Android image into the card. Assuming that the partition name found before was /dev/disk1s1, the related raw disk will be /dev/rdisk1.

    Note

    We are going to use the dd tool. This command writes raw disk images using low-level instructions. This means that you need to exactly follow the next steps and be really sure that you choose the correct disk device, because if it is wrong, you can lose all your data from an unwanted storage.

  12. Write the image previously extracted into the microSD card using dd with the following command:
    sudo dd bs=1m if=[udoo_image_name].img of=/dev/[raw_disk_name]
    

    A full example of the previous command is as follows:

    sudo dd bs=1m if=[udoo_image_name].img of=/dev/rdisk1
    
  13. When we launch the command nothing seems to happen, but actually, dd is writing the Android image in the background. Once the process is complete, it outputs the transferred bytes report, as shown in the following example:
    6771+1 records in
    6771+1 records out
    7100656640 bytes transferred in 1395.441422 secs (5088466 bytes/sec)
    
  14. Now we have our bootable Android operating system and we can eject the microSD card with the following command:
    sudo diskutil eject /dev/[raw_disk_name]
    

Installing from Linux

To install the Android image from Linux, we need a third-party tool to unpack the downloaded .zip file. Because the file is in 7-Zip compression format, we need to install the p7zip package porting from the command line using the package manager of our distribution. Then we can use the 7za utility to unpack the file or any other graphical unarchiver that makes you comfortable.

We can proceed to write the uncompressed image into our microSD card using the following steps:

  1. Open the Linux Terminal and enter into the folder where we have downloaded and extracted the Android image. Assuming the file is in our Downloads folder, we can issue the following command:
    cd Downloads
    
  2. Attach the microSD card using the built-in or external card reader.
  3. Find the correct device name through the following command:
    sudo fdisk -l | grep Disk
    
  4. The output is a filtered list of all the devices found, and it contains, among others output lines, something like:
    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    Disk /dev/mapper/ubuntu--vg-root: 157.5 GB, 157454172160 bytes
    Disk /dev/sdb: 7948 MB, 7948206080 bytes
    

    In this case, /dev/sda is our hard disk while /dev/sdb is our microSD card. If this is not your case and you are using an internal card reader, it's possible that the device is named /dev/mmcblk0.

    When you've found the right device name, keep it in mind so that we can use it later.

  5. Find all the mounted partitions of the above device through the following command:
    mount | grep [device_name]
    
  6. If the previous command generates an output, find the partition name available in the first column of the output and unmount any listed partitions through the following command:
    sudo umount /dev/[partition_name]
    

    Note

    dd is a tool that writes raw disk images using low-level instructions. This means that you need to exactly follow the next steps and be really sure that you choose the correct disk device because, if it is wrong, you can lose all your data from an unwanted storage memory.

  7. Write the image previously extracted to the above device name using the dd command:
    sudo dd bs=1M if=[udoo_image_name].img of=/dev/[device_name]
    

    Assuming /dev/sdb is our microSD card, the following is a full example:

    sudo dd bs=1M if=[udoo_image_name].img of=/dev/sdb
    
  8. When we launch the command nothing seems to happen, but actually, dd is writing the image in the background. Once the process is complete, it outputs the transferred bytes report, as follows:
    6771+1 records in
    6771+1 records out
    7100656640 bytes transferred in 1395.441422 secs (5088466 bytes/sec)
    
  9. Now we have our bootable Android operating system and we can eject the microSD card with the following command:
    sudo eject /dev/[device_name]
    

Our first run

Once we have a bootable microSD card, we can insert it into our UDOO board, use our external monitor or LVDS panel and connect a mouse and a keyboard. After the power is switched on, the Android logo shows up and when the loading process is finished, we can finally see the Android home interface.

You have been reading a chapter from
Getting started with Udoo
Published in: Feb 2015
Publisher:
ISBN-13: 9781784391942
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image