This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to create linux header right in "lib/modules"

Hello,

When compile modules " make modules_install INSTALL_MOD_PATH=.", I got "lib/modules/build" and "lib/modules/source" both point to Linux kernel folder on my Linux build host.

What should I do to make it portable in creating independent "build" and "source", ie. not point to Linux build host ?

Thanks,

~Duy-Ky

  • Do you want to build the module with just linux headers and not with source ?

    Actually we have to provide the "rootfs" path when you use the following command.

    Ex:
    make modules_install INSTALL_MOD_PATH=/media/rootfs
  • I did just that and found 2 folder "build" and "source" point to linux folder on Linux build machine!~
    How to fix it ?
    Thanks,

    ~Duy-Ky
  • Hi,
    You would get only "lib" folder when you do "modules_install"
    Use the following command and make sure.
    mkdir ./tmp
    make modules_install INSTALL_MOD_PATH=./tmp ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-



    When compile modules " make modules_install INSTALL_MOD_PATH=.", I got "lib/modules/build" and "lib/modules/source" both point to Linux kernel folder on my Linux build host.

    From your command, you are saving those modules information in current directory (.) which is linux source directory, so please note that we have also "lib" directory in linux source , it could lead to some understanding problem, create tmp directory and copy that module information to there.
  • I did what you recommended, but still have the same problem.

    Here's what it looks

    tmp

       lib

          modules

             3.12.10-ti2013.12.01

                build -> linux-folder

                 source-> linux-folder

               kernel

                  ..............

                  ..............

    I'm using Ubuntu-12

    Thanks,

     

    ~Duy-Ky

     

     

     

     

  • Hi,
    You can modify the "modules_install" in Makefile of Linux source.

    Try to comment out the "ln -s" lines like below.

    # Target to install modules
    PHONY += modules_install
    modules_install: _modinst_ _modinst_post

    PHONY += _modinst_
    _modinst_:
    @rm -rf $(MODLIB)/kernel
    @rm -f $(MODLIB)/source
    @mkdir -p $(MODLIB)/kernel
    # @ln -s $(srctree) $(MODLIB)/source
    @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
    rm -f $(MODLIB)/build ; \
    # ln -s $(objtree) $(MODLIB)/build ; \
    fi
    @cp -f $(objtree)/modules.order $(MODLIB)/
    @cp -f $(objtree)/modules.builtin $(MODLIB)/
    $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
  • It works now

    Thanks so much, Titusrathinara

    ~Duy-Ky

  • Thanks for your update.