BeagleBone Black之上Android的安装

本文档详述了如何在BeagleBone Black(BBB)上安装Android的操作过程,包括获取源代码、编译Android内核、U-Boot、Android文件系统的编译以及最终的安装步骤。主要涉及的工具有repo、gcc交叉编译器、U-Boot的v2013.04版本等。尽管最后安装未成功,作者提供了可能存在的问题和解决建议,对于尝试在BBB上运行Android的读者有一定参考价值。

如下所述,将适于BeagleBone Black之上的Android的编译,安装方法记述如下。

参考网站:http://icculus.org/~hendersa/android/

 

1. 获取用于BBB的Android的源代码

(1) mkdir rowboat-android

(2) cd rowboat-android

(3) repo init -u git://gitorious.org/rowboat/manifest.git -m rowboat-jb-am335x.xml

(4) repo sync

 

2. 获取Android Kernel

此处将采用Robert Nelson's 3.8.x kernel tree,参考网站:http://www.eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-LinuxKernel

 (1) git clone git://github.com/RobertCNelson/linux-dev.git

(2)cd linux-dev/

(3)git checkout origin/am33x-v3.8-b tmp

(4)./build_kernel.sh

编译中,自动出现的内核编译选项画面,如下设置:

 

                  

 

                  

 

                  

 

                  

 

保存设置退出,编译会自动进行,直至完成。               

在编译过程中如果出现任何错误,参照提示操作即可。

 

3. U-Boot

U-Boot需要v2013.04,如下下载安装:

(1)git clone git://git.denx.de/u-boot.git

(2)cd u-boot/

(3)git checkout v2013.04 -b tmp

(3)wget https://raw.github.com/eewiki/u-boot-patches/master/v2013.04/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

(4)patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

 编译U-Boot (/home/user指的是用户的根目录)

(1) cd u-boot/

(2) make ARCH=arm CROSS_COMPILE=/home/user/linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf- distclean

(3) make ARCH=arm CROSS_COMPILE=/home/user/linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf- am335x_evm_config

(4) make ARCH=arm CROSS_COMPILE=/home/user/linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-

 

4. Android文件系统编译

如上,现在已经编译完毕内核,现在准备编译Android文件系统。Rowboat自带的kernel是3.2的,因此需要做以下的修改:

(1) cd rowboat-android

(2) mv kernel kernel.backup

(3) ln -s /home/user/linux-dev/KERNEL kernel

(4) 修改Makefile

     [1] chmod 644 Makefile

     [2] 在Makefile中找到以下一行,

          export PATH :=$(PATH):$(ANDROID_INSTALL_DIR)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin

          在其前部加上“#”号,将其注释掉,然后改成以下内容:

          export PATH :=/home/user/linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin:$(PATH)

          export CC_PREFIX := arm-linux-gnueabihf-

     [3] 将Makefile中的全部"arm-eabi-"替换成"$(CC_PREFIX)",

          %s/arm-eabi-/$(CC_PREFIX)/g

(5) 编译

      make -j4 TARGET_PRODUCT=beagleboneblack OMAPES=4.x droid

 

(6) Build根文件系统

    [1] cd out/target/product/beagleboneblack

    [2] mkdir android_rootfs

    [3] cp -r root/* android_rootfs

    [4] cp -r system android_rootfs

    [5] cd android_rootfs/system

    [6] tar -xvzf /home/user/linux-dev/deploy/*modules.tar.gz

    [7] 在out/target/product/beagleboneblack目录下,备份android_rootfs/init.rc文件,然后打开文件做以下修改:

        将import /init.${ro.hardware}.rc改为import /init.am335xevm.rc

    [8] 备份android_rootfs/fstab.am335xevm文件,打开文件做以下修改:

        将/dev/block/platform/omap/omap_hsmmc.0/mmcblk0p3 改为

           /dev/block/mmcblk0p3

    [9] 打开android_rootfs/system/build.prop文件,在文件最下方添加以下两行:

          debug.egl.hw=0

          video.accelerate.hw=0

    [10] 在out/target/product/beagleboneblack目录下,执行以下命令:

         sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

 

5. 安装

    现在需要将上面所做的文件汇总,写入micro SD。

(1) mkdir image

(2) cp rowboat-android/external/ti_android_utilities/am335x/mk-mmc/* image

(3) cp rowboat-android/out/target/product/beagleboneblack/rootfs.tar.bz2 image

(4) cp u-boot/MLO image

(5) cp u-boot/u-boot.img image

(6) cp linux-dev/KERNEL/arch/arm/boot/zImage image

(7) cp linux-dev/KERNEL/arch/arm/boot/dts/am335x-boneblack.dtb image

(8) 按以下内容创建文件 image/uEnv.txt

         kernel_file=zImage

        console=ttyO0,115200n8

        mmcroot=/dev/mmcblk0p2 rw

        mmcrootfstype=ext4 rootwait

        loadkernel=load mmc ${mmcdev}:${mmcpart} 0x80200000 ${kernel_file}

        loadfdt=load mmc ${mmcdev}:${mmcpart} 0x815f0000 ${fdtfile}

        boot_ftd=run loadkernel; run loadfd

        tmmcargs=setenv bootargs consoleblank=0 console=${console} androidboot.console=ttyO0 mem=512M root=${mmcroot} rootfstype=${mmcrootfstype} init=/init ip=off video=720x480-16@60 qemu=1 vt.global_cursor_default=0

       uenvcmd=run boot_ftd; run mmcargs; bootz 0x80200000 - 0x815f0000

(9) 使用sudo fdisk -l命令来确认micro SD的设备号,比如是/dev/sdb

     [1] cd image

     [2] sudo ./mkmmc-android.sh /dev/sdb MLO u-boot.img zImage uEnv.txt rootfs.tar.bz2

(10) mount SD 的boot分区,这里是/dev/sdb1到image/boot里

     sudo mount /dev/sdb1 image/boot

(11) 执行以下命令

     [1] cd media/boot

     [2] sudo mv uImage zImage

     [3] sudo cp /home/user/image/am335x-boneblack.dtb .

     [4] sync

umount SD卡,插入BBB,启动,安装完成。

不过不幸的是,并未成功,led0,led1,led2三个灯常亮,启动失败。

 追记:

一年以来,并无时间再去研究android的安装启动。不过,据最近在BBB上制作Ubuntu启动包的经验,似乎问题出在uEnv文件上。

也即uEnv文件有错误。比如在Windows上编辑过,就需要删除每一行末尾的那个^M。

希望对尝试者有所帮助。



Title: Android for the BeagleBone Black Author: Andrew Henderson, Aravind Prakash Length: 120 pages Edition: 1 Language: English Publisher: Packt Publishing Publication Date: 2015-02-27 ISBN-10: 1784392162 ISBN-13: 9781784392161 Design and implement Android apps that interface with your own custom hardware circuits and the BeagleBone Black About This Book Design custom apps that interact with the outside world via BeagleBone Black Modify Android to recognize, configure, and communicate with sensors, LEDs, memory, and more A step-by-step guide full of practical Android app examples that will help the users to create Android controlled devices that will use BeagleBone as hardware Who This Book Is For If you are an Android app developer who wants to experiment with the hardware capabilities of the BeagleBone Black platform, then this book is ideal for you. You are expected to have basic knowledge of developing Android apps but no prior hardware experience is required. In Detail This book explores using the Android OS on the BeagleBone Black hardware platform and provides an introduction to Android's unique approach to hardware interfacing. You'll be walked through the process of installing and configuring Android on your BeagleBone Black, as well as preparing your PC development environment to create Android applications that directly interface with hardware devices. Several example projects within this book introduce you to using the GPIO, SPI, and I2C hardware interfaces of the BeagleBone Black. You'll create Android apps that communicate directly with actual hardware components such as sensors, memory chips, switches, and LEDs. Step-by-step guidance through both the software and hardware portions of these projects is provided. Combining all of the previous projects into a single project that uses GPIO, SPI, and I2C together, you will explore the details of creating an advanced hardware interfacing app. Finally, you'll be provided with information on transitioning prototype code into code suitable for deployment on an Android-based device. With a variety of example apps that demonstrate key hardware communication concepts, this book will help you become an Android hardware interfacing pro in no time. Table of Contents Chapter 1. Introduction to Android and the BeagleBone Black Chapter 2. Interfacing with Android Chapter 3. Handling Inputs and Outputs with GPIOs Chapter 4. Storing and Retrieving Data with I2C Chapter 5. Interfacing with High-speed Sensors Using SPI Chapter 6. Creating a Complete Interfacing Solution Chapter 7. Where to Go from Here
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值