Professional Documents
Culture Documents
Kaushik Prajapati
E-mail: kaushikprajapati@gmail.com
San Jose State University
Computer Engineering Department
STEP 1: Install the necessary software in order to compile and build the Android
To set up your Linux development environment, make sure you have the following:
Required Packages:
Git 1.5.4 or newer and the GNU Privacy Guard.
JDK 5.0, update 12 or higher. Java 6 is not supported, because of incompatibilities with
@Override.
flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl.
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf
libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl
libncurses5-dev zlib1g-dev
You might also want Valgrind, a tool that will help you find memory leaks, stack corruption,
array bounds overflows, etc.
$ sudo apt-get install valgrind
This has not been as well tested. Please send success or failure reports to android-
porting@googlegroups.com.
The Android build requires a 32-bit build environment as well as some other tools:
Required Packages:
Git, JDK, flex, and the other packages as listed above in the i386 instructions:
JDK 5.0, update 12 or higher. Java 6 is not supported, because of incompatibilities with
@Override.
Pieces from the 32-bit cross-building environment
X11 development
$ sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-
i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev
lib32readline5-dev lib32z-dev
Set the system to use the right version of java by default:
$ sudo update-java-alternatives -s java-1.5.0-sun
X11: Ubuntu doesn't have packages for the X11 libraries, but that can be worked around with
the following command:
$ sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
Repo is a tool that makes it easier to work with Git in the context of Android. For more
information about Repo, see Using Repo and Git.
1.Make sure you have a ~/bin directory in your home directory, and check to be sure that this
bin directory is in your path:
$ cd ~
$ mkdir bin
$ echo $PATH
2.If you don't have the bin directory in your path then:
$ sudo gedit ~/.bashrc
At the end of the file type following line to be able to put bin directory in your path.
export PATH=$PATH:/home/owner/bin
2.Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You
must specify the Url for the manifest.
$ repo init -u
git://labs.embinux.org/repo/android/platform/beaglemanifest.git/
3. When prompted, configure Repo with your real name and email address. If you plan to
submit code, use an email address that is associated with a Google account.
To use the Gerrit code-review tool, you will need an email address that is connected with a
registered Google account (which does not have to be a Gmail address). Make sure this is a live
address at which you can receive messages. The real name that you provide here will show up
in attributions for your code submissions.
The Android source files are divided among a number of different repositories. A manifest file
contains a mapping of where the files from these repositories will be placed within your
working directory when you synchronize your files.
Make sure you are there in the directory that you created which is “beagledroid”
To pull down files to your working directory from the repositories as specified in the default
manifest, run
$ repo sync
For more about repo sync and other Repo commands, see Using Repo and Git.
The Android source files will be located in your working directory under their project names.
Load the following public key into your GnuPG key database. The key is used to sign
annotated tags that represent releases.
$ gpg --import
then paste the key(s) below, and press Control-D to end the input and process the keys
To build the files, run make from within your working directory:
$ cd ~/beagledroid
$ make
if you have multiple core in your CPU then you can run “make -j 2” instead of
“make”. This will make the build processor faster by running tasks concurrently.
Now, after you are done with the android build. It's the time to get the android file system
Figure 7.2 Contents of the Android_RFS folder after copying all necessary items
STEP 8: Downloading the tool chain
$ cd /opt
Note there may be more than one partition (only one shown in the example below).
$ [df -h]
Filesystem Size Used Avail Use% Mounted on
...
/dev/sdc1 400M 94M 307M 24% /media/disk
...
2. Start fdisk
If the print out above does not show 255 heads, 63 sectors/track, then do the following
expert mode steps to redo the SD Card:
#cylinders = FLOOR (the number of Bytes on the SD Card (from above) / 255 / 63 /
512 )
So for this example: 2021654528 / 255 / 63 / 512 = 245.79. So we use 245 (i.e.
truncate, don't round). In my case it came out 240.
7. Create the FAT32 partition for booting and transferring files from Windows
8. Mark it as bootable
WARNING: Re-reading the partition table failed with error 16: Device or resource
busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Note: Wait for some time to let the process finish and then simply remove your SD card
from the slot and put it back. You can now see the partition by the name of beagleboot
and disk. Also, while dealing with SD card if you run into any problem then download the
following tool and format it. http://www.sdcard.org/consumers/formatter/eula
http://code.google.com/p/beagleboard/wiki/BeagleboardRevCValidation
1. MLO as MLO
2. u-boot as u-boot.bin
3. u-boot for flash as u-boot-f.bin
4. reset.scr as boot.scr
5. x-loader image as x-load.bin.ift
$ cd beagledroid/kernel/arch/arm/boot
And rename the uImage file to uImage.bin and copy it to the SD card beagleboot dos partition
#!/bin/sh
cat <<EOF > normal.cmd
if fatload mmc 0 80200000 uImage.bin
then
echo ***** Kernel: /dev/mmcblk0p1/uImage.bin *****
else
echo ***** Kernel: /dev/mtd3 *****
nand read 80200000 280000 400000
fi
if fatload mmc 0 81600000 ramdisk.gz
then
echo ***** RootFS: /dev/mmcblk0p1/ramdisk.gz *****
setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/ram0 rw ramdisk_size=32768
initrd=0x81600000,32M'
else
echo ***** RootFS: /dev/mmcblk0p2 *****
setenv bootargs 'console=ttyS2,115200n8 noinitrd rootfstype=ext3 root=/dev/mmcblk0p2 rw rootdelay=1
nohz=off omapfb.video_mode=1280x720MR-24@60 init=/init androidboot.console=ttyS2'
fi
bootm 80200000
EOF
$ sh normal.sh
It will generate normal.cmd and normal.scr files. Copy these files to the SD card beagleboot
dos partition.
Now we have to copy the Android_RFS root file system to the other partition of the SD card.
$ ~/beagledroid/out/target/product/generic/Android_RFS cp -a
./* /media/disk
$ umount /media/beagleboot
$ umount /media/disk
Final Content of the SD card partitions:
SD card (2 GB SanDisk)
References:
http://source.android.com/download
http://labs.embinux.org/index.php/Android_Porting_Guide_to_Beagle_Board#Booting_Androi
d_on_board_from_MMC.2FSD
http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat
http://code.google.com/p/beagleboard/wiki/BeagleboardRevCValidation