From: Kai Krakow <hurikha...@gmail.com>
Sent: Thursday, December 28, 2017 4:58 PM
To: gentoo-user@lists.gentoo.org
Cc: Spam Account
Subject: [gentoo-user] Re: Using an old kernel .config as the basis for a new 
.config

Am Thu, 28 Dec 2017 15:05:04 -0500 schrieb Jack:

> On 2017.12.28 14:52, Alan Mackenzie wrote:
>> Hello, Gentoo.
>>
>> Having just built linux-4.14.7-gentoo, suddenly a new version of the
>> kernel, linux-4.14.8-gentoo-r1 has become stable.  Configuring a kernel
>> from scratch is a repetitive drudge.
>>
>> There is some way of initialising a new kernel .config from an existing
>> one, I am sure, but I can't find it.  I've looked at the Gentoo wiki,
>> I've looked at (some of) the kernel's own documentation.  The nearest I
>> can find is make oldconfig, which supposedly does what I want, but it
>> just seems to start off with a default .config and go through the
>> hundreds of questions one at a time.
>>
>> So, would some kind soul please tell me how to get my old .config into
>> a new one properly.  Thanks!
>
> You need to copy your old .config into the new kernel source directory.
> "make oldconfig" then uses those values, and only asks you about new
> items.  It sounds like it was asking about everything because it didn't
> have the old file as a starting point - so was starting from scratch.

You actually even don't have to copy the old config file as long as the
currently running system provides the config you want to migrate.

You can just run

# make oldconfig

and it will figure out the config, looking at the current directory
first. It will then interactively ask for each new config option. You can
type "?" at each step to get a description. This is the way I do it.

I only copy a .config file if I want a specific known base configuration.

You can then run

# make menuconfig

to further fine-tune your decisions, or

# make localmodconfig

to disable modules not currently loaded. You should double-check it
didn't disable important stuff. Take a backup of .config first, then run
a diff. If in doubt, leave an option enabled as module.


# make olddefconfig

Doesn't ask questions but instead uses defaults. I wouldn't recommend
this if you are already running optimized manual configs.


There are many more (and interesting ones), have a look at

# make help


You can also "emerge -a kergen" and let it build a .config based on and
optimized for your hardware, tho it didn't work too well for me. You may
want to double check what it does, and then manually change the config.
You can also use it to migrate configs between kernel upgrades.


--
Regards,
Kai

Replies to list-only preferred.

________________________________________
If you were a genkernel user I'd say what I normally do is copy the current 
kernel config to match the name scheme of the new kernel / version:

➜  kernels ls -l
total 4452
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-4.10.10-aufs
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-4.10.11-aufs
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-4.10.12-aufs
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-4.10.13-aufs
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-4.10.14-aufs
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-4.10.15-aufs
-rw-r--r-- 1 root root 183894 May 22  2017 kernel-config-x86_64-4.10.8-aufs
-rw-r--r-- 1 root root 183894 May 22  2017 kernel-config-x86_64-4.10.9-aufs
-rw-r--r-- 1 root root 168142 May 22  2017 kernel-config-x86_64-4.4.52-aufs
-rw-r--r-- 1 root root 168109 May 22  2017 kernel-config-x86_64-4.4.65-aufs
-rw-r--r-- 1 root root 168109 May 22  2017 kernel-config-x86_64-4.4.66-aufs
-rw-r--r-- 1 root root 176132 Aug  3 16:36 kernel-config-x86_64-4.4.67-aufs
-rw-r--r-- 1 root root 181019 Sep 12  2016 kernel-config-x86_64-4.6.3-gentoo
-rw-r--r-- 1 root root 182663 Oct  2  2016 kernel-config-x86_64-4.7.3-gentoo
-rw-r--r-- 1 root root 178168 Nov 17  2016 kernel-config-x86_64-4.8.0-gentoo
-rw-r--r-- 1 root root 178213 Dec 25  2016 kernel-config-x86_64-4.8.9-gentoo
-rw-r--r-- 1 root root 180503 Jan 13  2017 kernel-config-x86_64-4.9.0-gentoo
-rw-r--r-- 1 root root 180737 Mar 28  2017 kernel-config-x86_64-4.9.10-gentoo
-rw-r--r-- 1 root root 181246 May 22  2017 kernel-config-x86_64-4.9.16-aufs
-rw-r--r-- 1 root root 180734 May 14  2017 kernel-config-x86_64-4.9.16-gentoo
-rw-r--r-- 1 root root 181246 May 22  2017 kernel-config-x86_64-4.9.25-aufs
-rw-r--r-- 1 root root 181246 May 22  2017 kernel-config-x86_64-4.9.26-aufs
-rw-r--r-- 1 root root 181246 May 22  2017 kernel-config-x86_64-4.9.27-aufs
-rw-r--r-- 1 root root 180654 Feb  8  2017 kernel-config-x86_64-4.9.2-gentoo
-rw-r--r-- 1 root root 183895 May 22  2017 kernel-config-x86_64-linux-aufs ➜  
kernels

then after copying the file from the old version to a new version I just run 
`genkernel all` and that usually works just fine. Sometimes some options can 
get missed if the option name changes but it's rarely ever a problem; you 
usually find out pretty quick. I have changed some options in genkernel. If 
you'd like to try this for yourself you can probably also start with `zcat 
/proc/config.gz > /etc/kernels/kernel-config-<version_format_here> also here is 
my genkernel.conf: 

OLDCONFIG="yes"
MENUCONFIG="no"
CLEAN="yes"
MRPROPER="yes"
MOUNTBOOT="yes"
SAVE_CONFIG="yes"
USECOLOR="yes"
MAKEOPTS="$(portageq envvar MAKEOPTS)"
LVM="yes"
LUKS="yes"
GPG="yes"
BUSYBOX="yes"
MDADM="yes"
MDADM_CONFIG="/etc/mdadm.conf"
E2FSPROGS="yes"
BTRFS="yes"
FIRMWARE_DIR="/lib/firmware"
DISKLABEL="yes"
SPLASH_THEME="gentoo"
TMPDIR="/tmp/genkernel"
BOOTDIR="/boot"
GK_SHARE="${GK_SHARE:-/usr/share/genkernel}"
CACHE_DIR="/var/cache/genkernel"
DISTDIR="${GK_SHARE}/distfiles"
LOGFILE="/var/log/genkernel.log"
LOGLEVEL=3
DEFAULT_KERNEL_SOURCE="/usr/src/linux"
DEFAULT_KERNEL_CONFIG=/root/my_kernel_config
ALLRAMDISKMODULES="1"
COMPRESS_INITRD="yes"
COMPRESS_INITRD_TYPE="best"

Reply via email to