本章节基于ubuntu22.04系统进行搭建。
如果编译过程中自动重启服务器,更新系统库以及确保所需的依赖
ubuntu22.04系统安装:
这个流程不做详细介绍;进ubuntu官网下载ubuntu22.04版本,然后制作U盘系统盘,
接着就是安装ubuntu系统了,这里直接走标准的安装流程,没做过多配置(如磁盘分区、swap),
并且联网安装,这样就无需安装好后再更新。
ubuntu22.04 系统基础环境配置:
安装如下依赖和工具(可能有重复):
sudo apt-get install openssh-server
sudo apt-get install net-tools tmux vim git gitk checkinstall libncursesw5-dev libreadline-dev
git config --global user.name "xxxxxx"
git config --global user.email [email protected]
sudo apt-get install make gcc
sudo apt-get install g++ patchelf gawk texinfo chrpath diffstat binfmt-support
sudo apt-get install g++-multilib unzip device-tree-compiler ncurses-dev libgucharmap-2-90-devsudo apt-get install expect
sudo apt-get install qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib
sudo apt-get install bzip2 expat gpgv2 cpp-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo apt-get install gnupg gperf libsdl1.2-dev gcc-10
sudo apt-get install libesd-java libwxgtk3.0-dev squashfs-tools build-essential zip curl
sudo apt-get install zlib1g-dev pngcrush schedtool libxml2 libxml2-utils
sudo apt-get install xsltproc lzop libc6-dev g++-multilib lib32z1-dev lib32ncurses5-dev
sudo apt-get install lib32readline-dev gcc-multilib libswitch-perl zip
sudo apt-get install liblz4-tool python-pyelftools python3-pyelftools
sudo apt-get install -y libssl-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev
sudo apt-get install libncurses*
sudo apt-get install -y bison build-essential ccache curl dpkg-dev flex g++-multilib gcc-multilib
sudo apt-get install -y gnupg gperf lib32ncurses5-dev lib32z-dev libc6-dev-i386 libesd0-dev libgl1-mesa-dev
sudo apt-get install -y libncurses5-dev:i386 libreadline6-dev:i386 libsdl1.2-dev libx11-dev libx11-dev:i386
sudo apt-get install -y libxml2-utils m4 tofrodos unzip x11proto-core-dev
sudo apt-get install -y xsltproc zip zlib1g-dev zlib1g-dev:i386
远程登陆
(按需)考虑到远程登陆(非局域网),需开放22端口:
sudo iptables -I INPUT -p tcp --dport 22 -j ACCEPT
下载npc_amd64包,修改npc配置文件,安装npc实现端口映射,至于nps的用法这里不做介绍!
sudo ./npc install -server=192.168.0.0 -vkey=kjdfpirf4t2o8lf3ul -type=tcp
sudo npc start
同步代码
下载rk repo工具,克隆地址文档有介绍,然后配置环境变量
cp ./repo/repo ./bin/
vim ~/.bashrc
export PATH=~/bin:$PATH
生成sshkey,提供给rk,授权后即可同步sdk代码:
例如:
Python2.7的环境下同步rk的repo
同步好rk repo后同步对应的sdk代码仓库:
~/repo/repo init --repo-url ssh://[email protected]/ccc/rk/tools/repo -u ssh://[email protected]/bbb/aaaaaaa/ccc/manifests -b linux -m rk3588_linux_release.xml
如无法同步可参考如下:
复制或移动ssh key 需要注意.ssh目录的文件权限。
3588:~/.ssh$ sudo chmod 644 id_rsa.pub
3588:~/.ssh$ sudo chmod 600 id_rsa
3588:~$ ssh-agent bash
3588:~$ ssh-add .ssh/id_rsa
配置gcc 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 1
sudo update-alternatives --config gcc
git版本是最新版(当前版本是2.36),默认不支持rsa。
修改~/.ssh/config文件,添加一行
PubkeyAcceptedKeyTypes +ssh-rsa
安装python2.7和python3.6按需切换
记得先安装gcc10才能安装python3.6
为何需要安装Python3.6?因为linux的repo版本需要!
如下:
http://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
下载后进行解压
tar -xvzf Python-3.6.4.tgz
然后安装
cd Python-3.6.4
./configure --with-ssl
sudo make
sudo make install
如果安装遇到问题百度即可:
类似如下错误可以参看:
The necessary bits to build these optional modules were not found:
apt-get install uuid-dev libbz2-dev libncurses5-dev libgdbm-dev liblzma-dev sqlite3 libsqlite3-dev openssl libssl-dev tcl8.6-dev tk8.6-dev libreadline-dev zlib1g-dev libffi-dev
进行python命令优先级的设定
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.6 2
选择python版本
sudo update-alternatives --config python
python2安装pip
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
pip安装formatter
sudo pip install formatter
ubuntu修改python2.7的默认编码方式为utf-8
sudo vim /usr/lib/python2.7/sitecustomize.py
在开头加入如下内容:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
如果在同步过程中遇到git 克隆问题可参考如下:
git config --global http.version HTTP/1.1
git config --global --unset https.proxy
git config --global --unset http.proxygit config --global http.sslverify false
git config --global https.sslverify false
请勿使用磁盘格式为NTFS,会导致sdk中的aux文件/文件夹无法创建。
至此,进入sdk目录按照官方文件全编译即可。