mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 17:50:17 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf28558a83 | ||
|
|
0b75e547f7 | ||
|
5605056c82
|
|||
| d4fcba18c0 | |||
|
|
5dcd763db9 | ||
| 4f8abadb3a | |||
|
57e90a4623
|
|||
|
|
136b899844 | ||
| 0dbd011648 | |||
|
65c392944b
|
|||
|
|
2683229bd3 | ||
| a7a9554875 | |||
|
5ad617c54f
|
|||
| 0aa7a46808 | |||
|
8711c54074
|
|||
|
|
c21c140039 | ||
|
c053f62b88
|
|||
|
e0bd703511
|
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
|
||||||
|
|
||||||
|
|||||||
15
Cargo.lock
generated
15
Cargo.lock
generated
@@ -66,13 +66,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edera-sprout-boot"
|
name = "edera-sprout-boot"
|
||||||
version = "0.0.25"
|
version = "0.0.26"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"edera-sprout-build",
|
"edera-sprout-build",
|
||||||
"edera-sprout-config",
|
"edera-sprout-config",
|
||||||
"edera-sprout-eficore",
|
"edera-sprout-eficore",
|
||||||
"hex",
|
"hex",
|
||||||
|
"jaarg",
|
||||||
"log",
|
"log",
|
||||||
"sha2",
|
"sha2",
|
||||||
"toml",
|
"toml",
|
||||||
@@ -82,18 +83,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edera-sprout-build"
|
name = "edera-sprout-build"
|
||||||
version = "0.0.25"
|
version = "0.0.26"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edera-sprout-config"
|
name = "edera-sprout-config"
|
||||||
version = "0.0.25"
|
version = "0.0.26"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edera-sprout-eficore"
|
name = "edera-sprout-eficore"
|
||||||
version = "0.0.25"
|
version = "0.0.26"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@@ -120,6 +121,12 @@ version = "0.4.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jaarg"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "534d589df1ef528a238f4bc4b1db081a1280f3aedf2695fd8971e9853a7fa4f6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.177"
|
version = "0.2.177"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ resolver = "3"
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
version = "0.0.25"
|
version = "0.0.26"
|
||||||
homepage = "https://sprout.edera.dev"
|
homepage = "https://sprout.edera.dev"
|
||||||
repository = "https://github.com/edera-dev/sprout"
|
repository = "https://github.com/edera-dev/sprout"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
@@ -29,6 +29,11 @@ version = "0.4.3"
|
|||||||
default-features = false
|
default-features = false
|
||||||
features = ["alloc"]
|
features = ["alloc"]
|
||||||
|
|
||||||
|
[workspace.dependencies.jaarg]
|
||||||
|
version = "0.2.2"
|
||||||
|
default-features = false
|
||||||
|
features = ["alloc"]
|
||||||
|
|
||||||
[workspace.dependencies.serde]
|
[workspace.dependencies.serde]
|
||||||
version = "1.0.228"
|
version = "1.0.228"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ anyhow.workspace = true
|
|||||||
edera-sprout-config.path = "../config"
|
edera-sprout-config.path = "../config"
|
||||||
edera-sprout-eficore.path = "../eficore"
|
edera-sprout-eficore.path = "../eficore"
|
||||||
hex.workspace = true
|
hex.workspace = true
|
||||||
|
jaarg.workspace = true
|
||||||
sha2.workspace = true
|
sha2.workspace = true
|
||||||
toml.workspace = true
|
toml.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const LINUX_CHAINLOAD_ACTION_PREFIX: &str = "linux-chainload-";
|
|||||||
const SCAN_LOCATIONS: &[&str] = &["\\boot", "\\"];
|
const SCAN_LOCATIONS: &[&str] = &["\\boot", "\\"];
|
||||||
|
|
||||||
/// Prefixes of kernel files to scan for.
|
/// Prefixes of kernel files to scan for.
|
||||||
const KERNEL_PREFIXES: &[&str] = &["vmlinuz"];
|
const KERNEL_PREFIXES: &[&str] = &["vmlinuz", "Image"];
|
||||||
|
|
||||||
/// Prefixes of initramfs files to match to.
|
/// Prefixes of initramfs files to match to.
|
||||||
const INITRAMFS_PREFIXES: &[&str] = &["initramfs", "initrd", "initrd.img"];
|
const INITRAMFS_PREFIXES: &[&str] = &["initramfs", "initrd", "initrd.img"];
|
||||||
|
|||||||
@@ -93,7 +93,17 @@ impl BootableEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Determine if this entry matches `needle` by comparing to the name or title of the entry.
|
/// Determine if this entry matches `needle` by comparing to the name or title of the entry.
|
||||||
|
/// If `needle` ends with *, we will match a partial match.
|
||||||
pub fn is_match(&self, needle: &str) -> bool {
|
pub fn is_match(&self, needle: &str) -> bool {
|
||||||
|
// If the needle ends with '*', we will accept a partial match.
|
||||||
|
if needle.ends_with("*") {
|
||||||
|
// Strip off any '*' at the end.
|
||||||
|
let partial = needle.trim_end_matches("*");
|
||||||
|
// Check if the name or title start with the partial match.
|
||||||
|
return self.name.starts_with(partial) || self.title.starts_with(partial);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standard quality matching rules.
|
||||||
self.name == needle || self.title == needle
|
self.name == needle || self.title == needle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ extern crate alloc;
|
|||||||
use crate::context::{RootContext, SproutContext};
|
use crate::context::{RootContext, SproutContext};
|
||||||
use crate::entries::BootableEntry;
|
use crate::entries::BootableEntry;
|
||||||
use crate::options::SproutOptions;
|
use crate::options::SproutOptions;
|
||||||
use crate::options::parser::OptionsRepresentable;
|
|
||||||
use crate::phases::phase;
|
use crate::phases::phase;
|
||||||
use alloc::collections::BTreeMap;
|
use alloc::collections::BTreeMap;
|
||||||
use alloc::format;
|
use alloc::format;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
use crate::options::parser::{OptionDescription, OptionForm, OptionsRepresentable};
|
|
||||||
use alloc::collections::BTreeMap;
|
|
||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
use anyhow::{Context, Result, bail};
|
use anyhow::Result;
|
||||||
|
use core::ptr::null_mut;
|
||||||
/// The Sprout options parser.
|
use jaarg::{
|
||||||
pub mod parser;
|
ErrorUsageWriter, ErrorUsageWriterContext, HelpWriter, HelpWriterContext, Opt, Opts,
|
||||||
|
ParseControl, ParseResult, StandardErrorUsageWriter, StandardFullHelpWriter,
|
||||||
|
};
|
||||||
|
use log::{error, info};
|
||||||
|
use uefi_raw::Status;
|
||||||
|
|
||||||
/// Default configuration file path.
|
/// Default configuration file path.
|
||||||
const DEFAULT_CONFIG_PATH: &str = "\\sprout.toml";
|
const DEFAULT_CONFIG_PATH: &str = "\\sprout.toml";
|
||||||
@@ -38,97 +40,93 @@ impl Default for SproutOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The options parser mechanism for Sprout.
|
/// The options parser mechanism for Sprout.
|
||||||
impl OptionsRepresentable for SproutOptions {
|
impl SproutOptions {
|
||||||
/// Produce the [SproutOptions] structure.
|
/// Produces [SproutOptions] from the arguments provided by the UEFI core.
|
||||||
type Output = Self;
|
/// Internally we utilize the `jaarg` argument parser which has excellent no_std support.
|
||||||
|
pub fn parse() -> Result<Self> {
|
||||||
/// All the Sprout options that are defined.
|
enum ArgID {
|
||||||
fn options() -> &'static [(&'static str, OptionDescription<'static>)] {
|
Help,
|
||||||
&[
|
AutoConfigure,
|
||||||
(
|
Config,
|
||||||
"autoconfigure",
|
Boot,
|
||||||
OptionDescription {
|
ForceMenu,
|
||||||
description: "Enable Sprout Autoconfiguration",
|
MenuTimeout,
|
||||||
form: OptionForm::Flag,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"config",
|
|
||||||
OptionDescription {
|
|
||||||
description: "Path to Sprout configuration file",
|
|
||||||
form: OptionForm::Value,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"boot",
|
|
||||||
OptionDescription {
|
|
||||||
description: "Entry to boot, bypassing the menu",
|
|
||||||
form: OptionForm::Value,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"force-menu",
|
|
||||||
OptionDescription {
|
|
||||||
description: "Force showing of the boot menu",
|
|
||||||
form: OptionForm::Flag,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"menu-timeout",
|
|
||||||
OptionDescription {
|
|
||||||
description: "Boot menu timeout, in seconds",
|
|
||||||
form: OptionForm::Value,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"help",
|
|
||||||
OptionDescription {
|
|
||||||
description: "Display Sprout Help",
|
|
||||||
form: OptionForm::Help,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces [SproutOptions] from the parsed raw `options` map.
|
// All the options for the Sprout executable.
|
||||||
fn produce(options: BTreeMap<String, Option<String>>) -> Result<Self> {
|
const OPTIONS: Opts<ArgID> = Opts::new(&[
|
||||||
|
Opt::help_flag(ArgID::Help, &["--help"]).help_text("Display Sprout Help"),
|
||||||
|
Opt::flag(ArgID::AutoConfigure, &["--autoconfigure"])
|
||||||
|
.help_text("Enable Sprout autoconfiguration"),
|
||||||
|
Opt::value(ArgID::Config, &["--config"], "PATH")
|
||||||
|
.help_text("Path to Sprout configuration file"),
|
||||||
|
Opt::value(ArgID::Boot, &["--boot"], "ENTRY")
|
||||||
|
.help_text("Entry to boot, bypassing the menu"),
|
||||||
|
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"),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Acquire the arguments as determined by the UEFI core.
|
||||||
|
let args = eficore::env::args()?;
|
||||||
|
|
||||||
// Use the default value of sprout options and have the raw options be parsed into it.
|
// Use the default value of sprout options and have the raw options be parsed into it.
|
||||||
let mut result = Self::default();
|
let mut result = Self::default();
|
||||||
|
|
||||||
for (key, value) in options {
|
// Parse the OPTIONS into a map using jaarg.
|
||||||
match key.as_str() {
|
match OPTIONS.parse(
|
||||||
"autoconfigure" => {
|
"sprout",
|
||||||
|
args.iter(),
|
||||||
|
|program_name, id, _opt, _name, value| {
|
||||||
|
match id {
|
||||||
|
ArgID::AutoConfigure => {
|
||||||
// Enable autoconfiguration.
|
// Enable autoconfiguration.
|
||||||
result.autoconfigure = true;
|
result.autoconfigure = true;
|
||||||
}
|
}
|
||||||
|
ArgID::Config => {
|
||||||
"config" => {
|
|
||||||
// The configuration file to load.
|
// The configuration file to load.
|
||||||
result.config = value.context("--config option requires a value")?;
|
result.config = value.into();
|
||||||
}
|
}
|
||||||
|
ArgID::Boot => {
|
||||||
"boot" => {
|
|
||||||
// The entry to boot.
|
// The entry to boot.
|
||||||
result.boot = Some(value.context("--boot option requires a value")?);
|
result.boot = Some(value.into());
|
||||||
}
|
}
|
||||||
|
ArgID::ForceMenu => {
|
||||||
"force-menu" => {
|
|
||||||
// Force showing of the boot menu.
|
// Force showing of the boot menu.
|
||||||
result.force_menu = true;
|
result.force_menu = true;
|
||||||
}
|
}
|
||||||
|
ArgID::MenuTimeout => {
|
||||||
"menu-timeout" => {
|
|
||||||
// The timeout for the boot menu in seconds.
|
// The timeout for the boot menu in seconds.
|
||||||
let value = value.context("--menu-timeout option requires a value")?;
|
result.menu_timeout = Some(value.parse::<u64>()?);
|
||||||
let value = value
|
|
||||||
.parse::<u64>()
|
|
||||||
.context("menu-timeout must be a number")?;
|
|
||||||
result.menu_timeout = Some(value);
|
|
||||||
}
|
}
|
||||||
|
ArgID::Help => {
|
||||||
|
let ctx = HelpWriterContext {
|
||||||
|
options: &OPTIONS,
|
||||||
|
program_name,
|
||||||
|
};
|
||||||
|
info!("{}", StandardFullHelpWriter::new(ctx));
|
||||||
|
return Ok(ParseControl::Quit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(ParseControl::Continue)
|
||||||
|
},
|
||||||
|
|program_name, error| {
|
||||||
|
let ctx = ErrorUsageWriterContext {
|
||||||
|
options: &OPTIONS,
|
||||||
|
program_name,
|
||||||
|
error,
|
||||||
|
};
|
||||||
|
error!("{}", StandardErrorUsageWriter::new(ctx));
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
ParseResult::ContinueSuccess => Ok(result),
|
||||||
|
ParseResult::ExitSuccess => unsafe {
|
||||||
|
uefi::boot::exit(uefi::boot::image_handle(), Status::SUCCESS, 0, null_mut());
|
||||||
|
},
|
||||||
|
|
||||||
_ => bail!("unknown option: --{key}"),
|
ParseResult::ExitError => unsafe {
|
||||||
|
uefi::boot::exit(uefi::boot::image_handle(), Status::ABORTED, 0, null_mut());
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(result)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,153 +0,0 @@
|
|||||||
use alloc::collections::BTreeMap;
|
|
||||||
use alloc::string::{String, ToString};
|
|
||||||
use anyhow::{Context, Result, bail};
|
|
||||||
use core::ptr::null_mut;
|
|
||||||
use eficore::env;
|
|
||||||
use log::info;
|
|
||||||
use uefi_raw::Status;
|
|
||||||
|
|
||||||
/// The type of option. This disambiguates different behavior
|
|
||||||
/// of how options are handled.
|
|
||||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
|
||||||
pub enum OptionForm {
|
|
||||||
/// A flag, like --verbose.
|
|
||||||
Flag,
|
|
||||||
/// A value, in the form --abc 123 or --abc=123.
|
|
||||||
Value,
|
|
||||||
/// Help flag, like --help.
|
|
||||||
Help,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The description of an option, used in the option parser
|
|
||||||
/// to make decisions about how to progress.
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct OptionDescription<'a> {
|
|
||||||
/// The description of the option.
|
|
||||||
pub description: &'a str,
|
|
||||||
/// The type of option to parse as.
|
|
||||||
pub form: OptionForm,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents a type that can be parsed from command line arguments.
|
|
||||||
/// This is a super minimal options parser mechanism just for Sprout.
|
|
||||||
pub trait OptionsRepresentable {
|
|
||||||
/// The output type that parsing will produce.
|
|
||||||
type Output;
|
|
||||||
|
|
||||||
/// The configured options for this type. This should describe all the options
|
|
||||||
/// that are valid to produce the type. The left-hand side is the name of the option,
|
|
||||||
/// and the right-hand side is the description.
|
|
||||||
fn options() -> &'static [(&'static str, OptionDescription<'static>)];
|
|
||||||
|
|
||||||
/// Produces the type by taking the `options` and processing it into the output.
|
|
||||||
fn produce(options: BTreeMap<String, Option<String>>) -> Result<Self::Output>;
|
|
||||||
|
|
||||||
/// For minimalism, we don't want a full argument parser. Instead, we use
|
|
||||||
/// a simple --xyz = xyz: None and --abc 123 = abc: Some("123") format.
|
|
||||||
/// We also support the format: --abc=123
|
|
||||||
fn parse_raw() -> Result<BTreeMap<String, Option<String>>> {
|
|
||||||
// Access the configured options for this type.
|
|
||||||
let configured: BTreeMap<_, _> = BTreeMap::from_iter(Self::options().to_vec());
|
|
||||||
|
|
||||||
// Collect all the arguments to Sprout.
|
|
||||||
// Skip the first argument, which is the path to our executable.
|
|
||||||
let args = env::args()?;
|
|
||||||
|
|
||||||
// Represent options as key-value pairs.
|
|
||||||
let mut options = BTreeMap::new();
|
|
||||||
|
|
||||||
// Iterators makes this way easier.
|
|
||||||
let mut iterator = args.into_iter().peekable();
|
|
||||||
|
|
||||||
loop {
|
|
||||||
// Consume the next option, if any.
|
|
||||||
let Some(option) = iterator.next() else {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
// If the option doesn't start with --, that is invalid.
|
|
||||||
if !option.starts_with("--") {
|
|
||||||
bail!("invalid option: {option}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Strip the -- prefix off.
|
|
||||||
let mut option = option["--".len()..].trim().to_string();
|
|
||||||
|
|
||||||
// An optional value.
|
|
||||||
let mut value = None;
|
|
||||||
|
|
||||||
// Check if the option is of the form --abc=123
|
|
||||||
if let Some((part_key, part_value)) = option.split_once('=') {
|
|
||||||
let part_key = part_key.to_string();
|
|
||||||
let part_value = part_value.to_string();
|
|
||||||
option = part_key;
|
|
||||||
value = Some(part_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error on empty option names.
|
|
||||||
if option.is_empty() {
|
|
||||||
bail!("invalid empty option");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the description of the configured option, if any.
|
|
||||||
let Some(description) = configured.get(option.as_str()) else {
|
|
||||||
bail!("invalid option: --{option}");
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check if the option requires a value and error if none was provided.
|
|
||||||
if description.form == OptionForm::Value && value.is_none() {
|
|
||||||
// Check for the next value.
|
|
||||||
let maybe_next = iterator.peek();
|
|
||||||
|
|
||||||
// If the next value isn't another option, set the value to the next value.
|
|
||||||
// Otherwise, it is None.
|
|
||||||
value = if let Some(next) = maybe_next
|
|
||||||
&& !next.starts_with("--")
|
|
||||||
{
|
|
||||||
iterator.next()
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the option form does not support a value and there is a value, error.
|
|
||||||
if description.form != OptionForm::Value && value.is_some() {
|
|
||||||
bail!("option --{} does not take a value", option);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the --help flag case.
|
|
||||||
if description.form == OptionForm::Help {
|
|
||||||
// Generic configured options output.
|
|
||||||
info!("Configured Options:");
|
|
||||||
for (name, description) in &configured {
|
|
||||||
info!(
|
|
||||||
" --{}{}: {}",
|
|
||||||
name,
|
|
||||||
if description.form == OptionForm::Value {
|
|
||||||
" <value>"
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
},
|
|
||||||
description.description
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Exit because the help has been displayed.
|
|
||||||
unsafe {
|
|
||||||
uefi::boot::exit(uefi::boot::image_handle(), Status::SUCCESS, 0, null_mut());
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the option and the value into the map.
|
|
||||||
options.insert(option, value);
|
|
||||||
}
|
|
||||||
Ok(options)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parses the program arguments as a [Self::Output], calling [Self::parse_raw] and [Self::produce].
|
|
||||||
fn parse() -> Result<Self::Output> {
|
|
||||||
// Parse the program arguments into a raw map.
|
|
||||||
let options = Self::parse_raw().context("unable to parse options")?;
|
|
||||||
// Produce the options from the map.
|
|
||||||
Self::produce(options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -78,8 +78,7 @@ pub struct RootConfiguration {
|
|||||||
/// Options configuration for Sprout, used when the corresponding options are not specified.
|
/// Options configuration for Sprout, used when the corresponding options are not specified.
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||||
pub struct OptionsConfiguration {
|
pub struct OptionsConfiguration {
|
||||||
/// The entry to boot without showing the boot menu.
|
/// The entry to mark as the default entry, instead of the first entry.
|
||||||
/// If not specified, a boot menu is shown.
|
|
||||||
#[serde(rename = "default-entry", default)]
|
#[serde(rename = "default-entry", default)]
|
||||||
pub default_entry: Option<String>,
|
pub default_entry: Option<String>,
|
||||||
/// The timeout of the boot menu.
|
/// The timeout of the boot menu.
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ if [ "${QEMU_GDB_WAIT}" = "1" ]; then
|
|||||||
set -- "${@}" "-S"
|
set -- "${@}" "-S"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -- "${@}" -smp 2 -m 4096
|
set -- "${@}" -nodefaults -smp 2 -m 4096
|
||||||
|
|
||||||
if [ "${NO_GRAPHICAL_BOOT}" = "1" ]; then
|
if [ "${NO_GRAPHICAL}" = "1" ]; then
|
||||||
set -- "${@}" -nographic
|
set -- "${@}" -nographic
|
||||||
else
|
else
|
||||||
if [ "${GRAPHICAL_ONLY}" != "1" ]; then
|
if [ "${GRAPHICAL_ONLY}" != "1" ]; then
|
||||||
@@ -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 \
|
-chardev 'stdio,id=stdio0,signal=off' \
|
||||||
-device virtconsole,chardev=stdio0,id=console0
|
-device 'virtconsole,chardev=stdio0,id=console0,name=alpine'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -62,6 +62,12 @@ if [ "${NO_INPUT}" != "1" ]; then
|
|||||||
-device usb-mouse
|
-device usb-mouse
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${NO_NETWORK}" != "1" ]; then
|
||||||
|
set -- "${@}" \
|
||||||
|
-netdev 'user,id=network0' \
|
||||||
|
-device 'virtio-net-pci,netdev=network0'
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f "${FINAL_DIR}/ovmf-boot.fd"
|
rm -f "${FINAL_DIR}/ovmf-boot.fd"
|
||||||
cp "${FINAL_DIR}/ovmf.fd" "${FINAL_DIR}/ovmf-boot.fd"
|
cp "${FINAL_DIR}/ovmf.fd" "${FINAL_DIR}/ovmf-boot.fd"
|
||||||
if [ "${TARGET_ARCH}" = "aarch64" ]; then
|
if [ "${TARGET_ARCH}" = "aarch64" ]; then
|
||||||
@@ -70,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"
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ copy_from_image_polyfill() {
|
|||||||
SOURCE="${2}"
|
SOURCE="${2}"
|
||||||
TARGET="${3}"
|
TARGET="${3}"
|
||||||
|
|
||||||
docker build -t "${IMAGE}-copy-polyfill:${DOCKER_TAG}" --build-arg "TARGET_IMAGE=${IMAGE}:${DOCKER_TAG}" \
|
docker build --platform="${DOCKER_TARGET}" -t "${IMAGE}-copy-polyfill:${DOCKER_TAG}" --build-arg "TARGET_IMAGE=${IMAGE}:${DOCKER_TAG}" \
|
||||||
-f hack/dev/utils/Dockerfile.copy-polyfill hack
|
-f hack/dev/utils/Dockerfile.copy-polyfill hack
|
||||||
# note: the -w '//' is a workaround for Git Bash where / is magically rewritten.
|
# note: the -w '//' is a workaround for Git Bash where / is magically rewritten.
|
||||||
docker run --rm -i -w '//' "${IMAGE}-copy-polyfill:${DOCKER_TAG}" cat "image/${SOURCE}" >"${TARGET}"
|
docker run --rm -i -w '//' "${IMAGE}-copy-polyfill:${DOCKER_TAG}" cat "image/${SOURCE}" >"${TARGET}"
|
||||||
@@ -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 "${FINAL_DIR}"
|
-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
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ has-item = "\\vmlinuz"
|
|||||||
|
|
||||||
[actions.chainload-kernel]
|
[actions.chainload-kernel]
|
||||||
chainload.path = "$boot\\vmlinuz"
|
chainload.path = "$boot\\vmlinuz"
|
||||||
chainload.options = ["console=hvc0"]
|
chainload.options = ["console=hvc0", "overlaytmpfs=yes"]
|
||||||
chainload.linux-initrd = "$boot\\initramfs"
|
chainload.linux-initrd = "$boot\\initramfs"
|
||||||
|
|
||||||
[entries.kernel]
|
[entries.kernel]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ has-item = "\\vmlinuz"
|
|||||||
|
|
||||||
[actions.chainload-kernel]
|
[actions.chainload-kernel]
|
||||||
chainload.path = "$boot\\vmlinuz"
|
chainload.path = "$boot\\vmlinuz"
|
||||||
chainload.options = ["console=hvc0"]
|
chainload.options = ["console=hvc0", "overlaytmpfs=yes"]
|
||||||
chainload.linux-initrd = "$boot\\initramfs"
|
chainload.linux-initrd = "$boot\\initramfs"
|
||||||
|
|
||||||
[entries.kernel]
|
[entries.kernel]
|
||||||
|
|||||||
@@ -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,21 +28,33 @@ 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 --set-str UEVENT_HELPER_PATH "/sbin/hotplug"
|
||||||
|
|
||||||
./scripts/config -e DRM_VIRTIO_GPU
|
./scripts/config -e DRM_VIRTIO_GPU
|
||||||
./scripts/config -e FRAMEBUFFER_CONSOLE
|
./scripts/config -e FRAMEBUFFER_CONSOLE
|
||||||
./scripts/config -e FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
|
./scripts/config -e FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
|
||||||
|
./scripts/config -e LOGO
|
||||||
|
|
||||||
./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
|
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 && \
|
||||||
@@ -7,6 +7,7 @@ RUN rc-update add devfs sysinit && \
|
|||||||
rc-update add sysctl boot && \
|
rc-update add sysctl boot && \
|
||||||
rc-update add hostname boot && \
|
rc-update add hostname boot && \
|
||||||
rc-update add bootmisc boot && \
|
rc-update add bootmisc boot && \
|
||||||
|
rc-update add networking boot && \
|
||||||
rc-update add syslog boot && \
|
rc-update add syslog boot && \
|
||||||
rc-update add mount-ro shutdown && \
|
rc-update add mount-ro shutdown && \
|
||||||
rc-update add killprocs shutdown && \
|
rc-update add killprocs shutdown && \
|
||||||
@@ -14,9 +15,11 @@ RUN rc-update add devfs sysinit && \
|
|||||||
ln -s /sbin/init /init && \
|
ln -s /sbin/init /init && \
|
||||||
echo 'root:root' | chpasswd && \
|
echo 'root:root' | chpasswd && \
|
||||||
echo 'sprout' > /etc/hostname && \
|
echo 'sprout' > /etc/hostname && \
|
||||||
echo '' > /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/getty -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
|
||||||
|
|
||||||
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS build
|
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS build
|
||||||
COPY --from=rootfs / /rootfs
|
COPY --from=rootfs / /rootfs
|
||||||
|
|||||||
3
hack/dev/vm/files/interfaces
Normal file
3
hack/dev/vm/files/interfaces
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
auto eth0
|
||||||
|
iface eth0
|
||||||
|
use dhcp
|
||||||
Reference in New Issue
Block a user