Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 19 Sep 2018, 02:03
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Bootable USB key with DOS created using Puppy 5.2 and Grub
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
rdog

Joined: 18 Oct 2010
Posts: 25
Location: Quesnel, BC, Canada

PostPosted: Mon 07 Feb 2011, 19:30    Post subject:  Bootable USB key with DOS created using Puppy 5.2 and Grub
Subject description: Need a DOS boot disk for your BIOS flash updates? This permits usage of the entire USB key!
 

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 hiting 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 (sdc or which ever device your USB key is).
You will first need to create a partition table (if you wiped it as
shown above), Device menu -> Create Partition Table, click Apply.

Partition the USB key as fat16 for dos. 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 grub directory in it /boot/grub.

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

Create a marker file to search for later. In the root of your USB
create a file called usb.txt (with your USB stick mounted as sdc1).
touch /mnt/sdc1/usb.txt

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 /usb.txt
(hd2,0)

This indicates what drive to use for the following commands. Ensure we
don't have this same marker file at the root of 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

Fetch the FreeDOS image file.
Mount the USB key.
Open a shell and cd to the key.
cd /mnt/sdc1
wget http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/unofficial/balder/balder10.img

Put the memdisk file onto the USB key. The trailing . has an intervening
space between /usr/lib/syslinux/memdisk and it, and means the destination
for the copy is the current directory.

cp /usr/lib/syslinux/memdisk .

Create a /boot/grub/menu.lst file that looks like this...
Quote:
# 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
root=(hd0,0)
title Boot FreeDOS
kernel /memdisk
initrd /balder10.img
# Linux bootable partition config ends
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 - The interactive grub prompt supports TAB commandline completion
root (hd0)
title - ===============================================================
root (hd0)



You can remove the marker file we created earlier called /usb.txt on the USB
if you wish.

If the usage.txt file was not created for some reason it looks like this..

Quote:
=======================================================================
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.


Copy your BIOS flash files or other DOS programs over to the USB.

When booting you will first get the Grub boot menu and then a FreeDOS boot menu. I have successfully booted using the first FreeDOS boot option 0 as well as the 4rth FreeDOS boot option.

When you first boot to FreeDOS it will indicate drive A: and a dir (directory listing) will show you the FreeDOS executables available. Changing to drive C: by typing C: and pressing the enter (return) key and doing a directory listing (dir) will show you the other files on the USB key.

Once you see your other USB files just type the command desired (executable file name) and you are in business.

If you just want a bootable Puppy on USB key check out my other post here:
http://www.murga-linux.com/puppy/viewtopic.php?t=64630
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0505s ][ Queries: 11 (0.0072s) ][ GZIP on ]