Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend cmdline to work with abstractions instead of strings #25

Open
alxiord opened this issue Mar 10, 2020 · 0 comments
Open

Extend cmdline to work with abstractions instead of strings #25

alxiord opened this issue Mar 10, 2020 · 0 comments

Comments

@alxiord
Copy link
Member

alxiord commented Mar 10, 2020

Per @andreeaflorescu's idea, instead of:

let mut kernel_cmdline = "reboot=k panic=1 pci=off nomodules 8250.nr_uarts=0 \
    i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd";
if blocks.has_root_block_device() && !blocks.has_partuuid_root() {
    kernel_cmdline.insert_str("root=/dev/vda")?;
    let flags = if blocks.has_read_only_root() {
        "ro"
    } else {
        "rw"
    };
   kernel_cmdline.insert_str(flags)?;
}

(source: firecracker, default cmdline)

we could build the kernel command line using a Rustacean builder:

let kernel_cmdline = Cmdline::default()
    .pci(None)
    .serial(None)
    .root_device(Some(Block { root: true, ro: true, partuuid: partuuid_config }))
    .extra_args("nomodules")?;

(Not its final form, merely demonstrative purposes).

This would make cmdline building simpler and more elegant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant