summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-bootloader-grub2.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-021-71/+75
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* Add configure option for unsuffixed GRUB2 commandsKenneth J. Miller2021-03-181-13/+14
| | | | | | | | | | | | | | GRUB starting with version 2.02 permits the use of the linux and initrd commands for both EFI boot in *-efi installations, as well as 32-bit BIOS boot in i386-pc installations. This makes the use of the -16 and -efi suffixes for BIOS and EFI boot obsolete on systems with a modern GRUB installation. The --with-modern-grub configure flag makes ostree use the unsuffixed linux/initrd commands when generating a GRUB configuration, while defaulting to the previous behaviour for users not wanted this option.
* grub2: Generate config from pending deploymentRobert Fairley2019-04-241-6/+5
| | | | | | | | | | | Generate a grub2 config using the pending deployment, if a grub2 bootloader is detected in the sysroot. Allows grub2-mkconfig to run if there are no previous deployments. Fixes: #1774 Closes: #1831 Approved by: jlebon
* grub2: add support for devicetreeRicardo Salveti2018-12-211-0/+10
| | | | | | | | | | | | | | Similar as available for u-boot (ce2995e1dc1557c4d97ef5af807eacf3ef4a22d8) and syslinux (c5112c25e4519835c4cd53f4350c1b2f2a477746), enable parsing and writing devicetree filename into grub.cfg. This is required by arm64-based devices running edk2 instead of u-boot as the main bootloader (e.g. 96boards HiKey and HiKey960). Signed-off-by: Ricardo Salveti <ricardo@foundries.io> Closes: #1790 Approved by: cgwalters
* lib/grub2: Support Debian-style grub.cfg pathFelix Krull2018-09-041-6/+12
| | | | | | | | | | Debian and Debian-derived systems have their GRUB configuration file in /boot/grub/grub.cfg, rather than /boot/grub2/grub.cfg. Detecting this file is necessary to correctly generate GRUB boot configuration on Debian systems. Closes: #1714 Approved by: cgwalters
* tree-wide: Update to new libglnx fd APIsColin Walters2017-10-111-1/+1
| | | | | | | | | | | | | | | | | | | This ends up a lot better IMO. This commit is *mostly* just `s/glnx_close_fd/glnx_autofd`, but there's also a number of hunks like: ``` - if (self->sysroot_fd != -1) - { - (void) close (self->sysroot_fd); - self->sysroot_fd = -1; - } + glnx_close_fd (&self->sysroot_fd); ``` Update submodule: libglnx Closes: #1259 Approved by: jlebon
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* lib/grub2: Port some to new code styleColin Walters2017-09-081-70/+57
| | | | | | | | | I resisted trying to do anything invasive here like fd-relative porting as our coverage is weak. But this was all straightforward porting to decl-after-stmt style. Closes: #1153 Approved by: jlebon
* grub2: Handle aarch64 (at least on Fedora/RHEL)Colin Walters2017-07-271-18/+20
| | | | | | | | | | See: https://github.com/projectatomic/rpm-ostree-toolbox/issues/102#issuecomment-316483554 The logic here should now match what grubby does. I have no idea whether this applies to other distributions though. Closes: #1021 Approved by: jlebon
* Update libglnx, port some uses to newer APIsColin Walters2017-07-241-7/+5
| | | | | | | | | | Mostly for the latest `-Wmaybe-uninitialized` fix, but while here also port some places to newer APIs. Update submodule: libglnx Closes: #1027 Approved by: jlebon
* tree-wide: Convert to using autoptr(GString) vs g_string_free(...,TRUE)Colin Walters2017-05-051-3/+1
| | | | | | | | | | | If we're freeing the segment, it's basically always better to use `autoptr()`. Fewer lines, more reliable, etc. Noticed an instance of this in the pull code while reviewing a different PR, decided to do a grep for it and fix it tree wide. Closes: #836 Approved by: pwithnall
* Define TARGET_PREFIX to use with grub2 deploymentAnton Gerasimov2017-03-271-1/+1
| | | | | Closes: #760 Approved by: cgwalters
* grub2: Use "linux16" only on x86/x86_64Colin Walters2017-03-031-2/+28
| | | | | | | | Got a report that a Fedora Atomic Host built for ppc64le didn't work with the `linux16`, it needed `linux`. See the comments for more links. Closes: #716 Approved by: vathpela
* grub2: Use g_spawn_sync() rather than GSubprocess to avoid SIGCHLDColin Walters2017-02-271-27/+37
| | | | | | | | | | | Due to the async nature of `GSubprocess` it grabs `SIGCHLD` which affects other software which might be using libostree, such as QtOTA. Closes: https://github.com/ostreedev/ostree/issues/696 Closes: #702 Approved by: jlebon
* tree-wide: Remove unused variables detected by CLangColin Walters2016-10-271-3/+0
| | | | | | | | | | CLang finds these, whereas GCC treats having `__attribute__((cleanup))` as a use. This obsoletes https://github.com/ostreedev/ostree/pull/411 Closes: #548 Approved by: jlebon
* Move ostree-* executables to /usr/lib/ostreeGatis Paeglis2016-08-111-1/+1
| | | | | | | | | | | | | | | | | Why not to use libexecdir? Because this directory does not exist on some distros or paths between distros varies. There are several reasons why a well known path is prefered, for example when generating a kernel command line: init=${ostree}/usr/lib/ostree-boot/ostree-prepare-root In addition this saves us some typing in a console when wanting to access the "ostree" cmd line. Closes: #449 Approved by: cgwalters
* grub2: Port away from gs_file_sync_data()Colin Walters2016-08-031-2/+12
| | | | | | | | Inlining this is uglier, but this code kind of sucks anyways =( We're going to need to do some fd-relative porting in here at some point. Closes: #424 Approved by: giuseppe
* lib: Port away from gs_file_rename()Colin Walters2016-08-031-3/+5
| | | | | | | | | In one case, we already had relative fds and hence this was nicer. Unfortunately the other areas got uglier. More fd-relative porting to do later. Closes: #424 Approved by: giuseppe
* lib: Use g_file_enumerator_iterate() if available, with fallbackColin Walters2016-06-211-2/+2
| | | | | | | | | | | | Import `gs_file_enumerator_iterate()` for the next six months or so...after RHEL 7.3 is released I'm strongly considering hard requiring 2.46 or so. Likely at some point we should figure out how to share more "glib backport" code with NetworkManager at least. Closes: #341 Approved by: jlebon
* Introducing ostree-grub-generatorGatis Paeglis2016-04-041-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ostree-grub-generator can be used to customize the generated grub.cfg file. Compile time decision ostree-grub-generator vs grub2-mkconfig can be overwritten with the OSTREE_GRUB2_EXEC envvar - useful for auto tests and OS installers. Why this alternative approach: 1) The current approach is less flexible than using a custom 'ostree-grub-generator' script. Each system can adjust this script for its needs, instead of using the hardcoded values from ostree-bootloader-grub2.c. 2) Too much overhead on embedded to generate grub.cfg via /etc/grub.d/ configuration files. It is still possible to do so, even with this patch applied. No need to install grub2 package on a target device. 3) The grub2-mkconfig code path has other issues: https://bugzilla.gnome.org/show_bug.cgi?id=761180 Task: https://bugzilla.gnome.org/show_bug.cgi?id=762220 Closes: #228 Approved by: cgwalters
* Use GSubprocess instead of GSSubprocess (libgsystem removal)Colin Walters2016-03-231-24/+18
| | | | | | Since we hard-depend on GLib 2.40, we can start using GSubprocess. This is part of dropping our dependency on libgsystem, which is deprecated in favor of libglnx (as well as migrating things to GLib).
* grub2: Don't delete grub2.cfg.old file we just copiedColin Walters2016-01-271-2/+0
| | | | | | | | | | | | The original intention here was that we'd keey around a copy of the file so that grub2 could eventually learn how to do atomic updates by checking for a "fully written" marker in the *new* file, and if it didn't exist, falling back to grub2.cfg.old. I haven't yet proposed that upstream, but we might as well stop deleting the file since it's useful as a backup at least. Reported-by: Gatis Paeglis
* Remove unnecessary #include "libgsystem.h"Matthew Barnes2015-05-061-1/+0
|
* Use g_auto(GStrv) instead of gs_strfreevMatthew Barnes2015-05-061-1/+1
|
* Use g_autoptr(GPtrArray) instead of gs_unref_ptrarrayMatthew Barnes2015-05-061-2/+2
|
* Use glnx_unref_object instead of gs_unref_objectMatthew Barnes2015-05-061-2/+2
| | | | | For non-GIO object types, at least until autocleanup support for GObject based types becomes more widespread.
* Use g_autoptr() for GIO object typesMatthew Barnes2015-05-061-10/+10
| | | | | GLib 2.44 supplies all the necessary autocleanup macros for GIO types, and libglnx backports the relevant macros for ostree.
* Use g_autofree instead of gs_freeMatthew Barnes2015-05-061-3/+3
|
* trivial: Fix typo in previous commitColin Walters2014-11-251-1/+1
|
* grub2: If using --sysroot, run in chrootColin Walters2014-11-251-0/+75
| | | | | | | | | | | | | | In Anaconda, we're using "ostree admin --sysroot=/mnt/sysimage instutil set-kargs", and it was working before, but newer versions of lorax strip out /etc/system-release which grub2 wants. That was wrong anyways as we want the /etc/system-release from the target root. (Man, grub2 sucks...give me a declarative config file format I can just write) https://bugzilla.gnome.org/show_bug.cgi?id=740697
* grub2: Fix bad substitution in review followupColin Walters2014-10-271-1/+1
| | | | This caused GRUB2+EFI installations to fail.
* Add (non-atomic) support for GRUB2 + UEFIColin Walters2014-10-231-9/+131
| | | | | | | | | | | | | | | | | | | We need basic support for UEFI - many newer servers don't support BIOS compatibility mode anymore. However, this patch only implements non-atomic because UEFI is FAT, and we can't do the previous design for OSTree of atomic swap of /boot/loader. The Fedora/RHEL UEFI layout has the kernels on a "real" /boot partition, and /boot/efi/EFI/$vendor just holds the grub2 UEFI binary and grub.cfg. Following this, /boot/loader is still on the OS boot partition, and we still atomically swap it. This potentially paves the way to atomic upgrades in the future. https://bugzilla.gnome.org/show_bug.cgi?id=724246
* libostree: Add initial GRUB2 supportColin Walters2014-10-161-0/+261
In this approach, we drop a /etc/grub.d/15_ostree file which is a hybrid of shell/C that picks up bits from the GRUB2 library (e.g. the block device script generation), and then calls into libostree's GRUB2 code which knows about the BLS entries. This is admittedly ugly. There exists another approach for GRUB2 to learn the BLS specification. However, the spec has a few issues: https://www.redhat.com/archives/anaconda-devel-list/2014-July/msg00002.html This approach also gives a bit more control to the admin via the naming of the 15_ostree symlink; they can easily disable it: Or reorder the ostree entries ahead of 10_linux: Also, this approach doesn't require patches for grub2, which is an issue with the pressure to backport (rpm-)OSTree to EL7.