step 1: 下载repo
git-repo下载可在服务器端通过以下任一方式下载。
git clone https://gerrit.googlesource.com/git-repo (谷歌官方源)
git clone https://mirrors.tuna.tsinghua.edu.cn/git/git-repo (国内清华源)
git clone git-repo - Git at Google (国内中科大源)
step 0:建立私人的git-repo工具工程:
方法一,在git server上直接操作
git clone https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -b main
方法二,在本地操作,然后上传到git server:
# git clone --mirror https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
git remote add gitrepo.git http://git.inspur.com/rk3588/gitrepo.git
git push -u gitrepo.git --all
git push -u gitrepo.git --tags (可选)
#git config --global http.postBuffer 1048576000 //设置缓存为1G
# git config http.postBuffer 524288000 //查看 http.postBuffer数值是否设置成功
step 2 初始化工程和mainifest git仓库
step 1: 初始化 manifest git server端,用于规划整个项目的代码结构:
pakydu@ubuntu18-fttr:~/works/3588/mygit$ mkdir -p rk3588/manifest
pakydu@ubuntu18-fttr:~/works/3588/mygit$ cd rk3588/manifest/
pakydu@ubuntu18-fttr:~/works/3588/mygit/rk3588/manifest$ ls -al
pakydu@ubuntu18-fttr:~/works/3588/mygit/rk3588/manifest$ git init
Initialized empty Git repository in /home/pakydu/works/3588/mygit/rk3588/manifest/
pakydu@ubuntu18-fttr:~/works/3588/mygit/rk3588/manifest$
#创建工程魔板:
vi default.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="linux"
fetch="http://git.inspur.com/rk3588" />
<default revision="master"
remote="linux"
sync-j="1" />
<project path="kernel" name="kernel" />
<project path="buildroot" name="rootfs" />
<project path="u-boot" name="u-boot" />
<project path="external/rockit" name="external/rockit" />
</manifest>
#提交工程模版
git add *
git commit -m "add default.xml"
git remote rm origin (删除旧的)
git remote add origin http://git.inspur.com/rk3588/manifest.git
git branch main
git checkout main
git push http://git.inspur.com/rk3588/manifest.git
step 3: 上传每个git的代码:
$ git init (已被git管控代码可省略)
$ git add . (已被git管控代码可省略)
$ git commit -m "Init Code" (已被git管控代码可省略)
$ git push http://git.inspur.com/rk3588/kernel.git master (master or main)
$git init (已被git管控代码可省略)
$ git add . (已被git管控代码可省略)
$ git commit -m "Init Code" (已被git管控代码可省略)
$ git push http://git.inspur.com/rk3588/buildroot.git master
...
step 4: 在客户端上repo拉取服务器端代码
将REPO_URL = 'https://gerrit.googlesource.com/git-repo'
修改为 REPO_URL = 'http://git.inspur.com/rk3588/git-repo.git'
#git push http://git.inspur.com/rk3588/git-repo.git
#export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
#export REPO_URL='http://git.inspur.com/rk3588/git-repo.git'
repo init -u http://git.inspur.com/rk3588/manifest.git
Manifest示例
每个采用 repo 管理的复杂多仓库项目都需要一个对应的 manifest 仓库,如 AOSP 的 manifest ,此仓库用来存储所有子仓库的配置信息,repo 也是读取此仓库的配置文件来进行管理操作。里面的配置就是 xml 定义的结构,例如aosp default repository一般是default.xml。
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<default revision="refs/tags/android-13.0.0_r11"
remote="aosp"
sync-j="4" />
<superproject name="platform/superproject" remote="aosp" revision="android-13.0.0_r11" />
<contactinfo bugurl="go/repo-bug" />
<project path="build/make" name="platform/build" groups="pdk" >
<linkfile src="CleanSpec.mk" dest="build/CleanSpec.mk" />
<linkfile src="buildspec.mk.default" dest="build/buildspec.mk.default" />
<linkfile src="core" dest="build/core" />
<linkfile src="envsetup.sh" dest="build/envsetup.sh" />
<linkfile src="target" dest="build/target" />
<linkfile src="tools" dest="build/tools" />
</project>
<project path="build/bazel" name="platform/build/bazel" groups="pdk" >
<linkfile src="bazel.WORKSPACE" dest="WORKSPACE" />
<linkfile src="bazel.sh" dest="tools/bazel" />
<linkfile src="bazel.BUILD" dest="BUILD" />
</project>
<project path="build/bazel_common_rules" name="platform/build/bazel_common_rules" groups="pdk" />
<project path="build/blueprint" name="platform/build/blueprint" groups="pdk,tradefed" />
<project path="build/pesto" name="platform/build/pesto" groups="pdk" />
<project path="build/soong" name="platform/build/soong" groups="pdk,tradefed" >
<linkfile src="root.bp" dest="Android.bp" />
<linkfile src="bootstrap.bash" dest="bootstrap.bash" />
</project>
<!-- END open-source projects -->
</manifest>
#示例
pakydu@ubuntu18-fttr:~/works/3588/rk3588_org/.repo$ cat manifests/rk3588/rk3588_linux_bsp_release_20230114_v1.0.6c.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<include name="include/firefly_gitlab.xml" />
<default remote="firefly-linux" sync-j="4" dest-branch="rk3588/firefly" revision="refs/tags/rk3588/linux_release_v1.0.6c"/>
<project name="u-boot" />
<project name="docs" >
<linkfile dest="docs/.Socs/RK3588/Rockchip_Developer_Guide_Linux_Software_CN.pdf" src="Rockchip_Developer_Guide_Linux_Software_CN.pdf"/>
</project>
<project name="docs-soc_internal" path="docs/.Socs" >
<linkfile dest="docs/RK3588" src="RK3588"/>
</project>
<project name="device/rockchip" dest-branch="firefly" >
<linkfile dest="mkfirmware.sh" src="common/mkfirmware.sh"/>
<linkfile dest="build.sh" src="common/build.sh"/>
<linkfile dest="rkflash.sh" src="common/rkflash.sh"/>
<linkfile dest="device/rockchip/.target_product" src="rk3588"/>
<linkfile dest="firefly-update.sh" src="common/firefly-update.sh"/>
</project>
<project name="tools" >
<linkfile dest="tools/windows/RKDevTool/RKDevTool_Release/config.cfg" src="windows/RKDevTool/RKDevTool_Release/rk3588-config.cfg"/>
<linkfile dest="tools/windows/RKDevTool/rockdev/package-file" src="windows/RKDevTool/rockdev/rk3588-package-file"/>
<linkfile dest="tools/windows/RKDevTool/rockdev/mkupdate.bat" src="windows/RKDevTool/rockdev/rk3588-mkupdate.bat"/>
<linkfile dest="tools/linux/Linux_Pack_Firmware/rockdev/mkupdate.sh" src="linux/Linux_Pack_Firmware/rockdev/rk3588-mkupdate.sh"/>
<linkfile dest="tools/linux/Linux_Pack_Firmware/rockdev/package-file" src="linux/Linux_Pack_Firmware/rockdev/rk3588-package-file"/>
</project>
<project name="kernel" />
<project name="prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu" />
<project name="prebuilts/gcc/linux-x86/arm/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf" />
<project name="rkbin" />
</manifest>
pakydu@ubuntu18-fttr:~/works/3588/rk3588_org/.repo$ cat manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<include name="rk3588/rk3588_linux_bsp_release_20230114_v1.0.6c.xml" />
<project name="external/security/rk_tee_user" />
<project name="app/qfm" />
<project name="app/QLauncher" />
<project name="app/multivideoplayer" />
<project name="app/qcamera" />
<project name="app/qplayer" />
<project name="app/qsetting" />
<project name="buildroot" >
<linkfile dest="Makefile" src="build/Makefile"/>
<linkfile dest="envsetup.sh" src="build/envsetup.sh"/>
</project>
<project name="external/drm-cursor" />
<project name="external/alsa-config" />
<project name="external/camera_engine_rkaiq" />
<project name="external/chromium" />
<project name="external/rkwifibt-app" />
<project name="external/rockchip-test" />
<project name="uefi" />
<project name="external/rk_pcba_test" />
<project name="external/rkscript" dest-branch="firefly"/>
<project name="external/rktoolkit" />
<project name="external/rkupdate" />
<project name="external/rkwifibt" />
<project name="external/gstreamer-rockchip" />
<project name="external/libmali" />
<project name="external/linux-rga" />
<project name="external/recovery" dest-branch="firefly"/>
<project name="external/security/bin" />
<project name="external/xserver" />
<project name="external/mpp" />
<project name="external/rknn-toolkit2" />
<project name="external/rknpu2" />
<project name="external/security/librkcrypto" />
<project name="external/rockit" />
</manifest>
参考: