Welcome to the Linux Foundation Forum!

In section 08, how to configure kernel after making changes?

Options
amoghmc
amoghmc Posts: 13
edited January 25 in LFD103 Class Forum

In section 8: writing your first patch,
I made the change to the uvc_driver.c by adding the following line

pr_info("I changed uvcvideo driver in the Linux Kernel\n");

Now how do I configure the module CONFIG_USB_VIDEO_CLASS=y?
I manually changed the line in .config from 'm' to 'y' and recompiled the kernel using:
make -j3 all

But I don't see the change in dmesg and now I am stuck in this part.

Best Answer

  • exlud
    exlud Posts: 4
    Answer ✓
    Options

    Sorry I didn't know other alternative, but really not suggest to edit .config file directly, as the file itself said, "Automatically generated file; DO NOT EDIT."

    You can search by / in the menu, for example, /USB_VIDEO_CLASS says the dependency tree
    --Device Drivers
    --MEDIA_SUPPORT
    --MEDIA_USB_SUPPORT
    --USB_VIDEO_CLASS
    So in this case, single change of USB_VIDEO_CLASS expect to work. But in general case, change(especially add) a single entry in .config file may leave it's dependency wild.

    By the way, y (built-in to kernel image) and m (build as a module) controls how to build the module into the new image. But sudo modprobe uvcvideo searches modules in the current operating system, I guess that's why it works after reboot.
    Have you tried to insmod after make (set it as m), hope it can save you from an extra reboot.

Answers

  • amoghmc
    amoghmc Posts: 13
    Options

    Edit: After make -j3 I followed the rest of the instructions:

    sudo make modules_install install
    sudo modprobe uvcvideo
    dmesg | less | grep "changed"

    And I dint see any result!

  • amoghmc
    amoghmc Posts: 13
    Options

    Update: It seems to work ONLY IF I reboot my system but the course material says I don't need to reboot. Please tell me where I went wrong with my commands? This is the list of commands I executed:

    1. vim .config # to change CONFIG_USB_VIDEO_CLASS from 'm' to 'y'
    2. make -j6
    3. sudo make modules_install install
    4. sudo modprobe uvcvideo
    5. dmesg | less | grep "changed" # didn't work
    6. sudo reboot
    7. dmesg | less | grep "changed" # works now!

    Where did I go wrong?

  • exlud
    exlud Posts: 4
    Options

    @amoghmc said:
    In section 8: writing your first patch,
    I made the change to the uvc_driver.c by adding the following line

    pr_info("I changed uvcvideo driver in the Linux Kernel\n");

    Now how do I configure the module CONFIG_USB_VIDEO_CLASS=y?

    I would try make menuconfig

    I manually changed the line in .config from 'm' to 'y' and recompiled the kernel using:

    Suggest not to do that way,
    reason 1: change .config file directly may leave some dependencies untouched.
    reason 2: change from m to y has nothing to do with this issue.

    make -j3 all

    after this, you will have a ko file named like uvc.ko, insmod that ko

    But I don't see the change in dmesg and now I am stuck in this part.

  • amoghmc
    amoghmc Posts: 13
    edited January 25
    Options

    @exlud
    Is there an alternate way to configure modules? make menuconfig overwhelms with me with too many options, which is why I manually edited .config. Considering I only wanted to make a single change.

  • viveky120
    Options

    Hi amoghmc,
    Changing .config file manually is not a good idea. You may miss dependencies (if any).

Categories

Upcoming Training