Revision [25258]

This is an old revision of GRUB made by darkcity on 2012-12-01 07:51:48.

 

HomePage > Components and HowTos > Booting > Boot Loaders

GRUB (Grand Unified Bootloader)


GRUB is a BootLoader. Within Puppy Linux GRUB may be installed onto any partition using: Menu > System > Grub

/boot/grub/menu.lst
This file should contain entries similar to these:
# For booting GNU/Linux on /dev/sda1 (H.D.D. primary partition)
title Puppy Linux
 rootnotify (hd0,0)
 kernel (hd0,0)/vmlinuz pmedia=idehd
 initrd (hd0,0)/initrd.gz

# For booting GNU/Linux on /dev/sda1 (U.S.B. flash drive partition)
title Puppy Linux
rootnotify (hd0,0)
kernel (hd0,0)/vmlinuz pmedia=usbflash
initrd (hd0,0)/initrd.gz

Error 2: Bad file or directory type thread


References

Can I install Puppy on HDD but boot from USB thumbdrive?

Appendix

When the GRUB menu comes up, press 'c' to go to a command line.
Type 'find /vmlinuz' and 'find /initrd.gz'
This will tell you where GRUB thinks the files are.


GRUB GRand Unified Bootloader, a multiboot bootloader that is easy to install and configure. It can boot from the Master Boot Record on a hard drive or from a CD. Especially easy to set up for Puppy. http://wiki.linuxquestions.org/wiki/GRUB

To learn about the GNU GRUB project, please see: http://www.gnu.org/software/grub/

The manual for "legacy" GRUB, including 0.96 installable from Puppy installer, please see: http://www.gnu.org/software/grub/manual/

GRUB (short for GRand Unified Boot Loader) is a boot loader, similar in overall function to LILO. It is the standard way to boot into an operating system (or several) used by most recent Linux distributions, but capable of being loaded on any Linux distro.

Go here for a comparison of Lilo & Grub, written by Laurence Bonney (IBM).


From TheBabbs - I run Puppy Linux 1.0.6 (soon to be 1.0.7) and Fedora Core 3 on the same desktop machine. Each has its own partition on different drives. When I first added Puppy Linux to this system, I had the hardest time configuring the GRUB install which Fedora had previously installed. It was not until someone provided me a sample configuration that I was able to hack "/boot/grub/grub.conf" to add an option to choose which Linux I wanted to use. In light of that, here is what I presently have in my grub.conf file:

# grub.conf
#
default=0
fallback=1
timeout=5
splashimage=(hd1,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
title Puppy Linux (1.0.6)
rootnoverify (hd0,0)
kernel (hd0,0)/boot/vmlinuz root=/dev/hda1
title Fedora Core (2.6.11-1.35_FC3)
root (hd1,0)
kernel /vmlinuz-2.6.11-1.35_FC3 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.11-1.35_FC3.img

MBR Solving problems with

if grub is more or less working, you should be able to boot Win XP by booting, press C to get a grub command line interface, then type:

root (hd0,0)
chainloader +1

you should be able to fix the mbr by booting the Win XP installation cd, getting the recovery console interface, then typing

fixmbr

but your Windows cd may not have a recovery console

i'm not sure, but i think you can install any standard mbr ... all the mbr should need to do is transfer control to the boot sector of the partition that Windows is installed on

one way to install a standard mbr from Puppy is to download mbr.bin and type:
dd if=mbr.bin of=/dev/hda
see: pclinuxos wiki
i think this should work without overwriting your partition table, because mbr.bin is 446 bytes

if it were to over write the entire 512 bytes of the mbr, your partition table would be gone, and everything on your drive would be lost ... you should be able to backup the entire mbr sector first by typing something like:
dd if=/dev/hda of=mbr.save bs=512 count=1
you should be able to restore it by typing:
dd if=mbr.save of=/dev/hda bs=512

you should be able to burn a bootable floppy or floppy image to a cd using any burning program, so if you don't have a floppy drive but you do have a cd drive, it should not be a problem

Ultimate Boot CD should be able to install a standard mbr:
http://www.ultimatebootcd.com/

Booting Puppy using the Grub bootloader


Ian's Page

This is a series of pages from the Puppy HowTo forum giving you a simple guide to setting up the Grub bootloader to boot Puppy from the' Master Boot Record' on your hard drive or creating a CD that will allow you to boot Puppy and Windows if you have Puppy installed in a Windows partition.

Grub - Windows - Linux Partition naming conventions


This is an introduction for beginners to Grub and how it works with Windows and Linux.

First we must introduce the idea of hard drives and partitions for those of you who know a little or nothing about the subject.

A hard drive is composed of platters stacked inside a case and accessed through what are called heads. These platters resemble CDs to a certain extent but differ in that both sides are written to and read from and the way they are divided into sections is different to a CD.
Hard drives are divided into sections called sectors and the sectors are arranged into what are refered to as cylinders, the combination of sectors and cylinders makes up the total of the hard drive.

Hard drives can by divided into partitions which are separate from each other and the divisions are defined by cylinder numbers starting at number1 and continuing on to the end of the hard drive as desired. For example on a 4.1G hard drive you could have one big partition that takes up all the space on the hard drive and it might look like this:

Start of partition = cyl no. 1

End of partition = cyl no. 525

Total size = 4.2G

In Windows this partition would be called C drive ( C: ) as this is how Windows describes partitions.
If you decided to create two partitions on your hard drive Windows would call the second one D drive
( D: ) so you would have:
C:
D:
on your hard drive as displayed in Windows, this all applies to DOS but I will just use Windows to cover all Microsoft operating systems, so for every extra partition you create Windows just uses the next letter in the alphabet. You will notice it does the same with CD drives as well.

Linux on the other hand uses a different naming convention, first it names the hard drive as hd and starting with the first hard drive it too uses letters of the alphabet so that the first hard drive on your system, the master hard drive, is named hda. The partitions are numbered starting at number 1.
So your C: drive in Windows would be named hda1 in Linux and subsequent partitions would be, hda2, hda3, and so on. If you had a second hard drive, a slave hard drive, under Linux it would become hdb and the partitions would become hdb1, hdb2.....

Grub starts it’s notation from zero, 0, it also uses the hd convention but does things slightly different.
For the first hard drive Grub shows hd0, for the second, hd1 etc.
Partitions also start at zero, so first hard drive - first partition is hd0,0 . For Grub to recognize this it must be enclosed in brackets i.e. (hd0,0).

At the beginning of the hard drive is a small section that never shows up in Windows or most operating systems called the Master Boot Record which is accessed by the BIOS in your computer to boot operating systems. This is where Grub is installed if you do a complete installation to a hard drive otherwise Grub can be set up on a CD and used to boot operating systems.

When Grub boots it looks for a boot directory with a grub directory inside it containing a configuration file, this is the file that you edit to allow your operating system/systems to start. Depending on what version of Linux you are using this file may be named menu.ls, grub.conconf or somthing similar but they all use the same terminology to describe what and how Grub should boot.

To sum up we will compare the partition naming conventions.

Windows c:/

Linux: /dev/hda1

Grub: (hd0,0)

When partitioning a hard drive there are certain rules that apply to Windows and Linux.
In Windows you are only allowed one Primary partition on your hard drive, to have extra partitions you must create an extended partition which does not hold data as it is only a receptacal for more partitions called Logical drives.
In Linux you can have four Primary partitions on your hard drive.

I hope this will help you understand the way drives and partitions are named and the way Grub sees things. This should help when it comes to editing the Grub configuration file.



Set up Grub on a single HDD Puppy installation.


If you have done the same as me and installed Puppy as a standalone OS in its own ex2fs partition on a hard drive and are still using a floppy to boot with, here is a quick and easy way to set up a bootloader.
I used Grub and set it up manually, it doesn’t have a pretty splashscreen but it boots quicker than using the floppy.

Grub requires just four files plus the vmlinuz of your current installation.
The Grub files are:

stage1
stage2
e2fs_stage1_5 (If you use a different filesystem you must select the appropiate stage1_5 file to suit. )
menu.lst

These are available from the Puppy forum here.

If you download the ‘grub_files.tar.gz’ tarball from the forum save it to /root/my-applications. To unpack it, open a terminal, click on rxvt on the desktop and type in,
#tar zxvf /root/my-applications/grub_files.tar.gz

this will place a folder called ‘Grub_files’ in my-applications.

To boot from Grub you must have a boot directory.containing a grub directory to hold the required files. As I had only one partition on my hard drive I just created a boot directory under the main tree /.
Open rxvt and type:
# mkdir -p /boot/grub

Now you need vmlinuz installed in the boot directory, ( I copied mine from the Puppy boot floppy made during the hard drive install)

Insert the boot floppy and using Start / File managers / Mount/unmount drives mount the floppy.
Go to /mnt/floppy and either drag or copy vmlinuz to /boot.
# cp /mnt/floppy/vmlinuz /boot

Next copy stage1 stage2 menu.lst and e2fs_stage1_5 (or whatever) to /boot/grub.
#cp /root/my-applications/Grub_files/stage1 stage2 menu.lst e2fs_stage1_5 /boot/grub

Now copy stage1 and stage2 to a floppy:
# cd /boot/grub

Insert floppy and type
# dd if=stage1 of=/dev/fd0 bs=512 count=1
1+0 records in
1+0 records out
Now stage2
# dd if=stage2 of=/dev/fd0 bs=512 seek=1
153+1 records in
153+1 records out
Next you need to reboot from the Grub floppy and when it comes to the grub prompt ‘grub> ’ you have to set Grub’s ‘root device’ to the partition containing the boot directory.

Grub uses different conventions to those used in Linux when naming partitions:
The master boot record on the hard drive in named (hd0) and each partition follows on from this i.e.
If you have just one partition, /hda1 in Linux or C: in Windows, it becomes (hd0) + 0 partition instead of no.1 or C.

The next partition would be 1, the next 2, and so on therefore Grub sees hda1 or C: as (hd0,0), that is ‘hard drive zero commer zero ‘and always enclosed in brackets.

So to set the ‘root device’:
grub> root (hd0,0) This sets /hda1 as hd0,0

Now run the setup command.
grub> setup (hd0)

This installs the boot loader into the Master Boot Record at the beginning of the hard drive. Then quit Grub.
grub> quit

There is only one thing left to do, you must give the boot loader instructions on how and what to boot, this requires a file named menu.lst which is a menu list for the boot loader.
A simple configuration for this is :

default 0
#By default boot the first entry.

timeout 30
# Boot automatically after 30 secs

title=Puppy Linux
# Display this as the Operating System to be booted

root (hd0,0)
kernel /boot/vmlinuz /root=/dev/hda1

# Where the Operating System is located

This file can be edited using ‘Beaver’ the text editor on the desktop.

If your setup is the same as the one described here do not worry about editing the menu.lst file.

When you reboot you will be presented with a text based menu, hit enter and Puppy will proceed to boot.

This has been put together mainly from the Grub instructions if you wish to multi-boot or have other setups than this you would do best to read the original Grub files.

To dual boot Puppy and Windows, read on.



Booting Puppy in Windows from a Grub CD


To create a bootable Grub CD to boot Puppy in Windows.
This is for everyone who is not sure how to go about creating a bootable CD.

Table of Contents
Creating the image file
Error messages
Finishing up
Some issues to look at
Suggestions

Creating the image file

Install Puppy in Windows9x using the wizard and a live CD.
During the installation of Puppy you will be required to make a floppy boot disk, you will need this later on.

Boot Puppy from the floppy.

Get the stage2_eltorito file and copy it into my-applications, it is included in the grub_files.tar.gz which you can download here.

In Puppy use TkZip archiver in Start/Utilities to open the grub_files.tar.gz file or go to the directory where you downloaded the file by opening rox on the desktop and then right click on the directory and select Xterm here and type in tar -zxvf grub_files.tar.gz.

Open a terminal by clicking on rxvt.
Using Puppy create a directory called iso, this is best done in my-applications so change to that directory.
# cd my-applications

Make the iso directory.
# mkdir iso

Make a boot directory and a directory in iso for GRUB.
# mkd -p iso/boot/grub

Copy the stage2_eltoito file to grub
# cp stage2_eltorito iso/boot/grub

Insert the floppy disk in the floppy drive and using Start/File managers/Mount/unmount drives, mount the floppy.
This will open a Rox window displaying the contents of the boot floppy.
Right click on autoexe.bat and read the entries, you will need these for the configuration file.

You will have to make a decision about the order you want things to boot in i.e. Windows first or Puppy first.

Make the menu.lst configuration file.

(Remember this is menu 'dot ell st' not menu 'dot one st')


You can do this using Beaver just open Beaver and either click 'File/New' or click on the 'Create a new document' Icon. Put these entries in the new document:
default 0
timeout 30

title Win98
rootnoverify (hd0,0)
chainloader +1

title Puppy Linux
rootnoverify (hd0,0)
kernel /vmlinuz root=/dev/ram0 PFILE=pup1 -none-524288
initrd /image.gz

Save this as iso/boot/grub/menu.lst

Now to make the iso filesystem type in:

# mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso

This is typed all on one line.

Hit ‘Enter’ and this will create a file named ‘grub.iso’.

Error Messages

If you get any error messages check these things first:

Did you create the iso/boot/grub file in my-applications.
Are you in the my-applications directory, check this by typing pwd at the command line this should return /root/my-applications.
Check the syntax of the command to create the iso file, spelling and spaces.

Finishing up

If you are successful in creating the grub.iso file the next thing to do is burn it to a CD, I use rewritable CDs in case something goes wrong as it is just a matter of erasing and starting from scratch,( In my case a lot of scratching). Using whatever burning program you have, create a new CD from the grub.iso image file.

Reboot your computer and set the Bios to boot from a CDROM first then insert the CD in the drive and reboot the machine.
If all is well you will be presented with a boot menu use the up/down keys to select the OS of your choice, hit enter and let Grub take over.

This HOWTO describes how to set up Grub on a CD to boot Windows and Puppy in that order, if you wish to boot Puppy first just swap them around.

The next section looks at some things that need addressing.

Some issues to look at

There are some things that I encountered during the creation of a bootable CD that I wish to address here.
Firstly I installed Puppy 0.9.8 in a fat32 partition that is running Windows 98, a standard installation, one partition taking up the whole hard drive. To do this I used a live CD.
Now when you boot off a live CD it looks for a file named pup001, or something like that, and if it can’t find one it creates one if it can, this depends on the filesystem as Puppy doesn’t writ to the NT filesystem.
This file is used to store things in, settings, data, etc, for the live CD so when you install Puppy in a Windows partition it creates a pup file also.

Instead of examining the Windows C: drive to see what Puppy had done I just ploughed ahead with the Puppy install which left me with two files, pup1 and pup001 which made things a little difficult.
By looking at the contents of the autoexe.bat file on the boot floppy that was created during the installation I discovered the following:

tiny.exe c:\vmlinuz c:\image.gz root=/dev/ram0 PFILE=pup1-none-524288 PHOME=hda1

so I determined that the floppy was booting the file pup1.
On the hard drive I found the files, vmlinuz, image.gz
That led me to the entry in menu.ls:

kernel /vmlinuz root=/dev/ram0 PFILE=pup1-none-524288 PHOME=hda1
initrd /image.gz

I set this up as Puppy Linux 1 and used the same entry with the slight change pup001 for Puppy Linux 001. This along with the entry for Windows98 now gave me three boot options that worked.

GRUB can be installed manually. GRUB has two parts - stage1 and stage2. Stage1 is the small block of boot code that gets written onto the M.B.R. Stage2 is the collection of support files that are stored in the directory /boot/grub on the Linux partition. That is also where the GRUB menu file menu.lst is located.

Inode sizes in EXT partitions:
http://www.murga-linux.com/puppy/viewtopic.php?p=262324#262324

Also see
BootLoaders



Categories
CategoryInstallation
CategoryCommandLine
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki