Skip to content

Commit ab7c61e

Browse files
committed
9p: added files and steps for 9pfs binary compilation to hyperv image
This adds a Dockerfile that is used to create a container in which the 9pfs binary is built. The binary is then extracted and installed into the system for 9p file sharing.
1 parent 375064f commit ab7c61e

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

9pfs/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM registry.access.redhat.com/ubi9:9.5 AS builder
2+
3+
RUN dnf install -y fuse-devel gcc git make
4+
5+
RUN git clone https://github.com/ftrvxmtrx/9pfs /src/9pfs
6+
7+
WORKDIR /src/9pfs
8+
9+
RUN git checkout af2e820f10af4781df8e55c05a79864a005817eb
10+
11+
RUN make

createdisk-library.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,18 @@ function copy_systemd_units() {
426426

427427
${SSH} core@${VM_IP} -- 'rm -rf /home/core/systemd-units /home/core/systemd-scripts'
428428
}
429+
430+
function compile_and_extract_9pfs() {
431+
${SCP} -r 9pfs core@${VM_IP}:/home/core/
432+
${SSH} core@${VM_IP} 'sudo bash -e -x -s' <<EOF
433+
cd 9pfs
434+
podman build -t 9pfs-builder .
435+
podman create --name extract-temp 9pfs-builder
436+
podman cp extract-temp:/src/9pfs/9pfs ./9pfs
437+
podman rm extract-temp
438+
sudo cp 9pfs /usr/local/bin
439+
cd ..
440+
rm -rf 9pfs
441+
podman rmi 9pfs-builder:latest registry.access.redhat.com/ubi9:9.5
442+
EOF
443+
}

createdisk.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ ${SSH} core@${VM_IP} -- 'sudo sed -i "s/^preserve_hostname: false$/preserve_host
203203
# Cleanup cloud-init config
204204
${SSH} core@${VM_IP} -- "sudo cloud-init clean --logs"
205205

206+
if [ "${ARCH}" == "x86_64" ] && [ "${SNC_GENERATE_WINDOWS_BUNDLE}" != "0" ]; then
207+
# compile 9pfs binary using UBI image and extract the binary
208+
# so that it can be used to set up a 9p filesystem on Windows
209+
compile_and_extract_9pfs
210+
fi
211+
206212
# Shutdown the VM
207213
shutdown_vm ${VM_NAME}
208214

0 commit comments

Comments
 (0)