Jump to content

How to setup an environment to build custom kernel modules


matrzh

Recommended Posts

This may be a somewhat stupid question, but I just cannot find anything about it.

  • I have custom-compiled the kernel for Allwinner A20/cubietruck as described here on a Virtual Box Ubuntu 18.04
  • Once done, I took the *.deb files out of output/debs, copied it to the machine and installed them.  Everything worked fine and so far so good B).   But the "build" directory on the host with the compile.sh script is surprisingly empty.
  • However, if I want to cross compile an additional kernel module on the virtual machine, how do I set this up?  Is it enough to "make" with CROSS-COMPILE=arm-linux-gnueabihf-?  or do I also need to somehow consider the linaro stuff in cache/toolchains?   (the arm-linux-gnueabihf files are all in the /usr/bin of the host machine)
  • I also want to reference some header-files (*.h) from the drivers sources, etc. can I copy the directory /usr/src/linux-headers-4.14....-sunxi? What happens if I extract the linux-source-next-sunxi_5.66_all.deb file to the virtual host machine?
  • Also as a side note: if I want to recompile to enable an additional module, what do I do to use the old kernel configuration as a base?  When I run "compile.sh" again, I get the choice to choose "cubietruck" again, but it starts from zero and does not consider any options I had previously disabled or changed.

 

The reason, I am doing this, is that I am upgrading from a legacy kernel and I have some custom modules to control peripherals here and here, that I want to adapt to the new kernel.

Link to comment
Share on other sites

No. But I am still at the stage to set up a decent IDE, so that I can include header files for other kernel drivers etc.  I do not believe that the modules will just compile, the gpio is handled differently in the new kernel and I would actually like to explore the code a bit (without changing it).  The *.h files will probably suffice to see what definitions exist.

Actually, I would just have to know where the sources are, after compile.sh is being run.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines