LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Kernel rebuilding first time ... (https://www.linuxquestions.org/questions/slackware-14/kernel-rebuilding-first-time-633193/)

din 04-05-2008 01:42 AM

Kernel rebuilding first time ...
 
Hi.
I started with this guide from Bruce Hill :
http://slackwarebox.com/resources/2.6-kernel-build.txt

I went through all steps in this guide but after reboot i got black screen. So i guess i was missing something.
I read the guide again and again and found some points i don`t understand.

Before i started to build new kernel i got in /boot :

1.
system map pointing to my generic-smp kernel
System.map -> System.map-generic-smp-2.6.21.5-smp

2.config file pointing to my config-generil-smp
config -> config-generic-smp-2.6.21.5-smp

3. the kernel
vmlinuz -> vmlinuz-generic-smp-2.6.21.5-smp

4. initrd-tree was install with generic-smp kernel.

After all process of building kernel i got

1. New system.map i was copy from new kernel directory.
No questions here.

2.The same config file i got before.
Here i am not sure. Where new config file? I didn't
get it from the guide. So my config file still pointing
to :
config -> config-generic-smp-2.6.21.5-smp

3.The new kernel - linux-2.6.24.4 .
It's here in /boot. i got it from
arch/i386/boot/bzImage. Interesting, why it's in
this directory? Every time i build new kernel it's
going there?

4. initrd. Not sure if i have to change anything here.
Is the new kernel use it? If yes, i can leave it in my
grub menu unchanged?

A lot of question, but we talking here about
some important stuff. :)

Thanks.

Bruce Hill 04-05-2008 04:31 AM

Hey din,

Here are some answers. And yes, your questions are important.

Forgive me for one thing ... Slackware by default uses LiLO as the boot loader. LILO is the most used Linux Loader for the x86 flavor of Linux. Therefore, my guide assumes LiLO as the bootloader, and my answers will, also. Since you choose to use GrUB, you will need to translate this information to GrUB. I never could get the hang of GrUB when I first started using Linux.


Q1: The System.map file is generated to document addresses of all kernel symbols. The default location for it is /boot, though if you don't copy it there, the kernel will find it anyway.

Q2: The .config file for the new kernel is still in the directory where you built it.

If you desire to copy it to /boot, that is fine. It's not necessary to have it there, just personal preference. Since I know where I build all my kernels (~/kernel/linux-version/), it has been my preference not to copy it to /boot. If you'd like it there, you may copy it there. On my workstation, I backup all my important files to ~/config-files/ and every night all our PC's home directories are backed up to our server via cron job. After building my kernel, I copy the .config file to that directory. At the moment I have two files in there:
Code:

mingdao@silas:~$ ls -1 config-files/2.6.24.4-config-*
config-files/2.6.24.4-config-ide
config-files/2.6.24.4-config-noide

If you want to put your new config file in /boot, from the kernel build directory issue:
Code:

cp .config /boot/config-2.6.24.4 ; ln -sf /boot/config-2.6.24.4 /boot/config
which will copy it to /boot and link it to /boot/config for you.

Q3: The newly built kernel will be located at arch/$(SUBARCH)/boot/bzImage, and the default path for it is /boot.

In /etc/lilo.conf you have a line like this:
Code:

boot = /dev/sda
which tells it which drive has LiLO, and these lines:
Code:

image = /boot/vmlinuz-generic-smp-2.6.24.4-smp
  initrd = /boot/initrd.gz
  root = /dev/vg/root
  label = Slack-12.1-rc1
  read-only

tell LiLO where your kernel image, initrd image, and root filesystem are located.

Q4: This depends upon whether or not you need an initrd (initial ramdisk image).

In Slackware /boot/README.initrd will tell you about this. Basically, if you have support for your / (root) filesystem built into the kernel (not as a module), and support for the drive containing your kernel, you will not need an initrd. There are exceptions, such as my LUKS encrypted root partition.

On my workstation:
I am running JFS for my / (root) filesystem and the motherboard has a VIA VT6420 SATA RAID Controller where the SATA drive containing Slackware is attached. Therefore it needs JFS for the filesystem and SATA_VIA for my hard drive.

I have a choice to either (a) build JFS and SATA_VIA as modules and make an initrd image, or (b) build them into the kernel. Either one is acceptable, so long as the kernel in /boot as the support for them or you have an initrd to load them.

When you edit /etc/lilo.conf (the LiLO configuration file), the boot= directive in /etc/lilo.conf tells LiLO where it should place its primary boot loader. Either the MBR (master boot record) of a hard drive accessible by the BIOS, or the root partition of your Linux OS is acceptable (but not only).

When you boot your Slackware system, LiLO loads the kernel, then the kernel mounts the / (root) filesystem and runs /sbin/init. Therefore, you must have the drivers for your / (root) filesystem either in the kernel or in an initrd image.

Probably the black screen is due to not having console display driver support in the kernel. Do you have FRAMEBUFFER_CONSOLE=y in your new kernel? These are my choices:
Code:

# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_VIDEO_SELECT=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
CONFIG_FONTS=y
# CONFIG_FONT_8x8 is not set
CONFIG_FONT_8x16=y
# CONFIG_FONT_6x11 is not set
# CONFIG_FONT_7x14 is not set
# CONFIG_FONT_PEARL_8x8 is not set
# CONFIG_FONT_ACORN_8x8 is not set
# CONFIG_FONT_MINI_4x6 is not set
# CONFIG_FONT_SUN8x16 is not set
# CONFIG_FONT_SUN12x22 is not set
# CONFIG_FONT_10x18 is not set
CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_MONO is not set
# CONFIG_LOGO_LINUX_VGA16 is not set
CONFIG_LOGO_LINUX_CLUT224=y

Your questions are important, and we're glad to answer them. If something is still not clear, post back.

din 04-05-2008 05:51 AM

Hi, Bruce.
Thank you! Your answers is very helpfull.
I will take my time, try check everything again and post the resalts.



.

din 04-05-2008 04:06 PM

Hi, Bruce.

After some tinkering with "Console display driver support" options i got my screen after boot.
But, i got kernel panic with "No kernel modules found" .
After some research i tried to run mkinitrd again with new kernel options.

Now i get :
Mount : mounting /dev/sda5 on /mnt failed.
Error: no /sbin/init found on rootdev (or not mounted)
Kernel panic.

To tell you the truth, i have no idea how to continue from here.
Maybe you have a clue? :)

Thanks in advance.

PS. I don't like to give up... :)

Bruce Hill 04-05-2008 06:54 PM

Hey, I don't give up, either. If so, this box would be running Windoze eXPeriment. ;)

Bask in one victory ... have don't have a black screen!

Error:
Code:

Mount : mounting /dev/sda5 on /mnt failed.
Error: no /sbin/init found on rootdev (or not mounted)
Kernel panic.

This would indicate that the kernel found your / (root) filesystem, but it just can't mount it.

Let me go out on a limb, from some experience here, and take some guesses and offer suggestions.

From looking at other posts you've made, it seems you have an Intel chipset. Since it is mounted on
/dev/sda5 with a kernel with a lot of modules, it is probably a Serial-ATA (SATA) drive.

Now your new kernel might be assigning it to /dev/hda5, which is not in your /etc/fstab file.

First, try adding "hda=noprobe" to the kernel boot command in grub. If it will boot, then I'm on the right path.

If so, my recommendation would be to change some options in your kernel.

From the Slackware kernel which works, please post the output of:
Code:

/etc/fstab
mount
lsmod
lspci





Note to self: should his controller use libata ATA_PIIX driver

T3slider 04-05-2008 07:41 PM

If Bruce Hill's advice doesn't work, an obvious possibility is that your initrd was not created (or created incorrectly, or specified incorrectly in /etc/lilo.conf [well, actually, since you use GRUB, it would be incorrectly specified in /boot/grub/menu.lst]). I would recommend building the filesystem used for your root partition into the kernel instead of as a module, if you haven't already -- that way you don't need an initrd, even if other partitions use different filesystems that are compiled as modules (they'll load automatically after / is mounted).

Good luck.

din 04-06-2008 01:06 AM

Hi.
First of all, big thanks for help and for "no give up"! :)
I will try to provide maximum info i can.

1. Option "hda=noprobe" changed nothing. I got the same
error.
Some info: i use grub from arch linux. In the menu i have
options loading arch or slackware. In case something going wrong i boot to arch and try to fix what needed...

menu.lst
# (0) Arch Linux
title Arch Linux
root (hd0,2)
kernel /boot/vmlinuz26 root=/dev/sda3 ro
initrd /boot/kernel26.img

# (1) Arch Linux
title Arch Linux Fallback
root (hd0,2)
kernel /boot/vmlinuz26 root=/dev/sda3 ro
initrd /boot/kernel26-fallback.img

title Slack (/dev/sda5)
root (hd0,4)
kernel /boot/vmlinuz root=/dev/sda5 ro vga=773 hda=noprobe
initrd /boot/initrd.gz


2.
About T3slider post:
When i recompiled the kernel i run initrd with new
kernel parameters:
mkinitrd -c -k 2.6.24.4 -f ext3 -r /dev/sda5
+ add to grub line
initrd /boot/initrd.gz

At least, with generic 12.0 kernel it worked.
so i guess i am Ok here.

About "recommend building the filesystem used for your root partition into the kernel instead of as a module".
I don't get 100% what it means. Can you explain how
i do it?
In config menu i have option
file systems -> Ext3 journalling file system support. Now it is on "M"
This option you recommend to change to "Y" ?



3. About partitions.
I have Sata disk 160GB
sda1 - swap
sda2 - partition to try new distros :)
sda3 - arch
sda4 - extended
sda5 - slackware
sda6 - free.

4. fstab


/dev/sda1 swap swap defaults 0 0
/dev/sda5 / ext3 defaults 1 1
#/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0


5. mount
mount
/dev/sda5 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda3 on /mnt/arch type ext3 (rw)


6. lsmod

lsmod
Module Size Used by
i915 25088 0
drm 75156 1 i915
snd_seq_dummy 6788 0
snd_seq_oss 32896 0
snd_seq_midi_event 10112 1 snd_seq_oss
snd_seq 50640 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_seq_device 10508 3 snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss 42784 0
snd_mixer_oss 18048 1 snd_pcm_oss
ipv6 254496 18
capability 7304 0
commoncap 9344 1 capability
lp 13736 0
parport_pc 27812 0
parport 34760 2 lp,parport_pc
pcspkr 6528 0
psmouse 39048 0
pcmcia 34988 0
snd_hda_intel 20248 4
snd_hda_codec 209152 1 snd_hda_intel
snd_pcm 72068 4 snd_pcm_oss,snd_hda_intel,snd_hda_codec
snd_timer 22532 3 snd_seq,snd_pcm
yenta_socket 27148 1
snd 47204 15 snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_hda_intel,snd_hda_codec,snd_pcm,snd _timer
rsrc_nonstatic 14848 1 yenta_socket
sdhci 18828 0
tifm_7xx1 10496 0
pcmcia_core 36500 3 pcmcia,yenta_socket,rsrc_nonstatic
soundcore 9824 1 snd
mmc_core 25988 1 sdhci
tifm_core 10368 1 tifm_7xx1
tg3 107780 0
ndiswrapper 185884 0
snd_page_alloc 11528 2 snd_hda_intel,snd_pcm
sg 30364 0
i2c_i801 11408 0
ata_generic 9220 0
serio_raw 9220 0
intel_agp 25116 1
shpchp 33172 0
agpgart 31432 3 drm,intel_agp
evdev 11904 1


7. lspci

lspci
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)
04:00.0 Network controller: Broadcom Corporation BCM94311MCG wlan mini-PCI (rev 01)
0f:06.0 CardBus bridge: Texas Instruments PCIxx12 Cardbus Controller
0f:06.1 FireWire (IEEE 1394): Texas Instruments PCIxx12 OHCI Compliant IEEE 1394 Host Controller
0f:06.2 Mass storage controller: Texas Instruments 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD)
0f:06.3 Generic system peripheral [0805]: Texas Instruments PCIxx12 SDA Standard Compliant SD Host Controller

din 04-06-2008 02:25 AM

OK.
After some tinkering again and again (close to pull hair out :) ) i able to boot !!!!!
Not sure how i did it, but i changed some options.
Good news - it works!!! bad news i am not sure why...
If i need to compile again i still don't know how.

Problems now : usb mouse + sound complitely out of work.

Continue from here ...

Bruce Hill 04-06-2008 02:32 AM

For sound you need SND_HDA_INTEL=m in the kernel;
for the mouse you need CONFIG_USB_UHCI_HCD=m, CONFIG_HID=m, and CONFIG_USB_HID=m.

din 04-06-2008 03:09 AM

Hi, Bruce.
Thanks a lot !!!! for help.
At the and it works! You know the feeling :)

1.
Mouse is working now.
Sound: i have this option enabled with M
SND_HDA_INTEL=m
still, when i boot i get :

Sound server informational message:
Error while initializing the sound driver:
device: default can't be opened for playback (Function not implemented)
The sound server will continue, using the null output device.

2. How can i save this config i just made? can i use it in the future with
new kernels?

3. Is there any way to check if i enabled things i don't need and can remove in config?

THANKS!!!

Bruce Hill 04-06-2008 08:39 AM

A1: In a previous post your lsmod output shows snd_hda_intel. First issue "lsmod" and see if the same modules are loaded. If not, you could run "alsaconf" as root. If this loads it, then run "alsamixer" as root and unmute (with the M key) at least Master and PCM, then turn up the sliders with the up arrow key. Close the mixer with the Esc key, the run "alsactl store" to save your settings across reboot.

If this doesn't help, boot into your kernel with working sound and issue "lspci -v" which will show you which kernel modules are being used for your devices. Then you will know what you need to compile in your kernel.

A2: I posted before how I save my kernel .config files. Just save it somewhere outside of the directory where you build kernels, and give it an unique name that you will remember. Typically before I upgrade my kernel to new sources from kernel.org, I will read the Changelog there and see what has changed. Then I copy my old kernel .config to the new kernel source directory and run "make silentoldconfig", which will only ask questions about new options that were not in your old .config. Then if I want to make other changes with that new source, I'll run "make xconfig" again and modify it.

A3: To find out about your hardware, once you get it all working you can issue "lspci -v" which will also show you the modules your hardware is using. Output will look like this:
Code:

00:0c.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)
        Subsystem: Creative Labs Unknown device 0052
        Flags: bus master, medium devsel, latency 64, IRQ 18
        I/O ports at b000 [size=32]
        Capabilities: [dc] Power Management version 2
        Kernel driver in use: EMU10K1_Audigy
        Kernel modules: snd-emu10k1

The kernel has options for things other than hardware support, also. For instance, there is:
Code:

Loopback device support (BLK_DEV_LOOP)

Saying Y here will allow you to use a regular file as a block
device; you can then create a file system on that block device and
mount it just as you would mount other block devices such as hard
drive partitions, CD-ROM drives or floppy drives. The loop devices
are block special device files with major number 7 and typically
called /dev/loop0, /dev/loop1 etc.

This is useful if you want to check an ISO 9660 file system before
burning the CD, or if you want to use floppy images without first
writing them to floppy. Furthermore, some Linux distributions avoid
the need for a dedicated Linux partition by keeping their complete
root file system inside a DOS FAT file using this loop device
driver.

To use the loop device, you need the losetup utility, found in the
util-linux package, see
<ftp://ftp.kernel.org/pub/linux/utils/util-linux/>.

The loop device driver can also be used to "hide" a file system in
a disk partition, floppy, or regular file, either using encryption
(scrambling the data) or steganography (hiding the data in the low
bits of, say, a sound file). This is also safe if the file resides
on a remote file server.

There are several ways of encrypting disks. Some of these require
kernel patches. The vanilla kernel offers the cryptoloop option
and a Device Mapper target (which is superior, as it supports all
file systems). If you want to use the cryptoloop, say Y to both
LOOP and CRYPTOLOOP, and make sure you have a recent (version 2.12
or later) version of util-linux. Additionally, be aware that
the cryptoloop is not safe for storing journaled filesystems.

Note that this loop device has nothing to do with the loopback
device used for network connections from the machine to itself.

To compile this driver as a module, choose M here: the
module will be called loop.

Most users will answer N here.

I compile it as a module, so if I want to look at the contents of an iso image, for instance, I do this:
Code:

root@silas:~# logout
mingdao@silas:~$ sudo mount -o loop slackware-current-install-dvd.iso /mnt/tmp/
mingdao@silas:~$ ls -l /mnt/tmp/
total 2164
-rw-r--r--  1 root root  10263 2007-07-01 14:03 ANNOUNCE.12_0
-rw-r--r--  1 root root  20933 2006-10-02 12:36 BOOTING.TXT
-rw-r--r--  1 root root  15781 2008-04-05 02:41 CHANGES_AND_HINTS.TXT
-rw-r--r--  1 root root 580855 2008-04-05 11:16 CHECKSUMS.md5
-rw-r--r--  1 root root    197 2008-04-05 11:16 CHECKSUMS.md5.asc
-rw-r--r--  1 root root  17976 1994-06-10 10:28 COPYING
-rw-r--r--  1 root root  15629 2006-10-02 12:37 COPYRIGHT.TXT
-rw-r--r--  1 root root    616 2006-10-02 12:37 CRYPTO_NOTICE.TXT
-rw-r--r--  1 root root  2192 2007-08-18 07:20 CURRENT.WARNING
-rw-r--r--  1 root root 116331 2008-04-05 11:08 ChangeLog.txt
-rw-r--r--  1 root root  33523 2007-07-02 05:24 FAQ.TXT
-rw-r--r--  1 root root 757948 2008-04-05 11:14 FILELIST.TXT
-rw-r--r--  1 root root  1565 2003-02-27 07:34 GPG-KEY
-rw-r--r--  1 root root 484966 2008-04-05 11:11 PACKAGES.TXT
-rw-r--r--  1 root root  10639 2007-07-02 05:13 README.TXT
-rw-r--r--  1 root root  15195 2007-06-27 09:37 README_CRYPT.TXT
-rw-r--r--  1 root root  5784 2007-07-02 07:12 README_LVM.TXT
-rw-r--r--  1 root root  3731 2007-07-02 04:19 RELEASE_NOTES
-rw-r--r--  1 root root  13847 2007-07-01 12:39 SPEAKUP_DOCS.TXT
-rw-r--r--  1 root root  16234 2007-06-30 10:04 SPEAK_INSTALL.TXT
-rw-r--r--  1 root root  60345 2007-06-30 11:14 Slackware-HOWTO
-rw-r--r--  1 root root  4253 2007-10-21 03:39 UPGRADE.TXT
drwxr-xr-x 24 root root  4096 2008-03-29 15:38 extra/
drwxr-xr-x  3 root root  2048 2008-04-01 13:26 isolinux/
drwxr-xr-x  5 root root  2048 2008-03-28 10:51 kernels/
drwxr-xr-x 17 root root  4096 2008-04-05 11:11 slackware/
drwxr-xr-x 18 root root  4096 2008-04-05 11:14 source/
drwxr-xr-x  4 root root  2048 2008-04-05 11:14 testing/
drwxr-xr-x  3 root root  2048 2008-04-05 00:40 usb-and-pxe-installers/

Read Linux Kernel in a Nutshell for a lot more kernel learning. Chapter 7, iirc, tells you how to find out more about this.

din 04-06-2008 08:51 AM

I will check this.
Now its Mutch!!! more clear to me :)

Thanks!

din 04-07-2008 02:32 PM

Hi.
Another question here.
After kernel recompilation i have problem with ndiswrapper module.
I get "module ndiswrapper not found". If i run "ndiswrapper -l" - it's works.
But i can't modprobe it. I think i have to rebuild this module?
Anyone will give me a clue - how? And why it's happening?
Maybe i need to find ndiswrapper for my new kernel - 2.6.24.4
and reinstall it?

Bruce Hill 04-07-2008 04:53 PM

Hi din!

We have one Ralink wireless device and two Atheros ones,
so we have not used ndiswrapper here.

Alien BOB has a good tutorial for ndiswrapper in his Wiki.

din 04-09-2008 08:06 AM

Bruce, thanks for a link.
I compiled ndiswrapper from source and it's working now.

I running now 2.6.24.4 kernel with old 12.0 packages,
and i have another problem.
When i try to remove or upgrade
any package i get :

chmod: /lib/libc.so.6: version `GLIBC_2.4' not found (required by chmod)

I checked - i have glibc-2.5-i486-4
Why system searching for glibc_2.4?


All times are GMT -5. The time now is 11:34 PM.