问题现象
参考OPTEE官方指导下载OPTEE QEMU v8对应repo时提示“Failed to connect to boringssl.googlesource.com port 443: Connection timed out”,如下
$repo sync -j4
Fetching: 85% (24/28) OP-TEE/optee_client.git
fatal: unable to access 'https://boringssl.googlesource.com/boringssl/': Failed to connect to boringssl.googlesource.com port 443: Connection timed out
tianocore/edk2.git/CryptoPkg/Library/OpensslLib/openssl/boringssl:
fatal: unable to access 'https://boringssl.googlesource.com/boringssl/': Failed to connect to boringssl.googlesource.com port 443: Connection timed out
tianocore/edk2.git/CryptoPkg/Library/OpensslLib/openssl/boringssl: sleeping 4.0 seconds before retrying
fatal: unable to access 'https://boringssl.googlesource.com/boringssl/': Failed to connect to boringssl.googlesource.com port 443: Connection timed out
tianocore/edk2.git/CryptoPkg/Library/OpensslLib/openssl/boringssl:
fatal: unable to access 'https://boringssl.googlesource.com/boringssl/': Failed to connect to boringssl.googlesource.com port 443: Connection timed out
error: Cannot fetch tianocore/edk2.git/CryptoPkg/Library/OpensslLib/openssl/boringssl from https://boringssl.googlesource.com/boringssl
Fetching: 100% (28/28), done in 4m36.202s
G
问题原因
optee的qemu-v8分支会自动下载edk2,而edk2的Openssl在下载boringssl时访问boringssl.googlesource.com,而GFW屏蔽了googlesouce,所以会导致链接超时
解决方案
解决思路是使用git config --global url.A.insteadOf B命令将boringssl.googlesource.com替换为谷歌的github镜像库https://github.com/google/boringssl.git,方法如下:
- 执行如下命令
git config --global url."https://github.com/google/boringssl.git".insteadOf "https://boringssl.googlesource.com/boringssl"
2.如果github下载速度过慢,则可以使用hub.fastgit.org加速,启用加速的命令如下
git config --global url."https://hub.fastgit.org/google/boringssl.git".insteadOf "https://boringssl.googlesource.com/boringssl"
- 重新执行repo sync即可
结果Log
xxx@LISS:~/optee
$git config --global url."https://hub.fastgit.org/google/boringssl.git".insteadOf "https://boringssl.googlesource.com/boringssl"
xxx@LISS:~/optee
$repo syncFetching: 100% (28/28), done in 1m25.215sGarbage collecting: 46% (13/28) tianocore/edk2.git/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/research/libdivsGarbage collecting: 100% (28/28), done in 0.072s
Checking out: 100% (28/28), done in 0.715s
repo sync has finished successfully.