Skip to content

Commit e0bd703

Browse files
committed
chore(dev): autologin to alpine and writable rootfs
1 parent 2a9c9f6 commit e0bd703

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

hack/dev/boot.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ if [ "${QEMU_GDB_WAIT}" = "1" ]; then
3030
set -- "${@}" "-S"
3131
fi
3232

33-
set -- "${@}" -smp 2 -m 4096
33+
set -- "${@}" -nodefaults -smp 2 -m 4096
3434

35-
if [ "${NO_GRAPHICAL_BOOT}" = "1" ]; then
35+
if [ "${NO_GRAPHICAL}" = "1" ]; then
3636
set -- "${@}" -nographic
3737
else
3838
if [ "${GRAPHICAL_ONLY}" != "1" ]; then
@@ -41,7 +41,7 @@ else
4141
else
4242
set -- "${@}" \
4343
-device virtio-serial-pci,id=vs0 \
44-
-chardev stdio,id=stdio0 \
44+
-chardev stdio,id=stdio0,signal=off \
4545
-device virtconsole,chardev=stdio0,id=console0
4646
fi
4747
fi
@@ -62,6 +62,12 @@ if [ "${NO_INPUT}" != "1" ]; then
6262
-device usb-mouse
6363
fi
6464

65+
if [ "${NO_NETWORK}" != "1" ]; then
66+
set -- "${@}" \
67+
-netdev user,id=network0 \
68+
-device virtio-net-pci,netdev=network0
69+
fi
70+
6571
rm -f "${FINAL_DIR}/ovmf-boot.fd"
6672
cp "${FINAL_DIR}/ovmf.fd" "${FINAL_DIR}/ovmf-boot.fd"
6773
if [ "${TARGET_ARCH}" = "aarch64" ]; then

hack/dev/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ copy_from_image_polyfill() {
4848
SOURCE="${2}"
4949
TARGET="${3}"
5050

51-
docker build -t "${IMAGE}-copy-polyfill:${DOCKER_TAG}" --build-arg "TARGET_IMAGE=${IMAGE}:${DOCKER_TAG}" \
51+
docker build --platform="${DOCKER_TARGET}" -t "${IMAGE}-copy-polyfill:${DOCKER_TAG}" --build-arg "TARGET_IMAGE=${IMAGE}:${DOCKER_TAG}" \
5252
-f hack/dev/utils/Dockerfile.copy-polyfill hack
5353
# note: the -w '//' is a workaround for Git Bash where / is magically rewritten.
5454
docker run --rm -i -w '//' "${IMAGE}-copy-polyfill:${DOCKER_TAG}" cat "image/${SOURCE}" >"${TARGET}"
@@ -81,7 +81,7 @@ if [ "${SKIP_VM_BUILD}" != "1" ]; then
8181
copy_from_image "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}" "ovmf.fd" "${FINAL_DIR}/ovmf.fd"
8282
copy_from_image "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}" "shell.efi" "${FINAL_DIR}/shell.efi"
8383
docker build --platform="${DOCKER_TARGET}" -t "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}:${DOCKER_TAG}" \
84-
-f hack/dev/vm/Dockerfile.initramfs "${FINAL_DIR}"
84+
-f hack/dev/vm/Dockerfile.initramfs "hack/dev/vm"
8585
copy_from_image "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}" "initramfs" "${FINAL_DIR}/initramfs"
8686

8787
if [ -n "${SPROUT_XEN_EFI_OVERRIDE}" ]; then

hack/dev/configs/all.sprout.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ has-item = "\\vmlinuz"
88

99
[actions.chainload-kernel]
1010
chainload.path = "$boot\\vmlinuz"
11-
chainload.options = ["console=hvc0"]
11+
chainload.options = ["console=hvc0", "overlaytmpfs=yes"]
1212
chainload.linux-initrd = "$boot\\initramfs"
1313

1414
[entries.kernel]

hack/dev/configs/kernel.sprout.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ has-item = "\\vmlinuz"
99

1010
[actions.chainload-kernel]
1111
chainload.path = "$boot\\vmlinuz"
12-
chainload.options = ["console=hvc0"]
12+
chainload.options = ["console=hvc0", "overlaytmpfs=yes"]
1313
chainload.linux-initrd = "$boot\\initramfs"
1414

1515
[entries.kernel]

hack/dev/kernel/docker-build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ if [ "${TARGET_KARCH}" = "x86_64" ]; then
3636
fi
3737
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" mod2yesconfig
3838

39+
./scripts/config -e UEVENT_HELPER
40+
./scripts/config --set-str UEVENT_HELPER_PATH "/sbin/hotplug"
41+
3942
./scripts/config -e DRM_VIRTIO_GPU
4043
./scripts/config -e FRAMEBUFFER_CONSOLE
4144
./scripts/config -e FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
45+
./scripts/config -e LOGO
46+
4247
./scripts/config -e XEN_DOM0
4348

4449
make "-j$(nproc)" CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}"

hack/dev/vm/Dockerfile.initramfs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS rootfs
2-
RUN apk --no-cache add alpine-base tzdata
2+
RUN apk --no-cache add alpine-base tzdata ifupdown-ng agetty
33
RUN rc-update add devfs sysinit && \
44
rc-update add dmesg sysinit && \
55
rc-update add mdev sysinit && \
66
rc-update add cgroups sysinit && \
77
rc-update add sysctl boot && \
88
rc-update add hostname boot && \
99
rc-update add bootmisc boot && \
10+
rc-update add networking boot && \
1011
rc-update add syslog boot && \
1112
rc-update add mount-ro shutdown && \
1213
rc-update add killprocs shutdown && \
1314
rc-update add savecache shutdown && \
1415
ln -s /sbin/init /init && \
1516
echo 'root:root' | chpasswd && \
1617
echo 'sprout' > /etc/hostname && \
17-
echo '' > /etc/motd && \
18+
rm /etc/motd && \
1819
ln -s /usr/share/zoneinfo/UTC /etc/localtime && \
19-
echo 'hvc0::respawn:/sbin/getty -L hvc0 115200 vt100' >> /etc/inittab
20+
echo 'hvc0::respawn:/sbin/agetty --autologin root -L hvc0 115200 vt100' >> /etc/inittab
21+
COPY files/interfaces /etc/network/interfaces
2022

2123
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS build
2224
COPY --from=rootfs / /rootfs

hack/dev/vm/files/interfaces

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
auto eth0
2+
iface eth0
3+
use dhcp

0 commit comments

Comments
 (0)