[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:
parent
4257c792a2
commit
3cd70b88b7
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user