我有两个带有Yocto meta数据的分支,它们构建的图像略有不同(其中一个图像安装了更多的包,有助于开发代码)。
目前,两个分支都在同一个构建目录中构建映像。我希望每个分支都有自己的构建目录和元数据,比如sstate-cache......如何实现?
trigger:
- development-image
variables:
IMAGE_NAME: texas-image
IMAGE_FILE: texas-image.rootfs.wic.xz
META_LAYERS: yocto-meta-layers
YOCTO_RELEASE: kirkstone
YOCTO_SOURCES: yocto-linux
YOCTO_BUILD_DIR: build
FIT_IMAGE_DIR: tools/tftp_u-boot
FIT_IMAGE_NAME: puma
BOOT_OVER_ETH: boot-over-eth
IMAGE_FILE_BOOT_OVER_ETH: texas-image.rootfs.cpio.gz
IMAGE_DEVICE_TREE_EVM_BOARD: k3-am642-evm.dtb
IMAGE_DEVICE_TREE_SK_BOARD: k3-am642-sk.dtb
BOOTLOADER_IMAGE_BOOT_OVER_ETH: u-boot.img
TIBOOT3_BINARY_BOOT_OVER_ETH: tiboot3.bin
TISPL_BINARY_BOOT_OVER_ETH: tispl.bin
KERNEL_IMAGE_BOOT_OVER_ETH: Image
pool:
#vmImage: ubuntu-latest
name: Etteplan
stages:
- stage: SetupYoctoEnv
jobs:
- job: DownloadResources
displayName: 'Downloading resources and dependencies'
#workspace:
#clean: $(IMAGE_DIR)
steps:
- bash: |
echo $(Build.ArtifactStagingDirectory)
echo $(Build.SourcesDirectory)
echo $(Build.BinariesDirectory)
echo $(Common.TestResultsDirectory)
- checkout: self # self represents the repo where the initial Pipelines YAML file was found clean: true
clean: false
path: $(YOCTO_SOURCES)
#- task: DeleteFiles@1
# displayName: "Removing tmp directory"
# inputs:
# SourceFolder: $(YOCTO_BUILD_DIR)/tmp
# Contents: '*'
# RemoveSourceFolder: true
- bash: |
echo Creating directory structure
ls -l
mkdir -p ${META_LAYERS}
mkdir -p ${BOOT_OVER_ETH}
- bash: |
echo Fetching Yocto meta layers
pwd
if [[ ! -d poky ]]; then git clone -b ${YOCTO_RELEASE} git://git.yoctoproject.org/poky.git; fi
if [[ ! -d meta-openembedded ]]; then git clone -b ${YOCTO_RELEASE} git://git.openembedded.org/meta-openembedded; fi
if [[ ! -d meta-ti ]]; then git clone -b ${YOCTO_RELEASE} git://git.yoctoproject.org/meta-ti; fi
if [[ ! -d meta-arm ]]; then git clone -b ${YOCTO_RELEASE} https://git.yoctoproject.org/meta-arm/; fi
workingDirectory: $(META_LAYERS)
- job: PrepareEnv
displayName: 'Preparing Environment'
dependsOn: 'DownloadResources'
steps:
- checkout: none
clean: false
path: $(YOCTO_SOURCES)
- bash: |
echo Initializing Yocto build environment
source ${META_LAYERS}/poky/oe-init-build-env
echo "Adding layers to bblayers.conf"
pwd
if ! grep -q meta-oe conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-openembedded/meta-oe; fi
if ! grep -q meta-python conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-openembedded/meta-python; fi
if ! grep -q meta-networking conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-openembedded/meta-networking; fi
if ! grep -q meta-arm-toolchain conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-arm/meta-arm-toolchain; fi
if ! grep -q meta-arm conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-arm/meta-arm; fi
if ! grep -q meta-ti-bsp conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-ti/meta-ti-bsp; fi
if ! grep -q meta-ti-extras conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/meta-ti/meta-ti-extras; fi
if ! grep -q meta-rt conf/bblayers.conf; then bitbake-layers add-layer ../${META_LAYERS}/../meta-rt; fi
- stage: BuildImage
dependsOn:
- SetupYoctoEnv
jobs:
- job: BuildImage
displayName: 'Building Yocto image'
timeoutInMinutes: 300
steps:
- checkout: none
clean: false
path: $(YOCTO_SOURCES)
- bash: |
source ${META_LAYERS}/poky/oe-init-build-env
bitbake ${IMAGE_NAME}
- job: BuildFitImage
displayName: 'Building Fit Image'
dependsOn: 'BuildImage'
steps:
- checkout: none
clean: false
path: $(YOCTO_SOURCES)
- bash: |
ln -s ../../$(YOCTO_BUILD_DIR)/tmp/deploy/images/am64xx-evm bin
ls -l bin
mkimage -f ${FIT_IMAGE_NAME}.its ${FIT_IMAGE_NAME}.itb
workingDirectory: $(FIT_IMAGE_DIR)
- stage: Publish
dependsOn:
- BuildImage
jobs:
- job: PublishImage
displayName: 'Publish Image'
steps:
- checkout: none
- task: CopyFiles@2
displayName: 'Collecting files boot over ethernet'
inputs:
sourceFolder: '$(YOCTO_BUILD_DIR)/tmp/deploy/images/am64xx-evm'
contents: |
$(IMAGE_FILE_BOOT_OVER_ETH)
$(IMAGE_DEVICE_TREE_EVM_BOARD)
$(IMAGE_DEVICE_TREE_SK_BOARD)
$(BOOTLOADER_IMAGE_BOOT_OVER_ETH)
$(TIBOOT3_BINARY_BOOT_OVER_ETH)
$(TIBOOT3_BINARY_BOOT_OVER_ETH)
$(TISPL_BINARY_BOOT_OVER_ETH)
$(KERNEL_IMAGE_BOOT_OVER_ETH)
overWrite: true
targetFolder: '$(BOOT_OVER_ETH)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(BOOT_OVER_ETH)
archiveType: 'zip'
archiveFile: $(BOOT_OVER_ETH).zip
replaceExistingArchive: true
verbose: true
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(BOOT_OVER_ETH).zip
artifactType: 'pipeline'
artifactName: $(BOOT_OVER_ETH)
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(YOCTO_BUILD_DIR)/tmp/deploy/images/am64xx-evm/$(IMAGE_FILE)
artifactType: 'pipeline'
artifactName: $(IMAGE_NAME)
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(FIT_IMAGE_DIR)/$(FIT_IMAGE_NAME).itb
artifactType: 'pipeline'
artifactName: fit-image-$(FIT_IMAGE_NAME)
感谢您的帮助:)
1条答案
按热度按时间deyfvvtc1#
所有构建都将发生在同一个
build
文件夹中,因为您没有在BuildImage
作业中将构建名称传递给source ${META_LAYERS}/poky/oe-init-build-env
。因此,每次运行管道时,
oe-init-build-env
都将源代码相同的构建。您可以创建新变量以自动获取分支名称,然后: