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

mkosi-initrd: add option to build generic initrds #3471

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mkosi/initrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ def main() -> None:
help="Output format (CPIO archive, UKI or local directory)",
default="cpio",
)
parser.add_argument(
"-g",
"--generic",
help="Build a generic initrd without host-specific kernel modules",
action="store_true",
default=False,
)

initrd_common_args(parser)

Expand All @@ -245,11 +252,13 @@ def main() -> None:
"--extra-tree=/usr/lib/firmware:/usr/lib/firmware",
"--remove-files=/usr/lib/firmware/*-ucode",
"--kernel-modules-exclude=.*",
"--kernel-modules-include=host",
"--build-sources", "",
"--include=mkosi-initrd",
] # fmt: skip

if not args.generic:
cmdline += ["--kernel-modules-include=host"]

if args.kernel_image:
cmdline += [
"--extra-tree", f"{args.kernel_image}:/usr/lib/modules/{args.kernel_version}/vmlinuz",
Expand Down
5 changes: 5 additions & 0 deletions mkosi/resources/man/mkosi-initrd.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ initrds and Unified Kernel Images for the current running system.
: Path to a directory where to place all generated artifacts. Defaults to the
current working directory.

`--generic=`, `-g`
: Build a generic initrd without host-specific kernel modules, which should
allow the local system to boot on different hardware, although it's tied to
the kernel version of the running system or set with `--kernel-version=`.

`--debug=`
: Enable additional debugging output.

Expand Down
Loading