Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ will pop the top element.

## Booting a machine

In the simplest case, run `zoxboot` and send your ramdisk via
ZMODEM. `zoxboot` is an alias that expands to to the command
line below.

Assuming you have booted into `bldb` on some machine of
interest, you will be presented with a prompt (`@`), at which
you may type commands. To send a compressed ramdisk, inflate
Expand Down
8 changes: 8 additions & 0 deletions src/bldb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ use crate::iomux;
use crate::mem;
use crate::mmu;
use crate::ramdisk;
use crate::repl;
use crate::result::Error;
use crate::uart::{self, Uart};
use alloc::boxed::Box;
use alloc::collections::BTreeMap;
use alloc::string::String;
use core::fmt;
use core::ops::Range;
use core::sync::atomic::{AtomicBool, Ordering};
Expand All @@ -64,6 +67,7 @@ pub(crate) struct Config {
pub(crate) page_table: mmu::LoaderPageTable,
pub(crate) ramdisk: Option<Box<dyn ramdisk::FileSystem>>,
pub(crate) prompt: cons::Prompt,
pub(crate) aliases: BTreeMap<String, String>,
}

impl Config {
Expand Down Expand Up @@ -134,6 +138,9 @@ pub(crate) unsafe extern "C" fn init(bist: u32) -> &'static mut Config {
iomux_region,
gpio_region,
];
let aliases = BTreeMap::from_iter(
repl::DEF_ALIASES.iter().map(|&(k, v)| (k.into(), v.into())),
);
let mut config = Box::new(Config {
cons,
iomux,
Expand All @@ -146,6 +153,7 @@ pub(crate) unsafe extern "C" fn init(bist: u32) -> &'static mut Config {
),
ramdisk: None,
prompt: cons::DEFAULT_PROMPT,
aliases,
});
if false {
say_hi_sp(&mut config, 4);
Expand Down
5 changes: 5 additions & 0 deletions src/repl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ mod sha;
mod smn;
mod vm;

pub const DEF_ALIASES: &[(&str, &str)] = &[(
"zoxboot",
"call . load /platform/oxide/kernel/amd64/unix . mount . @inflate . rz",
)];

#[derive(Clone)]
#[allow(dead_code)]
enum Value {
Expand Down
7 changes: 7 additions & 0 deletions src/repl/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ pub fn read(
if eval_reader_command(config, line, env, lastval) {
continue;
}
if let Some(expansion) = config.aliases.get(line) {
break expansion.clone();
}
break s;
};
let mut cmds = Vec::<Command>::new();
Expand Down Expand Up @@ -312,6 +315,10 @@ will pop the top element.

## Booting a machine

In the simplest case, run `zoxboot` and send your ramdisk via
ZMODEM. `zoxboot` is an alias that expands to to the command
line below.

To send a compressed ramdisk, inflate it, mount it, load a
kernel from it, and call into that kernel, passing the ramdisk
base address and length as arguments, run:
Expand Down