mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
rngd: Mix-in RDRAND and reload for HWRNGs added at runtime.
This commit is contained in:
@@ -51,6 +51,7 @@ lib/udev
|
||||
#lib/udev/rules.d/78-sound-card.rules
|
||||
#lib/udev/rules.d/80-drivers.rules
|
||||
#lib/udev/rules.d/80-net-name-slot.rules
|
||||
#lib/udev/rules.d/90-hwrng.rules
|
||||
#lib/udev/rules.d/95-udev-late.rules
|
||||
#lib/udev/rules.d/99-codel.rules
|
||||
#lib/udev/scsi_id
|
||||
|
||||
1
config/udev/90-hwrng.rules
Normal file
1
config/udev/90-hwrng.rules
Normal file
@@ -0,0 +1 @@
|
||||
ACTION=="add|remove", KERNEL=="hw_random", RUN+="/etc/rc.d/init.d/rngd udev-event"
|
||||
4
lfs/udev
4
lfs/udev
@@ -108,6 +108,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
install -v -m 644 $(DIR_SRC)/config/udev/25-alsa.rules \
|
||||
/lib/udev/rules.d
|
||||
|
||||
# Install hwrng rules.
|
||||
install -v -m 644 $(DIR_SRC)/config/udev/90-hwrng.rules \
|
||||
/lib/udev/rules.d
|
||||
|
||||
# Install codel rules.
|
||||
install -v -m 644 $(DIR_SRC)/config/udev/99-codel.rules \
|
||||
/lib/udev/rules.d
|
||||
|
||||
@@ -11,16 +11,24 @@
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
function has_rdrand() {
|
||||
grep -q "rdrand" /proc/cpuinfo
|
||||
}
|
||||
|
||||
function has_hwrng() {
|
||||
[ -e "/dev/hwrng" ]
|
||||
}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
if [ ! -e "/dev/hwrng" ]; then
|
||||
boot_mesg "No Hardware Random Number Generator found..." ${WARNING}
|
||||
if ! has_hwrng && ! has_rdrand; then
|
||||
boot_mesg "No Hardware Random Number Generator found..."
|
||||
echo_warning
|
||||
exit 0
|
||||
fi
|
||||
|
||||
boot_mesg "Starting Random Number Generator Daemon..."
|
||||
loadproc /usr/sbin/rngd
|
||||
loadproc /usr/sbin/rngd --no-tpm=1
|
||||
;;
|
||||
|
||||
stop)
|
||||
@@ -38,6 +46,10 @@ case "${1}" in
|
||||
statusproc /usr/sbin/rngd
|
||||
;;
|
||||
|
||||
udev-event)
|
||||
$0 restart &>/dev/null
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|restart|status}"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user