mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 12:09:31 +00:00
crosvm: add --block
argument to the run
command
We currently have 4 different arguments for specifying block devices: `disk`, `rwdisk`, `root`, and `rwroot`. These arguments basically do the same thing save for setting an additional flag to the disk configuration. This is both inefficient and confusing, so add a new `block` argument that allows to specify both the root and read-only properties as flags. It works similarly to the argument of the same name of the `devices` command and is easier to use in the context of a configuration file. We will eventually deprecate the 4 previous arguments after all users have transitioned to the new one. Change-Id: I87451aee57c714b5d47df9d8823c0b769137d426 BUG=b:218223240 TEST=`--block PATH,root` can be specified in place of `--rwroot PATH` and the right device is mounted as root, read-write. Change-Id: Ic186616344abac8af86040fc6b1613fd8e66a6a0 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3970364 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
eeafbb16e8
commit
efec33af6f
1 changed files with 22 additions and 0 deletions
|
@ -591,6 +591,27 @@ pub struct RunCommand {
|
||||||
/// path to BIOS/firmware ROM
|
/// path to BIOS/firmware ROM
|
||||||
pub bios: Option<PathBuf>,
|
pub bios: Option<PathBuf>,
|
||||||
|
|
||||||
|
#[argh(option, arg_name = "PATH[,key=value[,key=value[,...]]]")]
|
||||||
|
/// parameters for setting up a block device.
|
||||||
|
/// Valid keys:
|
||||||
|
/// path=PATH - Path to the disk image. Can be specified
|
||||||
|
/// without the key as the first argument.
|
||||||
|
/// ro=BOOL - Whether the block should be read-only.
|
||||||
|
/// (default: false)
|
||||||
|
/// root=BOOL - Whether the block device should be mounted
|
||||||
|
/// as the root filesystem. This will add the required
|
||||||
|
/// parameters to the kernel command-line. Can only be
|
||||||
|
/// specified once. (default: false)
|
||||||
|
/// sparse=BOOL - Indicates whether the disk should support
|
||||||
|
/// the discard operation. (default: true)
|
||||||
|
/// block_size=BYTES - Set the reported block size of the
|
||||||
|
/// disk. (default: 512)
|
||||||
|
/// id=STRING - Set the block device identifier to an ASCII
|
||||||
|
/// string, up to 20 characters. (default: no ID)
|
||||||
|
/// o_direct=BOOL - Use O_DIRECT mode to bypass page cache.
|
||||||
|
/// (default: false)
|
||||||
|
block: Vec<DiskOptionWithId>,
|
||||||
|
|
||||||
#[argh(option, arg_name = "CID")]
|
#[argh(option, arg_name = "CID")]
|
||||||
/// context ID for virtual sockets.
|
/// context ID for virtual sockets.
|
||||||
pub cid: Option<u64>,
|
pub cid: Option<u64>,
|
||||||
|
@ -1724,6 +1745,7 @@ impl TryFrom<RunCommand> for super::config::Config {
|
||||||
d.disk_option.root = false;
|
d.disk_option.root = false;
|
||||||
d
|
d
|
||||||
}))
|
}))
|
||||||
|
.chain(cmd.block.into_iter())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
// Sort all our disks by index.
|
// Sort all our disks by index.
|
||||||
|
|
Loading…
Reference in a new issue