summaryrefslogtreecommitdiff
path: root/src/shared/bootspec.h
Commit message (Collapse)AuthorAgeFilesLines
* bootctl: show report state and type in json outputLudwig Nussel2023-04-071-0/+1
|
* boot: remove random-seed-modeJason A. Donenfeld2022-11-221-1/+0
| | | | | | | | Now that the random seed is used on virtualized systems, there's no point in having a random-seed-mode toggle switch. Let's just always require it now, with the existing logic already being there to allow not having it if EFI itself has an RNG. In other words, the logic for this can now be automatic.
* bootspec: properly parse tries done/tries left from bootspec file namesLennart Poettering2022-09-021-0/+11
| | | | | | | This has been a long-time omission in the userspace parser of bootspec files. Correct that. Fixes: #16457
* bootctl: add --root and --imageLuca Boccassi2022-07-081-1/+1
| | | | Operate on image/directory, and also take files to install from it
* shared/bootspec: also export boot_config_load_type1()Zbigniew Jędrzejewski-Szmek2022-05-081-0/+7
| | | | | | The reallocation of memory and counter incrementation is moved from the only caller to the function. This way the callers can remain oblivious of the BootConfig internals.
* shared/bootspec: expose more parts of the config parsingZbigniew Jędrzejewski-Szmek2022-05-081-0/+3
|
* Move printing of boot entries from bootctl.c to shared/Zbigniew Jędrzejewski-Szmek2022-05-081-0/+12
| | | | | I want to use this for fuzzing, but also later to return jsonified list of entries from logind.
* shared/bootspec: add one more assertZbigniew Jędrzejewski-Szmek2022-05-081-1/+1
| | | | | All callers assume that boot_entry_title() always returns something. It will, as long as it's not called on an uninitialized entry.
* bootctl: unify boot entry loading for "status" and "list"Zbigniew Jędrzejewski-Szmek2022-04-041-1/+1
| | | | | | | | | | | We must be consistent in the two listings, so let's split out the loading code and call it from both verb_status() and verb_list(). This effectively makes verb_status() also call efi_loader_get_entries(). There is still some code duplicated, but that's hard to avoid. Error messages are made identical for the same errors in various places. Fixes #22580.
* bootspec: normalize function names/parameter listsLennart Poettering2022-03-281-3/+3
| | | | | | | | | | | | | This normalizes naming of functions operating on BootConfig objects. Let's always call them boot_config_xyz(), like our usual way to name stuff. moreover, move the BootConfig parameter to the beginning, as it's not a return value (which we typically move to the end of the parameter list), but simply an object, that even happens to be initialized already. With these changes the functions are more like our usual way to call things, and less surprises are good.
* bootspec: don't needlessly inline boot_config_find_entry()Lennart Poettering2022-03-281-11/+1
| | | | | | the function contains a loop and if expressions and whatnot. Let's define it as regular function, to make the header easier to read and let the compiler more freedom on whether to inline this or not.
* bootctl: use boot_config_default_entry() where appropriateLennart Poettering2022-03-281-0/+3
|
* bootspec: assess default/selected entries *after* we augmented entry list ↵Lennart Poettering2022-03-281-0/+8
| | | | | | with entries from loader Fixes: #22580
* bootspec: try harder to suppress duplicate enumerated entriesLennart Poettering2022-03-281-0/+3
| | | | | | | | | | | | | For testing purposes I run one of my system symlinking /boot/loader/ to /efi/loader/. This triggers annoying behaviour in boot entry enumeration: the code ends up iterating through the 'entries' subdir of both, thinking one was actually in the ESP and the other in XBOOTLDR, and thus distinct. This would result in duplicate entries. Let's address that, and filter out duplicates via their inode numbers: never process the same inode twice. This should protect us from any confusion effectively, regardless which inodes are symlinked (or even bind mounted).
* Merge pull request #22519 from poettering/boot-order-title-revertZbigniew Jędrzejewski-Szmek2022-03-181-0/+1
|\ | | | | sd-boot: rework boot entry sorting
| * sd-boot: make use of new "sort-key" boot loader spec fieldLennart Poettering2022-03-181-0/+1
| |
* | shared: split out ESP/XBOOTLDR search stuff from bootspec.cLennart Poettering2022-03-181-5/+1
|/ | | | | | | | The code is quite different from the rest of bootspec.c, with different deps and stuff. There's even a /***/ line to separate the two parts. Given how large the file already is, let#s just split it into two. No code changes, just some splitting out.
* boot: suppress XBOOTLDR if same device as ESP when enumerating entriesLennart Poettering2022-02-141-2/+2
| | | | | | | | | | On my local system I linked up the ESP and XBOOTLDR partitions, and ended up with duplicate entries being listed. Try hard to detect that and only enumerate entries in the ESP if it turns out that both dirs have the same dev_t. This should detect both bind mounted and symlinked cases and should make our list output less confusing.
* bootctl: show more information about boot entry state in listLennart Poettering2022-02-141-14/+19
| | | | | | | | | | | | | | | | Let's improve display of boot entries and show what type they have (i.e. boot loader spec type 1, or type 2, or auto-discovered or reported by boot loader), and in particular mark entries the boot loader discovered but we can't find (i.e. that likely vanished, or possibly couldn't be found due to a misconfiguration) and that the boot loader didn't find but we see (which are new, or possibly also the result of misconfiguraiton). This is supposed to be a replacement for #22161, but instead of hiding vanished entries, highlights them, which I think is more appropriate for a low-level tool such bootctl. Replaces: #22161 #22398
* bootspec: also collect/mark the "selected" boot entry (i.e. the one ↵Lennart Poettering2022-02-141-0/+2
| | | | | | currently booted) it's helpful and easy, so let's do it
* bootspec: also parse new 'beep' loader.conf variableLennart Poettering2022-02-141-0/+1
|
* bootspec: parse/show devicetree-overlay field tooLennart Poettering2022-02-141-0/+1
| | | | | It has been defined in the boot loader spec, and is the only field we currently don't parse, hence fix that.
* Revert "bootctl: Ignore boot entries (continue #22041)"Lennart Poettering2022-02-141-1/+1
|
* bootctl: removed unused parameter only_autoGoffredo Baroncelli2022-01-181-1/+1
| | | | | | | | Remove the parameter 'only_auto' from the function boot_entries_augment_from_loader() because each caller set it always to true. Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
* bootspec: fix comment that says exactly the opposite of what is trueLennart Poettering2021-11-111-1/+1
|
* tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* efi: cache LoaderEntries EFI variableLennart Poettering2020-05-291-7/+1
| | | | | | Based-on: https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
* bootspec: parse random-seed-mode line in loader.confYu Watanabe2020-01-261-0/+1
| | | | Fixes #14657.
* boot: Deduplicate old-style loader entries.Spencer Michaels2019-11-211-2/+6
| | | | | | | | | | | In cases where systemd (and thus bootctl) is updated to a version including the earlier unique-ID fix, but the corresponding new version of systemd-boot is not installed to the ESP and run at least once, the bootloader will report old-style entry IDs cached in the LoaderEntries EFI variable, while bootctl will report new-style IDs for the same entries, producing duplicate entries. This commit makes bootctl compute and retain old-style IDs for non-auto entries so that it can properly deduplicate entries even if the cache contains old-style IDs.
* bootspec: fix build when EFI support is disabledYu Watanabe2019-04-171-0/+6
| | | | Follow-up for ce4c4f810876b2d6e50041c8bbe089e8a9e2576e.
* bootspec: remove now-unused boot_entry_type_tableZbigniew Jędrzejewski-Szmek2019-04-051-3/+0
|
* bootspec: get rid of find_default_boot_entry() entirelyLennart Poettering2019-03-051-2/+7
| | | | | | Now only two operations are left. Let's just move this into the caller, since it should make things simpler, clearer and shorter, in particular as there's only a single user for this.
* bootspec: introduce new helper boot_entries_load_config_auto()Lennart Poettering2019-03-051-0/+1
| | | | | | | | It's a simple wrapper around boot_entries_load_config(), but determines the ESP/XBOOTLDR paths automatically at first. Also, it looks for a path /run/boot-loader-entries/ and loads the entries from there if it exists. This is supposed to be a hook for other boot loaders to make our tools aware of their own entries.
* bootspec: move augmentation of loader-discovered entries into bootspec.cLennart Poettering2019-03-051-0/+25
| | | | | | | | | Previously, bootctl would show boot loader entries discovered by the boot loader which couldn't found locally separately in the output. Let's move this code into bootspec.c, and beef it up a bit. This way we can use it later on for logind, and correctly show automatically discovered windows/macos entries too.
* bootspec: simplify find_default_boot_entry()Lennart Poettering2019-03-051-1/+1
| | | | | If the only caller passes NULL for the two paths, let's remove the parameter altogether.
* bootspec: load entries from both the ESP and XBOOTLDR partitionsLennart Poettering2019-03-011-2/+2
| | | | Let's simply search in both.
* bootspec: store 'root' field in each bootspec entry we loadLennart Poettering2019-03-011-2/+3
| | | | | | | | | | This 'root' field contains the root path of the partition we found the snippet in. The 'kernel', 'initrd', 'efi', … fields are relative to this path. This becomes particularly useful later when we add support for loading snippets from both the ESP and XBOOTLDR, but already simplifies the code for us a bit in systemctl.
* bootspec: add internal APIs to discover the XBOOTLDR partitionLennart Poettering2019-03-011-0/+1
|
* bootspec: reduce number of functions we exportLennart Poettering2018-10-081-5/+0
| | | | Let's internalize these four calls as noone else calls them.
* shared/bootspec: remember the full path to boot entry and use it in loggingZbigniew Jędrzejewski-Szmek2018-10-081-1/+2
| | | | | It's much easier to understand what is going on when the full path is logged.
* Move logic to find default sd-boot entry from systemctl to sharedZbigniew Jędrzejewski-Szmek2018-10-081-0/+2
| | | | In preparation for use in other places. No functional change.
* bootspec: rename "filename" field to "id"Lennart Poettering2018-09-271-3/+2
| | | | | | | This follows the renaming done a few commits earlier too systemd-boot itself. Also, let's show the ID, since it's useful.
* bootspec: fix include linesLennart Poettering2018-09-271-1/+5
| | | | List all files we use definitions from.
* Fix SPDX license tagsZbigniew Jędrzejewski-Szmek2018-06-141-1/+1
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-3/+1
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Merge pull request #8086 from hdante/sdboot-setmode-v2Zbigniew Jędrzejewski-Szmek2018-03-071-0/+1
|\