PC安装Ubuntu 18.04 编译6.0.1 的步骤

PC安装Ubuntu的步骤

1. 准备一个U盘,4G以上。

2. 下载Ubuntu系统镜像, https://www.ubuntu.com/download/desktop

3. 使用Rufus制作启动U盘,  http://rufus.akeo.ie

PC安装Ubuntu 18.04 编译6.0.1 的步骤_第1张图片

4. 插上U盘,重启,按提示逐步操作。

5. 安装完成。

vim中文乱码

sudo vim /etc/vim/vimrc

最后添加 

set fileencodings=utf-8,gbk,utf-16le,cp1252,iso-8859-15,ucs-bom
set termencoding=utf-8
set encoding=utf-8

将Ubuntu安装成中文版,需要将默认语言改为英文。

用vi(或nano等文本编辑器)打开 /etc/default/locale 文件

将原来的配置内容修改为

LANG=”en_US.UTF-8″

LANGUAGE=”en_US:en”

再在终端下运行:

locale-gen -en_US:en

注销或重启后,即可恢复为英文的语言环境。

ou are attempting to build with the incorrect version
of java.
 
Your version is: openjdk version "10.0.2" 2018-07-17 OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3) OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3, mixed mode).
The required version is: "1.8.x"
 
Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:213: *** stop.
build/core/ninja.mk:163: recipe for target 'out/build-rk3288.ninja' failed
make: *** [out/build-rk3288.ninja] Error 1

卸载 JDK

sudo apt-get remove openjdk-11-jre-headless

sudo apt-get remove openjdk*

ubuntu18.04LTS设置静态IP
因为Ubuntu18.04采用的是netplan来管理network。所以可以在/etc/netplan/目录下创建 
一个以yaml结尾的文件。比如01-netplan.yaml文件。 
然后在此文件下写入以下配置:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: no
      addresses: [192.168.1.110/24]
      gateway4:  192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 114.114.114.114]

特别要注意的是这里的每一行的空格一定要有的,否则会报错误而设置失败!
最后使用sudo netplan apply来重启网络服务就可以了。使用ip a查看你的静态IP是否设置成功

rk3288 6.0编译环境

 

3.      安装必要的包
sudo apt-get install git gnupg flex bison gperf build-essential zip curllibc6-dev libncurses5-dev:i386 x11proto-core-dev

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utilsxsltproc zlib1g-dev:i386
 

Build Kernel ERROR 总结:

    对 ROM 编译不陌生的"同行"应该了解,在第一次编译 ROM 时,在编译 System image 之前,编译Kernel 是必经的一步;
    通常在 ROM 版本迭代中,由于驱动的更改,也需要重新编译Kernel ,

--------------------------------------------------------------------------------------------------------------

Error 1:

root@lianluo_android:/home/mops/rk3288_6.0/kernel# make rk3288-tb_8846.img
......
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  BC      kernel/timeconst.h
/bin/sh: 1: bc: not found
/home/mops/rk3288_6.0/kernel/kernel/Makefile:141: recipe for target 'kernel/timeconst.h' failed
make[1]: *** [kernel/timeconst.h] Error 127
Makefile:829: recipe for target 'kernel' failed
make: *** [kernel] Error 2

解决方案:
# apt-get install bc

---------------------------------------------------------------------------------------

Error 2:

root@lianluo_android:/home/mops/rk3288_6.0/kernel# make rk3288-tb_8846.img
......
  LD      pie/pie_stage2.o
  OBJCOPY pie/pie_stage3.o
  LD      pie/pie.elf
  OBJCOPY pie/pie.bin
  OBJCOPY pie/pie.bin.o
  LD      pie/built-in.o
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  KSYM    .tmp_kallsyms1.o
  KSYM    .tmp_kallsyms2.o
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/head.o
  LZO     arch/arm/boot/compressed/piggy.lzo
/bin/sh: 1: lzop: not found
/home/mops/rk3288_6.0/kernel/arch/arm/boot/compressed/Makefile:196: recipe for target 'arch/arm/boot/compressed/piggy.lzo' failed
make[2]: *** [arch/arm/boot/compressed/piggy.lzo] Error 1
/home/mops/rk3288_6.0/kernel/arch/arm/boot/Makefile:53: recipe for target 'arch/arm/boot/compressed/vmlinux' failed
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
/home/mops/rk3288_6.0/kernel/arch/arm/Makefile:304: recipe for target 'zImage' failed
make: *** [zImage] Error 2

解决方案:
# apt-get install lzop

-------------------------------------------------------------------------------------

Error 3:

root@lianluo_android:/home/mops/rk3288_6.0/kernel# make rk3288-tb_8846.img
scripts/kconfig/conf --silentoldconfig Kconfig
^C
root@lianluo_android:/home/mops/rk3288_6.0/kernel# make rk3288-tb_8846.img
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  GEN     drivers/video/rockchip/screen/lcd.h
  Kernel: arch/arm/boot/Image is ready
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready

make: *** [kernel.img] Error 127

解决方案:

#sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

--------------------------------------------------------------------------------------

注意:
Android 6.0的 java 环境必须是 openjdk-7-jdk,否则导致报出ERROR,编译失败.
(亲测:openjdk-8-jdk 也不行,可能以后会适配)
解决方案:
#sudo apt-get install openjdk-7-jdk
#PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH

-------------------------------------------------------------------------------------

Build Android ERROR 总结:

Error1:

root@lianluo_android:/home/mops/rk3288_6.0/# make -j8
......
Notice file: external/jarjar/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//framework/jarjar.jar.txt
Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
prebuilts/misc/linux-x86/bison/bison -d  -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
Notice file: frameworks/base/tools/aidl/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/aidl.txt
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Broken pipe
make: *** Waiting for unfinished jobs....
flex-2.5.39: fatal internal error, exec of /usr/bin/m4 failed
frameworks/base/tools/aidl/aidl_language_l.l:55: warning, rule cannot be matched
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Broken pipe
make: *** Deleting file `out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp'
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

解决办法:
#sudo apt-get install bison

------------------------------------------------------------------------------------------------

Error2:

root@lianluo_android:/home/mops/rk3288_6.0/# make -j8
Copy: out/target/product/rk3288/system/etc/.allBlock
Copy: out/target/product/rk3288/system/etc/.videoBlock
Copy xml: out/target/product/rk3288/system/etc/GS8604.xml
/bin/bash: xmllint: command not found
make: *** [out/target/product/rk3288/system/etc/GS8604.xml] Error 127
make: *** Waiting for unfinished jobs....
preparing StaticLib: libc_common [including out/target/product/rk3288/obj/STATIC_LIBRARIES/libc_thread_atexit_impl_intermediates/libc_thread_atexit_impl.a]
preparing StaticLib: libc_common [including out/target/product/rk3288/obj/STATIC_LIBRARIES/libc_tzcode_intermediates/libc_tzcode.a]
target StaticLib: libc_common (out/target/product/rk3288/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a)

#### make failed to build some targets (2:55 (mm:ss)) ####

解决方法:
#sudo apt-get  install libxml2-utils

-------------------------------------------------------------------------------------

编译成功会出现类似如下LOG, 并显示编译所用时长:

Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Install: out/target/product/rk3288/system/app/Email/Email.apk
Install: out/target/product/rk3288/system/priv-app/Settings/Settings.apk
build/tools/generate-notice-files.py  out/target/product/rk3288/obj/NOTICE.txt  out/target/product/rk3288/obj/NOTICE.html "Notices for files contained in the filesystem images in this directory:" out/target/product/rk3288/obj/NOTICE_FILES/src
Combining NOTICE files into HTML
Combining NOTICE files into text
Installed file list: out/target/product/rk3288/installed-files.txt
Target system fs image: out/target/product/rk3288/obj/PACKAGING/systemimage_intermediates/system.img
Running:  mkuserimg.sh -s out/target/product/rk3288/system out/target/product/rk3288/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 1073741824 -D out/target/product/rk3288/system -L system out/target/product/rk3288/root/file_contexts
make_ext4fs -s -T -1 -S out/target/product/rk3288/root/file_contexts -L system -l 1073741824 -a system out/target/product/rk3288/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/rk3288/system out/target/product/rk3288/system
Creating filesystem with parameters:
    Size: 1073741824
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 4096
    Label: system
    Blocks: 262144
    Block groups: 8
    Reserved block group size: 63
Created filesystem with 1978/65536 inodes and 120827/262144 blocks
Install system fs image: out/target/product/rk3288/system.img
out/target/product/rk3288/system.img+out/target/product/rk3288/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=1096212480 blocksize=135168 total=479642035 reserve=11083776

#### make completed successfully (18:56 (mm:ss)) ####

新安装的ubuntu 18.04 简单配置一下android编译环境后,编译app 出现下面的错误提示:

flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertioncnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
1
2
bing 搜索之,在这个链接中找到解法 
https://stackoverflow.com/questions/49955137/error-when-build-lineageos-make-ninja-wrapper-error-1

export LC_ALL=C

把这行代码添加到bashrc 文件中。

实测有效。

那么这句配置是什么意思呢? 
搜索得到: 
LC_ALL=C 是为了去除所有本地化的设置,让命令能正确执行。
 

接下来还是错:

Device TableGen (gen-intrinsic): libLLVMipa <= external/llvm/include/llvm/IR/Intrinsics.td
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:51: recipe for target 'out/host/linux-x86/obj/lib/libart.so' failed
make: *** [out/host/linux-x86/obj/lib/libart.so] Error 1
make: *** Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:51: recipe for target 'out/host/linux-x86/obj/lib/libartd.so' failed
make: *** [out/host/linux-x86/obj/lib/libartd.so] Error 1

【我安装了下下面这些,究竟有没有用还需要试验:】

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
1
然后在网上搜了下,这个问题的解决方法:

http://forum.xda-developers.com/chef-central/android/guide-how-to-setup-ubuntu-16-04-lts-t3363669/page2
1
注意看这个帖子的15楼,哈哈,这个时候找到解决方法了,再修改art/build/Android.common_build.mk文件

ifneq ($(WITHOUT_HOST_CLANG),true)
1
改为:

ifeq ($(WITHOUT_HOST_CLANG),false)
1
执行:

    sudo vi art/build/Android.common_build.mk
    /WITHOUT_HOST_CLANG  #搜索该字符的位置

在第74行:

    # Clang build support.
    # Host.
    ART_HOST_CLANG := false
    ifneq ($(WITHOUT_HOST_CLANG),false)
      # By default, host builds use clang for better warnings.
      ART_HOST_CLANG := true
    endif

进行修改,然后继续make -j8编译。反复执行几次就可以了。

out/host/linux-x86/bin/jack: line 128: curl: command not found


sudo apt-get install curl

 

FAILED: setup-jack-server 
/bin/bash -c "(if !  /bin/bash -c \"prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar  2>&1 || (exit 0)\"; then uptime;  strace -f prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar  2>&1 || (exit 1); fi ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\"  prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (if !  /bin/bash -c \"prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0\"; then uptime;  strace -f prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA || (exit 1); fi ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47;  prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.18.BETA.jar 4.18.BETA || exit 47;  prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.20.BETA.jar 4.20.BETA || exit 47 )"
Jack server already installed in "/home/michael/.jack-server"
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/michael/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
No Jack server running. Try 'jack-admin start-server'
No Jack server running. Try 'jack-admin start-server'
[  9% 5293/54851] target  C++: libv8 <...er/js-native-context-specialization.cc
ninja: build stopped: subcommand failed.
build/core/ninja.mk:84: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

#### make failed to build some targets (27:03 (mm:ss)) ####

网上的方法找了n多,都没能解决。谷歌建议的方法是该$HOME/.jack文件,找了下我的主目录里并没有,遂自己建了一个,还是不行。
有没有大神给点建议好吗?谢谢了。


解决方案1:

你到 prebuilts/sdk/tools 目录下执行一下这个命令:./jack-admin install-server jack-launcher.jar jack-server-4.11.ALPHA.jar
jack-launcher.jar,jack-server-4.11.ALPHA.jar这两个文件的名字视你 prebuilts/sdk/tools 目录下的文件名而定

jack-admin start-server

 

解决:编译CM14.1 提示Jack “Out of memory error”错误

Android 7.1编译到33%时出现JDK内存溢出的错误:

Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by [email protected])).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx'.
Warning: This may have produced partial or corrupted output.

错误日志里边列出了问题并且已经给出了解决方案 - 增加Java虚拟机的-Xmx大小,即设置一个较大的堆内存上限。

所以,解决办法是:

1、修改Jack的配置文件prebuilts/sdk/tools/jack-admin

  这是一个管理Jack的shell脚本,找到start-server函数,直接修改其启动参数,由原来的

JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"

更改为

JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"

  此时Jack服务器仍然在后台执行,所以我们需要将其停止,然后重启启动(make会自动启动Jack服务器)才能使得修改后的参数生效。

  我们执行下面的命令此时Jack服务器仍然在后台执行,所以我们需要将其停止,然后重启启动(make会自动启动Jack服务器)才能使得修改后的参数生效。

  我们执行下面的命令:

#先停止服务
./prebuilts/sdk/tools/jack-admin stop-server

#重新开始服务
./prebuilts/sdk/tools/jack-admin start-server

 

详细的错误日志里边列出了问题并且已经给出了解决方案 - 增加Java虚拟机的-Xmx大小,即设置一个较大的堆内存上

参考

Ubuntu18.04 编译Android5.0 源码出错 unsupported reloc 43

cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld

 

https://blog.csdn.net/wangxueming/article/details/50144955

https://blog.csdn.net/MLQ8087/article/details/58605810?locationNum=1&fps=1

https://blog.csdn.net/ForeverSunshine/article/details/53256365

你可能感兴趣的:(LINUX,Rockchip)