Skip to content

install: refactor console handling and disable GRUB on s390x#1736

Merged
nikita-dubrovskii merged 5 commits into
coreos:mainfrom
nikita-dubrovskii:kargs_during_install_rework
Apr 13, 2026
Merged

install: refactor console handling and disable GRUB on s390x#1736
nikita-dubrovskii merged 5 commits into
coreos:mainfrom
nikita-dubrovskii:kargs_during_install_rework

Conversation

@nikita-dubrovskii
Copy link
Copy Markdown
Contributor

On s390x, installations with --console would fail because the installer attempted to modify GRUB config files that don’t exist (s390x uses zipl).

This PR refactors the code to better separate --platform and --console logic, and disables all GRUB-related code paths for s390x.

Issue: #1171

Extract kernel argument configuration logic from write_disk() into a new
configure_kernel_arguments() function. This improves code organization,
no functional changes.
Extract GRUB console configuration into configure_grub() function,
called separately after kernel arguments are configured in write_disk().
This separates GRUB settings from kernel argument handling.
Add cfg guards to disable GRUB-related functions on s390x since
GRUB is not used on that architecture.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a 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 refactors the installation process to correctly handle the '--console' flag and disable GRUB configuration on s390x architectures. The changes introduce several helper functions for kernel argument and GRUB configuration management, utilizing conditional compilation to ensure platform-specific behavior. Review feedback identifies opportunities to improve performance by reducing redundant disk I/O, specifically by consolidating multiple reads of 'platforms.json' and minimizing sequential writes to the BLS configuration file through a single 'visit_bls_entry_options' call.

Comment thread src/install.rs
@nikita-dubrovskii nikita-dubrovskii changed the title Kargs during install rework install: refactor console handling and disable GRUB on s390x Apr 10, 2026
@nikita-dubrovskii
Copy link
Copy Markdown
Contributor Author

Conflicts with: #1732.

This PR adds further refactoring to clean up the code and better separate the logic. Also, while platforms.json is currently never present on s390x, it may appear in the future - this change prepares for that by only skipping GRUB-related steps.

Comment thread src/install.rs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not the biggest fan of including ~10 #[cfg(not(target_arch = "s390x"))] statements in here mainly for code readability. Can we minimize it to just 2?

  • line 430
  • line 932

I realize this probably makes the binary size smaller, but how much does it really save? It would have to be a lot for it to be worth it I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In such case there will be a lot of warnings like:

warning: function `build_grub_console_commands` is never used

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so not a hard failure?

@travier WDYT?

Copy link
Copy Markdown
Member

@travier travier Apr 10, 2026

Choose a reason for hiding this comment

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

I think we should include them as it makes it clear that those functions are not used on a specific arch. It matches what I've seen in other Rust projects AFAIK.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we want to minimize it further then we could split the code into another file and set the conditionnal there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok. man this really makes the code ugly though.

Copy link
Copy Markdown
Member

@travier travier left a comment

Choose a reason for hiding this comment

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

I did not test this code but the style and implementation LGTM.

@nikita-dubrovskii nikita-dubrovskii merged commit 6e7b4de into coreos:main Apr 13, 2026
15 checks passed
@nikita-dubrovskii nikita-dubrovskii deleted the kargs_during_install_rework branch April 13, 2026 08:05
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.

3 participants