kernel compilation: generate modules.dep and map files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I am compiling linux kernel on Debian Stretch:



cd linux-4.9.59/
make menuconfig
make


so far so good.



normally, I would then issue make modules_install, to copy the modules to /lib/modules/.



But this kernel is intended for another machine, so I don't want to copy the modules locally. Besides, I am not compiling as root, so writing to /lib/modules/ would not work anyway.



export INSTALL_MOD_PATH="../MY_NEW_KERNEL"
mkdir -vp "$INSTALL_MOD_PATH

make modules_install


The above copies the newly compiled modules to directory ../MY_NEW_KERNEL/lib/modules/. But it does not generate the modules.dep and map files in ../MY_NEW_KERNEL/lib/modules/



Normally, if this was currently running kernel, I could run depmod to generate it in /lib/modules/. But I am not running this kernel on current machine.



And even when I copy bzImage and modules to the target machine, I would have to restart into the new kernel first, and then run depmod .



But the problem is, the kernel will not boot because it cannot find the modules, because I did not run depmod.



How can I run depmod for kernel modules, when the kernel is not currently running ?







share|improve this question
























    up vote
    2
    down vote

    favorite












    I am compiling linux kernel on Debian Stretch:



    cd linux-4.9.59/
    make menuconfig
    make


    so far so good.



    normally, I would then issue make modules_install, to copy the modules to /lib/modules/.



    But this kernel is intended for another machine, so I don't want to copy the modules locally. Besides, I am not compiling as root, so writing to /lib/modules/ would not work anyway.



    export INSTALL_MOD_PATH="../MY_NEW_KERNEL"
    mkdir -vp "$INSTALL_MOD_PATH

    make modules_install


    The above copies the newly compiled modules to directory ../MY_NEW_KERNEL/lib/modules/. But it does not generate the modules.dep and map files in ../MY_NEW_KERNEL/lib/modules/



    Normally, if this was currently running kernel, I could run depmod to generate it in /lib/modules/. But I am not running this kernel on current machine.



    And even when I copy bzImage and modules to the target machine, I would have to restart into the new kernel first, and then run depmod .



    But the problem is, the kernel will not boot because it cannot find the modules, because I did not run depmod.



    How can I run depmod for kernel modules, when the kernel is not currently running ?







    share|improve this question






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I am compiling linux kernel on Debian Stretch:



      cd linux-4.9.59/
      make menuconfig
      make


      so far so good.



      normally, I would then issue make modules_install, to copy the modules to /lib/modules/.



      But this kernel is intended for another machine, so I don't want to copy the modules locally. Besides, I am not compiling as root, so writing to /lib/modules/ would not work anyway.



      export INSTALL_MOD_PATH="../MY_NEW_KERNEL"
      mkdir -vp "$INSTALL_MOD_PATH

      make modules_install


      The above copies the newly compiled modules to directory ../MY_NEW_KERNEL/lib/modules/. But it does not generate the modules.dep and map files in ../MY_NEW_KERNEL/lib/modules/



      Normally, if this was currently running kernel, I could run depmod to generate it in /lib/modules/. But I am not running this kernel on current machine.



      And even when I copy bzImage and modules to the target machine, I would have to restart into the new kernel first, and then run depmod .



      But the problem is, the kernel will not boot because it cannot find the modules, because I did not run depmod.



      How can I run depmod for kernel modules, when the kernel is not currently running ?







      share|improve this question












      I am compiling linux kernel on Debian Stretch:



      cd linux-4.9.59/
      make menuconfig
      make


      so far so good.



      normally, I would then issue make modules_install, to copy the modules to /lib/modules/.



      But this kernel is intended for another machine, so I don't want to copy the modules locally. Besides, I am not compiling as root, so writing to /lib/modules/ would not work anyway.



      export INSTALL_MOD_PATH="../MY_NEW_KERNEL"
      mkdir -vp "$INSTALL_MOD_PATH

      make modules_install


      The above copies the newly compiled modules to directory ../MY_NEW_KERNEL/lib/modules/. But it does not generate the modules.dep and map files in ../MY_NEW_KERNEL/lib/modules/



      Normally, if this was currently running kernel, I could run depmod to generate it in /lib/modules/. But I am not running this kernel on current machine.



      And even when I copy bzImage and modules to the target machine, I would have to restart into the new kernel first, and then run depmod .



      But the problem is, the kernel will not boot because it cannot find the modules, because I did not run depmod.



      How can I run depmod for kernel modules, when the kernel is not currently running ?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 28 '17 at 22:48









      Martin Vegter

      1,00731110218




      1,00731110218




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          To answer your question, this should work. The System.map was created in the just-built source directory and is required:



          $ depmod -b "$INSTALL_MOD_PATH" -F System.map 4.9.59


          Where 4.9.59 is your new non-running kernel's version.



          Now, even the plain vanilla linux kernel source allows to build debian packages.



          $ make help|grep deb
          deb-pkg - Build both source and binary deb kernel packages
          bindeb-pkg - Build only the binary kernel deb package


          e,g: Instead of make and make modules_install (as normal user, root isn't needed):



          stretch-amd64:~/linux-source-4.13.10$ make bindeb-pkg -j4


          [... way later ...]



          stretch-amd64:~/linux-source-4.13.10$ $ ls -1 ../*4.13.10*deb
          ../linux-headers-4.13.10_4.13.10-1_amd64.deb
          ../linux-image-4.13.10_4.13.10-1_amd64.deb
          ../linux-libc-dev_4.13.10-1_amd64.deb


          Of course this might require a few additional debian packages, like dpkg-dev, fakeroot and a few related, but if the destination is a debian too, that's then perhaps easier to install it there.






          share|improve this answer






















          • that works. Thank you.
            – Martin Vegter
            Oct 29 '17 at 13:36










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401138%2fkernel-compilation-generate-modules-dep-and-map-files%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          To answer your question, this should work. The System.map was created in the just-built source directory and is required:



          $ depmod -b "$INSTALL_MOD_PATH" -F System.map 4.9.59


          Where 4.9.59 is your new non-running kernel's version.



          Now, even the plain vanilla linux kernel source allows to build debian packages.



          $ make help|grep deb
          deb-pkg - Build both source and binary deb kernel packages
          bindeb-pkg - Build only the binary kernel deb package


          e,g: Instead of make and make modules_install (as normal user, root isn't needed):



          stretch-amd64:~/linux-source-4.13.10$ make bindeb-pkg -j4


          [... way later ...]



          stretch-amd64:~/linux-source-4.13.10$ $ ls -1 ../*4.13.10*deb
          ../linux-headers-4.13.10_4.13.10-1_amd64.deb
          ../linux-image-4.13.10_4.13.10-1_amd64.deb
          ../linux-libc-dev_4.13.10-1_amd64.deb


          Of course this might require a few additional debian packages, like dpkg-dev, fakeroot and a few related, but if the destination is a debian too, that's then perhaps easier to install it there.






          share|improve this answer






















          • that works. Thank you.
            – Martin Vegter
            Oct 29 '17 at 13:36














          up vote
          2
          down vote



          accepted










          To answer your question, this should work. The System.map was created in the just-built source directory and is required:



          $ depmod -b "$INSTALL_MOD_PATH" -F System.map 4.9.59


          Where 4.9.59 is your new non-running kernel's version.



          Now, even the plain vanilla linux kernel source allows to build debian packages.



          $ make help|grep deb
          deb-pkg - Build both source and binary deb kernel packages
          bindeb-pkg - Build only the binary kernel deb package


          e,g: Instead of make and make modules_install (as normal user, root isn't needed):



          stretch-amd64:~/linux-source-4.13.10$ make bindeb-pkg -j4


          [... way later ...]



          stretch-amd64:~/linux-source-4.13.10$ $ ls -1 ../*4.13.10*deb
          ../linux-headers-4.13.10_4.13.10-1_amd64.deb
          ../linux-image-4.13.10_4.13.10-1_amd64.deb
          ../linux-libc-dev_4.13.10-1_amd64.deb


          Of course this might require a few additional debian packages, like dpkg-dev, fakeroot and a few related, but if the destination is a debian too, that's then perhaps easier to install it there.






          share|improve this answer






















          • that works. Thank you.
            – Martin Vegter
            Oct 29 '17 at 13:36












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          To answer your question, this should work. The System.map was created in the just-built source directory and is required:



          $ depmod -b "$INSTALL_MOD_PATH" -F System.map 4.9.59


          Where 4.9.59 is your new non-running kernel's version.



          Now, even the plain vanilla linux kernel source allows to build debian packages.



          $ make help|grep deb
          deb-pkg - Build both source and binary deb kernel packages
          bindeb-pkg - Build only the binary kernel deb package


          e,g: Instead of make and make modules_install (as normal user, root isn't needed):



          stretch-amd64:~/linux-source-4.13.10$ make bindeb-pkg -j4


          [... way later ...]



          stretch-amd64:~/linux-source-4.13.10$ $ ls -1 ../*4.13.10*deb
          ../linux-headers-4.13.10_4.13.10-1_amd64.deb
          ../linux-image-4.13.10_4.13.10-1_amd64.deb
          ../linux-libc-dev_4.13.10-1_amd64.deb


          Of course this might require a few additional debian packages, like dpkg-dev, fakeroot and a few related, but if the destination is a debian too, that's then perhaps easier to install it there.






          share|improve this answer














          To answer your question, this should work. The System.map was created in the just-built source directory and is required:



          $ depmod -b "$INSTALL_MOD_PATH" -F System.map 4.9.59


          Where 4.9.59 is your new non-running kernel's version.



          Now, even the plain vanilla linux kernel source allows to build debian packages.



          $ make help|grep deb
          deb-pkg - Build both source and binary deb kernel packages
          bindeb-pkg - Build only the binary kernel deb package


          e,g: Instead of make and make modules_install (as normal user, root isn't needed):



          stretch-amd64:~/linux-source-4.13.10$ make bindeb-pkg -j4


          [... way later ...]



          stretch-amd64:~/linux-source-4.13.10$ $ ls -1 ../*4.13.10*deb
          ../linux-headers-4.13.10_4.13.10-1_amd64.deb
          ../linux-image-4.13.10_4.13.10-1_amd64.deb
          ../linux-libc-dev_4.13.10-1_amd64.deb


          Of course this might require a few additional debian packages, like dpkg-dev, fakeroot and a few related, but if the destination is a debian too, that's then perhaps easier to install it there.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 29 '17 at 16:06









          GAD3R

          22.7k154895




          22.7k154895










          answered Oct 28 '17 at 23:59









          A.B

          3,4901621




          3,4901621











          • that works. Thank you.
            – Martin Vegter
            Oct 29 '17 at 13:36
















          • that works. Thank you.
            – Martin Vegter
            Oct 29 '17 at 13:36















          that works. Thank you.
          – Martin Vegter
          Oct 29 '17 at 13:36




          that works. Thank you.
          – Martin Vegter
          Oct 29 '17 at 13:36

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401138%2fkernel-compilation-generate-modules-dep-and-map-files%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay