登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

wonview的博客

 
 
 

日志

 
 

Android-Cupcake porting guide to BeagleBoard  

2010-05-30 06:47:11|  分类: embedded linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Android-Cupcake porting guide to BeagleBoard

From labs.embinux.org

Jump to: navigation, search

Contents

[hide]

Download Android build for Beagle Cupcake stable

Browse git

$ mkdir ~/Android_build
$ cd ~/Android_build
$ repo init -u git://labs.embinux.org/embinux-android-build/android-omap3/repo/android/platform/manifest.git -b beagle-cupcake
$ repo sync
$ make

Note: For complete info on repo check following links

  1. http://source.android.com/download
  2. http://source.android.com/download/using-repo

Compile Kernel

Kernel is located at

<Android_Build>/kernel

Set Environment variable $CC_PATH to toolchain path

$ export CC_PATH=/opt/arm-2007q3/bin/arm-none-linux-gnueabi-
$ cd <Android_Build>/kernel
$ ../vendor/embinux/support-tools/beagle_build_kernel.sh

Android's Root File System (RFS)

After build compilation , RFS is generated at

~/Android_build/out/target/product/generic
$ cd ~/Android_build/out/target/product/generic

Create Android_RFS directory and copy contents

$ mkdir ~/Android_RFS
$ cp -a root/* ~/Android_RFS
$ cp -a data/* ~/Android_RFS/data/
$ cp -a system/* ~/Android_RFS/system/

Key Mapping

Keyboard Key      Android Event
ESC Back
Right Window Menu
Page up Volume up
Page down Volume down
Left Window Power
Scroll lock Explorer
Right arrow DPAD
Left arrow DPAD left
Up arrow DPAD up
Down arrow DPAD down
Enter Enter
Home Home
Tab Tab
Note:- Along with above keys alphabetical characters & digit keys are mapped.

Ownership & Permissions

Modify ownership and permissions

$ cd ~/Android_RFS
$ sudo chown -R root.root *
$ sudo chmod -R 777 *

Booting Android on board from MMC/SD

Create two partitions on MMC/SD

  1. FAT
  2. ext3
  • For more information check here

Kernel Arguments:-

console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 video=omapfb.mode=dvi:1280x720MR-24@50 init=/init rootfstype=ext3 rw rootdelay=1 nohz=off androidboot.console=ttyS2
  • Pass appropriate video mode for your display. Check following link for more information 1 & 2.

Debugging Android

Execute below command from shell

$logcat

Check if you can find *.dex files of android apps in /data/dalvik-cache

Enabling Network

Connect eth0 interface to usb hub via ethernet to usb converter

Edit init.rc

<Android_RFS>/init.rc
# basic network init
setprop net.dns1 <primary-dns-server-ip>

Boot Beagle board Execute following commands from minicom

$netcfg eth0 up
$netcfg eth0 dhcp

NOTE:- Enable appropriate driver for your "ethernet to usb converter" in kernel. Driver can be found at :-

│ -> DeviceDrivers ││ -> Network device support (NETDEVICES[=y]) ││ -> USB Network Adapters








  LinuxBootDiskFormat  
How to create a dual-partition card for BeagleBoard to boot Linux from first partition and have root file system at second partition.

Introduction?

This guide is meant for those looking to create a dual-partition card, booting from a FAT partition that can be read by the OMAP3 ROM bootloader and Linux/Windows, then utilizing an ext3 partition for the Linux root file system.

Details?

Text marked with shows user input.

Determine which device the SD Card Reader is on your system?

Plug the SD Card into the SD Card Reader and then plug the SD Card Reader into your system. After doing that, do the following to determine which device it is on your system.

$ [dmesg | tail]
...
[ 6854.215650] sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
[ 6854.215653] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[ 6854.215659]  sdc: sdc1
[ 6854.218079] sd 7:0:0:0: [sdc] Attached SCSI removable disk
[ 6854.218135] sd 7:0:0:0: Attached scsi generic sg2 type 0
...

In this case, it shows up as /dev/sdc (note sdc inside the square brackets above).

Check to see if the automounter has mounted the SD Card?

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
...

Note the "Mounted on" field in the above and use that name in the umount commands below.

If so, unmount it?

$ [umount /media/disk]

Start fdisk?

Be sure to choose the whole device (/dev/sdc), not a single partition (/dev/sdc1).

$ [sudo fdisk /dev/sdc]

Print the partition record?

So you know your starting point. Make sure to write down the number of bytes on the card (in this example, 2021654528).

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         246     1974240+   c  W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
     phys
=(244, 254, 63) logical=(245, 200, 19)

Delete any partitions that are there already?

Command (m for help): [d]
Selected partition 1

Set the Geometry of the SD Card?

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:

  • Go into expert mode.
Command (m for help): [x]
  • Set the number of heads to 255.
Expert Command (m for help): [h]
Number of heads (1-256, default xxx): [255]
  • Set the number of sectors to 63.
Expert Command (m for help): [s]
Number of sectors (1-63, default xxx): [63]
  • Now Calculate the number of Cylinders for your 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).
  • Set the number of cylinders to the number calculated.
Expert Command (m for help): [c]
Number of cylinders (1-256, default xxx): [enter the number you calculated]
  • Return to Normal mode.
Expert Command (m for help): [r]

Print the partition record to check your work?

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   
Device Boot      Start         End      Blocks   Id  System

Create the FAT32 partition for booting and transferring files from Windows?

Command (m for help): [n]
Command action
   e   extended
   p   primary partition
(1-4)
[p]
Partition number (1-4): [1]
First cylinder (1-245, default 1): [(press Enter)]
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): [+50]

Command (m for help): [t]
Selected partition 1
Hex code (type L to list codes): [c]
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Mark it as bootable?

Command (m for help): [a]
Partition number (1-4): [1]

Create the Linux partition for the root file system?

Command (m for help): [n]
Command action
   e   extended
   p   primary partition
(1-4)
[p]
Partition number (1-4): [2]
First cylinder (52-245, default 52): [(press Enter)]
Using default value 52
Last cylinder or +size or +sizeM or +sizeK (52-245, default 245): [(press Enter)]
Using default value 245

Print to Check Your Work?

Command (m for help): [p]

Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          51      409626    c  W95 FAT32 (LBA)
/dev/sdc2              52         245     1558305   83  Linux

Save the new partition records on the SD Card?

This is an important step. All the work up to now has been temporary.

Command (m for help): [w]
The partition table has been altered!

Calling ioctl() to re-read partition table.

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.

WARNING
: If you have created or modified any DOS 6.x
partitions
, please see the fdisk manual page for additional
information
.
Syncing disks.

Format the partitions?

The two partitions are given the volume names LABEL1 and LABEL2 by these commands. You can substitute your own volume labels.

$ [sudo mkfs.msdos -F 32 /dev/sdc1 -n LABEL1]
mkfs
.msdos 2.11 (12 Mar 2005)

$
[sudo mkfs.ext3 -L LABEL2 /dev/sdc2]
mke2fs
1.40-WIP (14-Nov-2006)
Filesystem label=
OS type
: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
195072 inodes, 389576 blocks
19478 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
       
32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information:

Bootloader settings?

If you use bootloader U-Boot, use following settings to mount root file system at second partition from kernel:

console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1






















Building Android on Beagle

Posted by Michael Opdenacker on June 4th, 2009 (rss, trackback)
Tags: beagle

Beagle boardUpdated instructions to use Android on the Beagle board

These instructions are derived from Embinux.org’s Android Porting Guide to Beagle Board, based on their work to port Android on the Beagle board. They correct multiple inaccuracies in this guide, and also add many useful details.

These instructions were tested on xubuntu 9.04. There shouldn’t be many differences if you use other recent Ubuntu or Debian versions.

Install needed software packages

At the time of this writing, note that Android requires Sun’s Java5 JDK, and doesn’t support the Java6 one.

apt-get update apt-get dist-upgrade apt-get install git-core bison sun-java5-jdk flex g++ zlib1g-dev apt-get install libx11-dev libncurses5-dev gperf uboot-mkimage

Android also uses its own repo script as a git front-end:

mkdir -p ~/bin cd ~/bin wget http://android.git.kernel.org/repo chmod +x repo

We are also going to need a 2007q3 toolchain from Code Sourcery

cd wget http://www.codesourcery.com/sgpp/lite/arm/portal/package1787/public/arm-none-linux-gnueabi/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 cd /opt sudo tar jxf arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

You could also get this toolchain from our website:

cd wget http://free-electrons.com/pub/demos/beagleboard/android/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.lzma cd /opt sudo tar --lzma -xf ~/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.lzma Download sources

Our instructions create a directory in your home directory, but of course, it can be placed anywhere!

mkdir ~/beagledroid cd ~/beagledroid repo init -u git://labs.embinux.org/repo/android/platform/beaglemanifest.git/ repo sync

Caution: this can take a lot of time, as this downloads and extracts 2.4 GB of data. On a fast workstation with a 500KB/s Internet connection, it took about 90 minutes.

If your corporate network doesn’t let you use the git protocol, you can use our snapshot available on http://free-electrons.com/pub/demos/beagleboard/android/:

cd tar --lzma -xvf beagledroid-git-20090603.tar.lzma Building Androidmake

If your workstation has multiple CPUs, you could save a lot of time by running multiple jobs in parallel:

make -j 4

On our machine, this took about 4 hours!

Building the kernelexport CC_PATH=/opt/arm-2007q3/bin/arm-none-linux-gnueabi- cd ~/beagledroid/kernel ../vendor/embinux/support-tools/beagle_build_kernel.sh Copying the Android root filesystem

Android’s root file system is generated in ~/beagledroid/out/target/product/generic

cd ~/beagledroid/out/target/product/generic mkdir ~/beagledroid/rootfs cp -a root/* ~/beagledroid/rootfs/ cp -a system/* ~/beagledroid/rootfs/system/ cd ~/beagledroid/rootfs sudo chown -R root.root . sudo chmod -R a+rwX data system Formatting an MMC/SD card

First connect your card reader to your workstation, with the MMC/SD card inside. Type the dmesg command to see which device is used by your workstation. Let’s assume that this device is /dev/sdb

Type the mount command to check your currently mounted partitions. If MMC/SD partitions are mounted, unmount them.

In a terminal edit partitions with fdisk:

sudo fdisk /dev/sdb

Delete any existing partition with the d command.

Now, create the boot partition:

Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-239, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-239, default 239): +64M

Change its type to FAT32:

Command (m for help): t Selected partition 1 Hex code (type L to list codes): c Changed system type of partition 1 to c (W95 FAT32 (LBA))

Using the n command again, create a second partition filling up the rest of your card (just accept default values).

Now, format the partitions in your card:

sudo mkfs.vfat -n beagleboot -F 32 /dev/sdb1 sudo mkfs.ext3 /dev/sdb2

Remove and insert your card again. Your new partitions should be mounted automatically.

Copying data to the MMC/SD card

Start by copying the X-loader and U-boot on the first partition.

cd /media/beagleboot wget http://free-electrons.com/pub/demos/beagleboard/android/MLO http://free-electrons.com/pub/demos/beagleboard/android/u-boot.bin cp ~/beagledroid/kernel/arch/arm/boot/uImage .

Now copy the Android root filesystem to the second partition (assuming it is mounted on /media/disk:

sudo rsync -a ~/beagledroid/rootfs/ /media/disk/

Finish by unmounting your MMC/SD partitions:

sudo umount /media/beagleboot sudo umount /media/disk Boot setup

The last thing left to do is to specify how the board boots Linux.

Plug the Beagle board on your computer, and also connect it to a DVI-D monitor. Start minicom (corresponding to Hyperterminal in Windows) on /dev/ttyS0, or on /dev/ttyUSB0 if you are using a serial to USB adapter. Power up the board.

First, stop Minicom from truncating long lines by typing [Ctrl] [a] followed by z and w.

In the U-boot prompt, make the board boot automatically on the MMC/SD card:

setenv bootcmd 'mmc init;fatload mmc 0 80000000 uImage;bootm 80000000' saveenv

Now set the kernel command line arguments:

setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 video=omapfb.mode=dvi:1280x720MR-24@50 init=/init rootfstype=ext3 rw rootdelay=1 nohz=off androidboot.console=ttyS2

You may need to adapt the video settings to the capabilities of your DVI display. You should now see Android boot!

11 Responses
  1. Sanjeev Kumar Verma says:

    I have downloaded the snapshot view from http://free-electrons.com/pub/demos/beagleboard/android/ which is in tar.tat format. I am not able to uncompress it. Pleawe help
    I have downloaded the following:
    arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.tar
    beagledroid-git-20090603.tar.tar

    • mike says:

      Hi Sanjeev,

      Are you using Windows to extract these archives? In this case, we can’t help you?

      If you use GNU/Linux, you will find examples about how to use wget to download these files and how to extract the .tar.lzma archives. That’s what we recommend.

      Good luck,

      Cheers,

      Michael.

  2. sany says:

    Hi…i am not able to run the uImage obtained through the snapshot on our Beagle board.It says unsupported kernel image…what could be the problem?Please help!

    • mike says:

      Hi Sany,

      Try to run the following command:
      mkimage -l ~/beagledroid/kernel/arch/arm/boot/uImage

      … and give us the output (if you use Debian or Ubuntu, you may need the uboot-mkimage package). This way, we will be able to check whether the image looks correct or not.

      Here’s what we got:

      Image Name: Linux-2.6.29-omap1-07174-g7fbc41
      Created: Mon Jun 1 17:37:32 2009
      Image Type: ARM Linux Kernel Image (uncompressed)
      Data Size: 1913608 Bytes = 1868.76 kB = 1.82 MB
      Load Address: 0×80008000
      Entry Point: 0×80008000

      Cheers,
      Michael.

  3. sany says:

    My output was ,

    mkimage: Bad Magic Number: “uImage” is no valid image

  4. Ice7 says:

    Thank you for this guide. I was able to build Android for Beagle Board painlessly just following your instructions. I spent a day wrestling with the original Embinux guide to no avail.

  5. gambler says:

    I have downloaded the snapshot view from http://free-electrons.com/pub/demos/beagleboard/android/ which is in tar.lzma format.

    I have downloaded the following:
    beagledroid-git-20090603.tar.lzma

    When i try to uncompress, it give me the following errors:
    EOF in archive
    tar: Unexpected EOF in archive
    tar: Error is not recoverable: exiting now

    Please help…

  评论这张
 
阅读(3176)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018