Welcome to the Linux Foundation Forum!

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

Posts: 13
edited January 2024 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.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Best Answer

  • Posts: 4
    Answer ✓

    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

  • Posts: 13

    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!

  • Posts: 13

    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?

  • Posts: 4

    @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.

  • Posts: 13
    edited January 2024

    @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.

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

  • Posts: 3
    edited August 2024

    Hey, I just encountered the same thing.

    All you have to do it update grub and boot into the "dirty" version.

    I realized that after running ll /boot and noticing that the most up to date image has no longer the original name.

    Simply put: you have to boot into the most up to date version of your Kernel:

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training