Create First Kernel compile on Endeavour OS

Hi Community,

i am new to Endeavor OS always had curiosity about an Arch Linux like OS but never tried until i came across Endeavour OS and i have to say i am by now very impressed i installed the hole system in under 30 minutes on my Lenovo 250 and it works fast and like a charm,well that was a extensive introduction I AM SORRY:-)

i have as always in Linux after i installed an Distro right after install compiled my own kernel,by now i have only worked with Debian.

i followed this Arch Linux Tutorial Kernel Copile tutorial to get me to the point where i can modify the kernel compile the modules install the modules and copy the new custom vmlinuz kernel to the /boot folder so basically.

make menuconfig
make modules
make modules_install
make bzImage

and the last step for me until the problems started cp -v arch/x86/boot/bzImage /boot/vmlinuz-linuxAB

Then all other steps is where the problems started like:
cp /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/linuxAB.preset NO mkinitcpio of course no .preset nowhere

NO Grub nothing in /boot

then i discovered what i didn’t know ,something called DRACUT never heard of that one,i am stuck guys no initramfs creation nothing, i am stuck i need help i searched googled ,watched youtube found nothing what i was looking for, i need help for the last steps.

thanks for any reply

Manually installing a kernel will be a bit annoying.

You should package your kernel using a PKGBUILD and then everything will “just work”

I should note that it is possible to do it manually if you really want to. You don’t even need to mess around with the presets.

The basic steps are:

  • Move the kernel to /efi instead of /boot
  • Call dracut to build the initrd
  • Add an entry in /efi/loader/entries (This only needs to happen once)

As an example, here is a PKGBUILD I use to create an ARM aarch64 kernel for Pinebook Pro.

Then click on PKGBUILD to see the PKGBUILD itself.

This results in a vanilla kernel with zero patches, just as it offers it. Except this is just compiled to aarch64.

This produces a pacman .pkg.tar.zst package that can be installed with
sudo pacman -U full-name-of-package

This takes right at 40 minutes to compile on a Radxa ROCK 5B.


Thank you Dalto,
Thank you Pudge,

for you suggestions

Dalto it wasn’t 100% clear for me what your where referring too,so i ended up destroying the system, it did not find my vmlinuz kernel at boot time,and did not boot up again .

Well i reinstalled the hole system again this time in under 6 minutes i am still amazed :slight_smile:

here we go again i will download a kernel source again configure my own kernel and compile it we will see this time ,i have being reading alot of your posts so i am confident i will get to the point where i have success.

i have looked into PKGBUILD it just annoyed me i can not accept that it is such an pain to just install a freshly compiled kernel.

But i have looked into Dracut and i understand now

i do not accept that i don’t have the liberty to download my own copy of the kernel from modify it and compile it afterwards install it so that my modified kernel will boot up so i can use Endevour OS how i like it.

i am still motivated i don’t mind reinstalling 100 times the OS until i succeed this Lenovo Thinkpad 250 is just for that purpose to experiment with it .

i will keep you all updated

best regards


You can do whatever you want. It is just a question of how easy or hard it is.

A PKGBUILD is just the instructions on how to build a package. You can create a PKGBUILD that pulls the kernel source from and builds it to your specifications. If you do that, you will benefit from all our automation and everything will “just work”. It will also make it very easy to deal with as new kernels get released as you will have an easy way to build them with your configs in a semi-automated fashion.

Ok lets Go

i spend the last 48 hours figuring out how to compile a kernel on an Arch Distro called Endeavour OS.

First of all thank you @dalto and @Pudge for your suggestions.

you @dalto where absolutely right about PKGBUILD ones i figured out how that works i was able to edit one i found and use it.

in the last 48 hours i had so many failures trying to get my kernel compiled and installed with the PKGBUILD file i can tell you it was indeed a challenge.

well first of all, for all other users that want to try it themselves to configure and compile there own kernels here some steps to follow before messing around with the PKGBUILD

1. create a folder in my case i named it “kernelbuild” mkdir ~/kernelbuild
2. Download your kernel source from extract it into the new created folder “kernelbuild”
3. extract the actual .config file form your system and copy it inside the new created “kernelbuild” folder, do this in an terminal cd into the “kernelbuild” folder and type zcat /proc/config.gz > .config
4. Put your PKGBUILD file outside the “kernelbuild” folder,i got my PKGBUILD file from here → PKGBUILD of course edit it to your needs.

here is the PKGBUILD file i edited and used:

# Maintainer: Jan Alexander Steffens (heftig) <>


  # htmldocs

_srcname=/PATH/FOLDER_NAME_TO_YOUR_DOWNLOADED_KERNEL_SOURCE_FOLDER/kernelbuild/linux-6.7.4 # Adjust this if using a different kernel source

prepare() {
    cd $_srcname

    make mrproper                                                       #Beautiful lets Go
    make clean                                                          #Another One
    make menuconfig # Optionally, configure your kernel                 #make menuconfig of course i like a nice GUI
    make -j$(nproc) # Compile the kernel                                #Takes care of your CPU Cores i have to adjust this took me 4 hours to complete

export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase

prepare() {
  cd $_srcname

  echo "Setting version..."
  echo "-$pkgrel" > localversion.10-pkgrel
  echo "${pkgbase#linux}" > localversion.20-pkgname

  local src
  for src in "${source[@]}"; do
    [[ $src = *.patch ]] || continue
    echo "Applying patch $src..."
    patch -Np1 < "../$src"

  echo "Setting config..."
  make menuconfig
  make -s kernelrelease > version
  echo "Prepared $pkgbase version $(<version)"

build() {
  cd $_srcname
  make all
  make htmldocs

_package() {
  pkgdesc="The $pkgdesc kernel and modules"
    'wireless-regdb: to set the correct wireless channels of your country'
    'linux-firmware: firmware images needed for some devices'

  cd $_srcname
  local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

  echo "Installing boot image..."
  # systemd expects to find the kernel here to allow hibernation
  install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"

  # Used by mkinitcpio to name the kernel
  echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"

  echo "Installing modules..."
    DEPMOD=/doesnt/exist modules_install  # Suppress depmod

  # remove build link
  rm "$modulesdir"/build

_package-headers() {
  pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"

  cd $_srcname
  local builddir="$pkgdir/usr/lib/modules/$(<version)/build"

  echo "Installing build files..."
  install -Dt "$builddir" -m644 .config Makefile Module.symvers \
    localversion.* version vmlinux
  install -Dt "$builddir/kernel" -m644 kernel/Makefile
  install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
  cp -t "$builddir" -a scripts

  # required when STACK_VALIDATION is enabled
  install -Dt "$builddir/tools/objtool" tools/objtool/objtool

  # required when DEBUG_INFO_BTF_MODULES is enabled
  install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids

  echo "Installing headers..."
  cp -t "$builddir" -a include
  cp -t "$builddir/arch/x86" -a arch/x86/include
  install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s

  install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h

  install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h

  install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h

  install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h

  echo "Installing KConfig files..."
  find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;

  echo "Removing unneeded architectures..."
  local arch
  for arch in "$builddir"/arch/*/; do
    [[ $arch = */x86/ ]] && continue
    echo "Removing $(basename "$arch")"
    rm -r "$arch"

  echo "Removing documentation..."
  rm -r "$builddir/Documentation"

  echo "Removing broken symlinks..."
  find -L "$builddir" -type l -printf 'Removing %P\n' -delete

  echo "Removing loose objects..."
  find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete

  echo "Stripping build tools..."
  local file
  while read -rd '' file; do
    case "$(file -Sib "$file")" in
      application/x-sharedlib\;*)      # Libraries (.so)
        strip -v $STRIP_SHARED "$file" ;;
      application/x-archive\;*)        # Libraries (.a)
        strip -v $STRIP_STATIC "$file" ;;
      application/x-executable\;*)     # Binaries
        strip -v $STRIP_BINARIES "$file" ;;
      application/x-pie-executable\;*) # Relocatable binaries
        strip -v $STRIP_SHARED "$file" ;;
  done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)

  echo "Stripping vmlinux..."
  strip -v $STRIP_STATIC "$builddir/vmlinux"

  echo "Adding symlink..."
  mkdir -p "$pkgdir/usr/src"
  ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"

_package-docs() {
  pkgdesc="Documentation for the $pkgdesc kernel"

  cd $_srcname
  local builddir="$pkgdir/usr/lib/modules/$(<version)/build"

  echo "Installing documentation..."
  local src dst
  while read -rd '' src; do
    install -Dm644 "$src" "$dst"
  done < <(find Documentation -name '.*' -prune -o ! -type d -print0)

  echo "Adding symlink..."
  mkdir -p "$pkgdir/usr/share/doc"
  ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"

for _p in "${pkgname[@]}"; do
  eval "package_$_p() {
    $(declare -f "_package${_p#$pkgbase}")

# vim:set ts=8 sts=2 sw=2 et:

of course adjust/edit the PKGBUILD file to your needs

type makepkg -si --skipinteg in the terminal

i use make menuconfig to configure the kernel,after your done configuring the kernel ,save and exit the configuration ,sit back and wait until everything is finished.

i hope i could help beginners a little bit .
forgive my English,its not my native language.

i have learned a lot ,failing while trying is not a weakness it just make you better ,just never give up.

Best regards


1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.