Click here to Skip to main content
13,054,779 members (64,558 online)
Click here to Skip to main content
Add your own
alternative version


4 bookmarked
Posted 17 Sep 2012

Booting Android Completely Over Ethernet

, 17 Sep 2012
Rate this:
Please Sign up or sign in to vote.
How to setup an extremely fast embedded development workflow of "Modify-Build-Test" cycles...

When developing embedded-systems, initial development stages often involve huge number of "Modify-Build-Flash-Test" cycles. Test-Driven-Development methodology further promotes this style of development. This leads to a break in the "flow" at the Flash stage. Flashing the device with a newly built set of binaries interrupts the otherwise smooth "Modify-Build-Test" flow. Also, errors tend to creep-in in the form of an older binary being copied/flashed, often causing confusion during debugging and endless grief to the developer.

A simple way to avoid this is to have the binaries on the host-machine (a PC) and boot the embedded device directly using those binaries. In case of Android embedded system development, these binaries are the Linux-Kernel and the Android filesystem image.


  • The embedded device
  • A linux PC (this walk-through performed on Ubuntu 11.10)
  • Ethernet connectivity between the two 

NOTE: Below listed parts 1, 2 & 3 involve setting-up the "host" Linux PC. Part 4 describes configuring the device to boot directly using the binaries present on the "host". It is assumed that a functional bootloader (u-boot) is present on the device (internal-flash/mmc-card) and that ethernet-support(either direct or over usb) is enabled.

Part 1: Linux Kernel Over tftp

1.1 Install tftpd and Related Packages

host-PC$ sudo apt-get install xinetd tftpd tftp 

1.2. Create /etc/xinetd.d/tftp  

host-PC$ cat <<EOF | sudo tee /etc/xinetd.d/tftp
service tftp
    protocol        = udp
    port            = 69
    socket_type     = dgram
    wait            = yes
    user            = nobody
    server          = /usr/sbin/in.tftpd
    server_args     = /srv/tftp
    disable         = no

1.3. Make tftp-server Directory

host-PC$ mkdir <tftp-server-path> 
host-PC$ chmod -R 777 <tftp-server-path> 
host-PC$ chown -R nobody <tftp-server-path>  

1.4. Start tftpd Through xinetd

host-PC$  sudo /etc/init.d/xinetd restart

This concludes the tftp part of the setup process on the host.

Part 2: Android fs Over NFS

2.1. Install nfs Packages

host-PC$ sudo apt-get install nfs-kernel-server nfs-common

2.2. Add this Line to /etc/exports

<rootfs-path>   *(rw,sync,no_subtree_check,no_root_squash)

2.3. Restart Service

host-PC$ sudo service nfs-kernel-server restart 

2.4. Update Exports for the NFS Server

host-PC$ exportfs -a 

2.5. Check NFS Server

host-PC$ showmount -e 

If everything went right, the <rootfs-path> will be listed in the output of showmount.

Part 3: Where to Put the Files

3.1. Linux Kernel uImage

On the "host" PC, copy the Linux-Kernel uImage into <tftp-server-path>.

3.2. Android rootfs On the "host" PC

Copy the contents of the Android rootfs into <rootfs-path>.

Part 4: Configuring the bootloader

4.1. Update bootargs

Connect the embedded device to the host-PC over ethernet (either directly or via a switch/router) and power it on. As shown below, configure the bootloader to pick-up the kernel from the host-PC over tftp and to mount the filesystem from the host-PC over NFS. As both support configuring a static-ip for the embedded-device or obtaining one dynamically using dhcp, 4 combinations are possible (2 shown below).

nfs(static-ip) and tftp(dhcp)

U-Boot# setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M 
root=/dev/nfs ip=<client-device-ip> nfsroot=<nfs-server-ip>:<rootfs-path> rootdelay=2' 
U-Boot# setenv serverip 'host-pc-ip'
U-Boot# bootm <Load address>  

nfs(dhcp) and tftp(static-ip)

U-Boot# setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 
mem=256M root=/dev/nfs ip=dhcp nfsroot=<nfs-server-ip>:<rootfs-path> rootdelay=2'
U-Boot# setenv serverip 'host-pc-ip' 
U-Boot# setenv ipaddr 'client-device-ip' 
U-Boot# tftp  
U-Boot# bootm <Load address>   

4.2. Boot

Linux-Kernel loaded over tftp

Filesystem mounted over NFS



This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-Share Alike 3.0 Unported License


About the Author

Software Developer (Senior) Nvidia Corporation
India India
Chinmay V S (a.k.a TheCodeArtist) is a Senior software engineer at NVIDIA Corporation - India. With more than 4 Years of hands-on experience in Linux Kernel and Android BSP development, he has been actively involved in developing and integrating drivers for the Linux-kernel and hardware abstraction layers for OMAP4 based Android smartphones, automotive navigation and infotainment devices.

In his spare time, he can be seen lurking in the shadows on StackOverflow and various Linux kernel mailing-lists. He enjoys sharing his experiences with technology as TheCodeArtist on his blog.

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 18 Sep 2012
Article Copyright 2012 by TheCodeArtist
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid