All of lore.kernel.org
 help / color / mirror / Atom feed
* Difference between config, menuconfig and defconfig
@ 2016-09-19  5:43 Madhu K
  2016-09-19  6:53 ` Andrea D'Amore
  2016-09-19 14:58 ` Aruna Hewapathirane
  0 siblings, 2 replies; 8+ messages in thread
From: Madhu K @ 2016-09-19  5:43 UTC (permalink / raw)
  To: kernelnewbies

Hi All,

I am Kernel newbie, I want to know the difference between config,
menuconfig and defconfig.

Thanks,
Madhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/52dca43f/attachment.html 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19  5:43 Difference between config, menuconfig and defconfig Madhu K
@ 2016-09-19  6:53 ` Andrea D'Amore
  2016-09-19 10:50   ` Madhu K
  2016-09-19 14:58 ` Aruna Hewapathirane
  1 sibling, 1 reply; 8+ messages in thread
From: Andrea D'Amore @ 2016-09-19  6:53 UTC (permalink / raw)
  To: kernelnewbies

On 19 September 2016 at 07:43, Madhu K <madhu.sk89@gmail.com> wrote:
> I am Kernel newbie, I want to know the difference between config, menuconfig
> and defconfig.

Check the configuring and building chapter of book "Linux Kernel in a
Nutshell" by Greg Kroah-Hartman who's on this list.


-- 
Andrea

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19  6:53 ` Andrea D'Amore
@ 2016-09-19 10:50   ` Madhu K
  2016-09-19 13:29     ` Valdis.Kletnieks at vt.edu
  0 siblings, 1 reply; 8+ messages in thread
From: Madhu K @ 2016-09-19 10:50 UTC (permalink / raw)
  To: kernelnewbies

Hi,

Thanks for your response,

I have gone through "Linux Kernel in a Nutshell" by Greg Kroah-Hartman.

What he states in that book is :

Default Configuration Options:
Every kernel version comes with a ?default? kernel configuration. This
configuration is loosely based on the defaults that the kernel maintainer
of that architecture feels are the best options to be used.

That means kernel maintainer will define default configuration for his
architecture not for all architecture, I mean kernel maintainer might have
defined configuration for x86, not for ARM, POWERPC and all, is my
understanding correct?, if not please correct me.

Thanks
Madhu

On Mon, Sep 19, 2016 at 12:23 PM, Andrea D'Amore <and.damore@gmail.com>
wrote:

> On 19 September 2016 at 07:43, Madhu K <madhu.sk89@gmail.com> wrote:
> > I am Kernel newbie, I want to know the difference between config,
> menuconfig
> > and defconfig.
>
> Check the configuring and building chapter of book "Linux Kernel in a
> Nutshell" by Greg Kroah-Hartman who's on this list.
>
>
> --
> Andrea
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/87c742af/attachment.html 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19 10:50   ` Madhu K
@ 2016-09-19 13:29     ` Valdis.Kletnieks at vt.edu
  0 siblings, 0 replies; 8+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2016-09-19 13:29 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 19 Sep 2016 16:20:12 +0530, Madhu K said:

> That means kernel maintainer will define default configuration for his
> architecture not for all architecture, I mean kernel maintainer might have
> defined configuration for x86, not for ARM, POWERPC and all, is my
> understanding correct?, if not please correct me.

There's more than one defconfig file.  Even more than one per architecture.
For many, there's a separate defconfig for each board:

[/usr/src/linux-next] for i in arch/*/configs; do echo -n "$i: "; find $i -name '*defconfig' | wc -l; done
arch/arc/configs: 15
arch/arm/configs: 112
arch/arm64/configs: 1
arch/avr32/configs: 15
arch/blackfin/configs: 29
arch/c6x/configs: 5
arch/cris/configs: 4
arch/h8300/configs: 3
arch/hexagon/configs: 1
arch/ia64/configs: 6
arch/m32r/configs: 12
arch/m68k/configs: 19
arch/metag/configs: 4
arch/microblaze/configs: 2
arch/mips/configs: 61
arch/mn10300/configs: 2
arch/nios2/configs: 2
arch/openrisc/configs: 1
arch/parisc/configs: 8
arch/powerpc/configs: 99
arch/s390/configs: 4
arch/score/configs: 1
arch/sh/configs: 56
arch/sparc/configs: 2
arch/tile/configs: 2
arch/um/configs: 2
arch/unicore32/configs: 1
arch/x86/configs: 2
arch/xtensa/configs: 6

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/97d5c99b/attachment.bin 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19  5:43 Difference between config, menuconfig and defconfig Madhu K
  2016-09-19  6:53 ` Andrea D'Amore
@ 2016-09-19 14:58 ` Aruna Hewapathirane
  2016-09-19 17:13   ` Valdis.Kletnieks at vt.edu
  1 sibling, 1 reply; 8+ messages in thread
From: Aruna Hewapathirane @ 2016-09-19 14:58 UTC (permalink / raw)
  To: kernelnewbies

Hi Madhu,

make config:
Is a text-based configuration. The options are prompted one after another.
All options need to be answered,
and out-of-order access to former options is not possible. Try this *once*
so you have the experience but after that stay away just too much work and
grief.

make menuconfig:
An ncurses-based pseudo-graphical menu (only text input). Navigate through
the menu to modify the
desired options. Within menuconfig, use the / key to search modules by name.

make defconfig:
Generates a new config with default from the ARCH supplied defconfig file.
Use this option to get back the
default configuration file that came with the sources.

There are lot's of other options read the section under configuration
targets: https://www.kernel.org/doc/makehelp.txt

Hope this helps.

Aruna

On Mon, Sep 19, 2016 at 1:43 AM, Madhu K <madhu.sk89@gmail.com> wrote:

> Hi All,
>
> I am Kernel newbie, I want to know the difference between config,
> menuconfig and defconfig.
>
> Thanks,
> Madhu
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/79d93b9d/attachment.html 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19 14:58 ` Aruna Hewapathirane
@ 2016-09-19 17:13   ` Valdis.Kletnieks at vt.edu
  2016-09-19 20:02     ` Aruna Hewapathirane
  0 siblings, 1 reply; 8+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2016-09-19 17:13 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 19 Sep 2016 10:58:35 -0400, Aruna Hewapathirane said:

> make menuconfig:
> An ncurses-based pseudo-graphical menu (only text input). Navigate through
> the menu to modify the
> desired options. Within menuconfig, use the / key to search modules by name.

Actually, / searches (in a case-insensitive manner, so feel free to
type in lower case) for CONFIG_WHATEVER variables, not modules.

The distinction is important for 2 reasons:

1) Sometimes, the config variable that controls building a module
isn't the uppercase version of the module name.  It's rare, but does
happen.  For example, a Fedora 4.3.0 kernel has 2,739 =m entries in its
.config.  Of those:

[/lib/modules/4.3.0-0.rc0.git14.1.fc24.x86_64] for i in `grep =m /boot/config-4.3.0-0.rc0.git14.1.fc24.x86_64 |  sed -e 's/^CONFIG_//' -e 's/=m$//' | tr 'A-Z' 'a-z'`; do find . -name ${i}.ko.xz; done | wc -l
531
Only 531 are the lowercase of the config name.

[/lib/modules/4.3.0-0.rc0.git14.1.fc24.x86_64] for i in `grep =m /boot/config-4.3.0-0.rc0.git14.1.fc24.x86_64 |  sed -e 's/^CONFIG_//' -e 's/=m$//' | tr '_A-Z' '-a-z'`; do find . -name ${i}.ko.xz; done | wc
593
And some more have underscores changed to dashes (CONFIG_FOO_BAR -> foo-bar.ko)

And the *majority* of them play games of one form or another:

obj-$(CONFIG_BATTERY_OLPC)      += olpc_battery.o
obj-$(CONFIG_BLK_DEV_LOOP)     += loop.o
obj-$(CONFIG_LOOPBACK_TARGET)        += tcm_loop.o
obj-$(CONFIG_NVME_TARGET_LOOP)           += nvme-loop.o

and so on...

2) It's also good for finding yes/no variables that don't control
building a module. For example:

CONFIG_ALLOW_DEV_COREDUMP=y

> make defconfig:
> Generates a new config with default from the ARCH supplied defconfig file.
> Use this option to get back the
> default configuration file that came with the sources.

Actually, that *won't* get you back "the config that came with the sources".
If you look in a release source tarball from kernel.org, there *isn't* a
.config in there, you need to create one somehow (copying a distro .config
and then running 'make localmodconfig' is a popular choice).

And there's no guarantee that 'make defconfig' will re-create whatever
your distro shipped - in fact, it probably *won't* do so, because distros
rarely, if ever, ship a kernel that's built with a Linus-approved defconfig.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/a77703ff/attachment.bin 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19 17:13   ` Valdis.Kletnieks at vt.edu
@ 2016-09-19 20:02     ` Aruna Hewapathirane
  2016-09-19 21:16       ` Valdis.Kletnieks at vt.edu
  0 siblings, 1 reply; 8+ messages in thread
From: Aruna Hewapathirane @ 2016-09-19 20:02 UTC (permalink / raw)
  To: kernelnewbies

<snip>

>> make defconfig:
>> Generates a new config with default from the ARCH supplied defconfig
file.
>> Use this option to get back the
>> default configuration file that came with the sources.
>
> Actually, that *won't* get you back "the config that came with the
sources".
> If you look in a release source tarball from kernel.org, there *isn't* a
> .config in there, you need to create one somehow (copying a distro .config
> and then running 'make localmodconfig' is a popular choice).
>
> And there's no guarantee that 'make defconfig' will re-create whatever
> your distro shipped - in fact, it probably *won't* do so, because distros
> rarely, if ever, ship a kernel that's built with a Linus-approved
defconfig.

Yes true and agreed. I should have been a bit more specific.

Many times I have seriously screwed up my kernel to a point where it
suddenly refuses to boot. Every single time this has happened to me what
saved me was make defconfig. You may not have your internet connection
working, your sound may be kaput, the webcam not functional BUT defconfig
has invariably *every single time* given me back a kernel I can boot into.

>From there takes a wee bit of meddling with make menuconfig and I am good
to go :)

I forgot to cite where I got the earlier information from so here it is:
https://wiki.gentoo.org/wiki/Kernel/Configuration

Thank's Valdis for pointing that out - Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/9edb5fa5/attachment.html 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Difference between config, menuconfig and defconfig
  2016-09-19 20:02     ` Aruna Hewapathirane
@ 2016-09-19 21:16       ` Valdis.Kletnieks at vt.edu
  0 siblings, 0 replies; 8+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2016-09-19 21:16 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 19 Sep 2016 16:02:11 -0400, Aruna Hewapathirane said:

> Many times I have seriously screwed up my kernel to a point where it
> suddenly refuses to boot. Every single time this has happened to me what
> saved me was make defconfig. You may not have your internet connection
> working, your sound may be kaput, the webcam not functional BUT defconfig
> has invariably *every single time* given me back a kernel I can boot into.

Of course, the *correct* answer here is to keep around the known-working
config files for several previous kernels.  And the easiest way to do that
is to:

1) keep several kernels in /boot (I have enough room for the current kernel,
3 or 4 previous, and enough slack to do 12 or 13 builds for a 'git bisect'
without having to stop and clean up).

2) Set the following two things in your .config, so you can always boot
into an older kernel and retrieve its config from /proc/config.gz:

CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y

3) Make sure your kernel install process copies the .config used
to /boot/config-`uname -r` so you have it handy.

And of course:

4) Take regular backups of your system.  That will protect you from lots
of screw-ups - and hardware failures as well.  A 1 or 2 tera USB hard
drive isn't that expensive.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160919/d07f9003/attachment.bin 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-19 21:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19  5:43 Difference between config, menuconfig and defconfig Madhu K
2016-09-19  6:53 ` Andrea D'Amore
2016-09-19 10:50   ` Madhu K
2016-09-19 13:29     ` Valdis.Kletnieks at vt.edu
2016-09-19 14:58 ` Aruna Hewapathirane
2016-09-19 17:13   ` Valdis.Kletnieks at vt.edu
2016-09-19 20:02     ` Aruna Hewapathirane
2016-09-19 21:16       ` Valdis.Kletnieks at vt.edu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.