3

I want to build my Linux kernel on my host and use it in my VWware virtual machine. They both use the same Ubuntu kernel now.

On my Host, I do make and make configure. Then, what files should I copy to the target machine, before I do make modules_install and make install?

What other things do I need to do?

4

The 'best' way to do this, is building it as a package. You can then distribute and install it to any Ubuntu machine running the same (major) version.

For building vanilla kernels from source, there's a tool make-kpkg which can build the kernel as packages. Other major advantages: easy reverting by just removing the package, automatic triggers by the package management such as rebuilding DKMS, etc.

The Ubuntu community wiki on Kernel/Compile Alternate Build Method provides a few steps on how to do that.

Basically, it's just the same as building the kernel from upstream documentation, but instead of having make blindly installing it on your system, have it build in a 'fake root' environment and make a package out of it, using

fakeroot make-kpkg --initrd --append-to-version=-some-string-here \
  kernel-image kernel-headers

This should produce binary .deb files which you will be able to transfer to other machines and install it using

dpkg -i mykernelfile-image.deb mykernelfile-headers.deb ...
| improve this answer | |
2

I would comment on gertvdijk's answer but I don't have enough rep to comment.

I don't know if any of that is necessary now that rpm-pkg, deb-pkg, snap-pkg are viable targets for make.

So with Ubuntu, I'd imagine you'd like to use

make bindeb-pkg

(use make deb-pkg if you need to include source)

on RPM distros (RHEL, Fedora, CentOS) you'd use rpm-pkg/binrpm-pkg

see the Kernel Packaging section of make help for all options

Kernel packaging:
    rpm-pkg             - Build both source and binary RPM kernel packages
    binrpm-pkg          - Build only the binary kernel RPM package
    deb-pkg             - Build both source and binary deb kernel packages
    bindeb-pkg          - Build only the binary kernel deb package
    snap-pkg            - Build only the binary kernel snap package (will connect to external hosts)
    tar-pkg             - Build the kernel as an uncompressed tarball
    targz-pkg           - Build the kernel as a gzip compressed tarball
    tarbz2-pkg          - Build the kernel as a bzip2 compressed tarball
    tarxz-pkg           - Build the kernel as a xz compressed tarball
    perf-tar-src-pkg    - Build perf-5.2.0.tar source tarball
    perf-targz-src-pkg  - Build perf-5.2.0.tar.gz source tarball
    perf-tarbz2-src-pkg - Build perf-5.2.0.tar.bz2 source tarball
    perf-tarxz-src-pkg  - Build perf-5.2.0.tar.xz source tarball
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.