error message "-mrecord-mcount" when cross-compile out of kernel module

Viewed 325

I'm trying to build an out-of-kernel module and cross-compile it. So, I'm working on VM, Ubuntu, and I upgraded the running kernel to 5.15.6.

Now, I'm trying to cross-compile my very simple "Hello world" module. Its Makefile is simply:

obj-m += yanivModule.o

and the building command is:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /lib/modules/5.15.6/build/ M=$PWD modules

and I keep running into this error message:

arm-linux-gnueabihf-gcc: error: unrecognized command line option ‘-mrecord-mcount’; did you mean ‘-frecord-marker=4’?

Does anyone know what "-mrecord-mcount" means how to fix it?

I tried to disable the "CONFIG_FTRACE_MCOUNT_RECORD" and "CONFIG_HAVE_FTRACE_MCOUNT_RECORD" configuration flag as I read somewhere it might be related (and by name it actually might be), but it didn't solve the error.

I'm kind of lost here since in the tutorial video I'm following, it's done with no issues at all.

Update: I managed to fix the issue, but I'm not sure why it got fixed that way, and why the way I described before didn't work. I downloaded the kernel of beaglebone board from github: https://github.com/beagleboard/linux/tree/5.10 and then built it using:

  1. make ARCH=arm bb.org_defconfig
  2. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- C /home/.../beaglebone-linux-5.10/ M=$PWD modules

and only then, building the module, when -C is the new downloaded kernel tree - has succeeded with no issues.

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /home/.../beaglebone-linux-5.10/ M=$PWD modules

So now, I'm left with 2 questions:

  1. What, step fixed the issue and what was missing from the previous way I tried? was it using the bb.org_defconfig configuration file?
  2. Why this bb.org_defconfig configuration file is missing from the latest Linux kernel source tree?
0 Answers
Related