From: Robert Riches on
On 2010-01-23, Magnus Warker <magnux(a)mailinator.com> wrote:
> Hi,
>
> I used to build and install new kernels this way:
>
> - download, unpack in /usr/src/linux...
> - make menuconfig
> - make
> - make modules_install
>
> Well, after this step it always gets confusing. I know that some files have
> to be copied to /boot. Some do it manually, some use some tools.
> Additionally, there may be a ramdisk. Finally, there has to be an entry in
> the grub menu file.
>
> Well, I always have problems with this installation step. Often the mkinitrd
> step fails because of missing modules. Often the new kernel does not boot
> because of this.
>
> However, what would be a simple way of doing this? Maybe without a ram disk?
> Is there a unique recipe?
>
> Thanks
> Magnus

ISTR a 'make install' step, but that was for RedHat 6-7 on Alpha.

--
Robert Riches
spamtrap42(a)verizon.net
(Yes, that is one of my email addresses.)
From: Aragorn on
On Saturday 23 January 2010 11:18 in comp.os.linux.misc, somebody
identifying as Magnus Warker wrote...

> I used to build and install new kernels this way:
>
> - download, unpack in /usr/src/linux...

That is not the right place to build a new kernel. "/usr/src/linux" is
a symbolic link that must point to the kernel sources your distribution
(and thus glibc) was built against.

> - make menuconfig
> - make
> - make modules_install
>
> Well, after this step it always gets confusing. I know that some files
> have to be copied to /boot. Some do it manually, some use some tools.

Yes, the "bzImage" file, and you can also store the kernel's ".config"
in "/boot" for safekeeping and future reference or future
recycling. "System.map" also typically gets put there, but that's just
a text file with the functions of your new kernel, so it's not that
important.

> Additionally, there may be a ramdisk. Finally, there has to be an
> entry in the grub menu file.
>
> Well, I always have problems with this installation step. Often the
> mkinitrd step fails because of missing modules. Often the new kernel
> does not boot because of this.

If you are building your own kernel, then why are you building modules?
When custom-building your own kernel, you should build everything you
need statically into the kernel and only use proprietary binary blobs
as loadable modules. You don't need any /initrd/ - unless you're one
of those people who wants to have a splash screen obscuring the
technicals during boot, of course. ;-)

> However, what would be a simple way of doing this? Maybe without a ram
> disk? Is there a unique recipe?

Yes, as I stated above, build everything you need statically into your
kernel instead of as modules. And as Robert Riches has told you, you
can use...

make install

.... as the final step. If you do build modules and you use...

make modules_install

.... then you should do the actual kernel install after that, which you
can do in two ways, i.e. ...

make modules_install
make install

.... or...

make modules_install install

This procedure will normally also add a stanza for your new kernel to
your bootloader configuration - and if that is LILO, it'll
run "/sbin/lilo" for you - but it is typically set up to create
symlinks in "/boot" by default - e.g. "vmlinuz" rather than to make
actual references to the real kernel image name.

If you already have symlinks being referred to in your bootloader
configuration, then this is a dangerous thing, because the new symlinks
will overwrite the old ones, leaving you without a bootable kernel -
unless you know the name of the old kernel and you know how to use the
GRUB shell - if the new kernel won't boot. This is why it is generally
advised to manually copy over the "bzImage" and edit the bootloader
configuration by hand.

--
*Aragorn*
(registered GNU/Linux user #223157)
From: Magnus Warker on
Mumia W. wrote:

> On 01/23/2010 11:53 AM, Magnus Warker wrote:
> Rather than to perform the slave-labor of going through every
> configuration option in the kernel, you might just grab a .config file
> from your Debian stock kernel and put that into the source directory. Do
> a "make oldconfig" and then "make menuconfig" to add your desired
> features.

Well, this is my actual problem. My working kernel does not have
a /proc/config.gz. It's the one that came with Debian etch and was upgraded
several times (2.6.18.6). I just have to change a single option (use bt848
instead of bt878), but I had to start from scratch (using some config from
2006 I found somewhere). Unfortunately it always hangs during boot at some
USB related step.

It would help if I could retrieve the config of the working kernel somehow.

As you said: "Grab a .config file from your Debian stock kernel". How?

Thanks
Magnus
From: Mumia W. on
On 01/23/2010 11:56 PM, Magnus Warker wrote:
> Mumia W. wrote:
>
>> On 01/23/2010 11:53 AM, Magnus Warker wrote:
>> Rather than to perform the slave-labor of going through every
>> configuration option in the kernel, you might just grab a .config file
>> from your Debian stock kernel and put that into the source directory. Do
>> a "make oldconfig" and then "make menuconfig" to add your desired
>> features.
>
> Well, this is my actual problem. My working kernel does not have
> a /proc/config.gz. It's the one that came with Debian etch and was upgraded
> several times (2.6.18.6). I just have to change a single option (use bt848
> instead of bt878), but I had to start from scratch (using some config from
> 2006 I found somewhere). Unfortunately it always hangs during boot at some
> USB related step.
>
> It would help if I could retrieve the config of the working kernel somehow.
>
> As you said: "Grab a .config file from your Debian stock kernel". How?
>
> Thanks
> Magnus

Copy it from /boot. I'm using Lenny, so I would copy
/boot/config-2.6.26-2-486. You could copy like so:

cp /boot/config-$(uname -r) .config

That's why you want to use the Debian system for making kernel images.
Debian always gives you an easily accessible copy of the config file.

From: Magnus Warker on
Mumia W. wrote:

> On 01/23/2010 11:56 PM, Magnus Warker wrote:
>> Mumia W. wrote:
> cp /boot/config-$(uname -r) .config

Well, I found out that the config I found was one that came with the stock
kernel. So the original config from 2.6.18.6 lets the kernel 2.6.32.5
hang...

I summerized it in my other post.

Thank you!
Magnus