Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 2 | |
| 3 | set -eu |
| 4 | set -x |
| 5 | |
| 6 | # AST2400 |
| 7 | PALMETTO_MTD_URL='https://jenkins.openbmc.org/job/ci-openbmc/distro=ubuntu,label=docker-builder,target=palmetto/lastStableBuild/artifact/openbmc/build/tmp/deploy/images/palmetto/obmc-phosphor-image-palmetto.static.mtd' |
| 8 | PALMETTO_MTD="$(basename "$PALMETTO_MTD_URL")" |
| 9 | |
| 10 | # AST2500 |
| 11 | WITHERSPOON_MTD_URL='https://jenkins.openbmc.org/job/ci-openbmc/distro=ubuntu,label=docker-builder,target=witherspoon/lastStableBuild/artifact/openbmc/build/tmp/deploy/images/witherspoon/obmc-phosphor-image-witherspoon.ubi.mtd' |
| 12 | WITHERSPOON_MTD="$(basename "$WITHERSPOON_MTD_URL")" |
| 13 | |
| 14 | # AST2600 |
| 15 | TACOMA_WIC_XZ_URL='https://jenkins.openbmc.org/job/ci-openbmc/distro=ubuntu,label=docker-builder,target=witherspoon-tacoma/lastStableBuild/artifact/openbmc/build/tmp/deploy/images/witherspoon-tacoma/obmc-phosphor-image-witherspoon-tacoma.wic.xz' |
| 16 | TACOMA_WIC_XZ="$(basename "$TACOMA_WIC_XZ_URL")" |
| 17 | TACOMA_MMC="$(basename "$TACOMA_WIC_XZ_URL" .xz)" |
| 18 | |
| 19 | TACOMA_FITIMAGE_URL='https://jenkins.openbmc.org/job/ci-openbmc/distro=ubuntu,label=docker-builder,target=witherspoon-tacoma/lastStableBuild/artifact/openbmc/build/tmp/deploy/images/witherspoon-tacoma/fitImage-obmc-phosphor-initramfs-witherspoon-tacoma-witherspoon-tacoma' |
| 20 | TACOMA_FITIMAGE="$(basename "$TACOMA_FITIMAGE_URL")" |
| 21 | |
| 22 | TACOMA_KERNEL=$(mktemp --suffix .kernel) |
| 23 | TACOMA_DTB=$(mktemp --suffix .dtb) |
| 24 | TACOMA_INITRD=$(mktemp --suffix .initrd) |
| 25 | |
| 26 | cleanup() { |
Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 27 | rm -f "$PALMETTO_MTD" |
| 28 | rm -f "$WITHERSPOON_MTD" |
| 29 | rm -f "$TACOMA_WIC_XZ" "$TACOMA_MMC" |
| 30 | rm -f "$TACOMA_FITIMAGE" |
| 31 | rm -f "$TACOMA_KERNEL" "$TACOMA_DTB $TACOMA_INITRD" |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | trap cleanup EXIT 2 |
| 35 | |
| 36 | # AST2400 |
| 37 | wget "$PALMETTO_MTD_URL" |
Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 38 | # shellcheck disable=SC2016 # 'expect' strings |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 39 | expect \ |
| 40 | -c "spawn qemu-system-arm \ |
| 41 | -M palmetto-bmc \ |
| 42 | -drive file=${PALMETTO_MTD},if=mtd,format=raw \ |
| 43 | -nographic \ |
| 44 | -net nic \ |
| 45 | -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \ |
Andrew Jeffery | 7d6ee0b | 2022-05-02 10:04:48 +0930 | [diff] [blame^] | 46 | -c 'set timeout 300' \ |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 47 | -c 'expect timeout { exit 1 } "login:"' \ |
Andrew Jeffery | 0e47d12 | 2022-05-02 10:08:11 +0930 | [diff] [blame] | 48 | -c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \ |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 49 | -c 'expect -i $spawn_id eof' |
| 50 | |
| 51 | # AST2500 |
| 52 | wget "$WITHERSPOON_MTD_URL" |
Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 53 | # shellcheck disable=SC2016 # 'expect' strings |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 54 | expect \ |
| 55 | -c "spawn qemu-system-arm \ |
| 56 | -M witherspoon-bmc \ |
| 57 | -drive file=${WITHERSPOON_MTD},if=mtd,format=raw \ |
| 58 | -nographic \ |
| 59 | -net nic \ |
| 60 | -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \ |
Andrew Jeffery | 7d6ee0b | 2022-05-02 10:04:48 +0930 | [diff] [blame^] | 61 | -c 'set timeout 300' \ |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 62 | -c 'expect timeout { exit 1 } "login:"' \ |
Andrew Jeffery | 0e47d12 | 2022-05-02 10:08:11 +0930 | [diff] [blame] | 63 | -c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \ |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 64 | -c 'expect -i $spawn_id eof' |
| 65 | |
| 66 | # AST2600 |
| 67 | wget "$TACOMA_WIC_XZ_URL" |
Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 68 | unxz "$TACOMA_WIC_XZ" |
| 69 | truncate -s 16G "$TACOMA_MMC" |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 70 | |
Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 71 | wget "$TACOMA_FITIMAGE_URL" |
| 72 | dumpimage -T flat_dt -p 0 -o "$TACOMA_KERNEL" "$TACOMA_FITIMAGE" |
| 73 | dumpimage -T flat_dt -p 1 -o "$TACOMA_DTB" "$TACOMA_FITIMAGE" |
| 74 | dumpimage -T flat_dt -p 2 -o "$TACOMA_INITRD" "$TACOMA_FITIMAGE" |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 75 | |
Patrick Williams | e7162a0 | 2021-03-16 00:06:54 -0500 | [diff] [blame] | 76 | # shellcheck disable=SC2016 # 'expect' strings |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 77 | expect \ |
| 78 | -c "spawn qemu-system-arm -M tacoma-bmc \ |
| 79 | -kernel $TACOMA_KERNEL \ |
| 80 | -dtb $TACOMA_DTB \ |
| 81 | -initrd $TACOMA_INITRD \ |
| 82 | -drive file=${TACOMA_MMC},if=sd,format=raw,index=2 \ |
| 83 | -net nic \ |
| 84 | -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu \ |
| 85 | -nographic \ |
| 86 | -append \"console=ttyS4,115200n8 rootwait root=PARTLABEL=rofs-a\"" \ |
Andrew Jeffery | 7d6ee0b | 2022-05-02 10:04:48 +0930 | [diff] [blame^] | 87 | -c 'set timeout 300' \ |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 88 | -c 'expect timeout { exit 1 } "login:"' \ |
Andrew Jeffery | 0e47d12 | 2022-05-02 10:08:11 +0930 | [diff] [blame] | 89 | -c 'spawn sshpass -p 0penBmc ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2222 root@localhost journalctl -b' \ |
Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 90 | -c 'expect -i $spawn_id eof' |