mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 16:50:17 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf28558a83 | ||
|
|
0b75e547f7 | ||
|
5605056c82
|
|||
| d4fcba18c0 | |||
|
|
5dcd763db9 | ||
| 4f8abadb3a | |||
|
57e90a4623
|
|||
|
|
136b899844 |
4
.github/workflows/ci-actions.yml
vendored
4
.github/workflows/ci-actions.yml
vendored
@@ -25,12 +25,12 @@ jobs:
|
|||||||
actions: read # Needed to analyze action metadata.
|
actions: read # Needed to analyze action metadata.
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
12
.github/workflows/ci-code.yml
vendored
12
.github/workflows/ci-code.yml
vendored
@@ -21,12 +21,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ jobs:
|
|||||||
name: 'build ${{ matrix.arch }}'
|
name: 'build ${{ matrix.arch }}'
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -80,12 +80,12 @@ jobs:
|
|||||||
name: 'clippy ${{ matrix.arch }}'
|
name: 'clippy ${{ matrix.arch }}'
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -37,12 +37,12 @@ jobs:
|
|||||||
build-mode: none
|
build-mode: none
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
5
.github/workflows/publish.yml
vendored
5
.github/workflows/publish.yml
vendored
@@ -25,12 +25,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -53,3 +53,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
subject-name: artifacts.zip
|
subject-name: artifacts.zip
|
||||||
subject-digest: "sha256:${{ steps.upload.outputs.artifact-digest }}"
|
subject-digest: "sha256:${{ steps.upload.outputs.artifact-digest }}"
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
|||||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -25,12 +25,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: harden runner
|
- name: harden runner
|
||||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
|||||||
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -123,9 +123,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jaarg"
|
name = "jaarg"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b216e5405f7e759ee0d16007f9d5c3346f9803a2e86cf01fc8df8baac43d0fa"
|
checksum = "534d589df1ef528a238f4bc4b1db081a1280f3aedf2695fd8971e9853a7fa4f6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ default-features = false
|
|||||||
features = ["alloc"]
|
features = ["alloc"]
|
||||||
|
|
||||||
[workspace.dependencies.jaarg]
|
[workspace.dependencies.jaarg]
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["alloc"]
|
features = ["alloc"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
use anyhow::{Context, Result, bail};
|
use anyhow::Result;
|
||||||
use core::ptr::null_mut;
|
use core::ptr::null_mut;
|
||||||
use jaarg::alloc::ParseMapResult;
|
|
||||||
use jaarg::{
|
use jaarg::{
|
||||||
ErrorUsageWriter, ErrorUsageWriterContext, HelpWriter, HelpWriterContext, Opt, Opts,
|
ErrorUsageWriter, ErrorUsageWriterContext, HelpWriter, HelpWriterContext, Opt, Opts,
|
||||||
StandardErrorUsageWriter, StandardFullHelpWriter,
|
ParseControl, ParseResult, StandardErrorUsageWriter, StandardFullHelpWriter,
|
||||||
};
|
};
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use uefi_raw::Status;
|
use uefi_raw::Status;
|
||||||
@@ -45,32 +44,71 @@ impl SproutOptions {
|
|||||||
/// Produces [SproutOptions] from the arguments provided by the UEFI core.
|
/// Produces [SproutOptions] from the arguments provided by the UEFI core.
|
||||||
/// Internally we utilize the `jaarg` argument parser which has excellent no_std support.
|
/// Internally we utilize the `jaarg` argument parser which has excellent no_std support.
|
||||||
pub fn parse() -> Result<Self> {
|
pub fn parse() -> Result<Self> {
|
||||||
|
enum ArgID {
|
||||||
|
Help,
|
||||||
|
AutoConfigure,
|
||||||
|
Config,
|
||||||
|
Boot,
|
||||||
|
ForceMenu,
|
||||||
|
MenuTimeout,
|
||||||
|
}
|
||||||
|
|
||||||
// All the options for the Sprout executable.
|
// All the options for the Sprout executable.
|
||||||
const OPTIONS: Opts<&str> = Opts::new(&[
|
const OPTIONS: Opts<ArgID> = Opts::new(&[
|
||||||
Opt::help_flag("help", &["--help"]).help_text("Display Sprout Help"),
|
Opt::help_flag(ArgID::Help, &["--help"]).help_text("Display Sprout Help"),
|
||||||
Opt::flag("autoconfigure", &["--autoconfigure"])
|
Opt::flag(ArgID::AutoConfigure, &["--autoconfigure"])
|
||||||
.help_text("Enable Sprout autoconfiguration"),
|
.help_text("Enable Sprout autoconfiguration"),
|
||||||
Opt::value("config", &["--config"], "PATH")
|
Opt::value(ArgID::Config, &["--config"], "PATH")
|
||||||
.help_text("Path to Sprout configuration file"),
|
.help_text("Path to Sprout configuration file"),
|
||||||
Opt::value("boot", &["--boot"], "ENTRY").help_text("Entry to boot, bypassing the menu"),
|
Opt::value(ArgID::Boot, &["--boot"], "ENTRY")
|
||||||
Opt::flag("force-menu", &["--force-menu"]).help_text("Force showing the boot menu"),
|
.help_text("Entry to boot, bypassing the menu"),
|
||||||
Opt::value("menu-timeout", &["--menu-timeout"], "TIMEOUT")
|
Opt::flag(ArgID::ForceMenu, &["--force-menu"]).help_text("Force showing the boot menu"),
|
||||||
|
Opt::value(ArgID::MenuTimeout, &["--menu-timeout"], "TIMEOUT")
|
||||||
.help_text("Boot menu timeout, in seconds"),
|
.help_text("Boot menu timeout, in seconds"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Acquire the arguments as determined by the UEFI core.
|
// Acquire the arguments as determined by the UEFI core.
|
||||||
let args = eficore::env::args()?;
|
let args = eficore::env::args()?;
|
||||||
|
|
||||||
|
// Use the default value of sprout options and have the raw options be parsed into it.
|
||||||
|
let mut result = Self::default();
|
||||||
|
|
||||||
// Parse the OPTIONS into a map using jaarg.
|
// Parse the OPTIONS into a map using jaarg.
|
||||||
let parsed = match OPTIONS.parse_map(
|
match OPTIONS.parse(
|
||||||
"sprout",
|
"sprout",
|
||||||
args.iter(),
|
args.iter(),
|
||||||
|program_name| {
|
|program_name, id, _opt, _name, value| {
|
||||||
let ctx = HelpWriterContext {
|
match id {
|
||||||
options: &OPTIONS,
|
ArgID::AutoConfigure => {
|
||||||
program_name,
|
// Enable autoconfiguration.
|
||||||
};
|
result.autoconfigure = true;
|
||||||
info!("{}", StandardFullHelpWriter::new(ctx));
|
}
|
||||||
|
ArgID::Config => {
|
||||||
|
// The configuration file to load.
|
||||||
|
result.config = value.into();
|
||||||
|
}
|
||||||
|
ArgID::Boot => {
|
||||||
|
// The entry to boot.
|
||||||
|
result.boot = Some(value.into());
|
||||||
|
}
|
||||||
|
ArgID::ForceMenu => {
|
||||||
|
// Force showing of the boot menu.
|
||||||
|
result.force_menu = true;
|
||||||
|
}
|
||||||
|
ArgID::MenuTimeout => {
|
||||||
|
// The timeout for the boot menu in seconds.
|
||||||
|
result.menu_timeout = Some(value.parse::<u64>()?);
|
||||||
|
}
|
||||||
|
ArgID::Help => {
|
||||||
|
let ctx = HelpWriterContext {
|
||||||
|
options: &OPTIONS,
|
||||||
|
program_name,
|
||||||
|
};
|
||||||
|
info!("{}", StandardFullHelpWriter::new(ctx));
|
||||||
|
return Ok(ParseControl::Quit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(ParseControl::Continue)
|
||||||
},
|
},
|
||||||
|program_name, error| {
|
|program_name, error| {
|
||||||
let ctx = ErrorUsageWriterContext {
|
let ctx = ErrorUsageWriterContext {
|
||||||
@@ -81,52 +119,14 @@ impl SproutOptions {
|
|||||||
error!("{}", StandardErrorUsageWriter::new(ctx));
|
error!("{}", StandardErrorUsageWriter::new(ctx));
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
ParseMapResult::Map(map) => map,
|
ParseResult::ContinueSuccess => Ok(result),
|
||||||
ParseMapResult::ExitSuccess => unsafe {
|
ParseResult::ExitSuccess => unsafe {
|
||||||
uefi::boot::exit(uefi::boot::image_handle(), Status::SUCCESS, 0, null_mut());
|
uefi::boot::exit(uefi::boot::image_handle(), Status::SUCCESS, 0, null_mut());
|
||||||
},
|
},
|
||||||
|
|
||||||
ParseMapResult::ExitFailure => unsafe {
|
ParseResult::ExitError => unsafe {
|
||||||
uefi::boot::exit(uefi::boot::image_handle(), Status::ABORTED, 0, null_mut());
|
uefi::boot::exit(uefi::boot::image_handle(), Status::ABORTED, 0, null_mut());
|
||||||
},
|
},
|
||||||
};
|
|
||||||
|
|
||||||
// Use the default value of sprout options and have the raw options be parsed into it.
|
|
||||||
let mut result = Self::default();
|
|
||||||
|
|
||||||
for (key, value) in parsed {
|
|
||||||
match key {
|
|
||||||
"autoconfigure" => {
|
|
||||||
// Enable autoconfiguration.
|
|
||||||
result.autoconfigure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
"config" => {
|
|
||||||
// The configuration file to load.
|
|
||||||
result.config = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
"boot" => {
|
|
||||||
// The entry to boot.
|
|
||||||
result.boot = Some(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
"force-menu" => {
|
|
||||||
// Force showing of the boot menu.
|
|
||||||
result.force_menu = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
"menu-timeout" => {
|
|
||||||
// The timeout for the boot menu in seconds.
|
|
||||||
let value = value
|
|
||||||
.parse::<u64>()
|
|
||||||
.context("menu-timeout must be a number")?;
|
|
||||||
result.menu_timeout = Some(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ => bail!("unknown option: --{key}"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(result)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ else
|
|||||||
set -- "${@}" -serial stdio
|
set -- "${@}" -serial stdio
|
||||||
else
|
else
|
||||||
set -- "${@}" \
|
set -- "${@}" \
|
||||||
-device virtio-serial-pci,id=vs0 \
|
-device 'virtio-serial-pci,id=vs0' \
|
||||||
-chardev stdio,id=stdio0,signal=off \
|
-chardev 'stdio,id=stdio0,signal=off' \
|
||||||
-device virtconsole,chardev=stdio0,id=console0
|
-device 'virtconsole,chardev=stdio0,id=console0,name=alpine'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ fi
|
|||||||
|
|
||||||
if [ "${NO_NETWORK}" != "1" ]; then
|
if [ "${NO_NETWORK}" != "1" ]; then
|
||||||
set -- "${@}" \
|
set -- "${@}" \
|
||||||
-netdev user,id=network0 \
|
-netdev 'user,id=network0' \
|
||||||
-device virtio-net-pci,netdev=network0
|
-device 'virtio-net-pci,netdev=network0'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "${FINAL_DIR}/ovmf-boot.fd"
|
rm -f "${FINAL_DIR}/ovmf-boot.fd"
|
||||||
@@ -76,7 +76,7 @@ fi
|
|||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
set -- "${@}" \
|
set -- "${@}" \
|
||||||
-drive "if=pflash,file=${FINAL_DIR}/ovmf-boot.fd,format=raw,readonly=on" \
|
-drive "if=pflash,file=${FINAL_DIR}/ovmf-boot.fd,format=raw,readonly=on" \
|
||||||
-device nvme,drive=disk1,serial=cafebabe
|
-device 'nvme,drive=disk1,serial=cafebabe'
|
||||||
|
|
||||||
set -- "${@}" \
|
set -- "${@}" \
|
||||||
-drive "if=none,file=${FINAL_DIR}/sprout.img,format=raw,id=disk1,readonly=on"
|
-drive "if=none,file=${FINAL_DIR}/sprout.img,format=raw,id=disk1,readonly=on"
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ if [ "${SKIP_KERNEL_BUILD}" != "1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
copy_from_image "${DOCKER_PREFIX}/sprout-kernel-${TARGET_ARCH}" "kernel.efi" "${FINAL_DIR}/kernel.efi"
|
copy_from_image "${DOCKER_PREFIX}/sprout-kernel-${TARGET_ARCH}" "kernel.efi" "${FINAL_DIR}/kernel.efi"
|
||||||
|
copy_from_image "${DOCKER_PREFIX}/sprout-kernel-${TARGET_ARCH}" "kernel.modules.tgz" "${FINAL_DIR}/kernel.modules.tgz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${SKIP_VM_BUILD}" != "1" ]; then
|
if [ "${SKIP_VM_BUILD}" != "1" ]; then
|
||||||
@@ -80,8 +81,12 @@ if [ "${SKIP_VM_BUILD}" != "1" ]; then
|
|||||||
-f hack/dev/vm/Dockerfile.ovmf "${FINAL_DIR}"
|
-f hack/dev/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}" "ovmf.fd" "${FINAL_DIR}/ovmf.fd"
|
||||||
copy_from_image "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}" "shell.efi" "${FINAL_DIR}/shell.efi"
|
copy_from_image "${DOCKER_PREFIX}/sprout-ovmf-${TARGET_ARCH}" "shell.efi" "${FINAL_DIR}/shell.efi"
|
||||||
|
rm -rf "${FINAL_DIR}/initramfs.build"
|
||||||
|
mkdir -p "${FINAL_DIR}/initramfs.build"
|
||||||
|
cp -r "hack/dev/vm/files" "${FINAL_DIR}/initramfs.build/files"
|
||||||
|
cp "${FINAL_DIR}/kernel.modules.tgz" "${FINAL_DIR}/initramfs.build/kernel.modules.tgz"
|
||||||
docker build --platform="${DOCKER_TARGET}" -t "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}:${DOCKER_TAG}" \
|
docker build --platform="${DOCKER_TARGET}" -t "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}:${DOCKER_TAG}" \
|
||||||
-f hack/dev/vm/Dockerfile.initramfs "hack/dev/vm"
|
-f hack/dev/vm/Dockerfile.initramfs "${FINAL_DIR}/initramfs.build"
|
||||||
copy_from_image "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}" "initramfs" "${FINAL_DIR}/initramfs"
|
copy_from_image "${DOCKER_PREFIX}/sprout-initramfs-${TARGET_ARCH}" "initramfs" "${FINAL_DIR}/initramfs"
|
||||||
|
|
||||||
if [ -n "${SPROUT_XEN_EFI_OVERRIDE}" ]; then
|
if [ -n "${SPROUT_XEN_EFI_OVERRIDE}" ]; then
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ ENV BUILDPLATFORM=${BUILDPLATFORM}
|
|||||||
ENV TARGETPLATFORM=${TARGETPLATFORM}
|
ENV TARGETPLATFORM=${TARGETPLATFORM}
|
||||||
WORKDIR /build/src
|
WORKDIR /build/src
|
||||||
RUN /build/docker-build.sh
|
RUN /build/docker-build.sh
|
||||||
|
COPY --chown=build:build docker-install.sh /build/docker-install.sh
|
||||||
|
RUN /build/docker-install.sh
|
||||||
|
|
||||||
FROM scratch AS final
|
FROM scratch AS final
|
||||||
COPY --from=build /build/src/kernel.image /kernel.efi
|
COPY --from=build /build/src/kernel.image /kernel.efi
|
||||||
|
COPY --from=build /build/src/kernel.modules.tgz /kernel.modules.tgz
|
||||||
|
|||||||
@@ -28,13 +28,17 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "CROSS_COMPILE=${MAYBE_CROSS_COMPILE}" > kernel.buildenv
|
||||||
|
echo "TARGET_KARCH=${TARGET_KARCH}" >> kernel.buildenv
|
||||||
|
|
||||||
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" defconfig
|
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" defconfig
|
||||||
if [ "${TARGET_KARCH}" = "x86_64" ]; then
|
if [ "${TARGET_KARCH}" = "x86_64" ]; then
|
||||||
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" xen.config
|
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" xen.config
|
||||||
./scripts/config -e XEN_PV
|
./scripts/config -e XEN_PV
|
||||||
./scripts/config -e XEN_PV_DOM0
|
./scripts/config -e XEN_PV_DOM0
|
||||||
fi
|
fi
|
||||||
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" mod2yesconfig
|
|
||||||
|
./scripts/config -e BPF_SYSCALL
|
||||||
|
|
||||||
./scripts/config -e UEVENT_HELPER
|
./scripts/config -e UEVENT_HELPER
|
||||||
./scripts/config --set-str UEVENT_HELPER_PATH "/sbin/hotplug"
|
./scripts/config --set-str UEVENT_HELPER_PATH "/sbin/hotplug"
|
||||||
@@ -46,8 +50,11 @@ make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" mod2yesconfig
|
|||||||
|
|
||||||
./scripts/config -e XEN_DOM0
|
./scripts/config -e XEN_DOM0
|
||||||
|
|
||||||
|
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" mod2noconfig
|
||||||
|
|
||||||
make "-j$(nproc)" CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}"
|
make "-j$(nproc)" CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}"
|
||||||
|
|
||||||
[ -f "arch/x86/boot/bzImage" ] && cp "arch/x86/boot/bzImage" kernel.image
|
[ -f "arch/x86/boot/bzImage" ] && cp "arch/x86/boot/bzImage" kernel.image
|
||||||
[ -f "arch/arm64/boot/Image.gz" ] && gzip -d <"arch/arm64/boot/Image.gz" >kernel.image
|
[ -f "arch/arm64/boot/Image.gz" ] && gzip -d <"arch/arm64/boot/Image.gz" >kernel.image
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
11
hack/dev/kernel/docker-install.sh
Executable file
11
hack/dev/kernel/docker-install.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
. /build/src/kernel.buildenv
|
||||||
|
|
||||||
|
[ -f "arch/x86/boot/bzImage" ] && cp "arch/x86/boot/bzImage" kernel.image
|
||||||
|
[ -f "arch/arm64/boot/Image.gz" ] && gzip -d <"arch/arm64/boot/Image.gz" >kernel.image
|
||||||
|
|
||||||
|
make CROSS_COMPILE="${MAYBE_CROSS_COMPILE}" ARCH="${TARGET_KARCH}" INSTALL_MOD_PATH="/build/install" modules_install
|
||||||
|
cd /build/install
|
||||||
|
tar czpf /build/src/kernel.modules.tgz .
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS rootfs
|
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS rootfs
|
||||||
RUN apk --no-cache add alpine-base tzdata ifupdown-ng agetty
|
RUN apk --no-cache add alpine-base tzdata wireless-regdb ifupdown-ng agetty
|
||||||
RUN rc-update add devfs sysinit && \
|
RUN rc-update add devfs sysinit && \
|
||||||
rc-update add dmesg sysinit && \
|
rc-update add dmesg sysinit && \
|
||||||
rc-update add mdev sysinit && \
|
rc-update add mdev sysinit && \
|
||||||
@@ -18,6 +18,7 @@ RUN rc-update add devfs sysinit && \
|
|||||||
rm /etc/motd && \
|
rm /etc/motd && \
|
||||||
ln -s /usr/share/zoneinfo/UTC /etc/localtime && \
|
ln -s /usr/share/zoneinfo/UTC /etc/localtime && \
|
||||||
echo 'hvc0::respawn:/sbin/agetty --autologin root -L hvc0 115200 vt100' >> /etc/inittab
|
echo 'hvc0::respawn:/sbin/agetty --autologin root -L hvc0 115200 vt100' >> /etc/inittab
|
||||||
|
ADD kernel.modules.tgz /
|
||||||
COPY files/interfaces /etc/network/interfaces
|
COPY files/interfaces /etc/network/interfaces
|
||||||
|
|
||||||
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS build
|
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS build
|
||||||
|
|||||||
Reference in New Issue
Block a user