#!/bin/bash set -eu set -x ARTIFACT_DIR=$(mktemp -d) trap 'rm -rf ${ARTIFACT_DIR}' EXIT function acquire() { local target="$1" wget --quiet --show-progress --directory-prefix="${ARTIFACT_DIR}" https://jenkins.openbmc.org/view/latest/job/latest-master/lastSuccessfulBuild/label=docker-builder,target="${target}"/artifact/openbmc/build/tmp/deploy/images/"${target}"/'*zip*'/"${target}".zip unzip -qq -d "${ARTIFACT_DIR}" "${ARTIFACT_DIR}"/"${target}".zip echo "${ARTIFACT_DIR}"/"${target}" } # AST2400 PALMETTO_ARTIFACTS="$(acquire palmetto)" PALMETTO_MTD="$(echo "${PALMETTO_ARTIFACTS}"/obmc-phosphor-image-palmetto-*.static.mtd)" # shellcheck disable=SC2016 # 'expect' strings expect \ -c "spawn qemu-system-arm \ -M palmetto-bmc \ -drive file=${PALMETTO_MTD},if=mtd,format=raw \ -nographic \ -net nic \ -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \ -c 'set timeout 300' \ -c 'expect timeout { exit 1 } "login:"' \ -c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \ -c 'expect -i $spawn_id eof' # AST2500 ROMULUS_ARTIFACTS="$(acquire romulus)" ROMULUS_MTD="$(echo "${ROMULUS_ARTIFACTS}"/obmc-phosphor-image-romulus*.mtd)" # shellcheck disable=SC2016 # 'expect' strings expect \ -c "spawn qemu-system-arm \ -M romulus-bmc \ -drive file=${ROMULUS_MTD},if=mtd,format=raw \ -nographic \ -net nic \ -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \ -c 'set timeout 300' \ -c 'expect timeout { exit 1 } "login:"' \ -c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \ -c 'expect -i $spawn_id eof' # AST2600 P10BMC_ARTIFACTS="$(acquire p10bmc)" P10BMC_WIC_XZ="$(echo "${P10BMC_ARTIFACTS}"/obmc-phosphor-image-p10bmc-*.wic.xz)" P10BMC_MMC="${P10BMC_WIC_XZ%.xz}" P10BMC_UBOOT_SPL="$(echo "${P10BMC_ARTIFACTS}"/u-boot-spl.bin-*)" P10BMC_UBOOT="$(echo "${P10BMC_ARTIFACTS}"/u-boot-p10bmc-*.bin)" dd of="$P10BMC_MMC" if=/dev/zero bs=1M count=2 dd of="$P10BMC_MMC" if="$P10BMC_UBOOT_SPL" conv=notrunc dd of="$P10BMC_MMC" if="$P10BMC_UBOOT" conv=notrunc bs=1K seek=64 xz --decompress --stdout --keep "$P10BMC_WIC_XZ" | dd of="$P10BMC_MMC" conv=notrunc bs=1M seek=2 truncate -s 16G "$P10BMC_MMC" # shellcheck disable=SC2016 # 'expect' strings expect \ -c "spawn qemu-system-arm -M rainier-bmc \ -drive file=${P10BMC_MMC},if=sd,format=raw,index=2 \ -net nic \ -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu \ -nographic" \ -c 'set timeout 300' \ -c 'expect timeout { exit 1 } "login:"' \ -c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \ -c 'expect -i $spawn_id eof'