|
4 | 4 | set -u
|
5 | 5 | set -e
|
6 | 6 |
|
7 |
| -# This script currently only works for x86_64 and s390x, as |
8 |
| -# it is based on the VM image used by the BPF CI, which is |
9 |
| -# available only for these architectures. |
| 7 | +# This script currently only works for the following platforms, |
| 8 | +# as it is based on the VM image used by the BPF CI, which is |
| 9 | +# available only for these architectures. We can also specify |
| 10 | +# the local rootfs image generated by the following script: |
| 11 | +# https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh |
10 | 12 | ARCH="$(uname -m)"
|
11 | 13 | case "${ARCH}" in
|
12 | 14 | s390x)
|
@@ -34,6 +36,7 @@ aarch64)
|
34 | 36 | esac
|
35 | 37 | DEFAULT_COMMAND="./test_progs"
|
36 | 38 | MOUNT_DIR="mnt"
|
| 39 | +LOCAL_ROOTFS_IMAGE="" |
37 | 40 | ROOTFS_IMAGE="root.img"
|
38 | 41 | OUTPUT_DIR="$HOME/.bpf_selftests"
|
39 | 42 | KCONFIG_REL_PATHS=("tools/testing/selftests/bpf/config"
|
|
69 | 72 |
|
70 | 73 | Options:
|
71 | 74 |
|
| 75 | + -l) Specify the path to the local rootfs image. |
72 | 76 | -i) Update the rootfs image with a newer version.
|
73 | 77 | -d) Update the output directory (default: ${OUTPUT_DIR})
|
74 | 78 | -j) Number of jobs for compilation, similar to -j in make
|
@@ -128,7 +132,11 @@ load_rootfs()
|
128 | 132 | exit 1
|
129 | 133 | fi
|
130 | 134 |
|
131 |
| - download_rootfs | zstd -d | sudo tar -C "$dir" -x |
| 135 | + if [[ -n "${LOCAL_ROOTFS_IMAGE}" ]]; then |
| 136 | + cat "${LOCAL_ROOTFS_IMAGE}" | zstd -d | sudo tar -C "$dir" -x |
| 137 | + else |
| 138 | + download_rootfs | zstd -d | sudo tar -C "$dir" -x |
| 139 | + fi |
132 | 140 | }
|
133 | 141 |
|
134 | 142 | recompile_kernel()
|
@@ -342,8 +350,11 @@ main()
|
342 | 350 | local exit_command="poweroff -f"
|
343 | 351 | local debug_shell="no"
|
344 | 352 |
|
345 |
| - while getopts ':hskid:j:' opt; do |
| 353 | + while getopts ':hskl:id:j:' opt; do |
346 | 354 | case ${opt} in
|
| 355 | + l) |
| 356 | + LOCAL_ROOTFS_IMAGE="$OPTARG" |
| 357 | + ;; |
347 | 358 | i)
|
348 | 359 | update_image="yes"
|
349 | 360 | ;;
|
|
0 commit comments