summaryrefslogtreecommitdiff
path: root/common/machine_id.c
Commit message (Collapse)AuthorAgeFilesLines
* common: machine_id: guard against digest algo being unavailableAhmad Fatoum2022-08-091-0/+5
| | | | | | | | | | All callsites of digest_alloc(_by_algo) check for NULL pointer before proceeding except for machine_id_set_globalvar(). Fix this to fail more gracefully instead of the crash I ran into. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220808062010.390394-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: machine_id: simplify early exitAhmad Fatoum2022-08-091-4/+2
| | | | | | | | | | | | | | | | | We don't need the goto if we haven't done anything to clean up anyway. also globalvar_add_simple("machine_id", NULL) is a no-op when we have just called globalvar_add_simple above with an actual argument. It doesn't clean the parameter, nor should it, because the code is executed for the successful code as well and there is nothing that can fail that late. This slightly alters behavior: Whereas before $global.machine_id was always defined when CONFIG_MACHINE_ID is enabled, it's now only defined when it's non-empty. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220808062010.390394-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: adapt help text and naming for bootm.provide_machine_idAhmad Fatoum2020-11-231-2/+2
| | | | | | | | | | | | | The Kconfig help text as well the function name machine_id_set_bootarg() suggest that enabling the Kconfig option is sufficient to have barebox pass the machine id to the kernel. This is not the case, so change the naming/documentation to make this clearer. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Reviewed-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* magicvar: Replace BAREBOX_MAGICVAR_NAMED with BAREBOX_MAGICVARSascha Hauer2020-10-021-1/+1
| | | | | | | | BAREBOX_MAGICVAR now generates a unique identifier automatically, so we can convert users of BAREBOX_MAGICVAR_NAMED to the simpler BAREBOX_MAGICVAR macro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: machine_id: introduce machine id generationBastian Krause2019-09-301-0/+69
This patch adds functionality to pass device-specific information that will be hashed to generate a persistent unique machine id. It is then available as global.machine_id. It can be overwritten with nv.machine_id if necessary. Passing the machine id to the kernel is done in a separate patch. Note: if multiple sources provide hashable device-specific information (via machine_id_set_hashable()) the information provided by the last call prior to the late initcall set_machine_id() is used to generate the machine id from. Thus when updating barebox the machine id might change. Signed-off-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>