mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 10:10:17 +00:00
add initial initramfs support, not quite working yet
This commit is contained in:
@@ -9,8 +9,9 @@ COPY sprout.efi /work/${EFI_NAME}.EFI
|
||||
COPY sprout.toml /work/SPROUT.TOML
|
||||
COPY kernel.efi /work/KERNEL.EFI
|
||||
COPY shell.efi /work/SHELL.EFI
|
||||
COPY initramfs /work/INITRAMFS
|
||||
COPY edera-splash.png /work/EDERA-SPLASH.PNG
|
||||
RUN truncate -s256MiB sprout.img && \
|
||||
RUN truncate -s128MiB sprout.img && \
|
||||
parted --script sprout.img mklabel gpt > /dev/null 2>&1 && \
|
||||
parted --script sprout.img mkpart primary fat32 1MiB 100% > /dev/null 2>&1 && \
|
||||
parted --script sprout.img set 1 esp on > /dev/null 2>&1 && \
|
||||
@@ -22,6 +23,7 @@ RUN truncate -s256MiB sprout.img && \
|
||||
mcopy -i sprout.img SHELL.EFI ::/EFI/BOOT/ && \
|
||||
mcopy -i sprout.img SPROUT.TOML ::/ && \
|
||||
mcopy -i sprout.img EDERA-SPLASH.PNG ::/ && \
|
||||
mcopy -i sprout.img INITRAMFS ::/ && \
|
||||
mv sprout.img /sprout.img
|
||||
|
||||
FROM scratch AS final
|
||||
|
||||
@@ -27,14 +27,9 @@ else
|
||||
-chardev stdio,id=stdio0 \
|
||||
-device virtconsole,chardev=stdio0,id=console0
|
||||
|
||||
if [ "${TARGET_ARCH}" = "x86_64" ]; then
|
||||
set -- "${@}" \
|
||||
-vga std
|
||||
else
|
||||
set -- "${@}" \
|
||||
-vga none \
|
||||
-device "virtio-gpu,edid=on,xres=1024,yres=768"
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f "${FINAL_DIR}/ovmf-boot.fd"
|
||||
|
||||
@@ -79,6 +79,8 @@ if [ "${SKIP_VM_BUILD}" != "1" ]; then
|
||||
docker build --platform="${DOCKER_TARGET}" -t "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}:${DOCKER_TAG}" -f vm/Dockerfile.ovmf "${FINAL_DIR}"
|
||||
copy_from_image "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}" "ovmf.fd" "${FINAL_DIR}/ovmf.fd"
|
||||
copy_from_image "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}" "shell.efi" "${FINAL_DIR}/shell.efi"
|
||||
docker build --platform="${DOCKER_TARGET}" -t "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}:${DOCKER_TAG}" -f vm/Dockerfile.initramfs "${FINAL_DIR}"
|
||||
copy_from_image "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}" "initramfs" "${FINAL_DIR}/initramfs"
|
||||
fi
|
||||
|
||||
if [ "${SKIP_SPROUT_BUILD}" != "1" ]; then
|
||||
@@ -102,6 +104,7 @@ if [ "${SKIP_SPROUT_BUILD}" != "1" ]; then
|
||||
fi
|
||||
cp "${FINAL_DIR}/sprout.toml" "${FINAL_DIR}/efi/SPROUT.TOML"
|
||||
cp "${FINAL_DIR}/edera-splash.png" "${FINAL_DIR}/efi/EDERA-SPLASH.PNG"
|
||||
cp "${FINAL_DIR}/initramfs" "${FINAL_DIR}/efi/INITRAMFS"
|
||||
fi
|
||||
|
||||
if [ "${SKIP_BOOT_BUILD}" != "1" ]; then
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
version = 1
|
||||
|
||||
[values]
|
||||
default-options = "console=hvc0"
|
||||
default-options = "initrd=\\initramfs init=/bin/sh console=hvc0"
|
||||
|
||||
[actions.welcome]
|
||||
print.text = "Welcome to Sprout!"
|
||||
|
||||
[actions.splash]
|
||||
splash.image = "edera-splash.png"
|
||||
splash.time = 5
|
||||
splash.time = 1
|
||||
|
||||
[actions.chainload-kernel]
|
||||
chainload.path = "$path"
|
||||
chainload.options = ["$default-options"]
|
||||
|
||||
[actions.chainload-shell]
|
||||
chainload.path = "\\EFI\\BOOT\\shell.efi"
|
||||
|
||||
[generators.kernels.matrix]
|
||||
entry.title = "Boot Kernel $name"
|
||||
entry.values.path = "\\EFI\\BOOT\\$name"
|
||||
@@ -21,4 +24,4 @@ entry.actions = ["chainload-kernel"]
|
||||
values.name = ["kernel.efi"]
|
||||
|
||||
[[phases.startup]]
|
||||
actions = ["splash", "welcome"]
|
||||
actions = ["welcome", "splash"]
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
version: 1
|
||||
|
||||
values:
|
||||
default-options: "console=hvc0"
|
||||
|
||||
phases:
|
||||
startup:
|
||||
- actions: ["welcome"]
|
||||
|
||||
actions:
|
||||
welcome:
|
||||
print:
|
||||
text: "Welcome to Sprout!"
|
||||
chainload-kernel:
|
||||
chainload:
|
||||
path: "$path"
|
||||
options:
|
||||
- "$default-options"
|
||||
|
||||
generators:
|
||||
kernels:
|
||||
matrix:
|
||||
entry:
|
||||
title: "Boot Kernel $name"
|
||||
values:
|
||||
path: "\\EFI\\BOOT\\$name"
|
||||
actions: ["chainload-kernel"]
|
||||
values:
|
||||
name: ["kernel.efi"]
|
||||
11
vm/Dockerfile.initramfs
Normal file
11
vm/Dockerfile.initramfs
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM alpine:3.22@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 AS build
|
||||
RUN apk --no-cache add busybox-static
|
||||
RUN mkdir -p /tmp/initramfs/bin && cp /bin/busybox.static /tmp/initramfs/bin/busybox && \
|
||||
chroot /tmp/initramfs /bin/busybox --install -s /bin && \
|
||||
chroot /tmp/initramfs ln -s /bin/sh /init && \
|
||||
cd /tmp/initramfs && \
|
||||
find . | cpio -R 0:0 --ignore-devno --renumber-inodes -o -H newc --quiet > /initramfs && \
|
||||
rm -rf /tmp/initramfs
|
||||
|
||||
FROM scratch AS final
|
||||
COPY --from=build /initramfs /initramfs
|
||||
Reference in New Issue
Block a user