[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
|
#!/usr/bin/python
|
||||||
import fcntl, struct
|
import fcntl, struct
|
||||||
import time
|
import time
|
||||||
|
from os import path
|
||||||
|
|
||||||
RNDADDENTROPY=0x40085203
|
RNDADDENTROPY=0x40085203
|
||||||
|
|
||||||
@ -8,7 +9,8 @@ def avail():
|
|||||||
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
|
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
|
||||||
return int(avail.read())
|
return int(avail.read())
|
||||||
|
|
||||||
while 1:
|
if path.exists("/proc/sys/kernel/random/entropy_avail"):
|
||||||
|
while 1:
|
||||||
while avail() < 2048:
|
while avail() < 2048:
|
||||||
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
|
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
|
||||||
d = urnd.read(512)
|
d = urnd.read(512)
|
||||||
|
@ -10,6 +10,9 @@ inband_mgmt(){
|
|||||||
# order.
|
# order.
|
||||||
# NOTE: In the nokia platform the following sequence is performed by the Nokia
|
# NOTE: In the nokia platform the following sequence is performed by the Nokia
|
||||||
# platform service init script and thus should not be performed here
|
# 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
|
grep ^onie_platform /host/machine.conf 2>/dev/null | grep nokia >/dev/null
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
rmmod i2c-dev
|
rmmod i2c-dev
|
||||||
|
Reference in New Issue
Block a user