# Consistency in kernel compilation:  Need tips.

## 1clue

Hi,

I have a problem with kernel consistency.  I keep dropping features from one version to the next, and some other features seem to creep in.

I'm on the verge of writing a tool, but I want to make sure that some other tool doesn't exist already.  Here's my intended process:

```

make defconfig

unset_banned

set_wanted

```

So rather than 'make oldconfig' which tries to copy your entire config from the last version, I want to take whatever the current default config is, because for the most part I don't care.

To start, I would make a kernel config with 'make defconfig' on my current setup.  Then I would go through and set things the way I want, and save that kernel separately.

Once I do that, I'm thinking to diff the default config with the new one, and break that diff up into 2 parts:  The things I turned off into one file and the things I turned on into another.

Then my two scripts (or two steps of the same script?) would apply the changes I want and, most importantly, complain if something I expected isn't there.

Does somebody already have this?  Hate to spend the time if it's already out there.

Thanks.

----------

## krinn

why not make silentoldconfig?

Anything new will be add as default

----------

## NeddySeagoon

1clue,

Copy .config from one kernel to the next.

In the new kernel, run 

```
make oldconfig
```

This will silently drop any options that no longer exist in the new kernel, port over your existiting settings and ask you how to set any new options.

----------

## Tony0945

One simple script

```
#! /bin/bash

zcat /proc/config.gz >/root/config.now

cp /root/config.now /usr/src/linux/.config

cd /usr/src/linux

make oldconfig

cp .config /root/config.new

genkernel --menuconfig --install --kernel-config=/root/config.new  --bootloader=grub all

```

If you don't use genkernel, just substitute your usual commands. This will work fine starting with a kernel that has CONFIG_IKCONFIG=y and

CONFIG_IKCONFIG_PROC=y These store a copy of your configuration in the kernel where they are available as /proc/config.gz

When you emerge gentoo-sources a new default .config is set. Using this trick you can be sure you are starting from your existing working config instead of the default.Last edited by Tony0945 on Sun Jan 04, 2015 12:34 am; edited 1 time in total

----------

## The Doctor

 *1clue wrote:*   

> So rather than 'make oldconfig' which tries to copy your entire config from the last version, I want to take whatever the current default config is, because for the most part I don't care.

  This seems mutually exclusive to me. If you don't care, I would think that make oldnoconfig would be ideal for you and if you do care, make oldconfig followed by some diffing would seem to be the way to go.

----------

## 1clue

Problems with oldconfig:

I don't want it to silently drop old values. I want to get yelled at by the script so I can find out what happened and how to get the same functionality in the new kernel.

oldconfig takes the old values no matter what they were whenin most cases i want the default for the new kernel.

there are some values I want to keep, for drivers and functionality I need. The rest I want the default 

----------

## i92guboj

So you want a script that sometimes will use defaults and some other times will use value inherited from a previous config... This obviously won't work at all unless you have a consistent condition or criterion upon which to base when to go in one way or the opposite one.

Other than loosely grepping values and editing with sed I see no way to do what you want in an automated fashion. I don't know of a way to set CONFIG_ options at the make command line, and I am not taking into account the fact that a given driver or option might have different dependencies in two kernel versions, so, to do this correctly, you would need a way to ensure that the configuration is sane...

----------

## NeddySeagoon

1clue,

In response to your points.

1. Its very rare that there are any issues with dropping old config values.

They go through a depreciation stage first, so you tend to notice.

e.g. dmesg warnings.

2. Seems confused.  How do you know you want the defaults, when you don't know what they are?

You also assume the defaults are sane on your arch, which is not true. 

Do you recall the kernel that shipped with a default of PCI off for x86 and amd64?

3. is a subset of 2

None of this avoids the need to sanity check for the bare minimum you need to boot, but I've rarely seen problems.

----------

## 1clue

I thought we were past irrational defaults for defconfig.

I used kernel-seeds for awhile but since that no longer seems to be maintained I'm trying to avoid hours long kernel config sessions. I can read the help but that doesn't always make clear if the functionality is needed in a normal server or workstation.

It seems that every time I monkey around with the settings I lose something I wanted to be in there.

I guess what I'm after is going to have to be based on oldconfig rather than defconfig. I still want a script to force on certain settings so i can run it after I manually mess with menuconfig.

I guess it's time to dust off my sed and awk skills.

----------

## NeddySeagoon

1clue,

Don't mess with the .config file with a text editor or text processor. Ever.

The warning at the top means what it says.

The problem is that some menuconfig options fllp several flags in the .config file.

If you only get some of a group, you will have an illegal config file that often causes hard to find kernel bugs.

The config utilites flip the groups properly - if not, thats a kernel bug.  If you mess up, you may get a broken kernel in a way that's not obvious.

You will need to take into account the sets and depends on in the kernel

----------

## 1clue

I guess that makes the scripting part easier. I can at least grep the .config for settings I want and have it complain when they're wrong.

----------

## EmaRsk

1clue, if you really want to go with your idea, you may want to look at scripts/config in the kernel source.

It's a bash script to set/unset options from the command line. I have no idea if it's robust enough and I never used it, I just found about it in some tutorial, but I suppose you could make a script with

```
./scripts/config --disable SOME_OPTION

./scripts/config --enable SOME_OTHER_OPTION

./scripts/config --module SOMETHING_ELSE
```

----------

## 1clue

Oh, my goodness!

I'll research it and see how good it is, but if that works then this is EXACTLY what I want.

Thanks.

----------

