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

ref: Create separate kernel and module images #50

Merged
merged 1 commit into from
Jan 17, 2023
Merged

Conversation

Callisto13
Copy link
Member

@Callisto13 Callisto13 commented Dec 19, 2022

Closes #31 , part of #49

This commit moves the kernel image out of the flintlock/ subdir and splits the kernel image into two: one containing just the binary, the other just the modules.

The sequence works like so:

  • builder creates a starting point image from Ubuntu, installing packages etc.
  • base uses builder, pulls and compiles the kernel, then saves the modules and the binary in a scratch image. I have kept this image under the old flintlock-kernel name with modules and the binary to maintain backwards compatibility.
  • modules and bin use base and simply copy the things they need into a scratch image.

The images produced are:

  • kernel-builder
  • flintlock-kernel (kept the same for backwards compatibility)
  • kernel-bin
  • kernel-modules

@Callisto13 Callisto13 added kind/feature New feature or request kind/refactor Only refactoring changes labels Dec 19, 2022
@Callisto13 Callisto13 force-pushed the v2-kernel branch 3 times, most recently from 4baec80 to a624f63 Compare December 19, 2022 13:45
@Callisto13
Copy link
Member Author

Validated cluster works with:

rootVolume:
  id: root
  image: "docker.io/claudiaberesford/capmvm-k8s-os:1.23.5"
kernel:
  filename: "boot/vmlinux"
  image: "docker.io/claudiaberesford/kernel-bin:5.10.77"
volumes:
- id: modules
  image: "docker.io/claudiaberesford/kernel-modules:5.10.77"
  mountPoint: /lib/modules/5.10.77

yitsushi
yitsushi previously approved these changes Jan 12, 2023
Copy link
Member

@richardcase richardcase left a comment

Choose a reason for hiding this comment

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

How would we slot the CloudHypervisor kernel into this re-organised structure? It requires different options to be enabled and so it would require a different kernel/modules images

@Callisto13
Copy link
Member Author

Callisto13 commented Jan 12, 2023

How would we slot the CloudHypervisor kernel into this re-organised structure? It requires different options to be enabled and so it would require a different kernel/modules images

I planned to punt that to my stretch goal of using something like Packer to build our images instead. From what I see it provides an easier way of reusing modules of build parts into a matrix so we don't have to dupe things. If not that, I can split what we have further into as many reusable parts as possible and have like kernel/firecracker and kernel/cloudhypervisor subdirs:

# all off the top of my head
- kernel
  - builder
  - common base elements
  - firecracker
    - configs 
    - modules
    - bin
  - cloud hypervisor
    - configs
    - modules
    - bin

which is fine, at least better than it was now that we don't have OS images dependent on the kernel side of things.

but yeh i did ignore anything under experimental and perf for now 😜

This commit moves the kernel image out of the flintlock/ subdir and
splits the kernel image into two: one containing just the binary, the
other just the module.

The sequence works like so:
- `builder` creates a starting point image from Ubuntu, installing
  packages etc.
- `base` uses builder, pulls and compiles the kernel, then saves the
  modules and the binary in a `scratch` image. I have kept this image
  under the old `flintlock-kernel` name with modules and the binary to
  maintain backwards compatibility.
- `modules` and `bin` use `base` and simply copy the things they need
  into a `scratch` image.

The images produced are:
- `kernel-builder`
- `flintlock-kernel` (kept the same for backwards compatibility)
- `kernel-bin`
- `kernel-modules`
@Callisto13
Copy link
Member Author

@richardcase do you want me to factor in experimental images as part of this pr or can i leave it for the next one?

@richardcase
Copy link
Member

@richardcase do you want me to factor in experimental images as part of this pr or can i leave it for the next one?

Lets leave it as a follow-up PR.

@Callisto13 Callisto13 merged commit 9d4ae9e into main Jan 17, 2023
@Callisto13 Callisto13 deleted the v2-kernel branch January 17, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request kind/refactor Only refactoring changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop building modules into base kernel images
3 participants