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

Bug#384043: Patch to force copy modules



Hi again.

Perpahps last mail was so long and very dificult to understand.

I will try to explain again with a small example.



1.- Create new hook for initramfs-tools

/etc/initramfs-tools/hooks/soundtest

#----------------8<-----------------
#!/bin/sh

PREREQ=""

prereqs()
{
        echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
        prereqs
        exit 0
        ;;
esac

# Hooks for loading some kernel sound modules into the initramfs

. /usr/share/initramfs-tools/hook-functions

MODULES="snd-via82xx snd-ens-1371"

for mod in ${MODULES}; do
  echo "adding extra sound module ${mod}"
  manual_add_modules ${mod}
done


#----------------8<-----------------

Then chmod +x /etc/initramfs-tools/hooks/soundtest

2.- Generate new image

# mkinitramfs -o ./sound-initramfs.gz
# uname -r
2.6.16-1-k7

3.- Next I will uncompress and show that modules aren't into it:

# gunzip sound-initramfs.gz
# mkdir tmp
# cd tmp
# cpio -i < ../sound-initramfs
23276 blocks
# find ./lib/modules/ -name "snd-via82xx.ko"
(NO RESULTS)
# find ./lib/modules/ -name "*snd*"
./lib/modules/2.6.16-1-k7/kernel/sound/core/seq/snd-seq-device.ko
./lib/modules/2.6.16-1-k7/kernel/sound/core/snd-rawmidi.ko
./lib/modules/2.6.16-1-k7/kernel/sound/core/snd-page-alloc.ko
./lib/modules/2.6.16-1-k7/kernel/sound/core/snd-timer.ko
./lib/modules/2.6.16-1-k7/kernel/sound/drivers/mpu401/snd-mpu401-uart.ko
./lib/modules/2.6.16-1-k7/kernel/sound/pci/ac97/snd-ac97-bus.ko
./lib/modules/2.6.16-1-k7/kernel/sound/pci/ac97/snd-ac97-codec.ko

These are the dependencies of our module but the snd-via82xx
snd-ens-1371 aren't in image.


The problem:

This command in /usr/share/initramfs-tools/hook-functions in
manual_add_modules function

modprobe --set-version="${version}" --show-depends "${1}" 2>/dev/null |
awk '/^insmod/ { print $2 }'

show all dependencies of a module name but don't show the module ${1}


This only ocurrs in some modules and in other work ok, I suppose that
nobody insert sound modules in initrd images, but I need sound modules
and many other stuff.

Following patch will force to copy the module name after copy
dependencies:



--- hook-functions.orig 2006-08-21 21:20:14.000000000 +0200
+++ hook-functions      2006-08-21 21:26:31.000000000 +0200
@@ -52,6 +52,15 @@
                        echo "Adding module ${mam_x}"
                fi
        done
+
+       # force copy of module modprobe dont show as dependency
+        this_module=$(modprobe --set-version="${version}" -l "${1}")
+        if [ ! -e "${DESTDIR}/${this_module}" ]; then
+               echo "DELETEME, adding module ${this_module}"
+                mkdir -p "${DESTDIR}/$(dirname "${this_module}")"
+                ln -s "${this_module}" "${DESTDIR}/$(dirname
"${this_module}")"
+        fi
+        # end of force copy
 }

 # $1 is source

The line echo "DELETEME....." is for debug my hack.


I hope that can be included in next initramfs-tools, that it's really a
good project to create some complex things (livecds, thin clients,
etc...)

Bye

-- 
http://soleup.eup.uva.es/mariodebian

Attachment: signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente


Reply to: