Why modules and initramfs needs to be rebuilt after rebuilding patched linux kernel and make bzImage not enough

186 Views Asked by At

I build the linux kernel on one machine and install it to another machine using generated *.deb (make deb-pkg; dpkg -i *.deb) packages. Other machine has Ubunut or Xubuntu 22.04 (x86_64)

Then I modify one of the internal (static, not exportable) kernel functions, lets say /mm/sparce.c sparse_init(). The only change is adding a funciton like pr_info() to dump more information into dmesg log.

Because the only changed function is a function, that is not exportable, I expect, that make bzImage is enough to test change. Because target machine has identical kernel, initramfs, modules, etc.

So I compile the kernel using "make bzImage" and copy it as vmlinuz to another machine (where all deb packages have been previously installed and it boots, no problem).

But after this replacement, the other machine can not boot anymore. It stops somewhere in initramfs/busybox console with timeout waiting for root device UUID.

So, my question - why?

Of course if I rebuild everything (make deb-pkg) and then install new kernel to target machine - it wokrs. I see expected message from pr_info() in dmesg.

I've tried to regenerate initramfs image on the development machine. For this, I've compiled kernel using:

make -j10 make install_modules make install

and then copied both /boot/vmlinuz,initramfs images to target machine. Does not help. So, it looks like /lib/modules should also be copied ..

0

There are 0 best solutions below