blob: affb2c06674f22aa134cd883f0b2d5442b1eaeac [file] [log] [blame]
Patrick Williamse7162a02021-03-16 00:06:54 -05001#!/bin/bash
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +10302
3set -eu
4set -x
5
6# AST2400
7PALMETTO_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'
8PALMETTO_MTD="$(basename "$PALMETTO_MTD_URL")"
9
10# AST2500
11WITHERSPOON_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'
12WITHERSPOON_MTD="$(basename "$WITHERSPOON_MTD_URL")"
13
14# AST2600
15TACOMA_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'
16TACOMA_WIC_XZ="$(basename "$TACOMA_WIC_XZ_URL")"
17TACOMA_MMC="$(basename "$TACOMA_WIC_XZ_URL" .xz)"
18
19TACOMA_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'
20TACOMA_FITIMAGE="$(basename "$TACOMA_FITIMAGE_URL")"
21
22TACOMA_KERNEL=$(mktemp --suffix .kernel)
23TACOMA_DTB=$(mktemp --suffix .dtb)
24TACOMA_INITRD=$(mktemp --suffix .initrd)
25
26cleanup() {
Patrick Williamse7162a02021-03-16 00:06:54 -050027 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 Jeffery0eb7ce02021-01-15 22:47:22 +103032}
33
34trap cleanup EXIT 2
35
36# AST2400
37wget "$PALMETTO_MTD_URL"
Patrick Williamse7162a02021-03-16 00:06:54 -050038# shellcheck disable=SC2016 # 'expect' strings
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103039expect \
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" \
46 -c 'set timeout 120' \
47 -c 'expect timeout { exit 1 } "login:"' \
Patrick Williamse7162a02021-03-16 00:06:54 -050048 -c 'spawn sshpass -p 0penBmc
49 ssh -o UserKnownHostsFile=/dev/null
50 -o StrictHostKeyChecking=no
51 -p2222
52 root@localhost
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103053 journalctl -b' \
54 -c 'expect -i $spawn_id eof'
55
56# AST2500
57wget "$WITHERSPOON_MTD_URL"
Patrick Williamse7162a02021-03-16 00:06:54 -050058# shellcheck disable=SC2016 # 'expect' strings
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103059expect \
60 -c "spawn qemu-system-arm \
61 -M witherspoon-bmc \
62 -drive file=${WITHERSPOON_MTD},if=mtd,format=raw \
63 -nographic \
64 -net nic \
65 -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu" \
66 -c 'set timeout 120' \
67 -c 'expect timeout { exit 1 } "login:"' \
Patrick Williamse7162a02021-03-16 00:06:54 -050068 -c 'spawn sshpass -p 0penBmc
69 ssh -o UserKnownHostsFile=/dev/null
70 -o StrictHostKeyChecking=no
71 -p2222
72 root@localhost
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103073 journalctl -b' \
74 -c 'expect -i $spawn_id eof'
75
76# AST2600
77wget "$TACOMA_WIC_XZ_URL"
Patrick Williamse7162a02021-03-16 00:06:54 -050078unxz "$TACOMA_WIC_XZ"
79truncate -s 16G "$TACOMA_MMC"
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103080
Patrick Williamse7162a02021-03-16 00:06:54 -050081wget "$TACOMA_FITIMAGE_URL"
82dumpimage -T flat_dt -p 0 -o "$TACOMA_KERNEL" "$TACOMA_FITIMAGE"
83dumpimage -T flat_dt -p 1 -o "$TACOMA_DTB" "$TACOMA_FITIMAGE"
84dumpimage -T flat_dt -p 2 -o "$TACOMA_INITRD" "$TACOMA_FITIMAGE"
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103085
Patrick Williamse7162a02021-03-16 00:06:54 -050086# shellcheck disable=SC2016 # 'expect' strings
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +103087expect \
88 -c "spawn qemu-system-arm -M tacoma-bmc \
89 -kernel $TACOMA_KERNEL \
90 -dtb $TACOMA_DTB \
91 -initrd $TACOMA_INITRD \
92 -drive file=${TACOMA_MMC},if=sd,format=raw,index=2 \
93 -net nic \
94 -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu \
95 -nographic \
96 -append \"console=ttyS4,115200n8 rootwait root=PARTLABEL=rofs-a\"" \
97 -c 'set timeout 120' \
98 -c 'expect timeout { exit 1 } "login:"' \
Patrick Williamse7162a02021-03-16 00:06:54 -050099 -c 'spawn sshpass -p 0penBmc
100 ssh -o UserKnownHostsFile=/dev/null
101 -o StrictHostKeyChecking=no
102 -p2222
103 root@localhost
Andrew Jeffery0eb7ce02021-01-15 22:47:22 +1030104 journalctl -b' \
105 -c 'expect -i $spawn_id eof'