Compiling enough of the kernel to get symbols for EXTMODs, but no more

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a problem where I seem to need to compile the kernel twice, and
I am looking for a way to not have to repeat any compilation steps.

I have an embedded system kernel into which I'm bundling an initramfs.
That initramfs contains some modules that must be compiled external to
the kernel (due to my vendor's funky build system).  Before I do that
I must compile the kernel, so that the external module compilation can
insert the kernel symbols into mymodule.mod.c.  But after the module
is compiled, I must install it into the initramfs and recompile the
kernel.

I want the kernel to contain a bundled initramfs to simplify
distribution.  But I would rather not compile the kernel twice.  I'm
wondering if there is a target in the kernel makefile that will allow
me to compile just enough of the kernel such that when I compile the
external module it gets the proper symbols.

I tried something like this:

  make -C $(LINUX) prepare scripts
  make -C $(LINUX) M=$(PATH_TO_MY_MODULE) modules
  cp $(PATH_TO_MY_MODULE)/mymodule.ko $(PATH_TO_MY_ROOTFS_STAGING)/lib
  make -C $(LINUX) CONFIG_INITRAMFS_SOURCE=$(PATH_TO_MY_ROOTFS_STAGING)

but after booting that kernel, mymodule.ko would not load because it
was missing the proper symbols.  When I look at the file
$(PATH_TO_MY_MODULE)/mymodule.mod.c, the block assigned to
section("__versions") is empty.  

Apparently I need to compile more than just "prepare scripts" in my
first step.  I find that this works:

  make -C $(LINUX) CONFIG_INITRAMFS_SOURCE=$(PATH_TO_MY_ROOTFS_STAGING)
  make -C $(LINUX) M=$(PATH_TO_MY_MODULE) modules
  cp $(PATH_TO_MY_MODULE)/mymodule.ko $(PATH_TO_MY_ROOTFS_STAGING)/lib
  make -C $(LINUX) CONFIG_INITRAMFS_SOURCE=$(PATH_TO_MY_ROOTFS_STAGING)

But that has some redundancy that I want to avoid.  Is there a build
target that I could use for my first step that goes far enough in
building the kernel, but doesn't actually do the step of marshalling
the initramfs and linking it into the kernel?

Thanks,
Dave



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux