Template:Container 4

From OMAPpedia

Jump to: navigation, search
Android Logov2.jpg
How to get started building your own binaries for the Android OS on your OMAP Platform
Overview Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 Step 9


Step 4

This page details instructions on how to build the Android filesystem and how to enable various options. If you don't have the Android source in order to continue, refer "Android Environment - Source versions and Manifest" in the main page


[edit] Starting the build

Copy the board buildspec.mk default file found under the vendor/ti/ directory to buildspec.mk at the top of your android root folder. This should setup a reasonable default for the board. Check and edit the file for additional options.

Example for OMAP4430/Blaze boards

cp -Rfp vendor/ti/nextgen/buildspec.mk.default buildspec.mk

Example for Zoom2 or Zoom3 boards

cp -Rfp vendor/ti/zoom2/buildspec.mk.default buildspec.mk

Example for zoom1(ldp) board

cp -Rfp vendor/ti/ldp1/buildspec.mk.default buildspec.mk

Build Android

$ make -j2

Note: On latest current build there are .mk conflicts and libaudio conflicts that require you to mv or rm vendor/ti/nextgen and hardware/ti/omap3/libaudio/.

Note: On x86_64 if you get a "/usr/bin/ld: skipping incompatible ... libstdc++.a" error you may need to create two symlinks -- "ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so" and "ln -s /usr/lib32/libgcc_s.so.1 /usr/lib32/libgcc_s.so". See [1]. I also found that I needed lib32z1-dev and lib32ncurses5-dev.

Note: This make step can be sped up by using make’s -j option to enable parallel execution. Recommended settings are: make -j8 for 2 x Quad Core CPU, make -j4 for either a Quad Core CPU or a 2 x Dual Core, make -j2 for a Dual Core CPU and make for a Single Core CPU.

Actually the -j# is creating the number of threads so the CPU can handle. Each thread will require about 1 GB of RAM. If your CPU is capable of handle 4 threads but you have 2 GB of RAM, the compile time will rise since your box will use Swapfile memory.

If you are not sure how many cores your system has type the following command:

$ cat /proc/cpuinfo

That will list the number of cores that your system has. Use -j* where * is the number of cores listed on /proc/cpuinfo.

[edit] Adding System Sounds

By default, many UI sounds are disabled To enable keyclicks:

1. Navigate to the Settings widget and open it.
2. Select "Sound & Display"
3. Select "Audible touch tones" to toggle on.
4. Select "Audible selection" to toggle on.

You can also select the default notification sound from this same menu. This should be heard at bootup and other system events.The current default is "Look At Me".

[edit] Arm Only Build Option

Note: If you wouldn't use TI's HW Accelerated codecs and would want to perform only an ARM build, please follow the below instructions

After repo sync perform the following steps:

Edit: “vendor/ti/zoom2/BoardConfig.mk”:

Uncomment  “USE_CAMERA_STUB := true” 
Comment “BOARD_USES_TI_CAMERA_HAL := true” 
Comment "HARDWARE_OMX := true”  

Doing so will not build the TI OMX components and Opencore will choose it’s own codecs instead.

[edit] SD media Support Option

Note: This only applies to releases L25.9 and lower

All media files (mp3, mp4, aac, etc...) should be loaded onto the boot partition of the SD card. The fix below allows Android to detect the media files that are located on the boot section of the SD. Without this fix Android will not be able to detect media files and will give an error "unable to find media content".

Edit the following file: mydroid/system/core/mountd/ AutoMount.c

--- a/system/core/mountd/ AutoMount.c
+++ b/system/core/mountd/ AutoMount.c       

    if (mp->state != kMounted && mp->state != kMounting && 
           access(mp->device, R_OK) == 0) {

-        if (DoMountDevice(mp->device, mp->mountPoint) == 0 ||
-            MountPartition(mp->device, mp->mountPoint) == 0)
+        if (MountPartition(mp->device, mp->mountPoint) == 0)         
             SetState(mp, kMounted);         

[edit] Creating Android's File System for SD card

$ cd ~/
$ mkdir myfs
$ cd myfs
$ cp -Rfp $MYDROID/kernel/android-2.6.32/drivers/misc/ti-st/*.ko $MYDROID/out/target/product/nextgen/root
$ cp -Rfp $MYDROID/out/target/product/nextgen/root/* .
$ cp -Rfp $MYDROID/out/target/product/nextgen/system/ .
$ cp -Rfp $MYDROID/out/target/product/nextgen/data/ .
$ cp -Rfp $MYDROID/vendor/ti/nextgen/init.omap4sdp.rc init.rc

To change default display resolution value to 240 do:

$ echo “ro.sf.lcd_density=240” >> system/build.prop

$ cd ~/
$ mkdir myfs
$ cd myfs
$ cp -Rfp $MYDROID/omap/drivers/usb/gadget/*.ko $MYDROID/out/target/product/zoom2/root
$ cp -Rfp $MYDROID/omap/drivers/misc/ti-st/*.ko $MYDROID/out/target/product/zoom2/root
$ cp -Rfp $MYDROID/out/target/product/zoom2/root/* .
$ cp -Rfp $MYDROID/out/target/product/zoom2/system/ .
$ cp -Rfp $MYDROID/out/target/product/zoom2/data/ .
$ mv init.rc init.rc.bak
$ cp -Rfp $MYDROID/vendor/ti/zoom2/omapzoom2-mmc.rc init.rc
$ cd ~/
$ mkdir myfs
$ cd myfs
$ cp -Rfp $MYDROID/out/target/product/zoom2/root/* .
$ cp -Rfp ${mydroid}/kernel/android-2.6.29/drivers/usb/gadget/*.ko .
$ cp -Rfp $MYDROID/out/target/product/zoom2/system/ . 
$ cp -Rfp $MYDROID/out/target/product/zoom2/data/ .
$ mv init.rc init.rc.bak 
$ cp -Rfp init.omapzoom2.rc init.rc 
$ cd myfs
$ sudo cp –Rfp * /media/FS
$ sudo chmod 777 -R /media/FS/*

Note: For LDP, the folder is out/target/product/ldp1; For init.rc, copy omapldpboard.rc

[edit] Creating Android's File System for NAND

$ cd $MYDROID/out/target/product
$ cp -Rfp zoom2 zoom2.bak
$ cd zoom2
$ rm -rf *.img
$ rm -rf obj/PACKAGING/systemimage_unopt_intermediates/system.img
$ cp ~/myfs/* $MYDROID/out/target/product/zoom2/root

Note: Ok to see warnings here. Above step is only to copy files and not folders

$ cp -Rfp ~/myfs/system/* $MYDROID/out/target/product/zoom2/system
$ cp -Rfp ~/myfs/data/* $MYDROID/out/target/product/zoom2/data
$ pico $MYDROID/out/target/product/zoom2/root/init.rc (And uncomment out the following lines (by removing the # sign):
“# mount yaffs2 mtd@system /system”
“# mount yaffs2 mtd@userdata /data nosuid nodev”
“# mount yaffs2 mtd@cache /cache nosuid nodev”
$ make -j2
$ cd ~/
$ mkdir myfs_NAND
$ cd myfs_NAND
$ cp $MYDROID/u-boot/tools/mkimage .
$ cp $MYDROID/omap/arch/arm/boot/zImage .
$ cp $MYDROID/out/target/product/zoom2/*.img .
$ cp $MYDROID/u-boot/u-boot.bin .
$ cp $MYDROID/x-loader/MLO .

You should create a txt file called /home/<user_name>/myfs_NAND/env.txt with the following text inside:

bootdelay 5
bootargs console=ttyS3,115200n8 rootdelay=1 init=/init omap_vout.video1_numbuffers=6 omap_vout.vid1_static_vrfb_alloc=y omapfb.vram=0:4M
bootcmd nand unlock; nand read.i 81c00000 ${kernel_nand_offset} ${kernel_nand_size}; bootm 81c00000

Create an uMulti image by doing:

$ cd ~/myfs_NAND
$ sudo ./mkimage -A arm -O linux -T multi -C none -a 0x80008000 -e 0x80008000 -n 'L25.11' -d ./zImage:./ramdisk.img uMulti-2

[edit] How to

[edit] Opening and changing files in ramdisk.img for debugging

A ramdisk is basically a small filesystem containing the core files needed to initialize the system. It includes the critical init process, as well as init.rc, which is where you can set many system-wide properties. If you really want to know more about it, here is the documentation. Here's a list of files on a typical ramdisk:


Here are the steps to open, edit and create a new ramdisk.img

       # cp ramdisk.img ramdisk.cpio.gz
       # gzip -d ramdisk.cpio.gz
       # mkdir tmp
       # cd tmp
       # cp -Rfp ../ramdisk.cpio .

       # cpio -i -F ramdisk.cpio
       < Make your changes in RAMDISK files>
       # rm ramdisk.cpio
# cpio -i -t -F ../ramdisk.cpio | cpio -o -H newc -O ../ramdisk_new.cpio

Note that in last step: The command includes two O's. First o is lower-case, second is up-case. ramdisk.cpio in up folder of tmp folder. The command needs it there.

         # cd ..
         # rm -rf ramdisk.cpio
         # mv ramdisk_new.cpio ramdisk.cpio
         # gzip ramdisk.cpio
       < Make your changes in RAMDISK files>
       # cp ramdisk.cpio.gz ramdisk.img

[edit] Opening system.img for debugging using UNYAFFS tool

Using unyaffs

The Android OS makes use of a yaffs file system. You can download the unyaffs tool to extract the content of an Android image. There is a prebuildversion available at the Downloads section. Place the unyaffs tool inside the ~/bin directory so that the tool can be found because it is inside the PATH definition

When the unyaffs is downloaded, make sure it can be executed

       # cd ~/bin
       # chmod a+x unyaffs

To open the system.img you can use the command below

       # mkdir tmp
       # cd tmp 
       # sudo ~/bin/unyaffs <path_to_system.img>

Once you do this you will see the files/folders below


Left arrow1.png Android Logov2.jpg Right arrow1.png
Previous Home Next
Personal tools