If you have trouble using GParted on your USB (exits immediately)
start by wiping the partition table (assuming your USB is sdc) at a
console prompt type (back up any files you wish to keep from the
USB first):
dd if=/dev/zero of=/dev/sdc bs=512 count=1
You can wipe your entire key (if you wish) with the command
dd if=/dev/zero of=/dev/sdc
Provided your key is seen as sdc. Careful with this command it will wipe any
drive that is recognized as sdc. You can cancel out of this dd process part
way through by hitting CTRL and C together. Canceling out does not mean
any damage done so far is reversed or undone however.
Using GParted access the USB device. You will first need to create
a partition table (if you wiped it as shown above),
Device menu -> Create Partition Table, click Apply. A
MS-DOS partition table is the one you want (it is the default).
Partition the USB key as fat32 (so Windows can also see it). Click Apply.
Right click on the new partition and select Manage Flags from the shortcut
menu. Select (check) boot so the partition is marked as bootable. Quit
GParted.
Then create a /boot directory and a /puppy52usb directory at the root of the
partition.
Then create a /boot/grub directory on the USB key.
Then copy the files stage1, stage2, and fat_stage1_5, and put them
into the /boot/grub directory on the USB flash memory key. These files
are located in /usr/lib/grub/i386-pc in a puppy installation.
cp /usr/lib/grub/i386-pc/stage1 /mnt/sdc1/boot/grub
cp /usr/lib/grub/i386-pc/stage2 /mnt/sdc1/boot/grub
cp /usr/lib/grub/i386-pc/fat_stage1_5 /mnt/sdc1/boot/grub
Copy the puppy boot files over to /puppy52usb/ on the USB key. These
files include initrd.gz, lupu_520.sfs, vmlinuz and any puppy save files
or SFS (squash file system) files you wish to prime the USB with.
After the files are copied over, it's time to install GRUB to the
Master Boot Record (MBR) of the USB flash memory key.
# grub
grub> find /puppy52usb/vmlinuz
(hd2,0)
This indicates what drive to use for the following commands. Ensure we don't
have this same folder file structure on any other disk or we may be confused.
grub> root (hd2,0)
# Make sure you use the drive indication not including the partition
# for the following setup command or it will fail.
grub> setup (hd2)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... yes
Running "embed /boot/grub/fat_stage1_5 (hd2)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd2) (hd2)1+15 p (hd2,0)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.
grub> quit
Edit (create) the /boot/grub/menu.lst file to look something like this.
The contents of the /boot/grub/robsnotes.txt file looks like this...# GRUB configuration file '/boot/grub/menu.lst'.
#
# Start GRUB global section
default 0
timeout 5
color light-gray/blue black/light-gray
# End GRUB global section
# Linux bootable partition config begins
title Puppy Linux 5.2 (usb as hd0,0)
root (hd0,0)
kernel /puppy52usb/vmlinuz pmedia=usbflash psubdir=puppy52usb
initrd /puppy52usb/initrd.gz
# Linux bootable partition config ends
# Linux bootable partition config begins
title Puppy Linux 5.2 pfix=ram (no pupsave file loaded, usb as hd0,0)
root (hd0,0)
kernel /puppy52usb/vmlinuz pmedia=usbflash pfix=ram psubdir=puppy52usb
initrd /puppy52usb/initrd.gz
# Linux bootable partition config ends
#title Install GRUB to floppy disk (on /dev/fd0)
#pause Insert a formatted floppy disk and press enter.
#root (hd0,0)
#setup (fd0)
#pause Press enter to continue.
#title Install GRUB to Linux partition (on /dev/sda1)
#root (hd0,0)
#setup (hd0,0)
#pause Press enter to continue.
title - ===============================================================
root (hd0)
title - For help press 'c', then type: 'help'
root (hd0)
title - For usage examples press c then type: 'cat /boot/grub/usage.txt'
root (hd0)
title - For robs notes press c then type: 'cat /boot/grub/robsnotes.txt'
root (hd0)
title - The interactive grub prompt supports TAB commandline completion
root (hd0)
title - ===============================================================
root (hd0)
If the /boot/grub/usage.txt file does not exist it looks like this..This file is some of my notes concerning boot problems specifically
with regards to the USB.
The usage.txt file has more general information
type: 'cat /boot/grub/usage.txt' to see that file.
When setting up the grub boot the indicated drives and partitions
are not the same as when actually booting from the USB key.
For example the drive sdc was indicated as (hd2) and the partition
sdc1 was indicated as (hd2,0) when we installed grub. But When actually
booting from the USB, the BIOS remaps it to be (hd0) as if it was
the first hard disk. I alter the menu.lst text file to use (hd0,0)
as the boot partition and it works. After booting the drives are
switched around and then the hard disk in grub is once again assigned
(hd0) and the USB (hd2).
This may not be true for all computers. So if you are unable to
boot this puppy USB it could be you need to edit the entry to use
(hd2) again. One way to know what you have to use is to press c this
will put you into the Grub interactive mode. Then type find
/puppy52usb/vmlinuz (or a file you know should be on the USB).
Grub will indicate which drive it finds the file on (one reason
why I changed the puppy folder to say puppy52usb).
Press the [Esc] key to return to the GRUB menu. Then press e to
edit the entry for booting puppy. Highlight the (hd0,0) line and press
e again. Change the line to be (hd2,0) or whatever drive it should be
and then press b to boot.
Hope this helps. Rtaylor.
That's it for the instructions now for the novel (story) part of the document. I have 5 machines to test boot keys on and I have a variety of keys ranging from 128 Megabytes to over 4 Gigabytes.=======================================================================
This is an example of how to use the GRUB edit function.
Highlight the menu entry you want to edit, then press 'e', then
highlight the line you want to edit and press 'e'. Add what
you want to the line 'hdd=scsi' etc. and press enter, then
'b' to boot.
Examples of the difference between Linux and GRUB device names.
Linux IDE: GRUB IDE: Linux SCSI: GRUB SCSI:
/dev/hda1 (hd0,0) /dev/sda1 (hd0,0)
/dev/hda2 (hd0,1) /dev/sda2 (hd0,1)
/dev/hda3 (hd0,2) /dev/sda1 (hd0,2)
/dev/hda4 (hd0,3) /dev/sda2 (hd0,3)
/dev/hdb1 (hd1,0) /dev/sdb1 (hd1,0)
/dev/hdb2 (hd1,1) /dev/sdb2 (hd1,1)
/dev/hdb3 (hd1,2) /dev/sdb1 (hd1,2)
/dev/hdb4 (hd1,3) /dev/sdb2 (hd1,3)
These are some examples of how to use GRUB from the command prompt.
Press the 'c' key for the command prompt.
If you want to boot a Linux system on a partition, using it's kernel
/boot/vmlinuz etc., do this.
grub> root (hd0,1)
grub> kernel /boot/vmlinuz root=/dev/hda2 ro
grub> boot
You could do this to find what partition the kernel is on.
For example, show me what partitions have a /boot/vmlinuz.
grub> find /boot/vmlinuz
(hd0,1)
(hd0,2)
If you want to boot a Dos/Win partition, do this.
For example, boot partition on /dev/hda1.
grub> rootnoverify (hd0,0)
grub> makeactive
grub> chainloader +1
grub> boot
If you want to boot a FreeBSD partition using /boot/loader.
For example, boot freebsd partition on /dev/hda4.
grub> root (hd0,3,a)
grub> kernel /boot/loader
grub> boot
If that doesn't work, try this instead.
grub> rootnoverify (hd0,3,a)
grub> chainloader +1
grub> boot
==============================================================
Press the [Esc] key to return to the GRUB menu.
When I first started with Puppy I used the Puppy Universal Installer and some of my smaller keys. The installation and operation of the USB keys seemed to go very well and I was able to boot the keys on several of my PCs with little difficulty.
As I grew in my Puppy knowledge and learned to create and use sfs files for my applications (saving on pupsave file space) my needs for more space on the USB keys grew. I started using more of my keys and ran into some difficulties.
I have one key in particular that is actually 4.17 Gb in size which I could never manage to make bootable. I tried everything I could using the "Puppy Universal Installer", "Using the BootFLASH install Puppy to USB" and using dd to put different MBRs over to the USB.
Then I have another key which is actually 3.79 GB in size which I managed to get to be bootable on one PC using the "Puppy Universal Installer" but which would not boot on several other PCs.
I searched for tools and howtos in Google and tried and failed at a number of efforts. Often I would end up with the key no longer able to be accessed by GParted. GParted would just immediately exit when trying to read the partition table.
Finally I managed to put together this method (documented above) by extracting details from a few different howtos I found. The exciting part is now my 4.17 GB key will boot properly (never booted before) and my 3.79 GB key boots on every PC I've tried it on.
I have gone on to develop a similar howto for creating a DOS bootable USB key using Puppy 5.2 and Grub. Here is a link to that post:
http://www.murga-linux.com/puppy/viewtopic.php?t=64631