安装所需工具

depot_tools

mkdir ~/tools
cd ~/tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# 设置环境变量
export PATH=$PATH:$HOME/tools/depot_tools
nano ~/.bashrc
# 添加至最后一行
# 工具环境变量
export PATH=$PATH:$HOME/tools/depot_tools
# 然后source一下
source ~/.bashrc

如果提示无法连接,则为代理问题

git config --global http.proxy "http://127.0.0.1:7890"

安装Ninja

新的depot_tools工具中不带Ninja,所以需要自己安装

sudo apt install ninja-build

rpi_rootfs工具下载

mkdir -p ~/Workspace
git clone https://github.com/kclyu/rpi_rootfs

交叉编译工具链下载

cd ~/Workspace/rpi_rootfs
mkdir tools
cd tools
# 必须要翻墙
../scripts/gdrive_download.sh 1q7Zk-7NhVROrBBWVgm56PbndZauSZL27 gcc-linaro-8.3.0-2019.03-x86_64_arm-linux-gnueabihf.tar.xz
# 不用翻墙的方法、以下相同
# wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz
xz -dc gcc-linaro-8.3.0-2019.03-x86_64_arm-linux-gnueabihf.tar.xz  | tar xvf -
ln -sf gcc-linaro-8.3.0-2019.03-x86_64_arm-linux-gnueabihf  arm-linux-gnueabihf
cd /opt
sudo ln -sf ~/Workspace/rpi_rootfs
export PATH=/opt/rpi_rootfs/tools/arm-linux-gnueabihf/bin:$PATH

WebRTC 本机代码包

1.代理服务器配置

nano ~/.boto
# 填入以下内容
[Boto]
proxy = 127.0.0.1
proxy_port = 7890
# 设置环境变量
export NO_AUTH_BOTO_CONFIG=~/.boto
# 也可以写入bashrc里

2.下载webrtc的源代码

mkdir -p ~/Workspace/webrtc
cd ~/Workspace/webrtc
# 下载代码、很慢,有18G
fetch --nohooks webrtc
# 查看分支
git checkout -r
# 不能使用最新的分支,只能使用比较老的版本的分支
gclient sync -n -D -r 64f1f3f04edd945c8ae9f403f37ffb5cb6e7c14d
gclient sync

3.下载rpi_rootfs
报错:OSError: [Errno 13] Permission denied: 如下

################################################################################
###
### fixing absolute links
###
################################################################################
File Starting /home/yoola/Workspace/rpi_rootfs/rootfs/etc/fonts/conf.d/90-synthetic.conf link /usr/share/fontconfig/conf.avail/90-synthetic.conf
Traceback (most recent call last):
  File "./rpi_rootfs.py", line 274, in <module>
    sys.exit(main(sys.argv))
  File "./rpi_rootfs.py", line 256, in main
    process_relativelinks(rootfs_path);
  File "./rpi_rootfs.py", line 106, in process_relativelinks
    relativelinks_handlelink(topdir, filep, subdir) 
  File "./rpi_rootfs.py", line 92, in relativelinks_handlelink
    os.unlink(filep)
OSError: [Errno 13] Permission denied: '/home/yoola/Workspace/rpi_rootfs/rootfs/etc/fonts/conf.d/90-synthetic.conf'

解决方案:

#~/Workspace/rpi_rootfs$ 
sudo ./rpi_rootfs.py local ./rootfs