1. 程式人生 > >全志A33的環境搭建

全志A33的環境搭建





A33環境搭建編譯手冊


說明


目錄


Ubuntu安裝

製作UbuntuUSB啟動盤

找到DOWNLOAD UUI,下載

下載後,插入U盤執行(Universal-USB-Installer-1.9.5.9.exe 目前在技術部伺服器有提供)

同意協議,下一步

如下圖設定,

Step1:選著Linux發行版

Step2:選擇ubuntu映象所在的路徑

Step3:選擇插入的U

Step4:預設選項

確認

製作完成

安裝Ubuntu

插入製作好的U盤到電腦,重啟,按F12(根據實際情況)進入啟動選項選單,選擇從U盤啟動。

  一路不用操作,預設的“Try Ubuntu without Installing

直至進入Ubuntu試用系統,雙擊Install Ubuntu圖示開始安裝,如下圖 

選擇中文

勾選下載更新,勾選安裝第三方軟體

詢問安裝型別,建議使用其他選項,可以更好的進行自定義

選擇要安裝的硬碟進行分割槽,這裡安排是:

500G大小的硬碟

分割槽

掛載點

容量

第一個分割槽

/ (根分割槽)

30G

第二個分割槽

SWAP

4G

第三個分割槽

/opt

466G(即剩餘的容量)

這麼處理,考慮到以後開發相關的都放在opt上,如需重灌、升級作業系統,無需破壞開發的資料

操作如下,點選選擇目標硬碟的空閒空間,點選新增

如下圖設定第一個分割槽

重複上一步,再新增第二個分割槽


重複上一步,再新增第三個分割槽

選擇安裝啟動引導器的裝置為硬碟的引導區,點選現在安裝


接下來設定時區

設定鍵盤佈局


設定賬戶資訊和計算機資訊

等待安裝完成


直至提示安裝完成,點選重啟

重啟之後進入系統,彈出更新管理器,選擇不升級為14.04,選擇安裝更新

更新完重啟系統


配置ssh

Ctrl+Alt+T開啟終端

自動下載配置ssh

sudo apt-get install ssh

Windows下使用PuTTY即可使用SSH遠端登入

配置vim

vmvi的升級版本

自動下載配置vim

sudo apt-get install vim


開啟Ubuntu圖形介面的root許可權

快捷鍵開啟終端

Ctrl+Alt+T

獲取root許可權

輸入sudo  -s    輸入普通使用者登陸的密碼,回車獲得root許可權

修改配置檔案/etc/lightdm/lightdm.conf  

試用vim開啟或者試用gedit開啟

vim /etc/lightdm/lightdm.conf  

或:

gdit /etc/lightdm/lightdm.conf  

編輯後文檔內容如下(新增下面加底紋內容):

     [SeatDefaults]
     greeter-session=unity-greeter
     user-session=Ubuntu
     greeter-show-manual-login=true     allow-guest=false

設定root使用者密碼

sudo passwd root

重啟後選擇登陸root登陸帳號

注:下文開始,如無特殊說明都是在root使用者下進行操作


配置WINDOWS可用XRDP遠端桌面

開啟終端,自動配置安裝xrdpvnc

apt-get install xrdp vnc4server tightvncserver

開啟要遠端登入使用者的home目錄,root使用者即/root

cd ~

建立.xsession檔案

echo "gnome-session --session=ubuntu-2d" > .xsession

重啟xrdp

/etc/init.d/xrdp restart

Windows下使用遠端桌面連線(請根據實際情況輸入ip

輸入賬號密碼

即可登入


搭建安卓編譯開發環境

JAVA庫下載、安裝與配置

下載jdk-6u45-linux-x64.bin (技術部伺服器上有儲存)

需要注意的是,現在官方網站上最新的版本的JDK7, 但是這個這個版本是不能用於Android的編譯的,一定要去下載JDK6

下載後,修改許可權

chmod 777 jdk-6u45-linux-x64.bin

./jdk-6u45-linux-x64.bin

安裝後產生jdk1.6.0_45目錄,把它拷貝到/opt/lib/jvm/jdk6/下面

設定環境變數

vim /etc/environment

新增上底紋部分內容

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lib/jvm/jdk6/jdk1.6.0_45/bin:/opt/lib/jvm/jdk6/jdk1.6.0_45/jre/bin"

JAVA_HOME=/opt/lib/jvm/jdk6/jdk1.6.0_45

CLASSPATH=/opt/lib/jvm/jdk6/jdk1.6.0_45/lib

Source環境變數

source /etc/environment

檢視JAVA版本驗證安裝,若能看到版本資訊則一般安裝完成

java -version

版本資訊如下

java version "1.6.0_45"

Java(TM) SE Runtime Environment (build 1.6.0_45-b06)

Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

Uboot映象製作工具下載安裝

apt-get install uboot-mkimage

安裝編譯環境需要的庫

apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx-lts-trusty:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386

ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

編譯器下載、安裝與配置

編譯器下載、替換4.4版本

apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib

mv -f /usr/bin/gcc /usr/bin/bak_gcc

mv -f /usr/bin/g++ /usr/bin/bak_g++

ln -s /usr/bin/gcc-4.4 /usr/bin/gcc

ln -s /usr/bin/g++-4.4 /usr/bin/g++

測試一下gcc版本號

gcc -v

版本資訊如下

Using built-in specs.

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.7-1ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

Thread model: posix

gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-1ubuntu2)


編譯指南

建立專案資料夾

mkdir /opt/item_A33

解壓lichee.tar.gz壓縮包

tar -zxvf lichee.tar.gz -C /opt/item_A33/

解壓android.tar.gz壓縮包

tar -zxvf android.tar.gz -C /opt/item_A33/

進入lichee目錄

cd /opt/item_A33/lichee

編譯核心

source buildroot/scripts/mksetup.sh

出現以下設定選項,請依照設定

Welcome to mkscript setup progress

All available chips:

   0. sun8iw5p1

Choice: 0

All available platforms:

   0. android

   1. dragonboard

   2. linux

Choice: 0

All available kernel:

   0. linux-3.4

Choice: 0

All available boards:

   0. evb

   1. maple

   2. redwood

   3. y2

   4. y3

Choice: 4

編譯lichee

mklichee

編譯過程

INFO: ----------------------------------------

INFO: build lichee ...

INFO: chip: sun8iw5p1

INFO: platform: android

INFO: kernel: linux-3.4

INFO: board: y3

INFO: output: out/sun8iw5p1/android/y3

INFO: ----------------------------------------

INFO: build buildroot ...

external toolchain has been installed

INFO: build buildroot OK.

INFO: build kernel ...

INFO: prepare toolchain ...

Building kernel

  CHK     include/linux/version.h

  CHK     include/generated/utsrelease.h

make[1]: include/generated/mach-types.h”是最新的。

  CALL    scripts/checksyscalls.sh

  CHK     include/generated/compile.h

  CC      arch/arm/mach-sunxi/pm/standby/common.o

省略大部分編譯過程...

make: Leaving directory `/opt/item_A33/lichee/linux-3.4/modules/mali'

regenerate rootfs cpio

8772 blocks

9475 blocks

build_ramfs

Copy boot.img to output directory ...

Copy modules to target ...

INFO: build kernel OK.

INFO: build rootfs ...

INFO: skip make rootfs for android

INFO: build rootfs OK.

INFO: ----------------------------------------

INFO: build lichee OK.

INFO: ----------------------------------------

(至此編譯成功)

單獨編譯buildroot

mkbr

編譯過程

INFO: build buildroot ...

external toolchain has been installed

INFO: build buildroot OK.

單獨編譯核心

mkkernel

編譯過程

INFO: build kernel ...

INFO: prepare toolchain ...

Building kernel

  CHK     include/linux/version.h

  CHK     include/generated/utsrelease.h

make[1]: include/generated/mach-types.h”是最新的。

  CALL    scripts/checksyscalls.sh

  CHK     include/generated/compile.h

  CC      arch/arm/mach-sunxi/pm/standby/common.o

  CC      arch/arm/mach-sunxi/pm/standby/standby_clock.o

  CC      arch/arm/mach-sunxi/pm/standby/standby_ir.o

  CC      arch/arm/mach-sunxi/pm/standby/standby_key.o

  CC      arch/arm/mach-sunxi/pm/standby/standby_power.o

  CC      arch/arm/mach-sunxi/pm/standby/standby_twi.o

  CC      arch/arm/mach-sunxi/pm/standby/standby_usb.o

  AS      arch/arm/mach-sunxi/pm/standby/standby_delay.o

  CC      arch/arm/mach-sunxi/pm/standby/./arisc/standby_arisc.o

  CC      arch/arm/mach-sunxi/pm/standby/./arisc/arisc_hwmsgbox.o

(省略編譯過程.,.

make: Leaving directory `/opt/item_A33/lichee/linux-3.4/modules/mali'

regenerate rootfs cpio

8772 blocks

9475 blocks

build_ramfs

Copy boot.img to output directory ...

Copy modules to target ...

INFO: build kernel OK.

(至此,核心編譯完成)

編譯brandy

Bandy目錄中存放的是A33平臺的bootloader,該目錄為A33啟動程式碼,預設不編譯。

編譯u-boot

cd lichee/brandy/u-boot-2011.09/

make distclean

make sun8iw5p1_config

make -j2

當編譯成功,生成的u-boot-sun8iw5pl.bin檔案會自動拷貝到對應的tool目錄下,這時候可以直接打包或者其他操作。U-boot-sun8iw5pl.bin啟動時是uboot核心可執行程式。

"u-boot-sun8iw5p1.bin" -> "/opt/item_A33/lichee/brandy/u-boot-2011.09/../../tools/pack/chips/sun8iw5p1/bin/u-boot-sun8iw5p1.bin"

編譯android

編譯android前請先編譯核心

選擇方案

souece build/envsetup.sh

lunch

出現以下設定選項,請依照設定

You're building on Linux

Lunch menu... pick a combo:

     1. aosp_arm-eng

     2. aosp_x86-eng

     3. aosp_mips-eng

     4. vbox_x86-eng

     5. aosp_manta-userdebug

     6. aosp_deb-userdebug

     7. aosp_flo-userdebug

     8. aosp_grouper-userdebug

     9. aosp_tilapia-userdebug

     10. mini_armv7a_neon-userdebug

     11. mini_x86-userdebug

     12. mini_mips-userdebug

     13. aosp_mako-userdebug

     14. aosp_hammerhead-userdebug

     15. astar_y3-eng

     16. astar_y3-user

Which would you like? [aosp_arm-eng] 15

============================================

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=4.4.2

TARGET_PRODUCT=astar_y3

TARGET_BUILD_VARIANT=eng

TARGET_BUILD_TYPE=release

TARGET_BUILD_APPS=

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv7-a-neon

TARGET_CPU_VARIANT=cortex-a7

HOST_ARCH=x86

HOST_OS=linux

HOST_OS_EXTRA=Linux-3.13.0-46-generic-x86_64-with-Ubuntu-12.04-precise

HOST_BUILD_TYPE=release

BUILD_ID=KVT49L

OUT_DIR=out

============================================

拷貝kenrelmodules

extract-bsp

編譯android

make -j

(?表示啟用幾個程序編譯,一般不要超過cpu的核數)

最後顯示資訊

Install system fs image: out/target/product/astar-y3/system.img

out/target/product/astar-y3/system.img+out/target/product/astar-y3/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=822163584 blocksize=4224 total=591028141 reserve=8308608

Android打包

cdandroid根目錄用pack打包

pack

顯示以下資訊

copying tools file

copying configs file

copying boot resource

copying boot file

packing for android

normal

/opt/item_A33/lichee/tools/pack/pctools/linux/eDragonEx/

/opt/item_A33/lichee/tools/pack/out

Begin Parse sys_partion.fex

Add partion boot-resource.fex BOOT-RESOURCE_FEX

Add partion very boot-resource.fex BOOT-RESOURCE_FEX

FilePath: boot-resource.fex

FileLength=4bec00Add partion env.fex ENV_FEX000000000

Add partion very env.fex ENV_FEX000000000

FilePath: env.fex

FileLength=20000Add partion boot.fex BOOT_FEX00000000

Add partion very boot.fex BOOT_FEX00000000

FilePath: boot.fex

FileLength=afa000Add partion system.fex SYSTEM_FEX000000

Add partion very system.fex SYSTEM_FEX000000

FilePath: system.fex

FileLength=23175bdcAdd partion recovery.fex RECOVERY_FEX0000

Add partion very recovery.fex RECOVERY_FEX0000

FilePath: recovery.fex

FileLength=db2000Add partion diskfs.fex DISKFS_FEX000000

Add partion very diskfs.fex DISKFS_FEX000000

FilePath: diskfs.fex

FileLength=200sys_config.fex Len: 0xf397

config.fex Len: 0x9ac4

split_xxxx.fex Len: 0x200

sys_partition.fex Len: 0xf0a

boot0_nand.fex Len: 0x8000

boot0_sdcard.fex Len: 0x8000

u-boot.fex Len: 0xbc000

fes1.fex Len: 0x1f60

usbtool.fex Len: 0x20600

aultools.fex Len: 0x25d92

aultls32.fex Len: 0x2295a

cardtool.fex Len: 0x14000

cardscript.fex Len: 0x6ea

sunxi_mbr.fex Len: 0x10000

dlinfo.fex Len: 0x4000

arisc.fex Len: 0x2bee9

boot-resource.fex Len: 0x4bec00

Vboot-resource.fex Len: 0x4

env.fex Len: 0x20000

Venv.fex Len: 0x4

boot.fex Len: 0xafa000

Vboot.fex Len: 0x4

system.fex Len: 0x23175bdc

Vsystem.fex Len: 0x4

recovery.fex Len: 0xdb2000

Vrecovery.fex Len: 0x4

diskfs.fex Len: 0x200

Vdiskfs.fex Len: 0x4

BuildImg 0

Dragon execute image.cfg SUCCESS !

----------image is at----------

/opt/item_A33/lichee/tools/pack/sun8iw5p1_android_y3.img

pack finish