~thc
Group: Members
Posts: 42
Joined: Dec. 2005 |
|
Posted: Feb. 21 2007,20:26 |
|
use extreme caution: several steps mentioned below could ruin your pendrive and/or your harddisk DO NOT COPY AND PASTE COMMANDS - double check what you are doing! I have tested this with a 2 gb pendrive (fat16) / knoppix 5.1.1 and a 512 mb pendrive (fat32) / dsl 2.1.
the filenames, directoriy names and grub settings used below are only examples!
what you need
- an usb pendrive of any size formatted as a hard disk - the first or only partition of this pendrive formatted with a fat filesystem and enough space left for dsl/knoppix - the contents of a dsl (or other knoppix based) cd - a real or virtual computer running a linux installation with grub and usb pendrive support - a pc bios capable of emulating a hard disk booting mechanism for the usb pendrive
step by step
1. copy the following dsl/knoppix files to the usb pendrive
(cd)/KNOPPIX/KNOPPIX -> (usb)/KNOPPIX/KNOPPIX (cd)/boot/isolinux/kernel_filename -> (usb)/boot/linux (cd)/boot/isolinux/gzipped_miniroot_filename -> (usb)/boot/minirt.gz
[starting with knoppix 5 the cd contains essential kernel modules in /KNOPPIX/modules - you will need this directory and all files in it too.]
2. convert isolinux.cfg from the dsl/knoppix cd
create a new text file (dos or un*x) namend menu.lst and add those three lines:
Code Sample | default 0 timeout 5 color cyan/blue white/blue |
the syntax of the boot entries in (cd)/boot/isolinux/isolinux.cfg and grub's menu.lst differ slightly.
for every dsl/knoppix isolinux.cfg boot entry like this example
Code Sample | LABEL example KERNEL linux24 APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt24.gz quiet BOOT_IMAGE=knoppix |
add the corresponding boot entry to menu.lst like this converted example:
Code Sample | title example kernel /boot/linux ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 quiet BOOT_IMAGE=knoppix initrd /boot/minirt.gz |
another example: a menu.lst file containing only the default dsl 2.1 entry would look like this:
Code Sample | default 0 timeout 5 color cyan/blue white/blue
title dsl kernel /boot/linux ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 nomce noapic quiet BOOT_IMAGE=knoppix initrd /boot/minirt.gz |
create a directory (usb)/boot/grub. copy the file menu.lst to (usb)/boot/grub
3. prepare the grub install
boot the linux installation and mount your usb pendrive (sda1 and /mnt are only examples!)
Code Sample | # mount /dev/sda1 /mnt |
copy the grub stage loader files from the linux installation to the stick
Code Sample | # cp /boot/grub/stage1 /mnt/boot/grub # cp /boot/grub/fat_stage1_5 /mnt/boot/grub # cp /boot/grub/stage2 /mnt/boot/grub |
mark the usb grub directory by putting a unique file there:
Code Sample | # touch /mnt/boot/grub/mark |
4. install grub
start grub from the command line.
from the grub shell enter the following commands (hd1 and the grub output are only examples!):
Code Sample | grub> find /boot/grub/mark (hd1,0)
grub> root (hd1,0) Filesystem type is fat, partition type 0xe
grub> setup (hd1) 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 (hd1)"... 15 sectors are embedded. succeeded Runnung "install /boot/grub/stage1 (hd1) (hd1)1+15 p (hd1,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded Done.
grub> quit |
the file "mark" is no longer needed:
Code Sample | # rm /mnt/boot/grub/mark # umount /mnt |
the stick should now boot into grub.
goodies
- grub's stage 1.5 loader reads file systems, not hard disk sectors - you don't have to worry about the geometry or the size of your pendrive.
- grub's setup does not alter neither the boot sector of the first (or only) pendrive partition nor the contents of that partition. [the stage 1.5 loader is written to 15 (normally empty and unused) sectors directly following the mbr/partition table.]
- if bartpe is (or will be ;) ) installed on your pendrive, you can tell grub to boot it by adding to menu.lst:
Code Sample | title bartpe chainloader +1 |
|