Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] genkernel 2 manual

105 views
Skip to first unread message

João Matos

unread,
Oct 23, 2012, 6:10:01 PM10/23/12
to
Hi list.

I've been using Gentoo for quite a long time, and today I decided to try compiling the kernel myself, Thing I've never done before. I want a smaller kernel, a faster boot (without initramfs) and, of course, some fun :).

I'm still reading the oficial documentation, but I don't think it will be enough, so, if anyone of you know some documentation more detailed, I'd appreciate reading it.

I've just ran 'make xconfig', and I noticed that the configuration is the same from genkernel (genkernel --menuconfig). Is it good? Should I get an original .conf, with less garbage, or this is just the 'normal default' instead of 'genkernel default' as I'm guessing?

Is there any tool that can scan my pc and help me out with the .conf or even generate one? I guess not. There are lots of options that I have no idea what they are for. I think this will be the fun part, but I think I can't get a running kernel before I optimize it, so I can do it gradually.

Just for curiosity, what is the size of your kernel? Mine is 3.4 MB.

Thank you,
--
João de Matos
Linux User #461527

Redcap

unread,
Oct 23, 2012, 7:00:02 PM10/23/12
to
Hi there,

I'd definitely advise to you use one of Pappy's Kernel seed. Those are config
files that provide you with a good starting point to configure your own kernel.
You'll find the Kernel seeds at

http://kernel-seeds.org/

The website also has instructions on how to find out which Kernel options
you'll need to have your hardware supported.

Cheers...

Andrés Becerra Sandoval

unread,
Oct 23, 2012, 7:00:02 PM10/23/12
to
A small tip:

- Do lsmod in your genkernel kernel
- Write down the list
- For any module loaded find the corresponding option in the kernel
configuration
- Read briefly the description for the option
- Do a crosscheck with the output of lspci and lsusb

Have fun!

--
Andrés Becerra Sandoval

Gregory Shearman

unread,
Oct 23, 2012, 7:10:01 PM10/23/12
to
In linux.gentoo.user, you wrote:
>
> I've been using Gentoo for quite a long time, and today I decided to try
> compiling the kernel myself, Thing I've never done before. I want a smaller
> kernel, a faster boot (without initramfs) and, of course, some fun :).

Good for you. I've rolled my own kernels for around 15 years, but I
still use genkernel to build me an initramfs. I require the initramfs
because:

a) I've got my root filesystem on an LVM partition.

b) I've got my /usr directory on a separate partition. This is not a
problem, yet, but the udev update is coming!

c) I like a fancy boot splash screen during early boot.

I'm not that fond of using genkernel to build my initramfs, but it
works. I'll probably switch to dracut when it becomes more stable.

> I'm still reading the oficial documentation, but I don't think it will be
> enough, so, if anyone of you know some documentation more detailed, I'd
> appreciate reading it.

What do you mean by "official documentation"? Do you include the
information in the Documentation directory in your latest kernel?

Have you tried:

$make menuconfig

This gives you a good interface for configuring your kernel. If you hit
"/" you'll get a search function and there are "help" options for just
about every feature you want to include in your new kernel.

> I've just ran 'make xconfig', and I noticed that the configuration is the
> same from genkernel (genkernel --menuconfig). Is it good? Should I get an
> original .conf, with less garbage, or this is just the 'normal default'
> instead of 'genkernel default' as I'm guessing?

I usually start from scratch with a new machine, but in your case you
should be able to use your old genkernel .config file and then pare it
down to what you require ie what works.

> Is there any tool that can scan my pc and help me out with the .conf or
> even generate one? I guess not. There are lots of options that I have no
> idea what they are for. I think this will be the fun part, but I think I
> can't get a running kernel before I optimize it, so I can do it gradually.

I have had reasonable success with "lshw" (sys-apps/lshw). It generates
a list of the hardware on your machine. Unfortanately it won't produce a
.config file for you.

One option that makes subsequent kernels easier to produce is:

CONFIG_IKCONFIG

Kernel .config support

This feature provides copy of your current Kernel's .config file at
/proc/config.gz which you can then extract and use on your new kernel by
doing:

$ zcat /proc/config.gz > <new-kernel-directory>/.config
$ cd <new-kernel-directory>
$ make oldconfig

> Just for curiosity, what is the size of your kernel? Mine is 3.4 MB.

3.7MB

Yep.. it's bigger than your genkernel generated kernel... 8-)

Remember, the first kernel you produce on your own will take a bit of
effort, but subsequent kernels are easy.

--
Regards,
Gregory.

Dale

unread,
Oct 23, 2012, 7:30:01 PM10/23/12
to
> Jo�o de Matos
> Linux User #461527
>


I would add lspci -k since it lists not only modules but built in
drivers as well. Generally, if you have all those included, then you
are doing fine hardware wise. In menuconfig, just hit the / key and
search for the driver. Also, on the results of the search, it shows the
path to the page the driver is on too. Some of them hide pretty good at
times.

Also, don't forget that some things have to be built in and not as
modules. Things like file system that root is on, drive controller so
that the drives can be seen and maybe even mouse/keyboard stuff.

Some say not to but I just build everything into my kernel. The only
modules I have is nvidia for my video drivers. Everything else is built
in. Should work either way as long as the must haves are built in.

One more thing, keep a couple known good kernels laying around just in
case you really mess up. At least you can boot a old one to fix the new
one. ;-) Don't ask how I learned this sort of thing. :/

Dale

:-) :-)

--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

João Matos

unread,
Oct 23, 2012, 7:30:01 PM10/23/12
to
Well, It is being  easy than I thought. I've compilled it and the boot is faster since initramfs is not needed anymore :).

I'll now remove the hundreds of unneeded drivers.

2012/10/23 João Matos <jao...@gmail.com>
Graduando em Engenharia de Computação 2005.1
UEFS - Universidade Estadual de Feira de Santana

Bruce Hill

unread,
Oct 23, 2012, 10:50:01 PM10/23/12
to
On Tue, Oct 23, 2012 at 08:02:52PM -0200, Jo�o Matos wrote:
> Hi list.
>
> I'm still reading the oficial documentation, but I don't think it will be
> enough, so, if anyone of you know some documentation more detailed, I'd
> appreciate reading it.

emerge -av app-doc/linux-kernel-in-a-nutshell
--
Bruce

Neil Bothwick

unread,
Oct 24, 2012, 4:00:01 AM10/24/12
to
On Tue, 23 Oct 2012 21:25:04 -0200, João Matos wrote:

> Well, It is being easy than I thought. I've compilled it and the boot
> is faster since initramfs is not needed anymore :).

Whether or not you use an initramfs shouldn't make any real difference.
However the genkernel initramfs has to do a load of general hardware
recognition stuff, and that is what takes the time. The part of the boot
is run from the initramfs, but that is incidental.


--
Neil Bothwick

TEXAS VIRUS: Makes sure that it's bigger than any other file.
signature.asc

Michael Hampicke

unread,
Oct 24, 2012, 7:30:02 AM10/24/12
to
> Is there any tool that can scan my pc and help me out with the .conf or
> even generate one? I guess not. There are lots of options that I have no
> idea what they are for. I think this will be the fun part, but I think I
> can't get a running kernel before I optimize it, so I can do it gradually.

Well good starting points have already been provided, I usually check
for modules with lspci -k

> Just for curiosity, what is the size of your kernel? Mine is 3.4 MB.

3.0M, initramfs 2.2M

Michael Hampicke

unread,
Oct 24, 2012, 9:30:01 AM10/24/12
to
Damn, totaly forgot what I would write :) You may also have a loog at #
make localmodconfig

João Matos

unread,
Oct 24, 2012, 10:00:02 AM10/24/12
to
Well, thank you for your help.

I had some problems, like no bootable system or no network, but I could solve it and things are working pretty well pretty.

The compilation time is really small after I removed these modules, but I think it should be smaller: apparently the 'make && make modules install' command don't use my '-j3' option. How do I configure it?

The size is almost the same (3.3 MB), and I believe this is why my work until now was to remove non used hardware modules - the easy part. Now, I'll slow down a bit, bcz I need to learn about the other options before turning them off.

Thant you all,

2012/10/24 Michael Hampicke <gento...@hadt.biz>

--
João de Matos
Linux User #461527

Dale

unread,
Oct 24, 2012, 10:10:01 AM10/24/12
to
Jo�o Matos wrote:
> Well, thank you for your help.
>
> I had some problems, like no bootable system or no network, but I
> could solve it and things are working pretty well pretty.
>
> The compilation time is really small after I removed these modules,
> but I think it should be smaller: apparently the 'make && make modules
> install' command don't use my '-j3' option. How do I configure it?
>
> The size is almost the same (3.3 MB), and I believe this is why my
> work until now was to remove non used hardware modules - the easy
> part. Now, I'll slow down a bit, bcz I need to learn about the other
> options before turning them off.
>
> Thant you all,
>

make -j 3 all && make modules_install

I guess you can add -j 3 to the modules part to but since I have only
the forced SCSI ones, it takes only a second or two. If you use a lot
of modules, try adding that option.

Neil Bothwick

unread,
Oct 24, 2012, 10:40:02 AM10/24/12
to
On Wed, 24 Oct 2012 11:47:55 -0200, João Matos wrote:

> The size is almost the same (3.3 MB), and I believe this is why my work
> until now was to remove non used hardware modules - the easy part.

Modules don't significantly affect the size of the kernel, only builtins.
A hand-prepared kernel may actually be larger than a genkernel one
because the latter builds almost everything as modules whereas without an
initramfs, you need some modules as builtins.


--
Neil Bothwick

It's not a bug, it's tradition!
signature.asc

Jackson

unread,
Oct 24, 2012, 9:20:02 PM10/24/12
to
On 10/23/2012 10:02 PM, Jo�o Matos wrote:
> Hi list.
>
>
> Just for curiosity, what is the size of your kernel? Mine is 3.4 MB.
>
> Thank you,
> --
> Jo�o de Matos
> Linux User #461527
>
2.7 MB ,initramfs 1.5 MB

João Matos

unread,
Oct 25, 2012, 6:20:02 PM10/25/12
to

Damn, totaly forgot what I would write :) You may also have a loog at #
make localmodconfig

Great tool. Should be added to handbook. :)

I think my work is almost done. The kernel has 2.7MB, and I've removed all obvious unnecessary choices, just reading the 'help' from 'make menuconfig'. It was necessary to recompile nvidia-drivers a couple times, I don't know why, but now everything is working pretty fine.

Thank you all,
0 new messages