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

u-boot: add 'bootdir' to the generated uEnv.txt #3271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions src/libostree/ostree-bootloader-uboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, int bootver
for (int i = 0; i < boot_loader_configs->len; i++)
{
g_autofree char *index_suffix = NULL;
g_autofree char *bootdir = NULL;
if (i == 0)
index_suffix = g_strdup ("");
else
Expand All @@ -129,6 +130,9 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, int bootver
}
g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image%s=/boot%s", index_suffix, val));

bootdir = strndup (val, strrchr(val, '/') - val);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this effectively dirname()? We do this across the codebase:

          g_autofree char *tmpbuf = g_strdup (dir_or_file_path);
          const char *dir = dirname (tmpbuf);

g_ptr_array_add (new_lines, g_strdup_printf ("bootdir%s=%s/", index_suffix, bootdir));

val = ostree_bootconfig_parser_get (config, "initrd");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image%s=/boot%s", index_suffix, val));
Expand Down
Loading