[SOLVED] Provide kernel source for 4.15.0-37 generic kernel

vini_gajjar
vini_gajjar New Member Posts: 11
edited May 2019 in UP Squared Linux

Hello folks,
I can see here https://wiki.up-community.org/Linux_Kernels that the kernel sources for 4.9 and 4.12 are provided, but not for 4.15.
It is much required to modify few modules and drivers and to recompile them.
Does someone know where to find it .
the kernel source for 4.15.0-37 generic is found no where on kernel.org

Comments

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    From your UP board, once you have installed the UP specific Ubuntu Kernel 4.15: https://wiki.up-community.org/Ubuntu

    sudo apt-get source linux-hwe

    Also you can find instructions to build the kernel using Ubuntu tools here:
    https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel#Build_Environment

  • vini_gajjar
    vini_gajjar New Member Posts: 11

    @DCleri
    Thank you for your valuable repsonse.
    Just another question.
    Is the kernel source that is downloaded using above command specific for up board or is it generic ??
    Moreover, if I pick a specific ".ko" module from this new source and copy it to /lib/modules/4.15.0-37-generic/kernel/drivers/... , will it be completely okay and not cause me version mismatch error ??

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @vini_gajjar

    The kernel is a generic version for all UP family boards. The drivers are adapted for each board specially.

    You should be able to send any module to /lib/modules without problems.

    You can try these steps:
    sudo cp .ko /lib/modules/4.15.0-37-generic/kernel/drivers/
    sudo echo '' | sudo tee -a /etc/modules
    sudo depmod -a 4.15.0-37-generic

  • vini_gajjar
    vini_gajjar New Member Posts: 11

    hello @ccalde ,
    I downloaded kernel source using "sudo apt-get source linux-hwe", I performed following steps entering the root of kernel source.

    make mrproper
    cp /boot/config-4.15.0-37-generic .config
    make oldconfig
    make prepare
    make scripts
    make SUBDIRS=$drivers/usb/gadget/legacy modules
    cp drivers/usb/gadget/legacy/g_mass_storage.ko /lib/modules/4.15.0-37-generic/kernel/drivers/usb/gadget/legacy/
    depmod -a 4.15.0-37-generic
    modprobe g_mass_storage file= removable=1

    This caused an error as "version magic 4.15.18 SMP mod_unload should be 4.15.0-37-generic SMP mod_unload"

    For this I modified a line in /usr/src/linux-hwe-4.15.0/include/generated/utsrelease as,
    define UTS_RELEASE "4.15.18" to #define UTS_RELEASE "4.15.0-37-generic"

    Now the module can be successfully loaded

    The reason to post this comment is to verify whether the above steps are valid ??

  • vini_gajjar
    vini_gajjar New Member Posts: 11

    @DCleri Can you please check with the above comment

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @vini_gajjar ,

    Yes, that makes sense for me!

  • vini_gajjar
    vini_gajjar New Member Posts: 11

    Thank you folks. Your comments helped me a lot and may help many.

  • vini_gajjar
    vini_gajjar New Member Posts: 11

    @DCleri @ccalde
    Folks, I need a help with this.
    I compiled the module and loaded as per above discussions
    But after loading the module, when check kernel logs using dmesg, I read this.

    Loading Out-of-Tree kernel module taints kernel.
    Module verification failed - Signature mismatch taints kernel

    Although modified module is loaded successfully and the system is stable.
    Is the above message a serious problem
    Is kernel tainting unacceptable

    I'll appreciate if you can help me with this

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @vini_gajjar

    That shouldn't be an issue for your kernel.
    It seems a warning message about the signature for verification, due to the manual loading.