Skip to content

Commit 0257474

Browse files
committed
ci: build qemu image with ssh enable
1 parent dcc65e6 commit 0257474

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

.github/workflows/reuse_build_test_qemu_image.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ jobs:
116116
(cd ${{ env.QEMUV8_BUILD_FOLDER }}/qemu && git apply $GITHUB_WORKSPACE/.patches/test_qemu/qemu-qemu_expand_secure_memory.patch)
117117
(cd ${{ env.QEMUV8_BUILD_FOLDER }}/trusted-firmware-a && git apply $GITHUB_WORKSPACE/.patches/test_qemu/arm-atf_expand_secure_memory.patch)
118118
119+
- name: Apply patches to enable ssh
120+
run: |
121+
(cd ${{ env.QEMUV8_BUILD_FOLDER }}/build && git apply $GITHUB_WORKSPACE/.patches/test_qemu/optee-build_enable_ssh.patch)
119122
# cd to the output folder first to avoid extra path in the tar file.
120123
- name: Build And Pack
121124
env:

.patches/test_qemu/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ Relevant Patch File:
2626
to match the QEMU memory expansion.
2727
3. optee-build_expand_memory.patch: Updates build configurations to reflect the
2828
expanded memory setup.
29+
30+
## Patches for enabling ssh
31+
32+
Our CI workflow automates command execution via SSH and handles CA/TA deployment
33+
using SCP, providing a seamless local-like interface for the QEMU image.
34+
35+
Relevant Patch File:
36+
37+
1. optee-build_enable_ssh.patch: update build configurations to enable the ssh
38+
server.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
diff --git a/br-ext/board/qemu/post-build.sh b/br-ext/board/qemu/post-build.sh
19+
index 5b4f8b5..fe65f11 100755
20+
--- a/br-ext/board/qemu/post-build.sh
21+
+++ b/br-ext/board/qemu/post-build.sh
22+
@@ -7,6 +7,7 @@ TARGETDIR="$1"
23+
VIRTFS_AUTOMOUNT="$2"
24+
VIRTFS_MOUNTPOINT="$3"
25+
PSS_AUTOMOUNT="$4"
26+
+ENABLE_SSH="$5"
27+
28+
if [[ -z $TARGET_DIR ]]; then
29+
echo "TARGET_DIR missing"
30+
@@ -28,6 +29,11 @@ if [[ -z $PSS_AUTOMOUNT ]]; then
31+
exit 1
32+
fi
33+
34+
+if [[ -z $ENABLE_SSH ]]; then
35+
+ echo "ENABLE_SSH missing"
36+
+ exit 1
37+
+fi
38+
+
39+
40+
if [[ $VIRTFS_AUTOMOUNT == "y" ]]; then
41+
grep host "$TARGETDIR"/etc/fstab > /dev/null || \
42+
@@ -41,3 +47,10 @@ if [[ $PSS_AUTOMOUNT == "y" ]]; then
43+
echo "secure /var/lib/tee 9p trans=virtio,version=9p2000.L,msize=65536,rw 0 0" >> "$TARGET_DIR"/etc/fstab
44+
echo "[+] persistent secure storage mount added to fstab"
45+
fi
46+
+
47+
+
48+
+if [[ $ENABLE_SSH == "y" ]]; then
49+
+ sed -i -e 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' "$TARGET_DIR"/etc/ssh/sshd_config
50+
+ sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' "$TARGET_DIR"/etc/ssh/sshd_config
51+
+ echo "[+] ssh server allow root with no password"
52+
+fi
53+
diff --git a/qemu_v8.mk b/qemu_v8.mk
54+
index 9c36c8a..8d553d3 100644
55+
--- a/qemu_v8.mk
56+
+++ b/qemu_v8.mk
57+
@@ -7,6 +7,7 @@ COMPILE_NS_USER ?= 64
58+
override COMPILE_NS_KERNEL := 64
59+
COMPILE_S_USER ?= 64
60+
COMPILE_S_KERNEL ?= 64
61+
+ENABLE_SSH ?= y
62+
63+
################################################################################
64+
# If you change this, you MUST run `make arm-tf-clean` first before rebuilding
65+
@@ -15,7 +16,11 @@ TF_A_TRUSTED_BOARD_BOOT ?= n
66+
67+
BR2_ROOTFS_OVERLAY = $(ROOT)/build/br-ext/board/qemu/overlay
68+
BR2_ROOTFS_POST_BUILD_SCRIPT = $(ROOT)/build/br-ext/board/qemu/post-build.sh
69+
-BR2_ROOTFS_POST_SCRIPT_ARGS = "$(QEMU_VIRTFS_AUTOMOUNT) $(QEMU_VIRTFS_MOUNTPOINT) $(QEMU_PSS_AUTOMOUNT)"
70+
+BR2_ROOTFS_POST_SCRIPT_ARGS = "$(QEMU_VIRTFS_AUTOMOUNT) $(QEMU_VIRTFS_MOUNTPOINT) $(QEMU_PSS_AUTOMOUNT) $(ENABLE_SSH)"
71+
+ifeq ($(ENABLE_SSH),y)
72+
+BR2_PACKAGE_OPENSSH ?= y
73+
+BR2_SYSTEM_DHCP ?= eth0
74+
+endif
75+
76+
PLAT_QEMU ?= virt
77+
ifeq ($(PLAT_QEMU),virt)

0 commit comments

Comments
 (0)