
Hi Alex,
On 10/15/24 12:15 AM, Alex Shumsky wrote:
Increase rng-seed size to make Linux happy and initialize rng pool instantly. Linux 5.19+ requires 32 bytes of entropy to initialize random pool, but u-boot currently provides only 8 bytes. Linux 5.18 and probably some versions before it used to require 64 bytes. Bump min value to 64 bytes to be on a safe side.
Boot with 8 byte rng-seed (Linux 6.11): # dmesg | grep crng [ 12.089286] random: crng init done Boot with 32 byte rng-seed (Linux 6.11): # dmesg | grep crng [ 0.000000] random: crng init done
Linux source references: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/driv... https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/driv...
Signed-off-by: Alex Shumsky alexthreed@gmail.com Fixes: d2048bafae40 ("rockchip: board: Add board_rng_seed() for all Rockchip devices") Reviewed-by: Dragan Simic dsimic@manjaro.org
Changes in v4:
- fix typos and code style
Changes in v3:
- reword warning
- increase default rng_seed_size to support older linux as well
- reword commit message
Changes in v2:
add env config knob rng_seed_size
add warning for small rng_seed_size
12-character commit SHA in Fixes
arch/arm/mach-rockchip/board.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 3fadf7e412..ca6404776f 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -472,9 +472,18 @@ __weak int misc_init_r(void) __weak int board_rng_seed(struct abuf *buf) { struct udevice *dev;
- size_t len = 0x8;
- ulong len = env_get_ulong("rng_seed_size", 10, 64);
I'm wondering if we have somewhere some documentation on the environment variables that exist and what they used for because this would be a nice addition. At the very least, we can mention this variable in: - include/fdt_support.h for the function - common/Kconfig for the symbol
I'm also a bit torn on the base though, I think the assumed base is generally hex and not dec, so maybe we should rather have that?
Looking good otherwise :)
Cheers, Quentin