VirtualBox

source: vbox/trunk/src/VBox/Additions/3D/mesa/mesa-24.0.2/.gitlab-ci/bare-metal/poe-powered.sh@ 105254

最後變更 在這個檔案從105254是 103996,由 vboxsync 提交於 12 月 前

Additions/3D/mesa: export mesa-24.0.2 to OSE. bugref:10606

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:executable 設為 *
檔案大小: 6.8 KB
 
1#!/bin/bash
2# shellcheck disable=SC1091
3# shellcheck disable=SC2034
4# shellcheck disable=SC2059
5# shellcheck disable=SC2086 # we want word splitting
6
7. "$SCRIPTS_DIR"/setup-test-env.sh
8
9# Boot script for devices attached to a PoE switch, using NFS for the root
10# filesystem.
11
12# We're run from the root of the repo, make a helper var for our paths
13BM=$CI_PROJECT_DIR/install/bare-metal
14CI_COMMON=$CI_PROJECT_DIR/install/common
15CI_INSTALL=$CI_PROJECT_DIR/install
16
17# Runner config checks
18if [ -z "$BM_SERIAL" ]; then
19 echo "Must set BM_SERIAL in your gitlab-runner config.toml [[runners]] environment"
20 echo "This is the serial port to listen the device."
21 exit 1
22fi
23
24if [ -z "$BM_POE_ADDRESS" ]; then
25 echo "Must set BM_POE_ADDRESS in your gitlab-runner config.toml [[runners]] environment"
26 echo "This is the PoE switch address to connect for powering up/down devices."
27 exit 1
28fi
29
30if [ -z "$BM_POE_INTERFACE" ]; then
31 echo "Must set BM_POE_INTERFACE in your gitlab-runner config.toml [[runners]] environment"
32 echo "This is the PoE switch interface where the device is connected."
33 exit 1
34fi
35
36if [ -z "$BM_POWERUP" ]; then
37 echo "Must set BM_POWERUP in your gitlab-runner config.toml [[runners]] environment"
38 echo "This is a shell script that should power up the device and begin its boot sequence."
39 exit 1
40fi
41
42if [ -z "$BM_POWERDOWN" ]; then
43 echo "Must set BM_POWERDOWN in your gitlab-runner config.toml [[runners]] environment"
44 echo "This is a shell script that should power off the device."
45 exit 1
46fi
47
48if [ ! -d /nfs ]; then
49 echo "NFS rootfs directory needs to be mounted at /nfs by the gitlab runner"
50 exit 1
51fi
52
53if [ ! -d /tftp ]; then
54 echo "TFTP directory for this board needs to be mounted at /tftp by the gitlab runner"
55 exit 1
56fi
57
58# job config checks
59if [ -z "$BM_ROOTFS" ]; then
60 echo "Must set BM_ROOTFS to your board's rootfs directory in the job's variables"
61 exit 1
62fi
63
64if [ -z "$BM_BOOTFS" ] && { [ -z "$BM_KERNEL" ] || [ -z "$BM_DTB" ]; } ; then
65 echo "Must set /boot files for the TFTP boot in the job's variables or set kernel and dtb"
66 exit 1
67fi
68
69if [ -z "$BM_CMDLINE" ]; then
70 echo "Must set BM_CMDLINE to your board's kernel command line arguments"
71 exit 1
72fi
73
74set -ex
75
76date +'%F %T'
77
78# Clear out any previous run's artifacts.
79rm -rf results/
80mkdir -p results
81
82# Create the rootfs in the NFS directory. rm to make sure it's in a pristine
83# state, since it's volume-mounted on the host.
84rsync -a --delete $BM_ROOTFS/ /nfs/
85
86date +'%F %T'
87
88# If BM_BOOTFS is an URL, download it
89if echo $BM_BOOTFS | grep -q http; then
90 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
91 "${FDO_HTTP_CACHE_URI:-}$BM_BOOTFS" -o /tmp/bootfs.tar
92 BM_BOOTFS=/tmp/bootfs.tar
93fi
94
95date +'%F %T'
96
97# If BM_BOOTFS is a file, assume it is a tarball and uncompress it
98if [ -f "${BM_BOOTFS}" ]; then
99 mkdir -p /tmp/bootfs
100 tar xf $BM_BOOTFS -C /tmp/bootfs
101 BM_BOOTFS=/tmp/bootfs
102fi
103
104# If BM_KERNEL and BM_DTS is present
105if [ -n "${FORCE_KERNEL_TAG}" ]; then
106 if [ -z "${BM_KERNEL}" ] || [ -z "${BM_DTB}" ]; then
107 echo "This machine cannot be tested with external kernel since BM_KERNEL or BM_DTB missing!"
108 exit 1
109 fi
110
111 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
112 "${FDO_HTTP_CACHE_URI:-}${KERNEL_IMAGE_BASE}/${DEBIAN_ARCH}/${BM_KERNEL}" -o "${BM_KERNEL}"
113 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
114 "${FDO_HTTP_CACHE_URI:-}${KERNEL_IMAGE_BASE}/${DEBIAN_ARCH}/${BM_DTB}.dtb" -o "${BM_DTB}.dtb"
115 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
116 "${FDO_HTTP_CACHE_URI:-}${KERNEL_IMAGE_BASE}/${DEBIAN_ARCH}/modules.tar.zst" -o modules.tar.zst
117fi
118
119date +'%F %T'
120
121# Install kernel modules (it could be either in /lib/modules or
122# /usr/lib/modules, but we want to install in the latter)
123if [ -n "${FORCE_KERNEL_TAG}" ]; then
124 tar --keep-directory-symlink --zstd -xf modules.tar.zst -C /nfs/
125 rm modules.tar.zst &
126elif [ -n "${BM_BOOTFS}" ]; then
127 [ -d $BM_BOOTFS/usr/lib/modules ] && rsync -a $BM_BOOTFS/usr/lib/modules/ /nfs/usr/lib/modules/
128 [ -d $BM_BOOTFS/lib/modules ] && rsync -a $BM_BOOTFS/lib/modules/ /nfs/lib/modules/
129else
130 echo "No modules!"
131fi
132
133
134date +'%F %T'
135
136# Install kernel image + bootloader files
137if [ -n "${FORCE_KERNEL_TAG}" ] || [ -z "$BM_BOOTFS" ]; then
138 mv "${BM_KERNEL}" "${BM_DTB}.dtb" /tftp/
139else # BM_BOOTFS
140 rsync -aL --delete $BM_BOOTFS/boot/ /tftp/
141fi
142
143date +'%F %T'
144
145# Set up the pxelinux config for Jetson Nano
146mkdir -p /tftp/pxelinux.cfg
147cat <<EOF >/tftp/pxelinux.cfg/default-arm-tegra210-p3450-0000
148PROMPT 0
149TIMEOUT 30
150DEFAULT primary
151MENU TITLE jetson nano boot options
152LABEL primary
153 MENU LABEL CI kernel on TFTP
154 LINUX Image
155 FDT tegra210-p3450-0000.dtb
156 APPEND \${cbootargs} $BM_CMDLINE
157EOF
158
159# Set up the pxelinux config for Jetson TK1
160cat <<EOF >/tftp/pxelinux.cfg/default-arm-tegra124-jetson-tk1
161PROMPT 0
162TIMEOUT 30
163DEFAULT primary
164MENU TITLE jetson TK1 boot options
165LABEL primary
166 MENU LABEL CI kernel on TFTP
167 LINUX zImage
168 FDT tegra124-jetson-tk1.dtb
169 APPEND \${cbootargs} $BM_CMDLINE
170EOF
171
172# Create the rootfs in the NFS directory
173. $BM/rootfs-setup.sh /nfs
174
175date +'%F %T'
176
177echo "$BM_CMDLINE" > /tftp/cmdline.txt
178
179# Add some options in config.txt, if defined
180if [ -n "$BM_BOOTCONFIG" ]; then
181 printf "$BM_BOOTCONFIG" >> /tftp/config.txt
182fi
183
184set +e
185STRUCTURED_LOG_FILE=job_detail.json
186python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --update dut_job_type "${DEVICE_TYPE}"
187python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --update farm "${FARM}"
188ATTEMPTS=3
189first_attempt=True
190while [ $((ATTEMPTS--)) -gt 0 ]; do
191 python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --create-dut-job dut_name "${CI_RUNNER_DESCRIPTION}"
192 # Update subtime time to CI_JOB_STARTED_AT only for the first run
193 if [ "$first_attempt" = "True" ]; then
194 python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --update-dut-time submit "${CI_JOB_STARTED_AT}"
195 else
196 python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --update-dut-time submit
197 fi
198 python3 $BM/poe_run.py \
199 --dev="$BM_SERIAL" \
200 --powerup="$BM_POWERUP" \
201 --powerdown="$BM_POWERDOWN" \
202 --test-timeout ${TEST_PHASE_TIMEOUT:-20}
203 ret=$?
204
205 if [ $ret -eq 2 ]; then
206 echo "Did not detect boot sequence, retrying..."
207 python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --close-dut-job
208 first_attempt=False
209 else
210 ATTEMPTS=0
211 fi
212done
213python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --close-dut-job
214python3 $CI_INSTALL/custom_logger.py ${STRUCTURED_LOG_FILE} --close
215set -e
216
217date +'%F %T'
218
219# Bring artifacts back from the NFS dir to the build dir where gitlab-runner
220# will look for them.
221cp -Rp /nfs/results/. results/
222if [ -f "${STRUCTURED_LOG_FILE}" ]; then
223 cp -p ${STRUCTURED_LOG_FILE} results/
224 echo "Structured log file is available at ${ARTIFACTS_BASE_URL}/results/${STRUCTURED_LOG_FILE}"
225fi
226
227date +'%F %T'
228
229exit $ret
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette