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

Create minimal driver VMs #122

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

boinkaput
Copy link

This PR creates minimal linux and initramfs images for the virtio and virtio-snd examples.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete this file? Shouldn't there still be a buildroot config?

Copy link
Author

@boinkaput boinkaput Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually created a rootfs for each of the driver VMs because most of the files remain unused by the VM. So buildroot shouldn't be required for driver VMs.

The block driver VM contains:

  • /dev
  • /sys
  • /modules: Only contains kernel modules required by the block driver.
  • /init: This gets added during the build process using packrootfs

The sound driver VM contains:

  • /dev
  • /sys
  • /modules: Only contains kernel modules required by the block driver.
  • /init: This gets added during the build process using packrootfs
  • /alsa: config files for alsa
  • /alsactl
  • /etc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the file is missing you need to provide instructions for recreating the root FS, and in particular if there are any GPLd binaries in there how to get the source for them and rebuild them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wom-bat I have updated the readme for the 2 examples (sound driver readme, block driver readme). I just remembered that the sound driver VM requires a buildroot_config for building a statically linked alsactl. I've included the steps for reproducing this in the sound driver readme.

@Ivan-Velickovic
Copy link
Collaborator

Could you summarise what you modified in the Linux kernels? What configuration options did you disable?

@boinkaput boinkaput force-pushed the virtio_min_updated branch 6 times, most recently from 6d4b6b3 to 9522684 Compare September 16, 2024 11:33
… on qemu and mark the unused imgaes with a .old extension

Signed-off-by: Anuraag <[email protected]>
…ad of aarch64-linux-gnu for static linking

Signed-off-by: Anuraag <[email protected]>
…rather than copying it to /etc/init.d

Signed-off-by: Anuraag <[email protected]>
…mple on qemu and mark the unused imgaes with a .old extension

Signed-off-by: Anuraag <[email protected]>
…rch64-linux-gnu for static linking

Signed-off-by: Anuraag <[email protected]>
… to prevent it from duplicating the alsa-lib symbols

Signed-off-by: Anuraag <[email protected]>
…x kernel image as virtio-snd

include config options that are required but were not previously included

Signed-off-by: Anuraag <[email protected]>
create a custom init script for the sound driver VM userspace

move alsactl init back to the uio sound driver program

create a script that performs the initial setup for a driver VM and provides functions that each driver VM can implement

Signed-off-by: Anuraag <[email protected]>
…d. This fixes the issue by calling it multiple times until it succeeds.

Signed-off-by: Anuraag <[email protected]>
@boinkaput boinkaput force-pushed the virtio_min_updated branch 3 times, most recently from 188bec4 to bc408f3 Compare September 22, 2024 23:21
…o odroidc4 and delete buildroot_config for the sound driver VM

Signed-off-by: Anuraag <[email protected]>
…oard to the odroidc4 and delete buildroot_config for the block driver VM

Signed-off-by: Anuraag <[email protected]>
@boinkaput boinkaput force-pushed the virtio_min_updated branch 2 times, most recently from 7772979 to 04f95ee Compare September 23, 2024 01:57
…root config for sound driver VM, for building alsactl

Signed-off-by: Anuraag <[email protected]>
@boinkaput
Copy link
Author

boinkaput commented Sep 23, 2024

@Ivan-Velickovic here's a summary of the updated config:

  • Selected the minimum number of CPUs (which is 2)
  • Removed support for high res timers
  • Selected "no forced preemption" model for the kernel. As per the definition: it leads to better throughput and is better suited for servers.
  • Disabled NUMA support
  • Enabled support for initramfs and only supports gzipped images
  • Enabled config expert and selected the following options:
    • CONFIG_BASE_FULL: full sized kernel data structures
    • CONFIG_FUTEX: required by glibc applications
    • CONFIG_TIMERFD: required by the uio sound driver
    • CONFIG_SHMEM: used by tmpfs
    • everything else (like cgroups, namespaces, etc) has been disabled
  • For platform selection, I chose CONFIG_ARCH_MESON (not sure if we require other platforms atm, as we are only supporting qemu and odroidc4)
  • Disabled virtualization
  • Enabled module support: used by the sound and block drivers to add additional functionality on top of the base kernel through the use of modules
  • Disabled all power management options to prevent any policy conflicts with microkit.
  • Only has support for elf binaries.
  • Enabled free page reporting: will be useful if we decide to implement memory ballooning or any other kind of cooperative memory management.
  • Disabled all networking support
  • Disabled all filesystems, except for tmpfs and sysfs
  • Disabled all device driver except for the ones that were automatically enabled by selecting CONFIG_ARCH_MESON platform support and PCI support.
  • Disabled crypographic API, library routines and any other debug options
  • /dev/mem will still be present because it is required by the sound driver.
  • Enabled the block layer for virtio block (no other options are enabled in its submenu).
  • Enabled support for sound devices, ALSA and USB support (for audio devices that require USB). Most of these are enabled as modules, but some of them only have a yes/no option.

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

Successfully merging this pull request may close these issues.

4 participants