You are not logged in.

#1 2020-03-11 21:54:46

WhyDoWeWonder
Member
Registered: 2020-02-15
Posts: 17

Compiling linux kernel for another distro on Arch

I've managed to compile a kernel for Arch Linux but I'd like to compile one on my Arch computer for Debian or Ubuntu. What would I have to do (assuming both systems are x86_64)? What files would I have to copy over to where and what would I have to change in the grub config on the target machine?

Last edited by WhyDoWeWonder (2020-03-11 21:55:03)

Offline

#2 2020-03-11 22:04:05

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Compiling linux kernel for another distro on Arch

Kernels don't really depend on much of anything at all. You just need to have:

  • your /lib/modules/ subdirectory named what "uname -r" would report if you booted the kernel (install it into ./staging-directory via `make INSTALL_MOD_PATH="$PWD/staging-directory" modules_install`)
    This *must* be installed into /lib/modules on your destination Debian system.

  • the vmlinuz file itself (located via "make -s image_name").
    This can be copied literally anywhere, as long as the bootloader is told to use it. For grub, see https://wiki.archlinux.org/index.php/Us … figuration and pass the filename to the "linux" command in grub.cfg

Note it is complicated to build a .deb package on archlinux, so this would be deployed via cp, which is a bit awkward. You'd need to e.g. `depmod <uname_r>` yourself (and any other management goop which might normally be performed by package manager hooks or triggers maintenance scripts or what-have-you).

Last edited by eschwartz (2020-03-12 01:16:57)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2020-03-12 00:57:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: Compiling linux kernel for another distro on Arch

Do you have different configs for these two kernels?  If not, there should be no need to compiled another on for debian.  You compiled a kernel, just copy it wherever you need it.  Or even just have a single kernel used to boot both systems if they are on the same machine.  They'd have different initramfs's and different root parameters, but the kernel can be shared.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2020-03-12 01:16:25

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Compiling linux kernel for another distro on Arch

Trilby wrote:

Or even just have a single kernel used to boot both systems if they are on the same machine.  They'd have different initramfs's and different root parameters, but the kernel can be shared.

True enough, though you might need to have two copies of the /lib/modules/<uname_r>/ directory, one for each OS partition.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2020-03-15 16:18:47

WhyDoWeWonder
Member
Registered: 2020-02-15
Posts: 17

Re: Compiling linux kernel for another distro on Arch

I'm already lost, I copied the bzImage kernel file over ssh with scp. What do I have to do to my /lib/modules/<name_of_kernel>? Do I just copy it over ssh with scp to /lib/modules?

Offline

Board footer

Powered by FluxBB