You only need uInitrd and uImage for u-boot. The modules are loaded by the kernel in two stages:
1) modules in the initrd image (uInitrd when using u-boot)
2) modules in /lib/modules/... after the root partition has been mounted
This implies that you need to have the modules for your root file system in the initrd image. The script mkinitramfs will create an initrd image with modules as it deems required for booting. This is partially automatic (looking at the driver used for the root partition and filesystem) but can be configured in /etc/initramfs-tools/initramfs.conf as well as with files in /etc/initramfs-tools/conf.d. On top of that, there's a file /etc/initramfs-tools/modules which contains a list of modules that must loaded, regardless of the modules that it guesses.
Another aspect worth mentioning is that modules have dependencies on each other and those are stored in /lib/modules/.../modules.dep and friends. mkinitramfs expects those files to exist and this might be a problem when cross-compiling a kernel -- I never tried that and build my kernels directly on the plug. The command "depmod -a" can be used to create the module dependencies.
On my plug, I use the following script to build a custom kernel and move the core kernels out of the way for the initramfs tools:
#!/bin/bash
version=2.6.32-cm1.1-kirkwood
echo building version $version
if [ $# -gt 0 -a "$1" == "-r" ] ; then
# rebuild kernel
make clean
fi
if ! make || ! make zinstall; then
echo error: build failed....
exit 1
fi
if [ ! -d /lib/modules/$version ] ; then
mkdir /lib/modules/$version
fi
if ! make modules_install; then
echo error: modules_install failed....
exit 1
fi
if ! cd /boot || ! mkinitramfs -o /boot/initrd.img-$version $version; then
echo "error: mkinitramfs failed...."
exit 1
fi
ln -fs initrd.img-$version initrd.img
# Make this kernel known to update-initramfs. This is not exactly sufficient
# because update-initramfs will use "dpkg --compare-versions" to compare the
# versions of installed kernels and select the most recent one. Since our kernel
# has never been installed via dpkg and we don't exactly follow debian
# versioning rules (e.g. using "cm1.0" vs. "trunk"), we'll lose every time. But
# if we're the only kernel available, we'll win. We'll do this final step, i.e.
# making sure we're the only kernel, once we successfully flashed the kernel
# image further down. For now, just make sure update-initramfs knows about this
# new kernel
shasum /boot/initrd.img-$version >/var/lib/initramfs-tools/$version
if ! flash-kernel; then
echo "error: flash-kernel failed...."
exit 1
fi
# Everything went fine so far and the kernel has been installed; now disable
# other kernels in /var/lib/initramfs-tools to make sure further calls to
# update-initramfs will use our new kernel. Quite a hack but I never got around
# (or, in better words, bothered) to master the "official" zen of debian kernel
# compilation...
for i in /var/lib/initramfs-tools/*; do
if [ "$i" != "/var/lib/initramfs-tools/$version" ] ; then
rm $i
fi
done
In order to use this script, extract the linux source into /usr/src/linux-<version>, change into the source directory, copy the Debian config file from /boot/config-<version> into .config, patch the kernel and/or update the configuration with make menuconfig, then run the script above to build and install the kernel.
This script is a bit of a hack but I never got around using the Debian kernel build tools and I also like having full control over the build process...
Thanks,
--Christian