Chinaunix首页 | 论坛 | 博客
  • 博客访问: 387755
  • 博文数量: 120
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 741
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-27 18:15
文章分类

全部博文(120)

文章存档

2016年(13)

2015年(41)

2014年(66)

我的朋友

分类: Android平台

2014-08-11 23:54:43

一.CubieTruck烧写说明
1.linux下用LiveSuit整机烧写
  1.  a.下载 LiveSuit
  2.     http://docs.cubieboard.org/tutorials/common/livesuit_installation_guide
  3.  b. 安装LiveSuit
  4.     cong@dell:/work/ct/ct-droid1/tools$ unzip ./LiveSuitV305_For_Linux64.zip
  5.     cong@dell:/work/ct/ct-droid1/tools/LiveSuit_For_Linux64$ chmod 777 LiveSuit.run
  6.     cong@dell:/work/ct/ct-droid1/tools/LiveSuit_For_Linux64$ ./LiveSuit.run
  7.            LiveSuit has been installed in /home/cong/Bin/LiveSuit
  8.     cong@dell:/work/ct/ct-droid1/tools/LiveSuit_For_Linux64$ cd /home/cong/Bin/LiveSuit
  9.  c. 用LiveSuit刷机
  10.        cong@dell:~/Bin/LiveSuit$ sudo ./LiveSuit.sh //运行LiveSuit并选择镜像
  11. 注意: 此处不加sudo 则会提示 "get device stage failed"
  12.    开发板开机时,不用插电源线,只插usb线,并按住FEL键,然后LiveSuit就会弹出对话,选yes,然后等侍结束就可以了.
2. CubieTruck分区说明

3.烧boot.img
3.1 ct能进入android系统
在这种情况下只需用新编译出的boot.img更新nandc分区即可
  1. cong@dell:/work/ct/android42$ vi out/target/product/sugar-cubietruck/root/init.rc  //修改了init.rc
  2. cong@dell:/work/ct/android42$ make bootimage                                       //重新打包生成boot.img  
  3. cong@dell:/work/ct/android42$ adb push ./out/target/product/sugar-cubietruck/boot.img /mnt/sdcard/
  4. cong@dell:/work/ct/android42$ adb shell sync
  5. cong@dell:/work/ct/android42$ adb shell dd if=/mnt/sdcard/boot.img of=/dev/block/nandc
  6. cong@dell:/work/ct/android42$ adb shell sync
  7. cong@dell:/work/ct/android42$ adb shell reboot
3.1.1 boot.img的快速生成方法
  1. cong@dell:/work/ct/android42$ out/host/linux-x86/bin/mkbootfs out/target/product/sugar-cubietruck/root | out/host/linux-x86/bin/minigzip > out/target/product/sugar-cubietruck/ramdisk.img
  2. cong@dell:/work/ct/android42$ out/host/linux-x86/bin/mkbootimg --kernel out/target/product/sugar-cubietruck/kernel --ramdisk out/target/product/sugar-cubietruck/ramdisk.img --base 0x40000000 --output out/target/product/sugar-cubietruck/boot.img
3.1.2 kernel的快带生成方法
  1. cong@dell:/work/ct/lichee$ ./build.sh -p sun7i_android -m kernel      //编译生成kernel
  2.  cong@dell:/work/ct/android42$ out/host/linux-x86/bin/mkbootimg --kernel ../lichee/linux-3.3/bImage --ramdisk out/target/product/sugar-cubietruck/ramdisk.img --base 0x40000000 --output out/target/product/sugar-cubietruck/boot.img
所以在lichee目录下可以运行一个脚本就可以更新kernel,并烧写boot.img
cong@dell:/work/ct/lichee$ cat cp.sh
  1. #!/bin/sh
  2. echo "compile kernel and pack boot.img"
  3. OUT=../android42/out/
  4. ./build.sh -p sun7i_android -m kernel
  5. $OUT/host/linux-x86/bin/mkbootimg --kernel ./linux-3.3/bImage --ramdisk $OUT/target/product/sugar-cubietruck/ramdisk.img --base 0x40000000 --output $OUT/target/product/sugar-cubietruck/boot.img

  6. echo "flash boot.img"
  7. adb remount
  8. adb push $OUT/target/product/sugar-cubietruck/boot.img /mnt/sdcard/
  9. adb shell sync
  10. adb shell dd if=/mnt/sdcard/boot.img of=/dev/block/nandc
  11. adb shell sync
3.2 ct不能进入android系统
在这种情况下要用fastboot烧录新编出的boot.img即可
  1. cong@dell:/work/ct$ sudo ./android42/out/host/linux-x86/bin/fastboot devices
  2. 20080411 fastboot
  3. cong@dell:/work/ct$ sudo ./android42/out/host/linux-x86/bin/fastboot flash boot ./android42/out/target/product/sugar-cubietruck/boot.img
4.烧uboot
4.1 ct能进入android系统
  1. / # mkdir /mnt/temp
  2. / # mount -t vfat /dev/block/bootloader /mnt/temp          ;;挂载bootloader分区,类型是vfat
  3. / # ls -l /mnt/temp/
  4. -rwx------ root root 121524 1980-01-01 00:00 boot.axf
  5. -rwx------ root root 106 1980-01-01 00:00 boot.ini
  6. -rwx------ root root 222964 1980-01-01 00:00 drv_de.drv
  7. -rwx------ root root 233932 1980-01-01 00:00 drv_hdmi.drv
  8. -rwx------ root root 344813 1980-01-01 00:00 font24.sft
  9. -rwx------ root root 357443 1980-01-01 00:00 font32.sft
  10. drwx------ root root 1980-01-01 00:00 linux                ;;linux目录
  11. -rwx------ root root 512 1980-01-01 00:00 magic.bin
  12. drwx------ root root 1980-01-01 00:00 os_show
  13. -rwx------ root root 226576 1980-01-01 00:00 prvt.axf
  14. -rwx------ root root 44640 1980-01-01 00:00 script.bin
  15. -rwx------ root root 284320 1980-01-01 00:00 sprite.axf
  16. / # ls -l /mnt/temp/linux/
  17. -rwx------ root root 57654 1980-01-01 00:00 linux.bmp
  18. -rwx------ root root 214 1980-01-01 00:00 linux.ini
  19. -rwx------ root root 310964 2000-01-04 11:51 u-boot.bin     ;;个u-boot.bin
发现u-boot.bin是放在了挂载后的linux目录下,所以更新uboot,就是把这个u-boot.bin替换.
4.2 ct不能进入android系统
  烧写这个动作fastboot是可以的,但是不知道地址啊,等试出来再写.

二. android系统的编译

2.1 内核的编译
在编译内核时,需要把mkimage复制到PATH下
"mkimage" command not found - U-Boot images will not be built
cong@dell:/work/a31/lichee$ vi linux-3.3/scripts/mkuboot.sh
  L7 #MKIMAGE=$(type -path "${CROSS_COMPILE}mkimage")
  L8 MKIMAGE=/work/a31/lichee/u-boot/tools/mkimage
者直接把mkimage 放在 /usr/local/bin目录下
  1. $cd lichee/
  2. $cp linux-3.3/arch/arm/configs/cubietruck_defconfig linux-3.3/arch/arm/configs/sun7ismp_android_defconfig
  3. $./build.sh -p sun7i_android
2.1 编译出错
a. 编译 ./modules/mali/DX910-SW-99002-r3p2-01rel/目录时出错
  1. arm-none-linux-gnueabi-gcc: directory: No such file or directory
  2. arm-none-linux-gnueabi-gcc: directory
解决方法:
将mali目录中kbuild和makefile.common中的SVN_REV改为 SVN_REV := 1, (1后面有个逗号)
2.2 andorid的编译
  2.2.1 工具的安装
  1. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install xsltproc
  2. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install bison
  3. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install flex
  4. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install gperf

  5. a. gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  6. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install g++

  7. b. /usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
  8. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install gcc-multilib

  9. c./bin/bash: xmllint: command not found
  10. cong@dell:/work/ct/ct-droid1/android42$ sudo apt-get install libxml2-utils
 2.2.2 编译的流程
  1. $cd ../android42
  2. $source build/envsetup.sh
  3. $lunch 16 (select sugar_cubietruck-eng)
  4. $extract-bsp
  5. $make -j8
  6. $pack
最后pack出的镜像文件: /work/ct/ct-droid1/lichee/tools/pack/sun7i_android_sugar-cubietruck.img
[参]http://docs.cubieboard.org/tutorials/ct1/installation/cb3_a20-compiling_android_image_for_cubietruck

三.硬件
3.1 串口的使用
   接线:  白线插TX、绿线插RX、黑线插GND、红线不插
minicom的配置
  1. configuration --> Serial port setup
  2.             Serial Device : /dev/ttyUSB0
  3.             Bps/Par/Bits : 115200 8N1
  4.             Hardware Flow Control : No
  5.             Software Flow Control : No
3.2 wifi不能使用
这是因为ct的wifi驱动bcmdhd没有装
  //将驱动push到板子中
  1. cong@dell:/work/ct/lichee$ adb push ./out/android/common/lib/modules/3.3/bcmdhd.ko /sdcard/
  2. //执行insmod
  3. cong@dell:/tmp$ adb shell
  4. root@android: cd /sdcard/
  5. root@android:/sdcard # insmod ./bcmdhd.ko
注意:修改make menuconfig之前需要,修改内核源码顶层Makefile
  1. 195 ARCH ?= arm
  2. 196 CROSS_COMPILE ?= arm-linux-gnueabi-
但是这样每次开机都需要insmod一下,简单的方法就是把驱动一起编译到内核中
  1. 在make menuconfig中
  2. Device Drivers --->
  3.  [*] Network device support --->
  4.       [*] Wireless LAN --->
  5.          <*> Broadcom 4329/30 wireless cards support  //由M-->*
3.3 关闭灯
blue:ph21:led1
green:ph07:led4
orange:ph20:led2
white:ph11:led3

a. 修改配置,理论上来说应该是,但没有起作用
修改sys_config.fex中[leds_para],将
  1. leds_trigger_<1,2,3> = "heartbeat"
  2. 改为leds_trigger_<1,2,3> = "none"
将修改之后的sys_config.fex用fex2bin生成script.bin
  1. script.bin的生成过程
  2. cong@dell:/tmp$ /work/ct/bak/tools/sunxi/sunxi-tools/fex2bin ./sys_config.fex > script.bin
  3. cong@dell:/tmp$ adb push ./script.bin /sdcard/nanda/script.bin
其中板子上的/sdcard/nanda是挂载的是nanda分区
  1. 板子上的nanda分区的挂载
  2. root@android:/ # mkdir /sdcard/nanda
  3. root@android:/ # mount -t vfat /dev/block/nanda /sdcard/nanda/
b. 只好使用方案b
    取消LED的支持,配置内核取消led支持,然后编译并重烧.
  1. Device Drivers --->
  2.      [ ] LED Support --->
注意:修改make menuconfig之前需要,修改内核源码顶层Makefile
c. 还有一个黄灯
没有找到在内核的哪个地方用,所以没有在内核中把这个黄灯关闭.
正好网上有一个应用程序是操作gpio的,只好用折中的方法把这个灯关了.
3.4 V2.0_A20编译出错
  需要修改 ./lichee/linux-3.4/scripts/build_sun7i_android.sh中的build_modules函数
  1. 142 #export LANG=en_US.UTF-8
  2. 143 #unset LANGUAGE
  3. 144 #make -C modules/mali LICHEE_MOD_DIR=${LICHEE_MOD_DIR} LICHEE_KDIR=${LICHEE_KDIR} \
  4. 145 #install




阅读(1182) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~