Skip to content

Commit a76d28f

Browse files
hongxu-jiaChenQi1989
authored andcommitted
u-boot: add 'bootdir' to the generated uEnv.txt
When doing a full copy of: $deployment/usr/lib/ostree-boot -> /boot/ostree/$os-$bootcsum/ U-Boot bootscript can use the 'bootdir' to find, for example, the Device Tree (dtb) file, as in: load ${dtype} ${disk}:${bootpart} ${a_fdt} ${bootdir}${dtbname} Or u-boot external bootscript: load ${dtype} ${disk}:${bootpart} ${a_scr} ${bootdir}${scriptname} It could also be possible to point 'bootdir' directly to the $deployment/usr/lib/ostree-boot, but this would add unnecessary restrictions on what file system can be used for rootfs as u-boot, for example, can not read from BTRFS. So having bootdir=/boot/ostree/$os-$bootcsum/ is a better approach here, as /boot can be on a separate partition with its own file system type. Signed-off-by: Gatis Paeglis <[email protected]> Signed-off-by: Hongxu Jia <[email protected]> Signed-off-by: Chen Qi <[email protected]>
1 parent 0ea7d2e commit a76d28f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libostree/ostree-bootloader-uboot.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, int bootver
114114
for (int i = 0; i < boot_loader_configs->len; i++)
115115
{
116116
g_autofree char *index_suffix = NULL;
117+
g_autofree char *bootdir = NULL;
117118
if (i == 0)
118119
index_suffix = g_strdup ("");
119120
else
@@ -129,6 +130,9 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, int bootver
129130
}
130131
g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image%s=/boot%s", index_suffix, val));
131132

133+
bootdir = strndup (val, strrchr(val, '/') - val);
134+
g_ptr_array_add (new_lines, g_strdup_printf ("bootdir%s=%s/", index_suffix, bootdir));
135+
132136
val = ostree_bootconfig_parser_get (config, "initrd");
133137
if (val)
134138
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image%s=/boot%s", index_suffix, val));

0 commit comments

Comments
 (0)