$kernelver in [PRE|POST]_BUILD etc (including patch)

Christoph Mathys eraserix at gmail.com
Fri Jun 25 10:56:28 CDT 2010


Hello!

I'm doing a rather delicate package for some kernel modules with
internal dependencies. I have decided to split the modules into
several different dkms-packages, but this means I have to find some
way to access "Modules.symvers". I've solved this by copying around
the file so the dependent modules can find it and use it in their
MODPOST 2. The copying is done by scripts run in the POST_BUILD and
PRE_BUILD hooks of dkms. In order to copy Modules.symvers I need to
know where dkms-source is located and for which kernel the module has
been built (to reduce chances of accidentally using the wrong
Module.symvers). I could not find a nice way of getting access to this
information from inside the script, so I changed a few lines inside
dkms (patch attached). Or is there another way of getting this
information from inside the scripts without too much hassle
(especially kernelver)?

Christoph

===================================================================
--- sbin.orig/dkms	2010-06-25 11:20:57.780660209 +0200
+++ sbin/dkms	2010-06-25 17:55:39.738660761 +0200
@@ -101,6 +101,7 @@
     if [ -z "$kernel_source_dir" ] && [ -d "$install_tree/$1/build" ]; then
         kernel_source_dir="$install_tree/$1/build"
     fi
+    export kernel_source_dir
 }

 function setup_kernels_arches ()
@@ -492,8 +493,8 @@
     unset strip

     # Set variables supported in dkms.conf files (eg. $kernelver)
-    kernelver="$1"
-    arch="$2"
+    export kernelver="$1"
+    export arch="$2"
     set_kernel_source_dir "$1"

     # Source in the dkms.conf
@@ -3843,6 +3844,9 @@
     shift
 done

+export source_tree
+export dkms_tree
+
 # Run the specified action
 for action_to_run in $action; do
     case "$action_to_run" in



More information about the DKMS-devel mailing list