From 0f0eeb46389a976d4150ff6027c28cbc4da7d784 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 11 Apr 2019 11:39:38 +0200 Subject: [rfs-stage31] Add hotplug handler for loading kernel modules This will only handle PCI devices for now, everything else should not be required for stage31. --- core/rootfs/rootfs-stage31/data/etc/modules | 66 ---------------------------- core/rootfs/rootfs-stage31/data/init | 4 ++ core/rootfs/rootfs-stage31/data/sbin/hotplug | 15 +++++++ 3 files changed, 19 insertions(+), 66 deletions(-) create mode 100755 core/rootfs/rootfs-stage31/data/sbin/hotplug diff --git a/core/rootfs/rootfs-stage31/data/etc/modules b/core/rootfs/rootfs-stage31/data/etc/modules index e728c600..4b8c2482 100644 --- a/core/rootfs/rootfs-stage31/data/etc/modules +++ b/core/rootfs/rootfs-stage31/data/etc/modules @@ -1,68 +1,2 @@ -8139cp -8139too -acenic -adp8860_bl -adp8870_bl -atl1 -atl1c -atl1e -atl2 -atp -b44 -bna -bnx2 -bnx2x -cnic -cxgb -cxgb3 -cxgb4 -cxgb4vf -de2104x -dl2k -dmfe -dnet -e100 -e1000 -e1000e -forcedeth -hid-generic -hp100 -igb -igbvf -ipg -ixgb -ixgbe -ixgbevf -jme -ksz884x -myri10ge -nbd -ne2k-pci parport -pcnet32 -qla3xxx -qlge -r6040 -r8169 -s2io -sc92031 -sfc -sis190 -sis900 -skge -sky2 -smsc9420 squashfs -sunhme -tg3 -tlan -tulip -typhoon -uli526x -usbhid -via-rhine -via-velocity -vmxnet3 -vxge -xfs -xircom_cb diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init index 90c469f8..ee33c247 100755 --- a/core/rootfs/rootfs-stage31/data/init +++ b/core/rootfs/rootfs-stage31/data/init @@ -25,8 +25,12 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin # mount the important standard directories mkdir -p /tmp /proc /sys /dev /run [ ! -f /proc/cpuinfo ] && busybox mount -n -t proc proc /proc +echo "/sbin/hotplug" > "/proc/sys/kernel/hotplug" bench_event "KERNEL" "Kernel initialized" [ ! -d /sys/class ] && busybox mount -n -t sysfs sysfs /sys +for id in $( cat /sys/devices/pci*/*/modalias ); do + ACTION=add MODALIAS=$id /sbin/hotplug +done & # NOTE: busybox mount is only available through the busybox binary, # the link had to be dropped, to prevent bugs in the stage32. diff --git a/core/rootfs/rootfs-stage31/data/sbin/hotplug b/core/rootfs/rootfs-stage31/data/sbin/hotplug new file mode 100755 index 00000000..f2bda19b --- /dev/null +++ b/core/rootfs/rootfs-stage31/data/sbin/hotplug @@ -0,0 +1,15 @@ +#!/bin/ash + +[ "$ACTION" != "add" ] && exit 0 + +[ -z "$MODALIAS" ] && exit 0 + +[ "${MODALIAS:0:5}" != "pci:v" ] && exit 0 # Ignore everything but PCI devices + +ID="${MODALIAS:9:4}:${MODALIAS:18:4}" + +LINE="$( lspci -n | grep -oEi "[0-9]{4}: $ID" | cut -c1-2 )" +[ "$LINE" = "03" ] && exit 0 # Skip GFX, handled by other module + +modprobe "$MODALIAS" + -- cgit v1.2.3-55-g7522