1
0
mirror of https://github.com/ostreedev/ostree.git synced 2025-03-11 20:58:45 +03:00

android-boot: Remove dependency on ostree= karg, use androidboot.slot_suffix=

Given the kernel argument androidboot.slot_suffix= is required in
Android AB updates [1] there is no need to check for ostree= or ostree=aboot
at all in the aboot case. This also ensures if the dependancy on ostree=
is removed, the android-boot technique will work regardless.

[1]: https://source.android.com/docs/core/ota/ab/ab_implement
This commit is contained in:
Eric Curtin 2023-07-17 13:22:49 +01:00
parent 27a9fe30b3
commit a6f0a57134

@ -134,12 +134,8 @@ read_proc_cmdline_key (const char *key)
}
static inline char *
get_aboot_root_slot (void)
get_aboot_root_slot (const char *slot_suffix)
{
autofree char *slot_suffix = read_proc_cmdline_key ("androidboot.slot_suffix");
if (!slot_suffix)
errx (EXIT_FAILURE, "Missing androidboot.slot_suffix");
if (strcmp (slot_suffix, "_a") == 0)
return strdup ("/ostree/root.a");
else if (strcmp (slot_suffix, "_b") == 0)
@ -153,15 +149,11 @@ get_aboot_root_slot (void)
static inline char *
get_ostree_target (void)
{
autofree char *ostree_cmdline = read_proc_cmdline_key ("ostree");
autofree char *slot_suffix = read_proc_cmdline_key ("androidboot.slot_suffix");
if (slot_suffix)
return get_aboot_root_slot (slot_suffix);
if (!ostree_cmdline)
return NULL;
if (strcmp (ostree_cmdline, "aboot") == 0)
return get_aboot_root_slot ();
return steal_pointer (&ostree_cmdline);
return read_proc_cmdline_key ("ostree");
}
/* This is an API for other projects to determine whether or not the