Skip to content

Commit

Permalink
syslinux: Also check for extlinux.conf
Browse files Browse the repository at this point in the history
The NVidia Jetson NX comes with u-boot installed in syslinux compatible
mode.  It reads from `/boot/extlinux/extlinux.conf` to know what to boot.
In my setup I set `/boot/extlinux/extlinux.conf` to be a symlink pointing
at `../loader/syslinux.cfg` to take advantage of the ostree syslinux
support.

This commit improves compatibility by also checking for `extlinux.conf` in
addition to `syslinux.cfg` when trying to locate the existing
configuration.
  • Loading branch information
wmanley committed Jan 7, 2021
1 parent fd9d422 commit aa4aae4
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/libostree/ostree-bootloader-syslinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <string.h>

static const char syslinux_config_path[] = "boot/syslinux/syslinux.cfg";
static const char extlinux_config_path[] = "boot/extlinux/extlinux.conf";

struct _OstreeBootloaderSyslinux
{
Expand All @@ -51,6 +52,13 @@ _ostree_bootloader_syslinux_query (OstreeBootloader *bootloader,

if (!glnx_fstatat_allow_noent (self->sysroot->sysroot_fd, syslinux_config_path, &stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
if (errno == 0)
{
*out_is_active = TRUE;
return TRUE;
}
if (!glnx_fstatat_allow_noent (self->sysroot->sysroot_fd, extlinux_config_path, &stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
*out_is_active = (errno == 0);
return TRUE;
}
Expand Down Expand Up @@ -124,7 +132,19 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
glnx_file_get_contents_utf8_at (self->sysroot->sysroot_fd, syslinux_config_path, NULL,
cancellable, error);
if (!config_contents)
return FALSE;
{
if (errno != ENOENT)
return FALSE;
else
{
g_clear_error (error);
config_contents =
glnx_file_get_contents_utf8_at (self->sysroot->sysroot_fd, extlinux_config_path, NULL,
cancellable, error);
if (!config_contents)
return FALSE;
}
}

g_auto(GStrv) lines = g_strsplit (config_contents, "\n", -1);
g_autoptr(GPtrArray) new_lines = g_ptr_array_new_with_free_func (g_free);
Expand Down

0 comments on commit aa4aae4

Please sign in to comment.