674fac21c1
- Improve random number generation during early Sonic initialization by providing SW updates to Linux entropy value. - Improve handling of platform In-Band management port This commit provides the following updates to the Nokia ixs7215 platform 1. The Marvell Armada-38x SOC requires SW assistance to improve the system entropy value available early on in the Sonic boot sequence. 2. The Nokia ixs7215 platform does not have a dedicated Out-Of-Band (OOB) mgmt port and thus requires additional logic to optionally support configuring front panel port 48 as an In-Band mgmt port. This commit provides additional logic to manage and maintain the operation of this In-Band mgmt port.
20 lines
579 B
Python
20 lines
579 B
Python
#!/usr/bin/python
|
|
import fcntl, struct
|
|
import time
|
|
from os import path
|
|
|
|
RNDADDENTROPY=0x40085203
|
|
|
|
def avail():
|
|
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
|
|
return int(avail.read())
|
|
|
|
if path.exists("/proc/sys/kernel/random/entropy_avail"):
|
|
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)
|