赞
踩
首先我们手上要有一套Android的代码,我用的是全志A33的sdk,a33_lichee_4.4_sdk.tar和a33_android_4.4_sdk.tar,我使用的是ubuntu 18.04.5 lts编译a33,Ubuntu的安装流程我就不讲了,网上有很多流程,我这个环境是可以编译过RTOS的代码的,环境应该是OK的。
#sudo vim /etc/apt/sources.list
添加下面的源,放在这个list文件的最顶端
deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
执行更新:sudo apt-get update
#sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev libxml2-utils libswitch-perl gawk
先查看一下java版本,等会更新配置完再看一下:
#java -version
#javac -version
要编译4.4的代码,应该使用OracleJDK6.所以,先安装OracleJDK1.6,安装步骤如下:
a、首选下载jdk1.6:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
b、修改 bin 文件权限,使其可执行文件:
chmod +x jdk-6u45-linux-x64.bin
c、运行该文件,运行之后,会生成一个jdk1.6.0_45文件夹:
./jdk-6u45-linux-x64.bin
d、移动该文件夹到/usr/local/java中:
sudo mv jdk1.6.0_45/ /usr/local/java
e、配置环境变量:
sudo vim ~/.bashrc
使用vim打开.bashrc文件,并添加如下语句:
export JAVA_HOME=/usr/local/java/jdk1.6.0_45
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
退出编辑,然后执行 source /home/user/.bashrc
#java -version
#javac -version
看一下版本是不是你对应安装的版本( 我的是这个javac 1.6.0_45)
klg@ctk:~/code/a33_normal/lichee$ ./build.sh config
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. ococci
3. redwood
4. y2
5. y3
Choice: 2
klg@DESKTOP-BL4ST7Q:/mnt/e/code/android/code/A33/lichee$ mklichee
INFO: ----------------------------------------
INFO: build lichee ...
INFO: chip: sun8iw5p1
INFO: platform: android
INFO: kernel: linux-3.4
INFO: board: ococci
INFO: output: out/sun8iw5p1/android/ococci
INFO: ----------------------------------------
INFO: build buildroot ...
external toolchain has been installed
INFO: build buildroot OK.
INFO: build kernel ...
INFO: prepare toolchain ...
/mnt/e/code/android/code/A33/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc: /mnt/e/code/android/code/A33/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc: cannot execute binary file
Building kernel
/mnt/e/code/android/code/A33/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc: /mnt/e/code/android/code/A33/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc: cannot execute binary file
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
CC scripts/mod/empty.o
/bin/sh: /mnt/e/code/android/code/A33/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-gcc: cannot execute binary file: Exec format error
scripts/Makefile.build:307: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 126
scripts/Makefile.build:443: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:506: recipe for target 'scripts' failed
make: *** [scripts] Error 2
ERROR: build kernel Failed
然后我就在网上找了很多办法还是不行,以为是没有安装 libc6-dev-i386 这个是支持64位系统编译32位的文件,还是不行。
后面卡在make版本,通过这个连接解决了问题:Android 4.4 源码编译时,Android can only be built by versions 3.81 and 3.82解决方法_路过独木桥!!的博客-CSDN博客
build/core/main.mk:45: ********************************************************************************
build/core/main.mk:46: * You are using version 4.1 of make.
build/core/main.mk:47: * Android can only be built by versions 3.81 and 3.82.
build/core/main.mk:48: * see https://source.android.com/source/download.html
build/core/main.mk:49: ********************************************************************************
build/core/main.mk:50: *** stopping。 停止。
#### make failed to build some targets ####
把make 4.1的加上
#将这里修改为当前的4.1版本,兼容一下4.1就可以了
ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") = 4.1))
endif
1、编译环境(每打开一个新中端,都需要执行此命令)
cd android
source build/envsetup.sh
2、项目选择,这里选13 astar_ococci-eng.
lunch
13
3、lichee相关文件更新到android,执行
extract-bsp
4、全编android
make -j8
5、打包,烧录
1)·打包固件,直接执行命令:pack
2)·烧录固件,通过phoenixSuit工具来烧录sun8lw5p1_android_ococci.img固件。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。