summaryrefslogtreecommitdiffstats
path: root/src/kernel-install (follow)
Commit message (Collapse)AuthorAgeFilesLines
* kernel-install: silently ignore unexpected arguments for 'remove' commandYu Watanabe2023-07-192-2/+18
| | | | | | | | | | The shell script version of kernel-install silently ignored unexpected arguments, but C version refused that. Unfortunately, Fedora's kernel script specifies kernel file even for 'remove' command. Let's accept extra arguments and silently ignore them to keep backward compatibility. Fixes #28448. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2223794.
* kernel-install: Avoid reopening file descriptor via /procDaan De Meyer2023-07-141-13/+13
| | | | | | | | | | | kernel-install used to work without /proc mounted before the rewrite in C. Let's restore that property by making sure we don't reopen file descriptors via /proc. In this case, parse_env_file_fdv() calls fdopen_independent() to get a FILE * for the given file descriptor (which itself calls fd_reopen()). Let's avoid the call to fdopen_independent() by using chase_and_fopenat_unlocked() which gives us a FILE * immediately without having to reopen any file descriptors.
* meson: shorten code a bitYu Watanabe2023-06-221-0/+2
|
* Fix quotingcvlc122023-06-201-2/+2
|
* Add docs, improve log comments.cvlc122023-06-191-1/+1
|
* Define 'microcode' type of initrd for the kernel-install staging area.cvlc122023-06-181-3/+6
| | | | This allows microcode to be referenced first for UKIs and loader entries.
* kernel-install: skip to read /etc/machine-info in testYu Watanabe2023-06-152-0/+10
| | | | | | | | We do not provide any way to override /etc/machine-info. As the file is deprecated in kernel-install, let's skip to read it when we test kernel-install. Fixes #28011.
* Merge pull request #27946 from keszybz/ukify-genkey-verbZbigniew Jędrzejewski-Szmek2023-06-141-1/+1
|\ | | | | Add 'genkey' verb to ukify
| * ukify: move verb mangling to finalize_options()Zbigniew Jędrzejewski-Szmek2023-06-121-1/+1
| | | | | | | | | | | | | | This simplifies the logic: finalize_options() is the step that does the checks and the mangling. The checks for consistency are done in more places, so we need to pass a verb (we only have 'build', but once we add other verbs, any would do).
* | Merge pull request #26848 from yuwata/kernel-installLuca Boccassi2023-06-084-405/+1336
|\ \ | |/ |/| kernel-install: rewrite in C
| * test-kernel-install: add tests for --entry-token=Yu Watanabe2023-06-051-0/+17
| |
| * kernel-install: introduce --entry-token= optionYu Watanabe2023-06-051-2/+13
| | | | | | | | For consistency with bootctl.
| * test-kernel-install: add tests for --make-entry-directory=Yu Watanabe2023-06-051-0/+72
| |
| * kernel-install: introduce --make-entry-directory= optionYu Watanabe2023-06-051-1/+21
| | | | | | | | | | For consistency with bootctl. However, unlike the same option for bootctl, defaults to 'auto' for backward compatibility.
| * kernel-install: add --esp-path= and --boot-path= optionsYu Watanabe2023-06-051-3/+27
| | | | | | | | Then, kernel-install takes one more step for compatibility with bootctl.
| * kernel-install: also parse KERNEL_INSTALL_LAYOUT from /etc/machine-infoYu Watanabe2023-06-051-3/+5
| | | | | | | | For consistency with bootctl.
| * kernel-install: make inspect command optionally take kernel imageYu Watanabe2023-06-052-3/+10
| | | | | | | | | | If the kernel image is provided, then we can inspect the kernel image and may determine the layout based on the kernel image type.
| * kernel-install: rewrite in CYu Watanabe2023-06-053-405/+1183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly a one-to-one translation of kernel-install.sh, except for the followings: - BOOT_ROOT is searched with find_{esp,xbootldr}_and_warn(). - entry token is searched with boot_entry_token_ensure(). - inspect command verboses more information, e.g. found plugins, environment variables explicitly passed to plugins, arguments passed to plugins. - paths specified in $KERNEL_INSTALL_PLUGINS must be absolute. - LC_COLLATE is set to C.UTF-8 (or any specified on build time). By writing kernel-install C, we can share the code used by bootctl or so, and can introduce --root and/or --image options later.
* | ukify: simplify creation of parserZbigniew Jędrzejewski-Szmek2023-06-061-5/+4
|/ | | | | 00e5933f57c6e336ebed18601299acc6855bb3c2 made all the positional arguments optional, so let's take advantage of this to simplify variuos callers.
* test/60-ukify: override stub location in testsZbigniew Jędrzejewski-Szmek2023-05-051-0/+2
| | | | Without this, build would fail if the stub is not available in /usr/lib/.
* test-kernel-install: test 60-ukify.install and 90-uki-copy.installZbigniew Jędrzejewski-Szmek2023-05-052-7/+33
| | | | | | We install a kernel with layout=uki and uki_generator=ukify, and test that a UKI gets installed in the expected place. The two plugins cooperate, so it's easiest to test them together.
* 60-ukify: kernel-install plugin that calls ukify to create a UKIZbigniew Jędrzejewski-Szmek2023-05-052-2/+234
| | | | | | | | | | | | | 60-ukify.install calls ukify with a config file, so singing and policies and splash will be done through the ukify config file, without 60-ukify.install knowing anything directly. In meson.py, the variable for loaderentry.install.in is used just once, let's drop it. (I guess this approach was copied from kernel_install_in, which is used in another file.) The general idea is based on cvlc12's #27119, but now in Python instead of bash.
* 90-loaderentry: make sure that variables are setZbigniew Jędrzejewski-Szmek2023-05-031-3/+3
| | | | | We unconditionally use the variables later on, so let's make sure that they were passed as expected.
* test-kernel-install: several cleanupsYu Watanabe2023-03-301-10/+15
| | | | | | | | - allow to run without $PROJECT_BUILD_ROOT, - drop unnecessary export for bootctl, - enable -x option to show commands, - use 'test ! -e' to check the nonexistence of files, - show more debugging logs.
* Define $KERNEL_INSTALL_UKI_GENERATORGertalitec2023-03-262-1/+7
| | | | Define $KERNEL_INSTALL_UKI_GENERATOR in case one wants it to be different from $KERNEL_INSTALL_INITRD_GENERATOR. This can be useful if one wants to use mkinitcpio / Dracut to generate the initrd, but without creating the UKI so this can be left for e.g. ukify or something else. Right now these initrd generators will read /etc/kernel/install.conf and generate the UKI
* kernel-install: check all entry candidates first, then check existence of ↵Yu Watanabe2023-03-171-8/+8
| | | | | | | | | | $pref/loader/entries only once If we have multiple entries in $ENTRY_TOKEN_SEARCH, and $pref/loader/entries exists, then previously we would always exit after the first candidate and ignore the second and later candidates. Follow-up for 1b43f868934e971480249a6e0fa2f45da906ea2e.
* Revert "kernel-install: also try to find $BOOT by partition GUID"Yu Watanabe2023-03-171-20/+0
| | | | | | | | | | | This reverts commit 41f39e2144c935868059e894c1a1e13803e3568f. From the post merge comment in #26648: > Hmm, this is highly problematic, no? if I boot from my ssd and then > plug in a fedora live usb stick, then there will be two ESPs around, > the one from my ssd and the one from the live usb one, and this code > might find the wrong one and bad things will happen
* Merge pull request #26119 from kraxel/uki.installLuca Boccassi2023-03-082-4/+12
|\ | | | | kernel-install: improve uki handling
| * kernel-install: handle uki installs automaticallyGerd Hoffmann2023-03-071-2/+10
| | | | | | | | | | | | | | | | | | | | Detect image type using "bootctl kernel-identify $kernel", store result in KERNEL_INSTALL_IMAGE_TYPE. Extend layout autodetection to check the kernel image type and pick layout=uki for UKIs. Resolves: #25822
| * 90-uki-copy.install: create $BOOT/EFI/Linux directory if neededGerd Hoffmann2023-03-071-2/+2
| | | | | | | | | | Do not consider a missing 'Linux' subdirectory an error. Just create it instead.
* | kernel-install: also try to find $BOOT by partition GUIDLuca Boccassi2023-03-031-0/+20
| | | | | | | | | | | | | | | | When there is nothing set up on /boot, /boot/efi or /efi, try to find the $BOOT partition checking for the XBOOTLDR or ESP partition GUIDs. Prefer XBOOTLDR as per BLS. Fixes https://github.com/systemd/systemd/issues/26644
* | kernel-install: use log_verbose everywhereLuca Boccassi2023-03-031-7/+4
|/
* boot: Make sure we take --root into account everywhere.Daan De Meyer2023-02-091-4/+7
|
* meson: Properly install 90-uki-copy.installJan Janssen2023-01-271-2/+5
|
* bootctl: unlink and cleanup functionsLudwig Nussel2023-01-192-1/+33
| | | | | | | | | | The unlink command removes an entry from the ESP including referenced files that are not referenced in other entries. That is useful eg to have multiple entries that use the same kernel with different options. The cleanup command removes all files that are not referenced by any entry.
* kernel-install: refactor some variablesLudwig Nussel2023-01-101-10/+12
| | | | In preparation for plugin support
* kernel-install: run depmod only if writeableLudwig Nussel2023-01-051-0/+2
|
* kernel-install: Add uki layoutJoerg Behrmann2022-11-292-0/+99
| | | | | | | | | | | | | | Currently the kernel-install man page only documents the bls layout for use with the boot loader spec type #1. 90-loaderentry.install uses this layout to generate loader entries and copy the kernel image and initrd to $BOOT. This commit documents a second layout "uki" and adds 90-uki-copy.install, which copies a UKI "uki.efi" from the staging area or any file with the .efi extension given on the command line to $BOOT/EFI/Linux/$ENTRY_TOKEN-$KERNEl_VERSION(+$TRIES).efi This allows for both locally generated and distro-provided UKIs to be handled by kernel-install.
* kernel-install: add header to generate entry filesZbigniew Jędrzejewski-Szmek2022-11-231-0/+2
| | | | | | | | | | | | | I was looking at a bug in bugzilla about some boot loader issue, and it was hard to say if the boot entry files were generated by our plugin or something else. Add a header to make this clear. kernel-install invokes the plugins via absolute path always, so $0 gives as the full path the location where the plugin is installed. This is what we want: title Fedora Linux 37 (Workstation Edition) # Boot Loader Specification type#1 entry # File created by /usr/lib/kernel/install.d/90-loaderentry.install (systemd 252-409-g5028904^)
* kernel-install: make 90-loadentry.install templatedZbigniew Jędrzejewski-Szmek2022-11-222-2/+10
| | | | | It's a bit annoying that this causes so much churn, but I don't see a different way to do this.
* Handle MACHINE_ID=uninitializedMarcus Schäfer2022-11-161-0/+1
| | | | | | | | | systemd supports /etc/machine-id to be set to: uninitialized In this case the expectation is that systemd creates a new machine ID and replaces the value 'uninitialized' with the effective machine id. In the scope of kernel-install we should also enforce the creation of a new machine id in this condition
* Fix reading /etc/machine-id in kernel-install (#25388)Marcus Schäfer2022-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | * Fix reading /etc/machine-id in kernel-install The kernel-install script has code to read the contents of /etc/machine-id into the MACHINE_ID variable. Depending on the variable content kernel-install either logs the value or creates a new machine id via 'systemd-id128 new'. In that logic there is one issue. If the file /etc/machine-id exists but is empty, the script tries to call read on an empty file which return with an exit code != 0. As the script code also uses 'set -e', kernel-install will exit at this point which is unexpected. The condition of an empty /etc/machine-id file exists for example when building OS images, which should initialize the system id on first boot but not staticly inside of the image. afaik an empty /etc/machine-id is also a common approach to make systemd indicate that it should create a new system id. Because of this, the commit makes sure the reading of /etc/machine-id does not fail in any case such that the handling of the MACHINE_ID variable takes place.
* kernel-install: skip 50-depmod if depmod is not availableLuca Boccassi2022-11-071-0/+1
| | | | | | | Images might be built without any kernel module, and without installing depmod as it is not needed. Skip it. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023607
* kernel-install/90-loaderentry: do not override an existing systemd.machine_idAntonio Alvarez Feijoo2022-11-071-1/+1
| | | | | If the systemd.machine_id command line option is already set, do not override it.
* kernel-install/90-loaderentry: do not add multiple systemd.machine_id optionsAntonio Alvarez Feijoo2022-11-041-1/+1
| | | | | | | Do not unconditionally add a new systemd.machine_id command line option, first check if it already exists with the expected value. Fixes #25203
* kernel-install: do not fail if a plugin exits with 77Yu Watanabe2022-09-281-5/+4
|
* kernel-install: do not fail if $layout is not "bls"Yu Watanabe2022-09-281-2/+2
| | | | Fixes #24836.
* kernel-install/90-loaderentry: fix chownнаб2022-09-211-2/+2
|
* tree-wide: fix typoYu Watanabe2022-07-201-1/+1
|
* kernel-install: add helper for loggingZbigniew Jędrzejewski-Szmek2022-07-141-36/+30
|