You are not logged in.

#1 2020-07-16 07:10:00

pauledd
Member
Registered: 2019-12-14
Posts: 42

recompile custom kernel? [Solved]

Hi

I successfully configured, compiled and installed my custom kernel according to this article:
https://wiki.archlinux.org/index.php/Ke … ild_System

But how to recompile my kernel including "make menuconfig"? I do not mean to update the kernel source
from git, I just want to change a point in the .config and recompile and reinstall it.

If I again run makepkg -si  in my linux folder it just recreates the packages and installs them
but it does not offer me "make menuconfig" despite still configured in the PKGBUILD file:

...
prepare() {
...
make menuconfig
...

Last edited by pauledd (2020-07-17 14:25:18)

Offline

#2 2020-07-16 08:48:59

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: recompile custom kernel? [Solved]

I don't understand your question.  The included config is a guide, and if you uncomment the menuconfig step as you did, you are free to modify and if you save it, makepkg will compile using it.

Offline

#3 2020-07-16 09:07:15

pauledd
Member
Registered: 2019-12-14
Posts: 42

Re: recompile custom kernel? [Solved]

But makepkg does not call menuconfig nor recompile the kernel... it just uses my first build and creates the package and installs it...

In the meantime I forced a rebuild by running makepkg with the '-f' flag but that checked out git again and my old config was ereased by a new one...
No problem as I only changed two points in the kernel...

Offline

#4 2020-07-16 09:33:07

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: recompile custom kernel? [Solved]

pauledd wrote:

But makepkg does not call menuconfig nor recompile the kernel... it just uses my first build and creates the package and installs it...

In the meantime I forced a rebuild by running makepkg with the '-f' flag but that checked out git again and my old config was ereased by a new one...
No problem as I only changed two points in the kernel...

If you hard-coded a make menuconfig into your PKGBUILD, makepkg will absolutely run it.

Where you did you put your make menuconifig?
It will need to be after line 54: https://git.archlinux.org/svntogit/pack … /linux#n54

1) Post your PKGBUILD to https://pastebin.com/ or something and link it here.
2) Post the output of makepkg -sCf to https://pastebin.com/ or something and link it here.

EDIT: are you saying you want to dropin an already modified config and just build with it or are you saying you want to start from the distro default config and modify it with the menuconfig and build with it?

Last edited by graysky (2020-07-16 09:42:21)

Offline

#5 2020-07-16 09:48:04

pauledd
Member
Registered: 2019-12-14
Posts: 42

Re: recompile custom kernel? [Solved]

It will NOT invoke menuconfig NOR make if you DONT specify "-f" to makepkg, which I found out in my second post... But using "-f" will check out git again and my question was:

But how to recompile my kernel including "make menuconfig"? I do not mean to update the kernel source
from git, I just want to change a point in the .config and recompile and reinstall it.

You then could have simply suggest me  "use the -f flag to makepkg but this will pull git again and overwrite your config" and I would have been happy
but obviously I do my formulation of a question very incomprehensibly big_smile

Offline

#6 2020-07-16 09:53:34

pauledd
Member
Registered: 2019-12-14
Posts: 42

Re: recompile custom kernel? [Solved]

graysky wrote:

EDIT: are you saying you want to dropin an already modified config and just build with it or are you saying you want to start from the distro default config and modify it with the menuconfig and build with it?

~/build/linux/-+
               +--config
               \__PKGBUILD

I changed the PKGBUILD exactly according:
https://wiki.archlinux.org/index.php/Ke … _prepare() as I stated in my first post.

And yes, I will reuse my already changed .config and no I dont want to start from the distro default config. I want to remodify my already modified .config file in the same directoy as where the PKGBUILD file is located.

Offline

#7 2020-07-16 10:28:59

pauledd
Member
Registered: 2019-12-14
Posts: 42

Re: recompile custom kernel? [Solved]

Okay maybe I am just confused by how arch build system is made, I come from gentoo and we simply have a /usr/src/linux where we simply do a make && make modules_install ... thats all, the .config file stays the same with all changes I made and I can remodify it over and over again.

I guess with ARCH it is meant to create custom kernels from scratch every time including pulling the source from git.
I can live with that but just one question. I dont want to start with the .config from scratch. How can I use the config from my current
running kernel "zcat /proc/config.gz" for the new kernel? Where do I have to put the config so that PKGBUILD will recognize it instead of the one
pulled by git?

Last edited by pauledd (2020-07-16 10:29:24)

Offline

#8 2020-07-16 10:39:29

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,653
Website

Re: recompile custom kernel? [Solved]

If I again run makepkg -si  in my linux folder it just recreates the packages and installs them
but it does not offer me "make menuconfig" despite still configured in the PKGBUILD file:

Please include the full output you get to avoid confusion, but it sounds like you haven't incremented the pkgrel, and since you haven't told makepkg to overwrite the previously built package (see 'man makepkg') it is just telling pacman to install that.

Mod note: Moving to NC.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2020-07-16 11:05:57

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,401

Re: recompile custom kernel? [Solved]

I guess with ARCH it is meant to create custom kernels from scratch every time including pulling the source from git.

emphasis by me.

Use SRCDEST to avoid re-downloading / re-pulling sourcefiles from scratch, check man makepkg.conf for details .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2020-07-16 11:20:44

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

Re: recompile custom kernel? [Solved]

As noted above you could likely acheive your goal by incrementing the pkgrel, but I generally just go the manual route, e.g.:

cd src/linux<whatever>/
make menuconfig
cd ../..
makepkg -efi

Really though I use that type approach more with suckless tools when I'm modifying a config.h.  For my custom kernel I've actually found the "traditional approach" as it's called in the wiki far simpler - this may be due to my custom kernel not needing an initramfs, so a large portion of the packaging is irrelevant: I have no need for the pacman hooks or anything else to run mkinitcpio or to relocate kernels or initramfs images.  I just build the kernel, then copy it into /boot/.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2020-07-16 14:18:25

merlock
Member
Registered: 2018-10-30
Posts: 262

Re: recompile custom kernel? [Solved]

I haven't played too much with Arch custom kernels...but when I was running manjaro, all my kernels were custom.

What I did to keep the config the same (whether or not I used one of the kernel configurators (menuconfig/xconfig, etc) was to copy the .config file in the source directory back to my project directory.  The next run, it was copied back to the source directory prior to compiling.

Yes, it's hacky...but it worked.  This is what I did...you'll have to modify it for Arch (if it'll even work).

First, compile your kernel.  Go to your BUILDDIR, find the .config file, and copy it as .config_current (to the directory with the PKGBUILD  We are going to call this your _projdir).  If you want to increment your build number (as shown in uname) copy .version over, too.  In your _projdir, copy the original config file to something like config_orig, rename config_current to config.

Next, delete your BUILDDIR directory.

Edit your PKGBULD:

1.  After the ARCH=(x86_64) line, insert:

_projdir=$PWD

2.  Your new config should be copied over; comment out the line

make olddefconfig

replacing with

make menuconfig

if wanted.

3.  Add this as the last line in the build() function:

cp -u ".config" "${_projdir}/.config_current"

Just remember that config in your PKGBUILD dir will be the config used for the current compile.  MY BUILDDIR is in RAM, so it gets deleted every boot anyway, so I can't opine about setting a SRCDEST.


Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#12 2020-07-16 14:42:52

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,701

Re: recompile custom kernel? [Solved]

As an aside (merlock et al), I recommend that you also change the name of the kernel so that there is no confusion as to what kernel is running when you check it with uname.  And, so that you can keep a pacman controlled stock kernel installed along side your custom kernel without them stepping on each others modules, and so that pacman does not pitch a fit.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#13 2020-07-16 16:00:35

merlock
Member
Registered: 2018-10-30
Posts: 262

Re: recompile custom kernel? [Solved]

@ewaller, custom kernel name should be a given.  smile


Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#14 2020-07-17 14:24:52

pauledd
Member
Registered: 2019-12-14
Posts: 42

Re: recompile custom kernel? [Solved]

Alright, thanks for your suggestions. I think I'll go the @Trilby route next time I need to change the kernel.

Last edited by pauledd (2020-07-17 14:25:46)

Offline

Board footer

Powered by FluxBB