From ef897fb5484c6c128ef3c7e8979200202709194d Mon Sep 17 00:00:00 2001 From: Tim Yamin Date: Sat, 27 Nov 2004 13:33:25 +0000 Subject: [PATCH] Udev speedups; thanks to Eric Edgar for the patch - bug #72253. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@150 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- gen_initrd.sh | 2 ++ generic/initrd.scripts | 48 ++++++++---------------------------------- generic/linuxrc | 8 +++++++ 3 files changed, 19 insertions(+), 39 deletions(-) diff --git a/gen_initrd.sh b/gen_initrd.sh index dbfadab..7923276 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -82,6 +82,8 @@ create_base_initrd_sys() { [ "${UDEV}" -eq '1' ] && { tar -jxpf "${UDEV_BINCACHE}" -C "${TEMP}/initrd-temp" || gen_die "Could not extract udev binary cache!"; } + ln -sf "./udev" "${TEMP}/initrd-temp/bin/udevstart" || + gen_die 'Could not symlink udev -> udevstart!' # We make our own devfsd.conf these days, the default one doesn't work with the stripped # down devfsd we use with dietlibc diff --git a/generic/initrd.scripts b/generic/initrd.scripts index f2fed9b..06ba683 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -65,45 +65,15 @@ kill_devfsd() { } runUdev() { - export ACTION=add - export UDEV_NO_SLEEP=1 - # Add block devices and their partitions to /dev, - # using information from /sys, and only those - # devices (since other are not needed for boot). + mount -t tmpfs -o size=100k udev /dev + mkdir /dev/pts + mkdir /dev/shm + /sbin/udevstart + ln -snf /proc/self/fd /dev/fd + ln -snf /proc/self/fd/0 /dev/stdin + ln -snf /proc/self/fd/1 /dev/stdout + ln -snf /proc/self/fd/2 /dev/stderr + ln -snf /proc/kcore /dev/core - # We also do VC's for keymap support. - - for x in block/* - do - export DEVPATH="/${x}" - /sbin/udev block - - for y in ${x}/* - do - if [ -f "${y}/dev" ] - then - export DEVPATH="/${y}" - /sbin/udev block - fi - done - done - for x in class/tty - do - export DEVPATH="/${x}" - /sbin/udev class - - for y in ${x}/* - do - if [ -f "${y}/dev" ] - then - export DEVPATH="/${y}" - /sbin/udev class - fi - done - done - - cd / - - unset -v ACTION DEVPATH UDEV_NO_SLEEP } diff --git a/generic/linuxrc b/generic/linuxrc index 7d5c33f..0d27da2 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -147,6 +147,7 @@ then then cd /sys kill_devfsd + echo -e "${GOOD}>>${NORMAL}${BOLD} Activating udev...${NORMAL}" runUdev mv /dev/* /newroot/dev else @@ -214,6 +215,7 @@ if [ "${USE_UDEV_NORMAL}" -eq '1' -a "${CDROOT}" -eq '0' ] then USE_DEVFS_NORMAL=0 cd /sys + echo -e "${GOOD}>>${NORMAL}${BOLD} Activating udev...${NORMAL}" runUdev elif [ "${CDROOT}" -eq '0' -a "${USE_DEVFS_NORMAL}" -eq '1' ] then @@ -419,6 +421,12 @@ then rm /tmp/.initrd/dev -rf || '*: Failed to remove the initrd /dev!' elif [ "${USE_UDEV_NORMAL}" -eq '1' ] then + rm /tmp/.initrd/dev/fd || echo '*: Failed to rm the initrd fd!' + rm /tmp/.initrd/dev/stdin || echo '*: Failed to rm the initrd stdin!' + rm /tmp/.initrd/dev/stdout || echo '*: Failed to rm the initrd stdout!' + rm /tmp/.initrd/dev/stderr || echo '*: Failed to rm the initrd stderr!' + rm /tmp/.initrd/dev/core || echo '*: Failed to rm the initrd core!' + umount /tmp/.initrd/dev || echo '*: Failed to unmount the initrd /dev!' umount /tmp/.initrd/proc || echo '*: Failed to unmount the initrd /proc!' umount /tmp/.initrd/sys || echo '*: Failed to unmount the initrd /sys!' elif [ "${CDROOT}" -eq '1' ] -- 2.26.2