[marvell][platform] Checking file presence before access (#6208)

In marvell_et644m platform scripts, I have added a check to confirm the file availability before accessing it.

Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
This commit is contained in:
Sabareesh-Kumar-Anandan 2020-12-15 22:13:12 +05:30 committed by GitHub
parent 4257c792a2
commit 3cd70b88b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
import fcntl, struct
import time
from os import path
RNDADDENTROPY=0x40085203
@ -8,10 +9,11 @@ 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)
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)

View File

@ -10,6 +10,9 @@ inband_mgmt(){
# order.
# NOTE: In the nokia platform the following sequence is performed by the Nokia
# platform service init script and thus should not be performed here
if [ ! -f /host/machine.conf ]; then
exit 0
fi
grep ^onie_platform /host/machine.conf 2>/dev/null | grep nokia >/dev/null
if [ $? != 0 ]; then
rmmod i2c-dev