Missing headers for kernel in bzImage loaded on qemu

765 views Asked by At

I am trying to compile a kernel module of kernel version 3.2.0 on a linux kernel bzImage loaded on a qemu emulator, however I am getting the following error: /lib/modules/3.2.0/build no such file or directory. I tried to look up solutions over the net but nothing specific related to solve this for a kernel image being loaded over qemu. The command I issue to load the bzImage on qemu is qemu/qemu-system-x86_64 -m 2G -kernel ../linuxkernel/arch/x86/boot/bzImage -hda ../../sid.ext2 -append "root=/dev/sda"

1

There are 1 answers

2
Tsyvarev On BEST ANSWER

bzImage only contain kernel's image, it doesn't contain files needed for build modules.

You should:

  1. Find kernel headers(with some files built), corresponded to you kernel, and install them to directory, to which /lib/modules/3.2.0/build points.
  2. Or build kernel from the sources by hands. In that case reference /lib/modules/<kernel-version>/build will point to your compiled source files automatically.