[nSLUG] The .config file for compiling a kernel

Dave Flogeras dflogeras2 at gmail.com
Wed Mar 11 11:01:54 ADT 2015


I also highly recommend doing an out-of-tree build when you are
experimenting, it makes it very easy to start over if you wish to get
back to a known state without polluting your src tree. It also means
you can configure and build as a normal user (always a bad idea to run
X/gui tools as root).  Finally, it's nice if you keep multiple build
configurations for the same kernel.  You only have one copy of the
src/ dir, but multiple build dirs; one for each config.

Start in your /usr/src/linux directory (or wherever your sources are installed):
- make O=/path/to/some/place/to/build defconfig (that's a capital oh, not zero)
- cd /path/to/some/place/to/build
- cp /my/known/good/oldconfig .config
- make oldconfig

Everything else (make/make modues/make install) can now be done in the
out-of-tree dir.  The only thing you may have to do if building 3rd
party kernel modules against your new config (like nvidia, virtualbox
drivers), just specify KBUILD_OUTPUT=/path/to/some/place/to/build
before running configure/make for those.  You generally only need to
do this if you aren't currently running the new kernel, otherwise
/lib/modules/XYZ/build symlink will point it in the right direction.

HTH

On Wed, Mar 11, 2015 at 9:04 AM, Baha Baydar <bbaydar at gmail.com> wrote:
> And yes, you do want to use "make oldconfig" once you have the old .config
> file in the new kernel source directory.
>
> I don't know of any menu/gui options that work with oldconfig though. (Not
> saying they don't exist, just that I'm unaware of them)
>
> On Wed, Mar 11, 2015 at 2:28 AM, Mike Spencer <mspencer at tallships.ca> wrote:
>>
>>
>> I want to compile a new kernel.  The source doesn't come with a
>> ./.config file. I don't know what most of the options are/mean so
>> if I do the basic "make config" command, I'll be blindly responding to
>> dozens of "...if unsure, say {yes,no}" suggestions.
>>
>> What I'd like to to have just the same config as presently in use
>> excepting for any new items.  It is, after all, in the hope that the
>> newer kernel will support presently unsupported hardware that I'm
>> doing this.
>>
>> The README says one of the config options is:
>>
>>      "make oldconfig"   Default all questions based on the contents of
>>                         your existing ./.config file and asking about
>>                         new config symbols.
>>
>> which sounds like what I want.
>>
>> Except that there is no ./.config in the root directory of the new source
>> code.  I infer that I need to put one there.
>>
>> But where do I get it?
>>
>> There is a .config in /usr/src/linux-3.10.17:
>>
>>   /usr/src/linux-3.10.17:
>>
>>   -rw-r--r--   1 root root 141822 Oct 23  2013 .config
>>
>> But over in /boot, I have 4 versions of the kernel (owner fields
>> elided for readability):
>>
>>     lrwxrwxrwx  1  28 Aug 16  2014 vmlinuz -> vmlinuz-huge-smp-3.10.17-smp
>>     -rw-r--r--  1  3088656 Oct 23  2013 vmlinuz-generic-3.10.17
>>     -rw-r--r--  1  3272208 Oct 23  2013 vmlinuz-generic-smp-3.10.17-smp
>>     -rw-r--r--  1  5995104 Oct 23  2013 vmlinuz-huge-3.10.17
>>     -rw-r--r--  1  6251392 Oct 23  2013 vmlinuz-huge-smp-3.10.17-smp
>>
>> with 4 corresponding config files:
>>
>>     lrwxrwxrwx  1       27 Aug  8  2014 config ->
>> config-huge-smp-3.10.17-smp
>>     -rw-r--r--  1   140912 Oct 23  2013 config-generic-3.10.17
>>     -rw-r--r--  1   141822 Oct 23  2013 config-generic-smp-3.10.17-smp
>>     -rw-r--r--  1   140912 Oct 23  2013 config-huge-3.10.17
>>     -rw-r--r--  1   141822 Oct 23  2013 config-huge-smp-3.10.17-smp
>>
>> LILO boots /boot/vmlinuz which is a link to vmlinuz-huge-smp-3.10.17-smp.
>>
>> But the .config in the /usr/src tree is the same as the generic-smp
>> one in /boot, not the same as the huge-smp one in /boot. So the
>> .config in /usr/src seems not to match the kernel that I'm actually
>> running.
>>
>> You can (crudely) verify that from file sizes in the listings above.
>>
>> So I don't understand how this works or which .config I should copy to
>> the new kernel-source dir in order to use make oldconfig.
>>
>> Is there an obvious answer -- obvious to y'all that have presumably
>> done this many times before?
>>
>>
>> Tnx,
>> - Mike
>>
>> --
>> Michael Spencer                  Nova Scotia, Canada       .~.
>>                                                            /V\
>> mspencer at tallships.ca                                     /( )\
>> http://home.tallships.ca/mspencer/                        ^^-^^
>> _______________________________________________
>> nSLUG mailing list
>> nSLUG at nslug.ns.ca
>> http://nslug.ns.ca/mailman/listinfo/nslug
>
>
>
>
> --
> Baha Baydar                      http://www.hyperion.org
> bbaydar at gmail.com           http://www.hal-con.com
>
>
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/mailman/listinfo/nslug
>


More information about the nSLUG mailing list