[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#608538: btrfs root installation results in initramfs busybox prompt



On Mon, 2011-01-03 at 22:57 +0100, Michael Prokop wrote:
> * Ben Hutchings <ben@decadent.org.uk> [Mon Jan 03, 2011 at 09:50:46PM +0000]:
> > On Mon, 2011-01-03 at 22:16 +0100, Michael Prokop wrote:
> > > * Ben Hutchings <ben@decadent.org.uk> [Mon Jan 03, 2011 at 09:03:37PM +0000]:
> > > > On Mon, 2011-01-03 at 16:37 -0400, Joey Hess wrote:
> 
> > > > > So, at least a workaround would be for the initramfs to have crc32c added to
> > > > > it whenever libcrc32c is. Attached patch just adds it to the base modules
> > > > > list; since btrfs is already there that seems like an ok quick fix.
> 
> > > > This is stupid.  Without a declared module dependency, a MODULES=dep
> > > > configuration will remain broken.  I think this needs to be fixed in the
> > > > kernel instead.
> 
> > > > > Note that it would probably be better to try first loading hardware optimised
> > > > > versions like crc32c-intel, and only load crc32c if they fail to load.
> 
> > > > I believe that happens automatically, as the hardware-optimised modules
> > > > provide an alias of 'crc32c'.
> 
> > > > > (BTW, this bug probably also breaks netbooting with certian ethernet cards
> > > > > whose drivers also use libcrc32c.)
> 
> > > > Right.
> 
> > > Thanks for showing up, would be nice to see this fixed.
> 
> > > I just want to make sure you're aware of my bugreport #602254
> > > (which Joey seemed to have noticed already according to its
> > > BTS history).
> 
> > > Ben, do you think this could be fixed at the kernel side?
> 
> > Eventually, yes, but unfortunately it turns out that we can't fix it
> > immediately.  'depmod' only looks at symbol dependencies; there is no
> > way for modules to declare explicit dependencies through module
> > information.  We can bodge it by exporting a specific symbol from crc32c
> > and referring to that from libcrc32c, but since the optimised version
> > doesn't satisfy that dependency it will not be loaded.
> 
> Ok, that's what I expected.

Actually, 'modprobe' will completely ignore aliases if there is a module
whose real name matches the requested name.  So currently crc32c-intel
will never be automatically loaded!

> > So I'm afraid this will have to be worked around in initramfs-tools for
> > now: whenever you add libcrc32c, add crc32c as well (no matter how
> > libcrc32c was selected).
> 
> So we should just add crc32c-intel, libcrc32c and crc32c by default
> via initramfs-tools for now, ACK?

Try this.  I've made it reasonably generic so you can easily add other
hidden dependencies like tg3 -> broadcom.

Ben.

From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 3 Jan 2011 21:58:24 +0000
Subject: [PATCH] Handle hidden dependency of libcrc32c on crc32c

'depmod' only looks at symbol dependencies; there is no way for
modules to declare explicit dependencies through module information,
so dependencies on e.g. crypto providers are hidden.  Until this is
fixed, we need to handle those hidden dependencies.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hook-functions |   14 ++++++++++++++
 mkinitramfs    |    3 +++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/hook-functions b/hook-functions
index c559651..d77c295 100644
--- a/hook-functions
+++ b/hook-functions
@@ -484,6 +484,20 @@ auto_add_modules()
 	esac
 }
 
+# 'depmod' only looks at symbol dependencies; there is no way for
+# modules to declare explicit dependencies through module information,
+# so dependencies on e.g. crypto providers are hidden.  Until this is
+# fixed, we need to handle those hidden dependencies.
+hidden_dep_add_modules()
+{
+	for dep in "lib/libcrc32c crc32c"; do
+		set -- $dep
+		if [ -f "${DESTDIR}/lib/modules/${version}/kernel/$1.ko" ]; then
+			manual_add_modules "$2"
+		fi
+	done
+}
+
 # mkinitramfs help message
 usage()
 {
diff --git a/mkinitramfs b/mkinitramfs
index 0bb7806..40eb35b 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -232,6 +232,9 @@ list)
 	;;
 esac
 
+# Resolve hidden dependencies
+hidden_dep_add_modules
+
 # Have to do each file, because cpio --dereference doesn't recurse down
 # symlinks.
 
-- 
1.7.2.3

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: