From aeb42568b05029c109bdde77e686d3f89309b717 Mon Sep 17 00:00:00 2001 From: Dirk Date: Sun, 25 May 2014 23:25:23 +0200 Subject: Required changes to fix the device autodiscovery and setup. --- src/initramfs/scripts/bin/hwautocfg | 19 ++++++++----------- src/initramfs/scripts/init | 30 +++--------------------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/initramfs/scripts/bin/hwautocfg b/src/initramfs/scripts/bin/hwautocfg index 4ec42c4a..92d69943 100755 --- a/src/initramfs/scripts/bin/hwautocfg +++ b/src/initramfs/scripts/bin/hwautocfg @@ -24,9 +24,8 @@ for tool in /usr/sbin/acpidump \ echo -e "#!/bin/sh" >${tool} chmod u+x ${tool} done -# no kernel messages, switch on hotplug via /sbin/mdev +# no kernel messages echo "0 0 0 0" >/proc/sys/kernel/printk -echo "/sbin/mdev" >/proc/sys/kernel/hotplug echo -e "(control[A-Z])([0-9]) 0:0 660 =snd/\n(pcm[A-Z][0-9][A-Z][0-9][cp]) 0:0 660 =snd/\n\ (hw[A-Z0-9]*) 0:0 660 =snd/\ncard[0-9] 0:0 660 =dri/\n(event|mouse)[0-9] 0:0 640 =input/\n\ (control[A-Z])([0-9]+) 0:0 660 =dri/\n" >>/etc/mdev.conf @@ -62,7 +61,7 @@ elif [ -e /etc/init-hooks/00-started/xserver.sh -o \ modprobe -a ${MODPRV} r128 savage sis tdfx ttm via ;; esac - modprobe -a drm fbcon; mdev -s ) & + modprobe -a drm fbcon ) & fi # check and then load appropriate network card modules @@ -76,7 +75,7 @@ grep modprobe /etc/hwinfo.netcard-usbctrl | grep -E "$nwcardlist|hcd" \ if [ $(grep -ic "virtio_pci" /etc/modprobe.base) -ge 1 ]; then echo 'modprobe ${MODPRV} virtio_net' >>/etc/modprobe.base fi -sh /etc/modprobe.base; mdev -s +sh /etc/modprobe.base # optimization possible: exclude network and usb base drivers from the # following list (bios detection for non-hwautocfg component) @@ -88,7 +87,7 @@ echo -e "ext3\next2\nreiserfs\nxfs\njfs\next4\nvfat" >/etc/filesystems # request a local block device for config and root filesystem (lbd://) if grep -iq '"lbd://' /proc/cmdline /etc/initramfs-setup; then modprobe -a ${MODPRV} ehci_hcd usb-storage sd_mod - mdev -s + fi return 0 } @@ -105,7 +104,7 @@ sed '/Driver Info #1/,/Config Status:/d' /etc/hwinfo.data | grep modprobe \ | sed "s|.* Cmd: \"||;s|\"|$modloadbg|;s|modprobe|modprobe -b ${MODPRV}|" \ | sort -u >/etc/modprobe.pci sh /etc/modprobe.pci -mdev -s + # bluetooth setup (start it later if present, depends on firmware availa- # bility, interpreted by servconfig) @@ -123,7 +122,7 @@ mdev -s modprobe ${MODPRV} ide-cd 2>/dev/null modprobe ${MODPRV} sr_mod 2>/dev/null modprobe ${MODPRV} ide-floppy 2>/dev/null -mdev -s + # load kernel module for ps2 mice and map the mousehandler to /dev/input/mice ( [ -f /lib/modules/${KERNEL}/kernel/drivers/input/mouse/psmouse.ko ] && \ @@ -152,7 +151,7 @@ hwinfo --scanner >/etc/hwinfo.scanner modprobe ${MODPRV} parport_pc && modprobe ${MODPRV} ppdev # if any new device appeared up to now -mdev -s + return 0 } ############################################################################# @@ -226,7 +225,7 @@ fi ############################################################################# # cleanup/finishing part finish () { -mdev -s + # mount filesystem parts (if any) requested in disk setup [ -f /etc/do_mnt ] && \ { sed -e "1i. /etc/functions" -i /etc/do_mnt; sh /etc/do_mnt; } & @@ -285,12 +284,10 @@ case $1 in disk) # try to enable compressed RAM SWAP / ZRAM if modprobe ${MODPRV} ramzswap 2>/dev/null && [ -f /usr/bin/rzscontrol ] ; then - mdev -s rzscontrol /dev/ramzswap0 --init swapon /dev/ramzswap0 2>/dev/null #hdswap="# disk swap disabled because of enabled compressed ramswap" elif modprobe ${MODPRV} zram 2>/dev/null ; then - mdev -s # assign a quarter of total mem to zram echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize mkswap /dev/zram0 2>/dev/null diff --git a/src/initramfs/scripts/init b/src/initramfs/scripts/init index a4a41629..dd5c8d60 100755 --- a/src/initramfs/scripts/init +++ b/src/initramfs/scripts/init @@ -20,7 +20,7 @@ export PATH=/bin:/sbin:/usr/bin/:/usr/sbin # device files get their own filesystem (to be move mounted later) devdir="/dev" -mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir} +mount -n -t devtmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir} mkdir -p /run mount -n -t tmpfs -o 'mode=755' run "/run" @@ -29,26 +29,8 @@ mount -n -t tmpfs -o 'mode=755' run "/run" [ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc [ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys -# create basic device files an directories (in dev - for most hardware related -# devices mdev should handle that) -for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \ - "/dev/urandom c 1 9" "/dev/kmsg c 1 11" "/dev/tty0 c 4 0" \ - "/dev/tty1 c 4 1" "/dev/tty2 c 4 2" "/dev/tty3 c 4 3" \ - "/dev/tty4 c 4 4" "/dev/tty5 c 4 5" "/dev/tty6 c 4 6" \ - "/dev/tty7 c 4 7" "/dev/tty8 c 4 8" "/dev/tty9 c 4 9" \ - "/dev/tty10 c 4 10" "/dev/tty c 5 0" "/dev/console c 5 1" \ - "/dev/ptmx c 5 2" "/dev/psaux c 10 1" "/dev/agpgart c 10 175" \ - "/dev/fb0 c 29 0" "/dev/xconsole p"; do - mknod $i -done mkdir -p ${devdir}/pts ${devdir}/shm ${devdir}/.udevdb ${devdir}/.udev \ ${devdir}/.initramfs /var/log -# create some standard links (expected?) in /dev -ln -s /proc/kcore /dev/core -ln -s /proc/self/fd /dev/fd -ln -s /proc/self/fd/0 /dev/stdin -ln -s /proc/self/fd/1 /dev/stdout -ln -s /proc/self/fd/2 /dev/stderr mount -t devpts devpts /dev/pts @@ -56,10 +38,6 @@ mount -t devpts devpts /dev/pts getty -i -n -l /bin/cat 38400 tty10 & setlogcons 10 -# start device auto discovery/setup service of busybox -echo "# Set mdev behaviour in either init or hwautocfg" >/etc/mdev.conf -mdev -s - # source functions file common for all distros, messages contains all error # and info output (for some reason the error output is not produced properly # - crash) @@ -523,7 +501,6 @@ if [ -n "${bldmod}" ] ; then for module in ${bldmod} ; do modprobe ${MODPRV} ${module} || error "$init_errbld" done - mdev -s [ -z "$bldrfst" ] && bldrfst=squashfs bldhost=$(checkip $bldhost) if [ $DEBUGLEVEL -eq 20 ] ; then @@ -656,7 +633,6 @@ if [ -n "${bldmod}" ] ; then modprobe ${MODPRV} cowloop || { error "$init_loadcow" nonfatal unset cowloop; } - [ -x /bin/mdev ] && mdev -s fi if [ -n "${cowloop}" ] ; then if [ -n "${unionfs}" -o -n "${aufs}" ] ; then @@ -937,8 +913,8 @@ done chown 65534:0 /mnt/var/lib/nobody echo -e "# /etc/fstab - file generated by $0 (initramfs from $date)\n#\ \tOpenSLX Project, info@openslx.com\n\nrootfs\t\t/\t\trootfs\t\tro\t\t 0 0\n\ -proc\t\t/proc\t\tproc\t\tdefaults\t 0 0\ninitramdevs\t/dev\t\ttmpfs\ -\t\trw\t\t 0 0\ndevpts\t\t/dev/pts\tdevpts\t\tmode=0620,gid=5\t 0 0" \ +proc\t\t/proc\t\tproc\t\tdefaults\t 0 0\ninitramdevfs\t/dev\t\tdevtmpfs\ +\trw\t\t 0 0\ndevpts\t\t/dev/pts\tdevpts\t\tmode=0620,gid=5\t 0 0" \ >/mnt/etc/fstab || error "$init_fstab" echo -e "rootfs / rootfs rw 0 0\ninitramdevs /dev tmpfs rw\ 0 0" > /mnt/etc/mtab -- cgit v1.2.3-55-g7522