Monday, June 14, 2010

Android with database

It seems Android has own database sqlite. But sqlite is a self contained database, which means the database is on the local computer one. To pull information from internet, one have to use mysql server. Android will be able to pull the information out through PHP, which I have no clue at this moment.

To install MySQL on the ubuntu, use the following commands:

===============
sudo apt-get install mysql-server php5-mysql
===============

Then, you can use the following command to check the server status.

===============
mysql -u root -p
===============

The following command will create a database "pager" and give all the right to user "setup"

===============
mysql -u root -p

mysql> create database pager;
Query OK, 1 row affected (0.00 sec)

mysql> grant usage on *.* to setup@localhost identified by 'your password here';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on pager.* to setup@localhost;
Query OK, 0 rows affected (0.00 sec)
===============

Once the database is setup, you can check the following tutorial.

http://dev.mysql.com/doc/refman/5.0/en/tutorial.html

To make php to work, you might need phpmyadmin

===============
sudo phpmyadmin
===============

Further mysql setup is on
http://www.phpf1.com/tutorial/php-mysql-tutorial.html?page=5


\

Thursday, June 10, 2010

Android theme

/system/app/Launcher.apk is actually the theme file. Unzip the file and you can find the icon, color and font setup. You can change that package and upload to change your theme.

Boot animation

put your animation files as /data/local/bootanimation.zip

If this file does not exist, another animation will be displayed, which I have not found it yet.

Now, create desc.txt file and type the following…

* 480 427 30
p 1 0 part0
p 0 10 part1

Here is what the desc.txt file does and mean.

* 480 – stretched width of the animation
* 427 – stretched height of the animation
* 30p – this controlled the speed of both parts of the animation
* 1 – this defined how many times part0 of the animation looped
* 0 – saw no change when altering this number
* part0 – folder containing first part of the animation
* p – this was a bit confusing as there is no space between the words “part0″ & the “p”. I tried adding a space and changing this number -> “part0 30p”. I expected this to change the speed of the second part of the animation, but there was no change as far as I could tell.
* 0 – this defined the number of times part1 of the animation looped (0=infinite)
* 10 – saw no change when altering this number
* part1 – folder containing second part of the animation

Reset NAND

You can use "saveenv" to save the uboot environment, for example, bootdelay. Once you saved it, uboot will use that environment every time. To erease that NAND section, you can use the following command.

==============
nand unlock 0x260000 0x20000
nand erase 0x260000 0x20000
reset
==============

Friday, June 4, 2010

Add ethernet on boot

To enable ethernet on boot, there are several things you need to setup.

0. At one point, someone from online said put "ip=dhcp" in the bootarg. That actually does not work very well. You have to remove that if you have it in your u-boot.

1. The kernel section should enable the ethernet driver.

The following setup are actually in init.rc file:

2. There should be a line to bring up eth0 on boot

==============
# Bring up the eth0 interface
ifup eth0
# Setup the DNS server configuration.
setprop net.dns1 134.129.111.111
==============

3. Start up the netcfg service

==============
service ethernet /system/bin/netcfg eth0 dhcp
user root
==============

4. If the network does not work, you might want to add the following code

==============
service dhcpcdusb0 /system/bin/dhcpcd -o domain_name_servers -B eth0
user root
==============

Thursday, June 3, 2010

Get nano on android

==============
wget http://content.modaco.net/dropzone/nano.android.zip
wget http://content.modaco.net/dropzone/terminfo.zip
adb push terminfo /system/etc/terminfo
adb push nano /system/bin
adb shell
su
export TERMINFO=/system/etc/terminfo
export TERM=linux
==============

The above steps put terminal information in /system/etc/. The nano can not save at this moment.

Connected to Beagleboard

The beagleboard has an adb server running once it boot up. To connect to the beagleboard, you can use the adb commend on the host computer.

===============
adb connect 134.129.xxx.xxx:5555
adb devices
===============

Once it shows a device, you can use that device name. For example,

===============
adb -s 134.129.xxx.xxx:5555 shell
===============

will open up a shell on the beagleboard.

To install a package to the beagleboard, you can use the following command.
===============
adb -s 134.129.xxx.xxx:5555 install -r Entertainment1.5.apk
===============

If success, the terminal will show something like:

===============
210 KB/s (12897 bytes in 0.059s)
pkg: /data/local/tmp/Entertainment1.5.apk
Success
===============

If that device is the only device, you can copy file to the beagleboard by the following command, that will copy the current nano to beagleboard /system/bin directory.

===============
adb push nano /system/bin/nano
===============

Build Android filesystem

The files downloaded from 0xlab are modified. Here is how it works now.

1. U-boot: u-boot can be version as long as it detect C4 board. You can use "saveenv" to save boot options to NAND. At least the delay time was saved. The following code should be used to pass the boot option to kernel.

==============
"mmcargs=setenv bootargs console=${console} " \
"init=/init " \
"rootwait " \
"vram=${vram} " \
"omapfb.mode=640x480MR-16@60 " \
"omapfb.debug=y " \
"omapdss.def_disp=${defaultdisplay} " \
"root=${mmcroot} " \
"rootfstype=${mmcrootfstype}\0" \
==============


2. Kernel: The kernel file can be downloaded from http://gitorious.org/0xlab-kernel. The only thing you need to change is the boot option.

==============
CONFIG_CMDLINE="root=/dev/mmcblk0p2 init=/init rw console=ttyS2,115200n8"
==============

That will set the root to the SD card.

3. Root file system: Zipped root file system from 0xlab works fine. The compiled system does not work very well at this moment.

Wednesday, June 2, 2010

repo sync error

sync stopped at 61%, solved by the following.

also have the same problem and I solved it by modifying manually
the .repo/manifests/default.xml file:
fetch="git://gitorious.org/0xdroid/" #instead of
fetch="git://git.0xlab.org/"
review="0xlab.org" />

Tuesday, June 1, 2010

Add eth0

=================
netcfg
netcfg eth0 dhcp
setprop net.dns1 134.129.111.111
=================

Boot procedure

The prebuilt image works fine. My kernel and rootfs do not boot. The kernel can not find the files system. It seems the kernel boot option needs to be set up to boot from "root=/dev/mmcblk0p2". I kernel option I found is:

===============
root=/dev/mmcblk0p2 init=/init rw console=ttyS2,115200n8
===============


I am trying my own rootfs with prebuilt kernel. More will follow

Monday, May 31, 2010

Compile kernel

git clone git://gitorious.org/0xlab-kernel/kernel.git
git checkout -b kernel_omap3 origin/omap3
make omap3_beagle_defconfig

boot option (to start from SD card)
===============
root=/dev/mmcblk0p2 init=/init rw console=ttyS2,115200n8
===============

make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- uImage

Compile u-boot

U-Boot is the interface between X-loader and Kernel Image. Wrong u-Boot could disable your USB port and other things. If you want to use GPIO, you can also enable GPIO in u-Boot. The beagleboard x-loader looks for u-boot.bin file on your MMC card. If none was found, the beagleboard will use the default NAND u-boot.bin file, which could have the USB disabled.


Modify the file

===============
pico ./include/configs/omap3_beagle.h
make omap3_beagle_config
make
===============

Make from source

before you make, you need a buildspec.mk file to speicify the beagleboard.

===================
echo "TARGET_PRODUCT := beagleboard" > buildspec.mk
echo “INSTALL_PREBUILT_DEMO_APKS := true” >> buildspec.mk
===================

Then use:

===================
make -j2
===================

The output of the make is a root file system in out/target/product/beagleboard/system.img


===================
* Format the first partition over than 100MB with VFAT on a SD card.
* Download the installer uImage.bin
* Rename out/target/product/beagleboard/system.img to android-beagle.ubi
* Rename arch/arm/boot/uImage to 0xkernel-beagle.bin
* Copy above three files into the first partition of SD/MMC card
* Plug the SD card in Beagle board SD slot and restart the Beagleboard
* Wait for UI installer over. The installer would perform NAND flashing and u-boot environment setup.
* Unplug SD card from the Beagleboard and reboot
* Enjoy!
===================

Sunday, May 30, 2010

More clear picture

After search more a little bit, it seems the Zoom is another device from TI. Even Zoom uses the omap processor, it has a different structure than the beagleboard. Therefore, the source code I downloaded for the Zoom can not be used for beagleboard.

The 0xdroid has been working. I am going to keep using that platform for development. All the source code are:

http://code.google.com/p/0xdroid/wiki/Source

It provided an installer called uImage.bin. After an u-boot is loaded, the uImage is loaded since u-boot thinks it's a kernel. The downloaded uImage.bin is actually more than a kernel. It also flash the u-boot to NAND.

If you want the normal ubuntu boot up with x-loader, u-boot, uImage and root file system, here is how to set up the u-boot for the correct kernel command.

http://code.google.com/p/0xdroid/wiki/boot_nand

The u-boot and kernel information can be found at:

http://gitorious.org/0xlab-kernel

Friday, May 28, 2010

More android source

http://elinux.org/Android_on_OMAP
http://discuz-android.blogspot.com/2008/01/extract-google-android-file-system.html
http://wiki.kldp.org/wiki.php/AndroidPortingOnRealTarget
http://bs-android.seesaa.net/article/121303869.html
http://groups.google.com/group/rowboat/browse_thread/thread/825b5fa1142333a0
http://developer.android.com/resources/tutorials/testing/activity_test.html
http://www.yuan.se/?p=32
http://groups.google.com/group/0xlab-discuss/browse_thread/thread/35bc7fc86ab12d53/4cb21c93cf0daeed

Wednesday, May 26, 2010

More about Android

Just found out Android, like linux, has many distribution. One of them is called 0xdroid. It is easy to use and seems to have some documents.

To build Android from scratch, you can check the following link.

http://code.google.com/p/0xdroid/wiki/Source

However, I am still confused about the u-boot.bin.

Latest x-load and u-boot:

http://gitorious.org/beagleboard-validation/

Friday, May 21, 2010

Switch to andriod

Due to the need for another project I will explore Andriod.

There are sources I am checking out. The second one is a little bit outdated.

http://omappedia.org/wiki/Android_Getting_Started#Accessing_Source_Code
http://omappedia.org/wiki/Android_Video_Run_From_SD_Tutorial

I followed the steps installed all the required software.

===================
sudo apt-get install git-core flex bison gperf libesd0-dev
sudo apt-get install libwxgtk2.6-dev zlib1g-dev build-essential
sudo apt-get install libstdc++5 tofrodos libsdl-dev zip curl x-dev
sudo apt-get install libx11-dev libncurses5-dev sun-java5-jdk libc6-dev g++ gcc
===================

The second step is to install the cross compile. Since I used OpenEmbedded. I will keep the OE CC tool for now.

The Andriod uses repo, a tool similar to git. Unlike the above page, I move the repo tool to /usr/bin so I don't have to update my $PATH

===================
curl http://android.git.kernel.org/repo >~/repo
chmod a+x ~/repo
sudo mv repo /usr/bin
===================

Next get the source code. For different source code branches, you can check out: http://git.omapzoom.org/?p=platform/omapmanifest.git;a=summary

===================
mkdir andriod
cd andriod
repo init -u git://git.omapzoom.org/repo/android/platform/omapmanifest.git
repo sync
===================

After a long time ......
You can start build u-boot and x-loader

===================
cd ~/andriod/bootable/bootloader/uboot
make omap3430zoom2_config
make
===================

xloader
===================
cd ~/andriod/bootable/bootloader/x-loader
make omap3430zoom2_config
make
make ift
===================



How to clone kernel source:

===================
git clone git://git.omapzoom.org/kernel/omap.git /home/setup/android/kernel/
cd /home/setup/android/kernel/
git checkout --track origin/android-omap-2.6.32 -b android-omap-2.6.32
git pull
make omap_zoom3_defconfig
make uImage
===================

If you have an error, try the following branch.
git checkout --track origin/p-android-omap-2.6.32 -b p-android-omap-2.6.32

If you don't have mkimage, it's in ~/andriod/bootable/bootloader/u-boot/tools. You can add the path or copy it to /usr/bin