Friday, June 25, 2010

No Progress Day 4

Reading some more about kernels today. The only saving feature about this excersize is that I have a toy OS to work with, while maintaining a running OS for normal daily usage.

Try this. Run config again and unmark everything experimental. On those items which have recommendations, I follow the advice.

make
make modules install

A quote from LFS mailing list:

Not building a required driver into the kernel is almost certainly the 
problem here.  lsmod on an earlier system and lspci are exactly the 
right tools to figure out the needed drivers.  After that rebuilding the 
kernel and retrying are the boot will be needed.

   -- Bruce 

I found another website,
Techfreaks , Driver test page, and what seemed to be a step by step guide through configuring the kernel, Pappy's Kernel Seeds. Nothing I tried was working.

Thursday, June 24, 2010

No Progress

Day 3 of a stalled LFS installation. I am going to try using the legacy grub, as some people have suggested.


Once more, try make mrproper
 make LANG=nl_NL LC_ALL= menuconfig
(SCSI device support change all M's to stars. )
make (started 13:18)

This will take a long time.

While I was waiting, I found a website called kernelnewbies.org They mentioned something called cpuinfo, which I installed on my Mandriva platform. One of the things a kernel is supposed to do is talk with the hardware, and I figure I should know a little bit about what is inside my computer.

Re-making did not work. I tried running with my Mandriva legacy GRUB. Still kernel panic, although different unkown-block (0,0) instead of (2,0)

Tuesday, June 22, 2010

Chapter 9 Device Busy

While trying to unmount the lfs partition, using: umount -v $LFS, I get device busy warnings.
Here is an example of how I debugged this, thanks to Holy Scmoly
Note that I have already logged out of the chroot environment.

[root~]# fuser -m /dev/sdb6
/dev/sdb6:            3184c

[root~]# ps auxw | grep  3184
root      3184  0.0  0.1   4024  1820 pts/0    S+   08:25   0:00 bash
root     32081  0.0  0.0   3224   744 pts/1    S+   10:36   0:00 grep --color 3184
[root@samwise ~]# kill -9 3184

Clearly, that bash is from the exec command I used and am not sure was necessary. Re-run the fuser command and it should be ok.
[root@ ~]# umount -v $LFS
/dev/sdb6 umounted

Chapter 8 revisited

Looking at my notes, I seemed to have skipped this step and ran "make oldconfig" instead. This is due to my lack of familiarity with configuration using menuconfig. I am mostly familiar with the ./configure,make and make install that I had been doing through Chapters 5 and 6.

root#make LANG=nl_NL LC_ALL= menuconfig

Well, a menu appears!
This is nice.

#
# using defaults found in arch/x86/configs/i386_defconfig
#
#
# configuration written to .config
#


*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.
Tail end of output of make
Root device is (8, 22)
Setup is 11756 bytes (padded to 11776 bytes).
System is 4048 kB
CRC 5ffe0f2f
Kernel: arch/x86/boot/bzImage is ready  (#1)
  Building modules, stage 2.
  MODPOST 2 modules
  CC      arch/x86/kernel/test_nx.mod.o
  LD [M]  arch/x86/kernel/test_nx.ko
  CC      drivers/scsi/scsi_wait_scan.mod.o
  LD [M]  drivers/scsi/scsi_wait_scan.ko


root:/sources/linux-2.6.32.8# make modules_install
INSTALL arch/x86/kernel/test_nx.ko
INSTALL drivers/scsi/scsi_wait_scan.ko
DEPMOD 2.6.32.8


Did all the other stuff in this section as well, with no errors. Reboot but first unmount everything.

Monday, June 21, 2010

Frustrated

I have reached the end of the LFS document and have a kernel panic. I am searching for the solution. It seems like I have not learned anything. I was stuck in the devices chapter and moved on, but what if this is the cause of the error? I still do not understand the kernel! I do not remember configuring it. I only see the API headers. But no .configure, make and make install stuff. It's frustrating because this is the main reason I started this in the first place.

I'm going to quit for today. Tomorrow, read the FAQ, "How do I compile a kernel or set up modules". Not sure why this is in the FAQ, it should be in the main documentation.

Chapter 9 shutdown

Well, I thought I was done and re-booted before reading section 9.3. I had noticed all the "device busy " errors (see next blog entry) when re-starting. Also, it LFS did not boot at all.



logout
 

umount -v $LFS/dev/pts
umount -v $LFS/dev/shm
umount -v $LFS/dev
umount -v $LFS/proc
umount -v $LFS/sys
 
umount -v $LFS
 
shutdown -r now
 
ok, here we go!

Chapter 8.4 Grub

Ok, I have some experience with Grub. floppies....I'll have to look for them.
(google for the right command, here )
root:/sources# fdformat /dev/fd0

I also had to install some dos utilities and do the stuff on my OS and not LFS.
[home]#mkfs -t msdos /dev/fd0

On LFS,

root:/media#  mount -t msdos /dev/fd0 /media/floppy

root:/# grub-mkdevicemap --device-map=device.map
root:/# cat device.map
(fd0)    /dev/fd0
(hd0)    /dev/sda
(hd1)    /dev/sdb



Here is where I might run into trouble. I have made a floppy but I cannot verify what is on it. I do not know why.


#fdformat /dev/fd0
#mkfs -t msdos /dev/fd0
#mount -t msdos /dev/fd0 /media/floppy
#cd /media/lfs/tmp
#dd if=floppy.img of=/dev/fd0 bs=1440 count=1

 If I check using df, there is something there. Good.

 /dev/fd0              1,4M  210K  1,2M  15% /media/floppy


I tried rebooting with this and, although grub loaded, there was no prompt. Moving ahead anyway. So far, on my platform (the computer), I have (from the menu.lst) I believe that grub is installed on the MBR because I do not have Windows on this computer anymore. The boot device is sda (from Mandriva control center)

#title KDE Mandriva Linux (Official)
#root (hd0,0)

#title Gnome Mandriva Linux (Official)
#root (hd1,0)

A weekend has come between Friday and today, Monday. I got side tracked by the floppies.SO, after all the mounting and chroot (see Ch 7)

root:/# grub-install --grub-setup=/bin/true /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(fd0)    /dev/fd0
(hd0)    /dev/sda
(hd1)    /dev/sdb
root:/# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinux-2.6.32.8-lfs-6.6
done


I heard some disk access to the floppy drive. 140 .mod files were written to the /boot/grub directory. Just had a look at /boot. It has only 4 entries.


root:/boot# ls -lg
total 5864
-rw-r--r-- 1 root 1740472 Jun 17 16:56 System.map-2.6.32.8
-rw-r--r-- 1 root   67864 Jun 17 16:58 config-2.6.32.8
drwxr-xr-x 2 root    4096 Jun 21 11:40 grub
-rw-r--r-- 1 root 4176864 Jun 17 16:55 vmlinux-2.6.32.8-lfs-6.6

root:/etc/grub.d# ls -l
total 24
-rwxr-xr-x 1 root root 3223 Jun 14 21:20 00_header
-rwxr-xr-x 1 root root 3126 Jun 14 21:20 10_linux
-rwxr-xr-x 1 root root 4409 Jun 14 21:20 30_os-prober
-rwxr-xr-x 1 root root  214 Jun 14 21:20 40_custom
-rw-r--r-- 1 root root  483 Jun 14 21:20 README

I had to run these two commands when I tried, man grub-mkconfig
root:/boot/grub# export LANG=nl_NL
root:/boot/grub# export LC_ALL=POSIX
This fixed the error message, although there was no man page for this. I really want to know what it does because, in the documentation, it is written that an Ubuntu linux was also found on a different partition (UID number is different)

vol_id --uuid /dev/sdb1 is the partition on which I am running Mandriva Gnome.  Its uuid does not appear in this list. I wonder if I should put it there?

I found some grib information here. They mention:
Note the term 'installation' can mean two things. Installation of the grub software onto a host (to allow preparation and configuration of the bootloader), and installation of a bootloader onto a target ( placing the loader at the start of a disk/partition to make GRUB really work when the machine boots). To help differentiate these, the term 'write' will be used when possible to describe the second kind of installation.

root:/etc/grub.d# grub-install -v
grub-install (GNU GRUB 1.97.2)

root:~# blkid  shows all uuid paritions on computer

Although it is not mentioned in the documentation, I feel that I need to put in here somewhere my Mandriva KDE and GNOME partitions. Using this link as reference, I put the relevent lines into /etc/grub.d/40_custom. So for 2nd hard disk and first partition (Grub2 is different fromlegacy grub)


menuentry "Mandriva-Gnome" {
insmod ext3
set root=(hd1,1)
linux (hd1,1)/boot/vmlinuz
initrd (hd1,1)/boot/initrd.img
}
For a simple test, I changed the name of the cfg.
root:/boot/grub# grub-mkconfig -o /boot/grub/test_grub.cfg

Looks good.

Section 8.4.3., I have no idea what they are talking about.  Well, feeling brave and with some familarity with legacy grub, I tried what they suggested.

  1. /sbin/reboot Turns off the computer and starts again.
  2. When graphical menu appears, press ESC key (on my computer) to exit graphics mode. A window appears for me to confirm, press yes.
  3. I see a grub console.
  4. Type root (hd1,5) , noting that grub2 will use 6.
  5. Type kernel /boot/grub/core.img
  6. Type boot
I get to a boot menu with  linux, Mandriva Gnome and Mandriva KDE. Hooray.
But, it seems I made a typo. Instead of initrd, I had written initrf. So, I fixed this and ran  

root:/# grub-mkconfig -o /boot/grub/grub.cfg

 root:/# grub-setup /dev/sda
 root:/# logout
root:/#/sbin/reboot

That's it! Too late to turn back. The logout of chroot, I have yet to figure out. But when I reboot without doing so, there are errors that $LFS is busy.