yocto 是一个非常优秀的linux开源系统架构,如何将开源的yocto linux 代码变为本地仓库
1.获取源代码的仓库mirror镜像
mkdir version
repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-4.1-krogoth -m imx-4.1.15-2.0.0.xml
执行完之后文件结构如下:
cxt@cxt-Vostro-5468:~/version$ ls
fsl-arm-yocto-bsp.git git-repo.git meta-fsl-arm-extra.git meta-fsl-bsp-release.git meta-openembedded.git poky.git
fsl-community-bsp-base.git meta-browser.git meta-fsl-arm.git meta-fsl-demos.git meta-qt5.git
在当前目录下创建manifest.git管理仓库:
git init --bare manifest.git
执行完之后去另外一个窗口新建目录,并clone 下这个manifest.git仓库,假如本地ip为192.168.0.100
git clone cxt:/192.168.0.100:/home/cxt/version/manifest.git
cd mainifest
在源代码下有个.repo文件夹,复制其中的manifest.xml文件到本地目录
~
原始代码中fetch是从github获取的代码,我们需要将路径更换为本地,name也改为origin
同时project 也要更改为origin,更改后内容如下:
同时更改之后将manifest.xml更名替换为default.xml,然后提交到服务器.
git add .
git commit -m "add default.xml"
git push origin master
初始化完成之后新建文件夹就可以通过repo下载了
repo init -u ssh://[email protected]/home/cxt/version/manifest.git
repo sync
配置过程遇到问题如下:
cxt@cxt-Vostro-5468:~/test/test6$ repo init -u ssh://[email protected]/home/cxt/RepoServer/manifest.git
Get https://gerrit-googlesource.proxy.ustclug.org/git-repo/clone.bundle
Get https://gerrit-googlesource.proxy.ustclug.org/git-repo
remote: Finding sources: 100% (28/28)
remote: Total 28 (delta 6), reused 28 (delta 6)
Unpacking objects: 100% (28/28), done.
From https://gerrit-googlesource.proxy.ustclug.org/git-repo
34bc571..7c321f1 master -> origin/master... A new repo command ( 1.26) is available.
... You should upgrade soon:cp /home/cxt/test/test6/.repo/repo/repo /home/cxt/bin/repo
Get ssh://[email protected]/home/cxt/RepoServer/manifest.git
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
From ssh://192.168.0.100/home/cxt/RepoServer/manifest
* [new branch] master -> origin/master
fatal: manifest 'default.xml' not available
fatal: manifest default.xml not found
这个是由于从源代码拷贝过得manifest.xml文件没有更改为default.xml,repo下载代码会默认选择default.xml文件
cxt@cxt-Vostro-5468:~/test/test6$ repo init -u ssh://[email protected]/home/cxt/RepoServer/manifest.git
... A new repo command ( 1.26) is available.
... You should upgrade soon:cp /home/cxt/test/test6/.repo/repo/repo /home/cxt/bin/repo
remote: Counting objects: 2, done.
remote: Total 2 (delta 0), reused 0 (delta 0)
From ssh://192.168.0.100/home/cxt/RepoServer/manifest
85bf45e..73bf19f master -> origin/master
project .repo/manifests/
Updating 85bf45e..73bf19f
Fast-forward
manifest.xml => default.xml | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename manifest.xml => default.xml (100%)fatal: manifest 'default.xml' not available
fatal: remote oe not defined in /home/cxt/test/test6/.repo/manifests/default.xml
原始代码中的分支名有yocto,oe等各种分支,需要将这些名称更改为origin即可。
关于manifest.xml的解析可以参考:https://blog.csdn.net/shift_wwx/article/details/19557031