| Andrew Jeffery | 0eb7ce0 | 2021-01-15 22:47:22 +1030 | [diff] [blame] | 1 | #!/bin/sh | 
 | 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() { | 
 | 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 | 
 | 32 | } | 
 | 33 |  | 
 | 34 | trap cleanup EXIT 2 | 
 | 35 |  | 
 | 36 | # AST2400 | 
 | 37 | wget "$PALMETTO_MTD_URL" | 
 | 38 | expect \ | 
 | 39 |     -c "spawn qemu-system-arm \ | 
 | 40 |             -M palmetto-bmc \ | 
 | 41 |             -drive file=${PALMETTO_MTD},if=mtd,format=raw \ | 
 | 42 |             -nographic \ | 
 | 43 |             -net nic \ | 
 | 44 |             -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \ | 
 | 45 |     -c 'set timeout 120' \ | 
 | 46 |     -c 'expect timeout { exit 1 } "login:"' \ | 
 | 47 |     -c 'spawn sshpass -p 0penBmc \ | 
 | 48 |             ssh -o UserKnownHostsFile=/dev/null \ | 
 | 49 |                 -o StrictHostKeyChecking=no \ | 
 | 50 |                 -p2222 \ | 
 | 51 |                 root@localhost \ | 
 | 52 |                 journalctl -b' \ | 
 | 53 |     -c 'expect -i $spawn_id eof' | 
 | 54 |  | 
 | 55 | # AST2500 | 
 | 56 | wget "$WITHERSPOON_MTD_URL" | 
 | 57 | expect \ | 
 | 58 |     -c "spawn qemu-system-arm \ | 
 | 59 |             -M witherspoon-bmc \ | 
 | 60 |             -drive file=${WITHERSPOON_MTD},if=mtd,format=raw \ | 
 | 61 |             -nographic \ | 
 | 62 |             -net nic \ | 
 | 63 |             -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \ | 
 | 64 |     -c 'set timeout 120' \ | 
 | 65 |     -c 'expect timeout { exit 1 } "login:"' \ | 
 | 66 |     -c 'spawn sshpass -p 0penBmc \ | 
 | 67 |             ssh -o UserKnownHostsFile=/dev/null \ | 
 | 68 |                 -o StrictHostKeyChecking=no \ | 
 | 69 |                 -p2222 \ | 
 | 70 |                 root@localhost \ | 
 | 71 |                 journalctl -b' \ | 
 | 72 |     -c 'expect -i $spawn_id eof' | 
 | 73 |  | 
 | 74 | # AST2600 | 
 | 75 | wget "$TACOMA_WIC_XZ_URL" | 
 | 76 | unxz $TACOMA_WIC_XZ | 
 | 77 | truncate -s 16G $TACOMA_MMC | 
 | 78 |  | 
 | 79 | wget $TACOMA_FITIMAGE_URL | 
 | 80 | dumpimage -T flat_dt -p 0 -o $TACOMA_KERNEL $TACOMA_FITIMAGE | 
 | 81 | dumpimage -T flat_dt -p 1 -o $TACOMA_DTB $TACOMA_FITIMAGE | 
 | 82 | dumpimage -T flat_dt -p 2 -o $TACOMA_INITRD $TACOMA_FITIMAGE | 
 | 83 |  | 
 | 84 | expect \ | 
 | 85 |     -c "spawn qemu-system-arm -M tacoma-bmc \ | 
 | 86 |             -kernel $TACOMA_KERNEL \ | 
 | 87 |             -dtb $TACOMA_DTB \ | 
 | 88 |             -initrd $TACOMA_INITRD \ | 
 | 89 |             -drive file=${TACOMA_MMC},if=sd,format=raw,index=2 \ | 
 | 90 |             -net nic \ | 
 | 91 |             -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu \ | 
 | 92 |             -nographic \ | 
 | 93 |             -append \"console=ttyS4,115200n8 rootwait root=PARTLABEL=rofs-a\"" \ | 
 | 94 |     -c 'set timeout 120' \ | 
 | 95 |     -c 'expect timeout { exit 1 } "login:"' \ | 
 | 96 |     -c 'spawn sshpass -p 0penBmc \ | 
 | 97 |             ssh -o UserKnownHostsFile=/dev/null \ | 
 | 98 |                 -o StrictHostKeyChecking=no \ | 
 | 99 |                 -p2222 \ | 
 | 100 |                 root@localhost \ | 
 | 101 |                 journalctl -b' \ | 
 | 102 |     -c 'expect -i $spawn_id eof' |