From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Alexander E. Patrakov" Date: Thu, 15 Jul 2004 16:45:17 +0000 Subject: Re: [PATCH] Enable all events for initramfs Message-Id: <40F6B49D.7090103@ums.usu.ru> List-Id: References: <40F3C48F.30905@suse.de> In-Reply-To: <40F3C48F.30905@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Alexander E. Patrakov wrote: > Hannes Reinecke wrote: > >> Hi all, >> >> currently most driver events are not sent out when using initramfs as >> driver_init() (which triggers the events) is called before >> init_workqueues. >> >> This patch rearranges the init calls so that the hotplug event queue >> is enabled prior to calling driver_init(), hence we're getting all >> hotplug events again. >> >> Patch is relative to 2.6.7-mm6, but should apply to 2.6.8-rc1 also. >> >> Please apply. > LFS-ers: get it from http://lkml.org/lkml/diff/2004/7/13/74/1 > > This is probably a very good news. > > I see the following application of it. Since no hotplug events are > dropped any more, the initramfs could save their type and environment in > files on a ramfs, and then remount that ramfs to some location > accessible by the main system. The information accumulated in these > files can be used for re-synthesis of events not handled because e.g. > /usr was not mounted. It appeared to be easier to just make /sbin/hotplug processes in initramfs sleep until they can call /sbin/hotplug on the real root. > This means that we can drop the udevstart program and *.rc files that > come with the hotplug package and replace them by playback of such > recorded events. This looks much cleaner, since right now the > reconstruction is imperfect. > > I will try to implement this approach (i.e, create initramfs and modify > the hotplug and udev packages) during this week on a copy of Linux From > Scratch 20040702, and report the results here. > Done. The initramfs image (busybox-based) is available at: http://ums.physics.usu.ru/~patrakov/initramfs_data.cpio.gz md5sum: 69f5b834526b4ce918887c2f7a4067a6 This has been tested on my computer with LFS SVN-20040702 and LFS-bootscripts 20040704 with the following changes: 1) The mountkernfs, udev, checkfs and hotplug initscripts should be disabled or removed. Removal of checkfs is because of (3) below, other initscripts are not needed because my initramfs does their jobs. For those not familiar with LFS, the "mountkernfs" initscript mounts /proc and /sys, the "udev" initscript mounts ramfs on /dev and then runs udevstart and creates some extra nodes, "checkfs" runs fsck, "hotplug" is a pretty much original initscript that comes with the hotplug package that should be well-known here :) 2) The LFS-specific change of the kmod.c file should be dropped 3) The use of a journaled filesystem (e.g. ext3) mounted rw at boot is a must. /sbin/hotplug may mishandle hotplug events on read-only root. 4) The /proc, /sys and /proc/bus/usb entries in /etc/fstab should be marked as "noauto" 5) The following line should be added to /etc/modprobe.conf: install usbcore /sbin/modprobe -i usbcore ; mount /proc/bus/usb (usbcore must be a module, or a modification of /init is needed) Results: all my devices are in /dev, all modules for my hardware are loaded due to early hotplug events delivered to /sbin/hotplug without any loss. Caveats: 1) a kernel bogusly complains about runaway modprobe loop net-pf-1. This is really not a loop, just imagine that 200 "udevd" behemots simultaneously try to create a socket :( Don't compile af-unix as a module. 2) The loop that waits for all hotplug processes to go away doesn't seem to work. As a result, a bug involving a race between hotplug and e.g. swapon is likely to exist. -- Alexander E. Patrakov ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idG21&alloc_id040&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel