一、首先为了不出更多问题使用Ubuntu16.04系统,推荐虚拟机方便一次搭建,迁移方便
首先修改阿里apt源
见帖子ubuntu镜像-ubuntu下载地址-ubuntu安装教程-阿里巴巴开源镜像站
sudo vi /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgradeMake bash in the default shell (Android build scripts contain the bash shell
dependencies that require the system default shell /bin/sh to invoke bash ) using
one of the following options:
Reconfigure the package.
Use the following command:
sudo dpkg-reconfigure dash
Type No. Change the symlink /bin/sh→dash to /bin/sh→bash using the following
commands:
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh然后运行下面的脚本配置环境,保存为.sh文件,然后运行两次
#!/bin/sh
#Ubuntu 16.04
sudo apt install git -y
sudo apt-get install openssh-server -y
sudo /etc/init.d/ssh restart
#ssh-keygen -t rsa -C "tully.wang@goertek.com"
#cat ~/.ssh/id_rsa.pub
#git config --global user.name "tully.wang"
#git config --global user.email "tully.wang@goertek.com"
#openssl
sudo apt-get install libssl-dev -y
sudo apt install tree -y
#compile
sudo apt install m4 -y
sudo apt-get install libxml2-utils -y
sudo apt-get install libssl_dev -y
#chmod +x Hexagon.LLVM_linux_installer_8.0.08.bin
#chmod +x Hexagon.LLVM_linux_installer_8.0.09.bin
#./Hexagon.LLVM_linux_installer_8.0.09.bin
#./Hexagon.LLVM_linux_installer_8.0.08.bin
sudo apt-get install bootchart
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.co checkout
sudo apt install shutter -y
sudo apt install gitk -y
sudo apt install sqlite3 -y
sudo apt-get install bison -y
sudo apt install virtualenv -y
sudo add-apt-repository ppa:openjdk-r/ppa -y
sudo apt-get update
sudo apt-get install openjdk-8-jdk -y
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javap
sudo update-alternatives --config javadoc
sudo apt install icedtea-netx -y
#gcc
sudo apt remove gcc-5
sudo apt-get install gcc-4.9 gcc-4.9-multilib g++-4.9 g++-4.9-multilib -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 40
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
gcc -v
sudo apt-get install bison -y
sudo apt-get install flex -y
sudo apt-get install libncurses5-dev -y
sudo apt install vim
#Ubuntu 18.04
sudo apt install gcc-multilib -y
sudo apt install aptitude -y
sudo apt install subversion -y
sudo apt install htop -y
sudo apt install curl -y为预防出现错误xmllint: command not found
sudo apt-get install libxml2-utils为确保gcc、g++版本为4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 40
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
gcc -v为预防代码默认下载好后,编译路径被记下了,存放在了文件里bootable/bootloader/edk2/Conf/BuildEnv.sh,使用make clean 没办法清掉.
可以验证下,进入报错目录: bootable/bootloader/edk2 使用如下命令
. edksetup.sh
结果
WORKSPACE: /home/sdduser/code/android_O/bootable/bootloader/edk2
EDK_TOOLS_PATH: /local/android_O/bootable/bootloader/edk2/BaseTools
CONF_PATH: /home/sdduser/code/android_O/bootable/bootloader/edk2/Conf可以看到BaseTools路径:EDK_TOOLS_PATH 还是之前的路径. 解决办法, 在edk2目录下执行:
rm -rf Conf/BuildEnv.sh
unset EDK_TOOLS_PATH
. ./edksetup.sh BaseTools进入 BaseTools目录:
make clean就不再报abl 编译错误了
编译7源码时,报错:SSL error when connecting to the Jack server. Try ‘jack-diagnose‘
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in
/etc/java-8-openjdk/security/java.security file
Restart the jack server:
cd /prebuilts/sdk/tools/
./jack-admin kill-server
./jack-admin start-server
source build/envsetup.shlunch xx
重新编译: make -j8 2>&1 | tee build.log
注意如果遇到错误但是却找不到哪错了,要用单线程编译,这样就会在错误的地方中断
make -j1 2>&1 | tee build.log非常方便找到问题
版权声明:本文为u012572552原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。