diff options
-rw-r--r-- | boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm | 4 | ||||
-rwxr-xr-x | boot-env/pbs/uclib-rootfs/bin/bbinit | 19 | ||||
-rwxr-xr-x | boot-env/pbs/uclib-rootfs/bin/handleEvents | 38 | ||||
-rwxr-xr-x | boot-env/pbs/uclib-rootfs/etc/bbinit.d/example | 32 | ||||
-rw-r--r-- | boot-env/pbs/uclib-rootfs/etc/events/example | 2 | ||||
-rwxr-xr-x | initramfs/stage3-stuff/bin/hwautocfg | 4 | ||||
-rwxr-xr-x | initramfs/stage3-stuff/init | 8 |
7 files changed, 107 insertions, 0 deletions
diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm index a4a984e9..ca4764ca 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm @@ -240,6 +240,10 @@ sub _copyKernelModules push @kernelModules, split ' ', $self->{attrs}->{ramfs_miscmods}; push @kernelModules, split ' ', $self->{attrs}->{ramfs_nicmods}; + if ($self->{attrs}->{ramfs_nicmods} =~ m{virtio}i) { + push @kernelModules, qw( virtio_pci virtio_net ); + } + # a function that determines dependent modules recursively my $addDependentsSub; $addDependentsSub = sub { diff --git a/boot-env/pbs/uclib-rootfs/bin/bbinit b/boot-env/pbs/uclib-rootfs/bin/bbinit new file mode 100755 index 00000000..3fd67612 --- /dev/null +++ b/boot-env/pbs/uclib-rootfs/bin/bbinit @@ -0,0 +1,19 @@ +#!/bin/hush + +# create clean setup +mkdir -p /etc/events.conf +mkdir -p /etc/events.d +rm /etc/events.d/* +for f in $(ls -1 /etc/events) +do + ln -sf /etc/events/$f /etc/events.d/$f +done + +mkdir -p /tmp/event +rm /tmp/event/* +rm /tmp/events + +# start bbinit +inotifyd /bin/handleEvents /tmp/event/:n & +# initial call (executing all zero dependent scipts) +handleEvents diff --git a/boot-env/pbs/uclib-rootfs/bin/handleEvents b/boot-env/pbs/uclib-rootfs/bin/handleEvents new file mode 100755 index 00000000..9bb78951 --- /dev/null +++ b/boot-env/pbs/uclib-rootfs/bin/handleEvents @@ -0,0 +1,38 @@ +#!/bin/hush + +# wait for lock +while [ -f /tmp/bbinit.lock ] +do + sleep 0.1 +done + +# lock eventhandler +touch /tmp/bbinit.lock + +# source list of finished events +[ -f /tmp/events ] && . /tmp/events + +# go through all unhandled events +for f in $( ls -1 /etc/events.d/ ) +do + . /etc/events.d/$f + + # check dependencies + eval dep=\$${f}_depends + havealldeps=1 + for d in $dep + do + eval havedep=\$have${d} + [ "x$havedep" == "x1" ] || havealldeps=0 + done + + # if nothing is missing execute script + if [ "x$havealldeps" == "x1" ]; then + echo executing $f + /etc/bbinit.d/$f & + rm /etc/events.d/$f + fi +done + +# unlock eventhandler +rm /tmp/bbinit.lock diff --git a/boot-env/pbs/uclib-rootfs/etc/bbinit.d/example b/boot-env/pbs/uclib-rootfs/etc/bbinit.d/example new file mode 100755 index 00000000..122cf566 --- /dev/null +++ b/boot-env/pbs/uclib-rootfs/etc/bbinit.d/example @@ -0,0 +1,32 @@ +#!/bin/hush + +me=$(basename $0) + +# read event parameters +. /etc/events/$me +eval provides=\$${me}_provides + +# get config output of the dependencies +eval dep=\$${me}_depends +for d in $dep +do + [ -f /etc/event.conf/$d ] && . /etc/event.conf/$d +done + +# do some stuff +echo "[$me] starting .." +for i in 1 2 3 4 5 6 +do + echo "[$me] $i" + sleep 1 +done +echo "[$me] finished .." + +# write configuration output +value="test" +echo "${provides}_someconfig=\"$value\"" >> /etc/event.conf/$provides + +# trigger eventhandler +echo "have${provides}=1" >> /tmp/events +touch /tmp/event/$me + diff --git a/boot-env/pbs/uclib-rootfs/etc/events/example b/boot-env/pbs/uclib-rootfs/etc/events/example new file mode 100644 index 00000000..75768967 --- /dev/null +++ b/boot-env/pbs/uclib-rootfs/etc/events/example @@ -0,0 +1,2 @@ +example_depends="" +example_provides="example" diff --git a/initramfs/stage3-stuff/bin/hwautocfg b/initramfs/stage3-stuff/bin/hwautocfg index 0bfbdd2c..9cd0f8a4 100755 --- a/initramfs/stage3-stuff/bin/hwautocfg +++ b/initramfs/stage3-stuff/bin/hwautocfg @@ -31,6 +31,10 @@ modprobe -a ${MODPRV} usbhid hid-bright 2>/dev/null & nwcardlist=$(echo ${slxconf_listnwmod}|sed "s/\ /|/g") hwinfo --netcard --usb-ctrl | grep modprobe | grep -E "$nwcardlist|hcd" | \ grep -v ehci | sed 's/.* Cmd: "//;s/"//' | sort -u >/etc/modprobe.base +# virtio hack +if [ $(grep -ic "virtio_pci" /etc/modprobe.base) -ge 1 ]; then + echo "modprobe virtio_net" >>/etc/modprobe.base +fi ash /etc/modprobe.base; mdev -s # optimization possible: exclude network and usb base drivers from the # following list (bios detection for non-hwautocfg component) diff --git a/initramfs/stage3-stuff/init b/initramfs/stage3-stuff/init index a96c66e0..b28f1138 100755 --- a/initramfs/stage3-stuff/init +++ b/initramfs/stage3-stuff/init @@ -379,6 +379,7 @@ else fi runinithook '10-nw-if-config' + # check for multiple ethernet interfaces (we have at least the mac of PXE boot # device in $bootmac) # check here for the active ethernet link (skip non-ethN interfaces) @@ -410,6 +411,7 @@ if strinstr "eth" "$nwif" ; then done fi # hook to setup bridging (several virtualization tools ...) + runinithook '20-nw-bridge-config' # set up loopback networking @@ -802,6 +804,11 @@ fi runinithook '50-have-layered-fs' +# logdir +. /mnt/etc/opt/openslx/openslx.conf +testmkd /mnt/${OPENSLX_DEFAULT_LOGDIR} +chmod -R 1777 /mnt/${OPENSLX_DEFAULT_LOGDIR} # testmkd 1777 seems not to work + # script for stuff to execute during early bootup d_mkrlscript init boot.slx "Running configuration postponed from InitRamFS" echo "fs complete at $(sysup)" >/tmp/fscmpl @@ -927,6 +934,7 @@ else fi runinithook '80-after-plugins' + # runtimer [ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ echo "** Plugin configuration finished at $(sysup)" |