当前位置:   article > 正文

在Winds 10 下通过WSL安装Linux子系统-Ubuntu 的环境下安装 Android 的编译环境,遇到的问题没解决,后面换成Linux服务器去编译成功了_wsl安装安卓平板系统

wsl安装安卓平板系统

在Winds 10 下通过WSL安装Linux子系统-Ubuntu 的环境下安装 Android 的编译环境,遇到的问题没解决,后面换成Linux服务器去编译成功了

一、准备后面需要的东西。

首先我们手上要有一套Android的代码,我用的是全志A33的sdk,a33_lichee_4.4_sdk.tar和a33_android_4.4_sdk.tar,我使用的是ubuntu 18.04.5 lts编译a33,Ubuntu的安装流程我就不讲了,网上有很多流程,我这个环境是可以编译过RTOS的代码的,环境应该是OK的。

二、安装必要工具。

1、修改更新源:

#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

2、安装必要的库:

#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

3. 安装JDK 1.6:

先查看一下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)

4、编译uboot, linux内核源码:
解包a33_lichee_4.4_sdk.tar后,进入lichee目录下配置内核(只需执行一次以后不需要)终端操作:

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

5、配置完成开始编译,就出现以下错误:

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位的文件,还是不行。

6、后面我放到服务器上编译,就没有卡在上面错误的地方。

后面卡在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

7、后面就开始编译 a33_android_4.4_sdk.tar  


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固件。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/576966
推荐阅读
相关标签
  

闽ICP备14008679号