-
Notifications
You must be signed in to change notification settings - Fork 149
Get kargs from usr/lib/bootc/kargs.d #1783
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces two main changes. First, it adds support for reading kernel arguments from .toml files in /usr/lib/bootc/kargs.d during installation and upgrades. This is a valuable feature for customizing kernel command line arguments. Second, it refactors the storage handling by introducing boot_dir and esp fields in the Storage struct. This significantly cleans up the code by centralizing the logic for accessing the boot directory and the ESP, removing redundant ESP mounting logic across multiple files. The changes are well-implemented and improve both functionality and code maintainability. I have one minor suggestion to improve an error message for better debuggability.
| Cmdline::from(options) | ||
| } | ||
|
|
||
| _ => anyhow::bail!("Found NonEFI config"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message "Found NonEFI config" is confusing. This branch is executed when a config type other than NonEFI is found (e.g., EFI or Unknown). A more accurate message would be "Unsupported BLS config type, expected NonEFI", which would make debugging easier.
| _ => anyhow::bail!("Found NonEFI config"), | |
| _ => anyhow::bail!("Unsupported BLS config type, expected NonEFI"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We change the key efi to uki here #1780
This would need to change anyway afterwards
|
The big assumption here is that all composefs systems will boot via UEFI. That being said, we were already making this assumption in a few other places |
3d66308 to
1f75c8d
Compare
|
I think I overwrote some of my changes on force pushing. Marking this as draft for now |
| /// Directory holding the physical root | ||
| pub physical_root: Dir, | ||
|
|
||
| /// The 'boot' directory, useful and `Some` only for composefs systems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more that ostree::Sysroot handles this itself right now right?
And that kind of gets to the next thing. The way I'd been thinking about struct Storage is closer to an abstraction over ostree::Repo and composefs::Repository.
Maybe arguably it'd be slightly cleaner to actually have a struct SystemRoot that has these new members, and has an impl Deref<Target=Storage>?
But eh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I'd been thinking about struct Storage is closer to an abstraction over ostree::Repo and composefs::Repository
We do have physical_root and run in struct Storage so not quite an abstraction over Repository...
Maybe we could put these in BootedComposefs, but that doesn't sound right either
crates/lib/src/bootc_kargs.rs
Outdated
|
|
||
| let fname_str = fname | ||
| .to_str() | ||
| .ok_or_else(|| anyhow::anyhow!("Failed to get filename as string"))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps arguably we should skip in this case?
I think we want a helper fn for this that includes the path in the error message if we do propagate an error.
(Non-UTF8 filenames is just a giant mess)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps arguably we should skip in this case?
I think we can skip it, and maybe have in the docs that we only support UTF8 filenames
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping any non UTF-8 named files with a warning
Parse toml files in usr/lib/bootc/kargs.d and append them to kernel cmdline on install and upgrade/switch. Also, copy over current deployment's cmdline args on upgrade/switch to another deployment Signed-off-by: Pragyan Poudyal <[email protected]>
We have a lot of places where we mount the ESP temporarily and a lot of switch cases for Grub's vs SystemdBoot's 'boot' directory. We add a `boot_dir` field in Storage which points to `/sysroot/boot` for systems with Grub as the bootloader and points to the ESP for systems with SystemdBoot as the bootloader. Also we mount the ESP temporarily while creating the storage struct, which cleans up the code quite a bit. Signed-off-by: Pragyan Poudyal <[email protected]>
Signed-off-by: Pragyan Poudyal <[email protected]>
1f75c8d to
20eb4e4
Compare
Parse toml files in usr/lib/bootc/kargs.d and append them to kernel
cmdline on install and upgrade/switch. Also, copy over current
deployment's cmdline args on upgrade/switch to another deployment
storage: Add
boot_dirandespfieldsWe have a lot of places where we mount the ESP temporarily and a lot of
switch cases for Grub's vs SystemdBoot's 'boot' directory.
We add a
boot_dirfield in Storage which points to/sysroot/bootforsystems with Grub as the bootloader and points to the ESP for systems
with SystemdBoot as the bootloader.
Also we mount the ESP temporarily while creating the storage struct,
which cleans up the code quite a bit.