Skip to content

Commit

Permalink
Some improvements to handle qemu. Let's see if it runs more stable in…
Browse files Browse the repository at this point in the history
… GH Actions.
  • Loading branch information
AlbrechtL committed Nov 18, 2024
1 parent 4ebc2c4 commit c88fb21
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ RUN echo "Building for platform '$TARGETPLATFORM'" \
-device virtio-blk-pci,drive=hd0 \
-device virtio-net,netdev=qlan0 -netdev user,id=qlan0,net=192.168.1.0/24,hostfwd=tcp::$SSH_PORT-192.168.1.1:22 \
-device virtio-net,netdev=qwan0 -netdev user,id=qwan0 \
-daemonize; \
& QEMU_PID=$!; \
else \
SSH_PORT=2022; \
qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -nodefaults -m 256 \
Expand All @@ -127,8 +127,9 @@ RUN echo "Building for platform '$TARGETPLATFORM'" \
-device virtio-blk-pci,drive=hd0 \
-device virtio-net,netdev=qlan0 -netdev user,id=qlan0,net=192.168.1.0/24,hostfwd=tcp::$SSH_PORT-192.168.1.1:22 \
-device virtio-net,netdev=qwan0 -netdev user,id=qwan0 \
-daemonize; \
& QEMU_PID=$!; \
fi \
&& echo "QEMU started with PID $QEMU_PID" \
\
# OpenWrt master uses apk insted of opkg \
&& if [ "$OPENWRT_VERSION" = "master" ]; then \
Expand Down Expand Up @@ -167,13 +168,9 @@ RUN echo "Building for platform '$TARGETPLATFORM'" \
&& scp -P $SSH_PORT /var/vm/openwrt_additional/usr/bin/* root@localhost:/usr/bin \
&& ssh root@localhost -p $SSH_PORT "${PACKAGE_REMOVE} openssh-sftp-server" \
\
# Sync changes into image and kill qemu
# Sync changes into image and shutdown qemu \
&& ssh root@localhost -p $SSH_PORT 'sync; halt' \
&& if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
while pgrep -x "qemu-system-x86_64" >/dev/null; do echo "Waiting for qemu exit ..."; sleep 1; done; \
else \
while pgrep -x "qemu-system-aarch64" >/dev/null; do echo "Waiting for qemu exit ..."; sleep 1; done \
fi \
&& while kill -0 $QEMU_PID 2>/dev/null; do echo "Waiting for qemu exit ..."; sleep 1; done \
\
&& gzip /var/vm/squashfs-combined-${OPENWRT_VERSION}.img \
\
Expand Down

0 comments on commit c88fb21

Please sign in to comment.