Linux Kernel Modules between different kernel patches - linux

I am running into a issue with RH7 kernels. We are running RH6/Centos6 based systems - we normally compile the kernel module once (Centos6.6) and we could install the kernel module on another Centos kernel in the same series (say Centos6.4).
With Centos7 (3.10 kernel) I cannot build the kernel module with says 3.10.0-329 (Centos7.2) kernel and install on a kernel version 3.10.0-227 (Centos7.1) - insmod returns invalid format.
Anyone run into similar issues - are there any workarounds.
Thanks
--
Jimmy

Probably, you want a binary blob - ready-made object file which is part of the module. Look into kernel documentation for know how to build module which uses binary blobs. – Tsyvarev

Related

hcidump binary not found

I'm setting up the BlueZ protocol stack on a custom system using linux 3.3. I'm using buildroot to setup the filesystem, and specifically am using BlueZ-4.101.
I'm attempting to use the hcidump utility to get some logs, but the binary has not been installed.
I've checked that:
Device driver is installed in kernel
BlueZ Utils is enabled in buildroot .config file
Other utilities work, such as hcitool or hciconfig
Going into the Makefile in output/build/bluez_utils-4.101 it would appear that the object file hcidump.o is being compiled into a binary called btmon.
Further investigation would reveal that in Makefile, btmonis assigned to am__EXEEXT_10, and that is then assigned to the variable noinst_PROGRAMS.
So this is where I'm at. I'm pretty sure that this is an automatically generated Makefile by buildroot. I'm not sure how these files are generated, thus I'm unsure as to why btmon is being assigned to the noinst_PROGRAMS variable.
In summary, I believe that my version of BlueZ uses a binary btmon instead of hcidump. btmon is compiled (binary seen at output/build/bluez_utils-4.101/monitor/btmon), but not being installed onto my target system because of instructions in Makefile.
My best guess would something weird about compatibility between my kernel version and bluez. Any suggestions would be greatly appreciated!
In BlueZ 4, hcidump was distributed as a separate package, bluez-hcidump. This has never been packaged in buildroot, however. So either create your own package for bluez-hcidump, or switch to BlueZ 5. BleuZ 5 is provided by buildroot starting from 2014.08.

Install 2.4.33 kernel in Debian Wheezy

I need to install old kernel into Kali (Debian like) distro. I need to run program which requires older kernel.
I downloaded kernel but the installation gives me too many errors. I was reading similar topics and watch the videos, but so far I am not successful.
I do not have experience with kernels. Is there .deb package for kernels or any other easier way to do it?
Can I use such old kernel for this distribution?
Thank you
The 2.4.33 kernel is pretty old. According to Debian's packaging files installing that old a kernel doesn't seem to be doable in wheezy. Attempting to install and run an old kernel outside the packaging system is not going to to work. All the "modern" libraries and applications will be broken when running the 2.4 kernel, as will the program (you need more than just a kernel for your program). If it were me, I'd set up a virtualization environment like VirtualBox or something similar and pick an old distro like CentOS 3.9 or an older Debian release (sarge or later). If that's not an option, you could always try and port the program to a more recent kernel.

Kernel Code : where can I find and how to debug the kernel

Recently I have installed Ubuntu 12.04 LTS ISO image in my desktop. Below is the output of the kernel version I have installed:
# uname -r
3.5.0-41-generic
I am trying to develop a VFS and want the kernel source code version '3.5.0-41-generic' for reference purpose - where can I find the same?
What are the excellent kernel debugging options looking at logs and mapping them to kernel code?
How and which debugger I can use to debug a live kernel flow execution?
Are there ways I can add more printk methods and re-modify the modules? Say I want to know how a FS mount method works - I can modify the required FS code (adding more printk functions) re-compile and reload the modules. Now with aid of my new printk functions I can understand the flow
Why don't you install vanilla 3.5 kernel and try to develop on it?
As a kernel debugger you can use kGDB or just printk.
But... I suggest you to test your vfs on linux running on qemu. Qemu is able to debug the running linux - so you can connect gdb to it and debug the whole emulating system.

How to distribute kernel modules using a RPM?

What is the recommended approach for distributing a kernel module using a RPM? Ideally, for portability, I would like the RPM to be able to build the modules against the running kernel's headers before installing.
I've used Dynamic Kernel Module Support or DKMS before to distribute a Linux driver targeting multiple kernel versions (2.6.31-37). DKMS itself is a collection of bash scripts that can automate both the building and rebuilding of a kernel module based on the current installed version of Linux. You can distribute drivers as either RPM or DEB files which contain the driver source, DKMS scripts, and optionally, binary versions of the driver tied to particular kernel versions.

About compiling Linux kernel in Debian Live

This is my first time compiling Linux kernel. I am using Debian Live. I used kernel-package to compile and I also added a new system call to return an arbitrary integer value greater than zero.
Everything went fine and I got both headers and image .deb files. When I tried to install them with dpkg, there was a warning that said I needed to configure LILO. I then aborted the installation and looked for LILO to find out that Debian Live got neither LILO nor GRUB. I installed GRUB, but it was not installed on my sda1 (USB disk running Debain Live), it said that it was not a proper block device. Debian Live uses squashfs (a file system).
Then, I ignored bootloader and installed the custom kernel. After I rebooted my computer, I was directly booted to the old Debain Live and my system call returns -1.
Please provide some solutions guys.
Thanks,
Debian Live is not a suitable base for you do to your own kernel development on. As you've found, it doesn't contain the tools needed to rebuild itself (that's not what its designed to do).
Install the regular Debian distribution (perhaps inside a virtualisation environment like VMWare Server or VirtualBox). Do your kernel development there.

Resources