我有兩個帶有 Yocto 元資料的分支,它們構建略有不同的影像(其中一個影像安裝了更多有助于開發代碼的包)。每個分支都有管道腳本。
目前,兩個分支都在同一個構建目錄中構建鏡像。我希望每個分支都有自己的構建目錄及其元資料,例如 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)
感謝幫助:)
uj5u.com熱心網友回復:
所有構建都將發生在同一個build檔案夾中,因為您沒有source ${META_LAYERS}/poky/oe-init-build-env在BuildImage作業中傳遞構建名稱。
因此,每次運行管道時,oe-init-build-env都會獲取相同的構建。
您可以創建新變數以自動獲取分支名稱,然后:
variables:
BRANCH_NAME: example
..
- 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 -b $(BRANCH_NAME)
^
|
--------------------------------------------------------/
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/527277.html
標籤:天蓝色管道约克托
