How to compile the mainline Kernel the Manjaro way

I may be but we’ll see. I copied over a known working 4.16.9 .config and updated it to 4.17.4. So we’ll see if I can boot. It was stopping at the ramdisk part- which is normally a really simple thing to fix but I’m about to reboot to find out.

I can’t get past “loading initial ramdisk” during bootup. I don’t know if this is due to my config or due to something within the makepkg setup. I may continue this tomorrow.

Yes, most probably a config problem.
Stick as close to the official config as possible and only make small changes at a time (unless you know what you’re doing). Also it’s better to start from a 4.17 config, not from 4.14.

2 Likes

Please post text when it’s possible to do so. There are several reasons, including: text is searchable; text uses less space on the server; text is zoomable; text is searchable; images can be more difficult to read for people with less then perfect eyesight.

1 Like

@joelf I took your path from debian derived kernels to Manjaro a couple years ago. At the time, I just needed a few config options enabled and a few additional hardware patches so that my device was usable. I still build both sets of kernels, but the recent mainline kernels work well enough for my device.

For me, the only way I got a kernel working was to start with the Manjaro config. From the project directory I used

makepgk -o

to set up the working directory and apply the patches and generate the standard Manjaro .config. Then I used “make menuconfig” (or whatever) to set the .config options I needed. After adjusting the .config I continued the build with

makepkg -ef

which compiles and packages the kernel. Then I saved the new .config from the working directory and modified the PKGBUILD to use my new config instead of the standard Manjaro config.

Debian and Arch seem to use a few incompatible options, so it doesn’t work to just copy and paste one to the other. Diff or Meld can help identify the relevant differences. Using localmodconfig, the diff will have a lot more “noise”. You’ll probably need to diff your .config with a standard debian .config and you might want to look at a diff of debian and manjaro. The Manjaro standard config is pretty good, and I have backported some of those settings to my debian style kernels.

Anyway, that was my experience. Good Luck, you seem to be well on your way!

2 Likes

Good point.
If you integrate it with a local git repo, you have even more control, also with patches.

1 Like

Oh noes! Did I use 4.14? I did git clone https://aur.archlinux.org/linux-mainline.git and used that as my reference config file collection! I’m not sure where to get the PKGBUILD for 4.17.x (I’m using 4.17.4)

I’m giving it another try with a more recent collection of configuration files. Fingers crossed!!

It’s not pure vanilla mainline, but I think it would be a better idea to start either with the official Arch version here:
https://www.archlinux.org/packages/core/x86_64/linux/

or use the Manjaro linux417 as a base:

The linux-mainline from AUR is 4.18, which is still in RC phase. If you use that config, use it for 4.18 only.

2 Likes

I prefer the 4.17.4 but it seems like the one from the Manjaro GIT is just 4.17.0 and I wonder if it’s trying to find 4.17.4 modules. Whatever the case is, I can now ALMOST boot to the desktop with the new Kernel but I cannot go any further than the CLI (recovery mode). I can get to the part where I drop down to the shell, password, then CLI. I tried to reinstall the Nvidia driver because that has been an issue in the past with Ubuntu but it said that it was already installed.

From the current gitlab linux417 PKGBUILD

pkgbase=linux417
pkgname=('linux417' 'linux417-headers')
_kernelname=-MANJARO
_basekernel=4.17
_basever=417
_aufs=20180430
_bfq=v8r12
_bfqdate=20180531
_sub=4
pkgver=${_basekernel}.${_sub}

The version is 4.17.4.
You could edit the PKGBUILD to
_sub=6
to pick up the newest maintenance release (4.17.6)
Just run updpkgsums to update your linux417 project sources.

2 Likes

Ughhh. I had no idea that was what _sub= was for! Well, that makes sense. I could try it.

1 Like

Ok, mine already has _sub=4 and I’m using 4.17.4 and it didn’t work. I’ll look at the logs and do some more research. I’m almost there though.

Sanity check here:

I download the kernel, extract it, then I place all the PKGBUILD configuration files and scripts into that directory, modify just PKGBUILD, then run makepkg -sri ? Am I correct here?

That should work. My experience is with makepkg -f. I build on a desktop for a low powered 2-in-1. Takes about 25 minutes instead of a few hours on the target machine. The -f makes a couple of tarballs that can be installed with sudo pacman -U linux417*.tar.xz

Anyway, the process is the same. Grab the linux417 project, unzip it (or git it), edit the PKGBUILD, updpkgsums and then makepkg, all from within the project directory.

This sounds a little bit wrong. Because the kernel you downloaded and extracted will not be used. It doesn’t matter if it is there, so it is not really wrong but unnecessary.

Just create a folder, put all files form the Gitlab page in there (or just do a git clone) and edit all files you want to change. For example the PKGBUILD file if you don’t want all the Manjaro patches or change the config.x86_64 if you want a diffrent config for a x86_64 Kernel. Then run updpkgsums and makepkg with the appropriate options, for example makepkg -sri
The makepkg will download, extract, patch and then build the Kernel, with the -i option also install. There is no reason for you to manually download and extract the Kernel.

3 Likes

Xabbu, that is where I am now. Thank you for the clarification. Things seem to go well but when I attempt to boot it says “loading initram” and nothing. Just stops there. I’ve had this before but I could always find the problem using make xconfig. Here, nothing seems to work. I copied and pasted into the CONFIG file my working .config. I will have to try again tomorrow.

I don’t think you can use a straight debian “working” config in a Manjaro kernel. Unless your system didn’t boot with the Manjaro liveUSB, try just building a standard Manjaro kernel first. You need validate your build environment. There are a few details that need to be right and hardly anybody remembers all of them once their system has been building kernels for awhile!

Once you can build a working standard kernel, then you can start experimenting.

I think that’s what I was using. The .config is what I created using make xconfig. Otherwise, it was all Manjaro. :frowning:

Humor me. Start with the stock Manjaro config (no modifications). Build a standard Manjaro kernel and see if it boots. I seem to recall that you have a fast AMD with a ton of cores. It should take under 10-15 minutes. Once that works, then you’ll only have to worry about your config edits (or your patches) if your modified kernel doesn’t boot.

1 Like

Forum kindly sponsored by