Skip to content

Commit f3241fd

Browse files
committed
ci
1 parent d658217 commit f3241fd

File tree

2 files changed

+47
-88
lines changed

2 files changed

+47
-88
lines changed

platform/aarch64/qemu-gicv3/test/systemtest/trootfs_deploy.sh

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33
set -x # Print commands for debugging
44

55
# ========================
6-
# Environment Configuration (aarch64 specific)
6+
# Environment Configuration
77
# ========================
88
WORKSPACE_ROOT="${GITHUB_WORKSPACE:-$(pwd)}"
99
ROOTFS_DIR="${WORKSPACE_ROOT}/platform/aarch64/qemu-gicv3/image/virtdisk/rootfs"
@@ -28,84 +28,66 @@ mount_rootfs() {
2828

2929
prepare_sources() {
3030
echo "=== Cloning required repositories ==="
31-
if [ ! -d "linux_5.4" ]; then
32-
git clone https://github.com/CHonghaohao/linux_5.4.git || return 1
33-
fi
34-
if [ ! -d "hvisor-tool" ]; then
35-
git clone https://github.com/syswonder/hvisor-tool.git || return 1
36-
fi
31+
git clone https://github.com/CHonghaohao/linux_5.4.git || return 1
32+
git clone https://github.com/syswonder/hvisor-tool.git || return 1
3733
}
3834

3935
build_hvisor_tool() {
4036
echo "=== Building hvisor components ==="
4137
cd "${HVISOR_TOOL_DIR}"
4238

43-
# 【关键修正:釜底抽薪】
44-
# 在编译前,直接用 sed 命令修改 hvisor-tool 的 Makefile,
45-
# 将其内部污染环境的 CFLAGS += ... 这一行注释掉。
46-
# 这是解决问题的最根本方法。
47-
echo "--- Patching hvisor-tool/tools/Makefile to prevent environment pollution ---"
48-
sed -i 's/^\(CFLAGS += -I\/usr\/aarch64-linux-gnu\/include.*\)/# \1/' tools/Makefile
49-
echo "--- Patching complete. Displaying patched file content: ---"
50-
cat tools/Makefile
51-
echo "--- End of patched file content ---"
52-
53-
54-
local MAKE_ARCH=""
55-
56-
case "${ARCH}" in
57-
riscv64)
58-
export CC='riscv64-linux-gnu-gcc --sysroot=/usr/riscv64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0'
59-
MAKE_ARCH="riscv"
60-
;;
61-
aarch64)
62-
export CC='aarch64-linux-gnu-gcc --sysroot=/usr/aarch64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0'
63-
MAKE_ARCH="arm64"
64-
;;
65-
esac
66-
67-
# 我们依然使用劫持 CC 和清空 CFLAGS 的方法作为双重保险。
68-
make -e all \
69-
ARCH=${MAKE_ARCH} \
39+
# Cross-compilation parameters
40+
make all \
41+
ARCH=arm64 \
7042
LOG=LOG_INFO \
71-
KDIR="${LINUX_KERNEL_DIR}" \
72-
CFLAGS="" \
73-
MAKE='make -e'
43+
KDIR="${LINUX_KERNEL_DIR}"
7444
}
7545

7646
deploy_artifacts() {
77-
# ... 此函数内容无需修改 ...
7847
echo "=== Deploying build artifacts ==="
7948
local dest_dir="${ROOTFS_DIR}/home/arm64"
8049
local test_dest="${dest_dir}/test"
81-
sudo mkdir -p "${dest_dir}"
82-
sudo mkdir -p "${test_dest}/testcase"
50+
# Copy main components
8351
sudo cp -v "${HVISOR_TOOL_DIR}/tools/hvisor" "${dest_dir}/"
8452
sudo cp -v "${HVISOR_TOOL_DIR}/driver/hvisor.ko" "${dest_dir}/"
53+
# Device Tree & Configurations
8554
sudo cp -v "${DTS_DIR}/zone1-linux.dtb" "${dest_dir}/zone1-linux.dtb"
8655
sudo cp -v "${CONFIG_DIR}/zone1-linux.json" "${dest_dir}/zone1-linux.json"
8756
sudo cp -v "${CONFIG_DIR}/zone1-linux-virtio.json" "${dest_dir}/zone1-linux-virtio.json"
57+
# Test artifacts
8858
sudo cp -v ${TEST_DIR}/testcase/* "${test_dest}/testcase/"
8959
sudo cp -v "${TEST_DIR}/textract_dmesg.sh" "${test_dest}/"
9060
sudo cp -v "${TEST_DIR}/tresult.sh" "${test_dest}/"
61+
# Boot zone1 shells
9162
sudo cp -v "${TEST_DIR}/boot_zone1.sh" "${dest_dir}/"
9263
sudo cp -v "${TEST_DIR}/screen_zone1.sh" "${dest_dir}/"
64+
65+
# Verify deployment
9366
echo "=== Deployed files list ==="
9467
sudo find "${dest_dir}" -ls
68+
9569
}
9670

9771
# ========================
98-
# Main Execution Flow (aarch64 specific)
72+
# Main Execution Flow
9973
# ========================
10074
(
10175
cd "${WORKSPACE_ROOT}/platform/aarch64/qemu-gicv3/image/virtdisk"
76+
77+
# Setup environment
10278
mount_rootfs
10379
prepare_sources
80+
81+
# Build process
10482
if ! build_hvisor_tool; then
10583
echo "ERROR: Build failed" >&2
10684
exit 1
10785
fi
86+
87+
# Deployment
10888
deploy_artifacts
89+
90+
# Cleanup
10991
echo "=== Unmounting rootfs ==="
11092
sudo umount "${ROOTFS_DIR}"
11193
) || exit 1

platform/riscv64/qemu-plic/test/systemtest/trootfs_deploy.sh

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,89 +28,66 @@ mount_rootfs() {
2828

2929
prepare_sources() {
3030
echo "=== Cloning required repositories ==="
31-
if [ ! -d "linux_v6.10-rc1" ]; then
32-
git clone https://github.com/CHonghaohao/linux_v6.10-rc1.git || return 1
33-
fi
34-
if [ ! -d "hvisor-tool" ]; then
35-
git clone https://github.com/syswonder/hvisor-tool.git || return 1
36-
fi
31+
git clone https://github.com/CHonghaohao/linux_v6.10-rc1.git || return 1
32+
git clone https://github.com/syswonder/hvisor-tool.git || return 1
3733
}
3834

39-
# ... 在 riscv64 的脚本中 ...
40-
4135
build_hvisor_tool() {
4236
echo "=== Building hvisor components ==="
4337
cd "${HVISOR_TOOL_DIR}"
4438

45-
# 【关键修正:釜底抽薪】
46-
# 对 riscv64 也进行同样的手术,注释掉其 Makefile 中污染环境的 CFLAGS。
47-
echo "--- Patching hvisor-tool/tools/Makefile to prevent environment pollution ---"
48-
sed -i 's/^\(CFLAGS += -I\/usr\/riscv64-linux-gnu\/include.*\)/# \1/' tools/Makefile
49-
echo "--- Patching complete. Displaying patched file content: ---"
50-
cat tools/Makefile
51-
echo "--- End of patched file content ---"
52-
53-
54-
local MAKE_ARCH=""
55-
56-
case "${ARCH}" in
57-
riscv64)
58-
export CC='riscv64-linux-gnu-gcc --sysroot=/usr/riscv64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0'
59-
MAKE_ARCH="riscv"
60-
;;
61-
aarch64)
62-
export CC='aarch64-linux-gnu-gcc --sysroot=/usr/aarch64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0'
63-
MAKE_ARCH="arm64"
64-
;;
65-
esac
66-
67-
# 双重保险
68-
make -e all \
69-
ARCH=${MAKE_ARCH} \
39+
# Cross-compilation parameters
40+
make all \
41+
ARCH=riscv \
7042
LOG=LOG_INFO \
71-
KDIR="${LINUX_KERNEL_DIR}" \
72-
CFLAGS="" \
73-
MAKE='make -e'
43+
KDIR="${LINUX_KERNEL_DIR}"
7444
}
7545

7646
deploy_artifacts() {
77-
# ... 此函数内容无需修改 ...
7847
echo "=== Deploying build artifacts ==="
7948
local dest_dir="${ROOTFS_DIR}/home/riscv64"
8049
local test_dest="${dest_dir}/test"
81-
sudo mkdir -p "${dest_dir}"
82-
sudo mkdir -p "${test_dest}/testcase"
50+
# Copy main components
8351
sudo cp -v "${HVISOR_TOOL_DIR}/tools/hvisor" "${dest_dir}/"
8452
sudo cp -v "${HVISOR_TOOL_DIR}/driver/hvisor.ko" "${dest_dir}/"
53+
# Device Tree & Configurations
8554
sudo cp -v "${DTS_DIR}/zone1-linux.dtb" "${dest_dir}/zone1-linux.dtb"
8655
sudo cp -v "${CONFIG_DIR}/zone1-linux.json" "${dest_dir}/zone1-linux.json"
8756
sudo cp -v "${CONFIG_DIR}/zone1-linux-virtio.json" "${dest_dir}/zone1-linux-virtio.json"
57+
# Test artifacts
8858
sudo cp -v ${TEST_DIR}/testcase/* "${test_dest}/testcase/"
8959
sudo cp -v "${TEST_DIR}/textract_dmesg.sh" "${test_dest}/"
9060
sudo cp -v "${TEST_DIR}/tresult.sh" "${test_dest}/"
61+
# Boot zone1 shells
9162
sudo cp -v "${TEST_DIR}/boot_zone1.sh" "${dest_dir}/"
9263
sudo cp -v "${TEST_DIR}/screen_zone1.sh" "${dest_dir}/"
64+
65+
# Verify deployment
9366
echo "=== Deployed files list ==="
9467
sudo find "${dest_dir}" -ls
68+
9569
}
9670

9771
# ========================
9872
# Main Execution Flow
9973
# ========================
10074
(
10175
cd "${WORKSPACE_ROOT}/platform/riscv64/qemu-plic/image/virtdisk"
76+
77+
# Setup environment
10278
mount_rootfs
10379
prepare_sources
104-
if [ "$SKIP_BUILD" != "true" ]; then
105-
echo "--- Build step is enabled. Starting build... ---"
106-
if ! build_hvisor_tool; then
107-
echo "ERROR: Build failed" >&2
108-
exit 1
109-
fi
110-
else
111-
echo "--- SKIP_BUILD is true. Skipping build step. ---"
80+
81+
# Build process
82+
if ! build_hvisor_tool; then
83+
echo "ERROR: Build failed" >&2
84+
exit 1
11285
fi
86+
87+
# Deployment
11388
deploy_artifacts
89+
90+
# Cleanup
11491
echo "=== Unmounting rootfs ==="
11592
sudo umount "${ROOTFS_DIR}"
11693
) || exit 1

0 commit comments

Comments
 (0)