Add fdt_kaslrseed function to add kaslr-seed to chosen node
If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to randomize the virtual address at which the kernel image is loaded, it expects entropy to be provided by the bootloader by populating /chosen/kaslr-seed with a 64-bit value from source of entropy at boot. Add a fdt_kaslrseed function to accommodate this allowing an existing node to be overwritten if present. For now use the first rng device but it would be good to enhance this in the future to allow some sort of selection or policy in choosing the rng device used. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Michal Simek <michal.simek@amd.com> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: Akash Gajjar <gajjar04akash@gmail.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Devarsh Thakkar <devarsht@ti.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chris Morgan <macromorgan@hotmail.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
This commit is contained in:
@@ -463,4 +463,14 @@ void fdt_fixup_board_enet(void *blob);
|
||||
#ifdef CONFIG_CMD_PSTORE
|
||||
void fdt_fixup_pstore(void *blob);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* fdt_kaslrseed() - create a 'kaslr-seed' node in chosen
|
||||
*
|
||||
* @blob: fdt blob
|
||||
* @overwrite: do not overwrite existing non-zero node unless true
|
||||
* Return: 0 if OK, -ve on error
|
||||
*/
|
||||
int fdt_kaslrseed(void *blob, bool overwrite);
|
||||
|
||||
#endif /* ifndef __FDT_SUPPORT_H */
|
||||
|
Reference in New Issue
Block a user