Skip to content

Commit

Permalink
[antlir2][vm] consolidate rootfs artifacts
Browse files Browse the repository at this point in the history
Summary:
Clean up the wild targets everywhere before starting to migrate simple
customer VM layers to antlir2.

Test Plan: CI. This changes nothing, so should have no target graph changes.

Reviewed By: vmagro

Differential Revision: D50622199

fbshipit-source-id: 8c63c34dcd740fb077ace0ddc66b836a03df0451
  • Loading branch information
wujj123456 authored and facebook-github-bot committed Oct 25, 2023
1 parent f778ee0 commit 7b1364a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions antlir/antlir2/antlir2_vm/bzl/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,11 @@ vm = struct(
disk_boot = "//antlir/antlir2/antlir2_vm:default-disk-boot",
nvme_disk_boot = "//antlir/antlir2/antlir2_vm:default-nvme-disk-boot",
),
rootfs = struct(
# Base layer to start from when customizing VM rootfs layer
layer = "//metalos/vm/os:rootfs",
# Features to add onto an existing layer to make it work for VM
virtualization_features = "//metalos/vm/os:virtualization-features",
),
),
)
11 changes: 11 additions & 0 deletions antlir/antlir2/docs/docs/internals/vm-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@ layer, to a partition, to a disk image and make it bootable.
`metalos/vm/disks/simple.bzl` uses these API to provide the default disk used
above and also serves as an example.

To build rootfs layer that boots with VM, one can do one of the following,
assuming you are familiar with building antlir2 layers.
1. If you have an antlir2 layer already, add feature
`vm.artifacts.rootfs.virtualization_features` should make it work with VM,
unless the existing layer has conflicting configs, which should be unlikely.
This is a better approach if you have elaborated antlir2 image builds for
production already.
2. If you just want to add something to the default VM rootfs, use
`vm.artifacts.rootfs.layer` as `parent_layer` to add your features. This is
the easier approach to do light customization for your VM rootfs.

Various folders inside `metalos/vm/` provides targets for initrd, kernel,
bootloader, etc that one can use to complete the construction from layer to disk
image. The goal is to provide anyone with an antlir2 image layer all the tools
Expand Down

0 comments on commit 7b1364a

Please sign in to comment.