runtime-rs: Suppress kernel parameters for IBM SE

For IBM SE, the following kernel parameters are not required:

- Basic parameters (reboot and systemd-related)
- Rootfs parameters

This commit suppresses these parameters when IBM SE is configured.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
This commit is contained in:
Hyounggyu Choi 2025-02-28 15:36:58 +01:00
parent 4c8e881a84
commit 59c1f0b59b
2 changed files with 20 additions and 0 deletions

View File

@ -123,6 +123,11 @@ impl KernelParams {
self.params.push(new_param);
}
pub(crate) fn remove_all_by_key(&mut self, key: String) {
// Remove all params with the given key from the vector
self.params.retain(|param| param.key != key);
}
pub(crate) fn from_string(params_string: &str) -> Self {
let mut params = vec![];

View File

@ -2142,6 +2142,21 @@ impl<'a> QemuCmdLine<'a> {
self.machine
.set_confidential_guest_support("pv0")
.set_nvdimm(false);
self.kernel.params.remove_all_by_key("reboot".to_string());
self.kernel
.params
.remove_all_by_key("systemd.unit".to_string());
self.kernel
.params
.remove_all_by_key("systemd.mask".to_string());
self.kernel.params.remove_all_by_key("root".to_string());
self.kernel
.params
.remove_all_by_key("rootflags".to_string());
self.kernel
.params
.remove_all_by_key("rootfstype".to_string());
}
pub fn add_sev_protection_device(&mut self, cbitpos: u32, firmware: &str) {