From: Eric Curtin Date: Mon, 17 Jul 2023 12:22:49 +0000 (+0100) Subject: android-boot: Remove dependency on ostree= karg, use androidboot.slot_suffix= X-Git-Tag: archive/raspbian/2023.7-3+rpi1~1^2~9^2^2~49^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a6f0a5713443b93c4060991ffa16d58d62c27fa9;p=ostree.git 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 --- diff --git a/src/switchroot/ostree-mount-util.h b/src/switchroot/ostree-mount-util.h index 180ab2e4..4404c232 100644 --- a/src/switchroot/ostree-mount-util.h +++ b/src/switchroot/ostree-mount-util.h @@ -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"); - - if (!ostree_cmdline) - return NULL; - - if (strcmp (ostree_cmdline, "aboot") == 0) - return get_aboot_root_slot (); + autofree char *slot_suffix = read_proc_cmdline_key ("androidboot.slot_suffix"); + if (slot_suffix) + return get_aboot_root_slot (slot_suffix); - return steal_pointer (&ostree_cmdline); + return read_proc_cmdline_key ("ostree"); } /* This is an API for other projects to determine whether or not the