sonic-buildimage/platform/marvell-armhf/sonic-platform-et6448m/entropy.py
Sabareesh-Kumar-Anandan fe524c37e7
[platform][marvell] Arm 32-bit Arch support changes (#5749)
- Added Arm 32-bit arch build fixes
- Added marvell armhf platform specific changes

Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
2020-12-03 12:38:50 -08:00

18 lines
474 B
Python

#!/usr/bin/python
import fcntl, struct
import time
RNDADDENTROPY=0x40085203
def avail():
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
return int(avail.read())
while 1:
while avail() < 2048:
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
d = urnd.read(512)
t = struct.pack('ii', 4 * len(d), len(d)) + d
fcntl.ioctl(rnd, RNDADDENTROPY, t)
time.sleep(30)