Monday, June 21, 2010

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.


    No comments:

    Post a Comment