This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

kernel module driver load question

Hello everyone,

I am fairly new in the Linux department, and stumbled upon a question that I'd like to pose in this forum.

Within the Kernel configuration I can mark the modules to be build in the Kernel image or to be build as external modules. I got the git depository from git://linuxtv.org/pinchartl/media.git which includes the Kernel 3.14.

My goal was to use the omap3-isp driver with my Gumstix overo board and a OV3640 camera module. So I configured the Kernel to build the omap3-isp.ko module and edited the board-overo.c to tell the Kernel that I want to use the ISP.

static struct isp_platform_data overo_isp_platform_data = {
    .xclks = {
        [0] = {
            .dev_id = "3-003c",
        },
    },
    .subdevs = overo_camera_subdevs,
};
static int __init overo_camera_init(void)
{
    omap3_init_camera(&overo_isp_platform_data);
    return 0;
}

When I booted the device I saw that the omap3-isp module was loaded automatically.

So now my question is: From where does the Kernel exactly know that he has to load the omap3-isp.ko module, which is located in /lib/modules/*version*/kernel/drivers/media/platform/omap3isp/omap3-isp.ko? And how did he find out the location or the needed name?

Does the Kernel probably have some kind of list of external modules that have to be loaded when booting?

Thank you in advance.

Best regards,

Michael

  • Hi,

    say e.x.,

    make uImage ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi-    (compiling kernel uImage)

    make modules ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi-   (for compiling kernel as modules which selected in menuconfig)

    After this you need to install those built kernel modules into filesystem

    make modules_install  INSTALL_MOD_PATH=/media/rootfs  ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi-

    Here , You need to mention filesystem location then it will write modules & kernel driver & linux version write into

    "/lib/modules/< linux version> /modules.dep" file

  • Hello Titus,

    thanks for the reply. 

    So this file represents the location and the existing of all kernel modules. But when and where will the kernel look into this file and make the insmod or modprobe command? Why was the omap3-isp driver inserted automatically?

    Thank you in advance.

    Best Regards,

    Michael

  • Hi,

    . But when and where will the kernel look into this file and make the insmod or modprobe command? Why was the omap3-isp driver inserted automatically?

    In filesystem,

    "etc/rcS.d/S20modutils.sh" this file will initialize/call the modules.

    #!/bin/sh

    LOAD_MODULE=modprobe
    [ -e /sbin/modprobe ] || LOAD_MODULE=insmod

    if [ -e /sbin/depmod -a ! -f /lib/modules/`uname -r`/modules.dep ]; then
        [ "$VERBOSE" != no ] && echo "Calculating module dependencies ..."
        depmod -Ae
    fi

    if [ -f /proc/modules ]; then
           if [ -f /etc/modules ]; then
                   [ "$VERBOSE" != no ] && echo -n "Loading modules: "
                   while read module args
                   do
                           case "$module" in
                                   \#*|"") continue ;;
                           esac
                           [ "$VERBOSE" != no ] && echo -n "$module "
                           eval "$LOAD_MODULE $module $args >/dev/null 2>&1"
                   done < /etc/modules
                   [ "$VERBOSE" != no ] && echo
           fi
    fi

    : exit 0

  • Hello Titus,

    again many thanks for your reply. Please excuse my noob questions.

    So this script will insmod all modules which are listed in the module.dep.

    So if I would create a filesystem myself and don't create a script called "S20modutils.sh" the kernel modules would not be loaded at boot time?

    Because if I understand the modules_install command correctly all the files will just be copied to the /lib folder, right?

    Best Regards, Tom

  • Because if I understand the modules_install command correctly all the files will just be copied to the /lib folder, right?

    Exactly.

    So if I would create a filesystem myself and don't create a script called "S20modutils.sh" the kernel modules would not be loaded at boot time?

    Yes, It won't

  • OK, Thanks for your help.

    Best regards,

    Michael