IMX 平台Yocto SDK拉取步骤
拉取步骤可以在NXP官方yocto指导文档里查看,这里再贴一次,然后针对的讲可能遇到的问题。
1,首先下载repo。repo是谷歌开发的一款python小程序。是基于GIT工作的,可以批量拉取,合并多个代码仓库。用如下的命令下载repo并设置路径,如果不能访问谷歌,可以使用其他镜像,自行网上搜索一下,有很多其他地址。
$ mkdir ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
2,同步repo仓库
#根据需要新建SDK存放的目录
repo init -u https://source.codeaurora.org/external/imx/imx-manifest-b imx-linux-sumo -m imx-4.14.98-2.3.0.xml #这个是同步代码仓库信息
$ repo sync #这里根据代码仓库信息正式拉取代码
主要的问题就是出现在repo sync这里。
fatal: Could not read from remote repository
如果报以上的错误可能的原因有2个,一个是ssh相关的密钥设置错误,需要重新设置。第二原因是因为仓库的地址不对。我在使用时发现imx-5.4.70版本可以正常拉取,但是imx4.14.98版本就提示错误,部分代码不能拉取,通过比较主要原因是在repo仓库文件里的URL错误。
在工作目录下有一个隐藏文件夹.repo,在文件夹manifests里包含所有代码仓库的信息,根据你向拉取的版本,查看对应的xml文件,下面是imx-4.14.98-2.3.1.xml的内容。
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<default sync-j="2"/>
<remote fetch="git://git.yoctoproject.org" name="yocto"/>
<remote fetch="git://github.com/Freescale" name="community"/>
<remote fetch="git://github.com/openembedded" name="oe"/>
<remote fetch="git://github.com/OSSystems" name="OSSystems"/>
<remote fetch="git://github.com/meta-qt5" name="QT5"/>
<remote fetch="https://source.codeaurora.org/external/imx" name="CAF"/>
<project remote="yocto" revision="cbb677e9a09d5dad34404a851f7c23aeb5122465" name="poky" path="sources/poky"/>
<project remote="yocto" revision="86772601e7f6ea188dfaf64097edafc05e15aef3" name="meta-freescale" path="sources/meta-freescale"/>
<project remote="oe" revision="8760facba1bceb299b3613b8955621ddaa3d4c3f" name="meta-openembedded" path="sources/meta-openembedded"/>
<project remote="community" revision="70535e13dd2aabbad53243518f4cc5064d284592" name="fsl-community-bsp-base" path="sources/base">
<linkfile dest="README" src="README"/>
<linkfile dest="setup-environment" src="setup-environment"/>
</project>
<project remote="community" revision="82037216280a39957fb4272581637abec734ad50" name="meta-freescale-3rdparty" path="sources/meta-freescale-3rdparty"/>
<project remote="community" revision="f7e2216e93aff14ac32728a13637a48df436b7f4" name="meta-freescale-distro" path="sources/meta-freescale-distro"/>
<project remote="OSSystems" revision="75640e14e325479c076b6272b646be7a239c18aa" name="meta-browser" path="sources/meta-browser" />
<project remote="QT5" revision="d4e7f73d04e8448d326b6f89908701e304e37d65" name="meta-qt5" path="sources/meta-qt5" />
<project remote="CAF" revision="e1cab5d0fbb8f586f42cf67519822992c852be4c" name="meta-fsl-bsp-release" path="sources/meta-fsl-bsp-release" >
<linkfile src="imx/tools/fsl-setup-release.sh" dest="fsl-setup-release.sh"/>
<linkfile src="imx/README" dest="README-IMXBSP"/>
</project>
</manifest>
可以看到第6-11行列出了远端仓库的URL,下面是要拉取的工程名称。根据这个文件,如果要拉取fsl-community-bsp-base,则ssh协议下的URL是git://github.com/Freescale/fsl-community-bsp-base。但是我们可以在github的仓库页面,可以看到具体的git远程地址已经变了,如下图。但是L4.14.98是比较老的版本了,所以URL地址没有同步修改。所以我们需要对应的修改URL可以使用git地址,也可以使用https地址。
这里修改成https地址后如下所示。注意只需要修改github网站对应的地址,其他网站的地址没有变就不需要修改,如yoctoproject。
<remote fetch="git://git.yoctoproject.org" name="yocto"/>
<remote fetch="https://github.com/Freescale" name="community"/>
<remote fetch="https://github.com/openembedded" name="oe"/>
<remote fetch="https://github.com/OSSystems" name="OSSystems"/>
<remote fetch="https://github.com/meta-qt5" name="QT5"/>
<remote fetch="https://source.codeaurora.org/external/imx" name="CAF"/>