PDA

View Full Version : Booting Knoppix without CD and with ISO image and PH?



inguaravi
12-01-2007, 03:48 PM
Hi friends....

I have KNOPPIX.iso on /dev/hdb7 and persistent home on /dev/hdb5. I use knoppix cheat codes and first put up knoppix CD and then load KNOPPIX.iso and persistent home.

Is there a way to boot linux without everytime putting knoppix CD and using image file?
i.e by changing boot loader options or GRUB etc..


Plz help..

mperrin
12-02-2007, 01:19 AM
inguaravi,

I am booting the KNOPPIX image file directly from a compact flash in an IDE adapter using the extlinux bootloader from the syslinux package by H. Peter Arvin. I tried to post the procedure for you but it was blocked for containing a banned word, although I can't imagine what that word might be. I sent a message to the site admin and hopefully the post will go through eventually. If you (or anyone else) would like it before then, contact me by PM and I can provide the details.

If your BIOS provides a startup boot menu option, you could use it to choose the disk with the extlinux bootloader. If not, you may be able to use the chainloader command in GRUB to transfer booting to the extlinux disk.

Mike Perrin

mperrin
12-02-2007, 04:53 AM
Thanks to very timely and effective response from the site admins (I am really impressed!) I can post the procedure now. Sorry it is so lengthy but it was intended to walk someone through the process step by step -- or myself six months from now when I have forgotten everything I know. I hope this is helpful.

Acknowledgment: My inspiration for this project came from Terry Gray's page on running KNOPPIX from compact flash found at
http://staff.washington.edu/gray/KnoppixCFguide.html

Correction to my previous post: the syslinux package is from H. Peter Anvin, not Arvin. Can't even blame the QWERTY keyboard layout for that one.


General:

The following procedure was developed using KNOPPIX 5.1.1 on a Biostar M7VKQ
motherboard with 800MHz Duron CPU and 256MB memory. The IDE/CF adapter was
jumpered as master and plugged into the primary IDE connector. A DMA-capable
CD burner was connected as the secondary IDE master. The CF was a 1GB standard
speed PIO-only SanDisk. Internet access was available on eth0 through a router
with DHCP server. Everything is accomplished using a single KNOPPIX CD session.

I had to use the nodma cheatcode with a PIO-only CF. Disabling DMA for the CF in
BIOS didn't work. nodma=/dev/hda is not a valid cheatcode and doesn't work either.
nodma affects all IDE drives including hard disks and CD/DVD burners. DMA can be
re-enabled for specific devices using the DMA acceleration tool found in the
KNOPPIX -> Utilities menu. If you have a CF or flash IDE module that supports DMA,
you may be able to ignore the nodma elements in the following procedure.

The bootloader and boot files are installed in one partition and the KNOPPIX
system files in another. That is because KNOPPIX mounts the partition containing
the system image as read only and refuses to allow it to be made writable.
If the boot directory was in the same partition it would be impossible to modify
the bootloader configuration and menu files from the running system. A third
partition is used for the persistent KNOPPIX disk image file. This file saves
configuration settings and /home/knoppix/ contents between boot-ups. The default
size of 100MB is used here; it could have been more than twice that with the
space available on the CF. However, persistent data is contained in a single file
(knoppix.img) and the data therein is only available through KNOPPIX extraction.
A fourth partition is dedicated to a conventional file system for user storage.
A 2GB or larger flash card allows for a bigger persistent image as well as a
generous user storage partition.

The persistent disk image saved configuration changes such as adding printers and
specifying time zone. I found no need for the option to save KNOPPIX configuration
through the configs.tbz and knoppix.sh files, but your situation may be different.
Those files only require 1MB so they would fit in the hda3 partition as sized below.


Cheatcode Notes:

When booting from CD, invoking the fromhd cheatcode did not mount KNOPPIX from
the compact flash partition (hda2), but rather from hdc, the CD drive. Using the
explicit cheatcode fromhd=/dev/hda2 did result in mounting from the CF.
When booting from CF with a CD in the drive, it still mounted the CD image.
When booting from the CF with no CD in the drive this is not an issue and the
fromhd cheat code works as expected.

There is no need to specify the home=scan or home=<path> cheatcode since the
default behavior appears to be home=scan. Knoppix found the knoppix.img file
on hda3 whether booting from compact flash or CD. The default action,
however, is to ignore the persistent image file. The user must actively
select OK on the bootup dialog window within the 20 second timeout period.

The codes used in the procedure below, nodma fromhd noprompt noeject, were
chosen as a minimum set needed to produce a basic CF install. You may wish
to add other cheatcodes listed in /cdrom/KNOPPIX/knoppix-cheatcodes.txt.
For example, you may want screen=1280x1024 and/or xvrefresh=60 for an LCD
monitor. You can always edit the extlinux.conf file after booting from the
CF install, but for some codes now is better than later. The screen and
xvrefresh codes modify the way the xorg.conf file is created. If the system
is booted without these codes and the persistent disk image is created,
xorg.conf will specify the default 1024x768 maximum resolution. If you
subsequently edit extlinux.conf to add those codes, they will be used for
boot-up but overriden by the xorg.conf saved in the persistent disk image,
presuming you accept it. If you don't accept it you would lose printer and
other configuration information also. So in the case of these examples, it
is better to add the codes before creating the persistent disk image, or
alternately, to edit the xorg.conf file to get the desired resolution and
vertical frequency rather than use cheat codes.


Procedure:

1. Boot "knoppix nodma" from CD with the CF in the IDE adapter. We presume
from here on that the CF is the primary master, /dev/hda.

2. Open a root shell from the KNOPPIX menu and create the following Linux
(type 83) partitions on the CF card using fdisk or your tool of choice.

hda1: minimum 10MB, bootable (for boot files)
hda2: minimum 750MB (for KNOPPIX system files)
hda3: minimum 110MB (for persistent image file)
hda4: whatever is left (for user storage)

hda4 is conceived as user storage for files that could be accessed by
other machines with a CF IDE adapter or USB card reader. If you want a
Windows box to be able to mount hda4 you will need to change the partition
Id to be compatible with a vfat file system you will create in the next step.
The down side is that vfat does not support links. My preference is to make
hda4 a full function Linux filesystem and use the network or a USB flash drive
if I have to share files with a Windows machine.

Example partition table for a 1GB CF card:
Disk /dev/hda: 1024 MB, 1024966656 bytes
32 heads, 63 sectors/track, 993 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 10 10048+ 83 Linux
/dev/hda2 11 760 756000 83 Linux
/dev/hda3 761 870 110880 83 Linux
/dev/hda4 871 993 123984 83 Linux

Choose "Do Nothing" when the what-should-I-do dialog boxes pop up after
writing the partition table.

3. Create ext2 filesystems on all partitions. Use the -m 0 option
to eliminate dead space reserved for root.
# If you created hda4 as a FAT16 or FAT32 partition, create the
# corresponding vfat filesystem (mkfs.vfat [ -F 32 ] /dev/hda4) instead.
mkfs.ext2 -m 0 /dev/hda1 (For boot files)
mkfs.ext2 -m 0 /dev/hda2 (For the KNOPPIX system files)
mkfs.ext2 -m 0 /dev/hda3 (For the persistent image file)
mkfs.ext2 -m 0 /dev/hda4 (For general storage)

4. Mount these four partitions and make hda1, hda2 and hda4 writable using
the desktop drive icon tools.
EDIT 2007-12-17: If you are using a fresh CF with a vfat filesystem,
mounting hda1 will fail until you edit /etc/fstab to change the filesystem
type in the /dev/hda1 entry from vfat to auto. :END EDIT
If everything went well, the df command should produce something like:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 3471 25 3446 1% /
/ramdisk 197528 5008 192520 3% /ramdisk
/UNIONFS 197528 5008 192520 3% /UNIONFS
/dev/hdc 713064 713064 0 100% /cdrom
/dev/cloop 1997852 1997852 0 100% /KNOPPIX
/dev/hda1 9725 92 9633 1% /media/hda1
/dev/hda2 744088 760 743328 1% /media/hda2
/dev/hda3 107367 1550 105817 2% /media/hda3
/dev/hda4 120051 1550 118501 2% /media/hda4

5. Copy and edit boot files from the CD to the compact flash
# Copy the entire boot directory tree to hda1
cp -r /cdrom/boot /media/hda1
# Change to the /media/hda1/boot directory
cd /media/hda1/boot
# Rename the isolinux directory to extlinux
mv isolinux extlinux
# Change to the extlinux directory
cd extlinux
# Rename the bootloader configuration file
mv isolinux.cfg extlinux.conf
# Remove files that will no longer be used
rm -f boot.cat isolinux.bin
# Make extlinux.conf writable
chmod +w extlinux.conf
# Edit extlinux.conf using vi or the editor of your choice.
vi extlinux.conf
Add these cheatcodes to the APPEND command lines: nodma fromhd noprompt noeject
Note that nodma is already present in the failsafe APPEND command. If you have
a CF that supports DMA, you may not need nodma in the other selections.
# You can now return to the knoppix home directory
cd

6. Copy the KNOPPIX system files from the CD to the compact flash
# Copy the entire KNOPPIX directory tree to hda2 (this will take some time)
cp -r /cdrom/KNOPPIX /media/hda2
# When complete, disk usage (df) should look something like this:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 3471 25 3446 1% /
/ramdisk 197528 5164 192364 3% /ramdisk
/UNIONFS 197528 5164 192364 3% /UNIONFS
/dev/hdc 713064 713064 0 100% /cdrom
/dev/cloop 1997852 1997852 0 100% /KNOPPIX
/dev/hda1 9725 4941 4784 51% /media/hda1
/dev/hda2 744088 709312 34776 96% /media/hda2
/dev/hda3 107367 1550 105817 2% /media/hda3
/dev/hda4 120051 1550 118501 2% /media/hda4

7. The filesystem on hda4 is owned by root and only root has write permission
so user knoppix cannot write to it without invoking sudo or opening a root
shell. This also prevents users on another machine writing to it without
root privilege. This is inconvenient and inconsistent with the intent.
You can skip this step if you created a vfat filesystem on hda4.
# Change access permissions for the hda4 filesystem to allow write by all
chmod a+w /media/hda4

8. Now it is time to obtain and install the extlinux boot loader.
Extlinux is included in the syslinux package and may be downloaded from
http://www.kernel.org/pub/linux/utils/boot/syslinux/
The package is available in tar.gz, tar.bz2 and zip formats. If you use
Konquerer it will save by default to /home/knoppix. If you use Iceweasel
(Firefox) it defaults to saving it in the Desktop folder. We presume here
that you downloaded the tar.gz version into /home/knopppix (or moved it there).
# Extract the archive (version 3.53 was current at the time of this writing).
tar -xvzf syslinux-3.53.tar.gz
# Change to the syslinux master boot record directory
cd sylinux-3.53/mbr
# The MBR on your CF may be OK but just in case, write a known good one to it.
cat mbr.bin > /dev/hda
# Change to the extlinux directory
cd ../extlinux
# Install the bootloader into the extlinux subdirectory on hda1
./extlinux -i /media/hda1/boot/extlinux
# You can now close the root shell
exit

9. Finally, you should create the persistent file system. If you do not wish to
save the downloaded syslinux archive and directory in /home/knoppix, you can
remove them or move one or both to /media/hda4 for safekeeping. Choose "Create
a persistent KNOPPIX disk image" from the KNOPPIX -> Configure menu, and select
/dev/hda3 as the target partition. hda3 was sized for the default 100MB image.

10. If luck is on your side and the phase of the moon is right, you should be able
to reboot, remove the CD in the process, and come back up on the CF drive.

inguaravi
12-02-2007, 06:03 AM
Thanx mperrin,

I have windows also installed on my system.

If i use syslinux and change the boot loader will i be able to boot windows again?

mperrin
12-02-2007, 06:27 AM
I am presuming that you are currently booting Windows from GRUB installed on hda. The procedure I suggested would not replace GRUB as the primary boot mechanism. Extlinux would be installed on a bootable primary partition on hdb, and you would use the chainloader command in GRUB to transfer boot control to extlinux similar to the way that you do for Windows. I can't help a lot here because I don't do Windows and I gave up on dual boot some time ago, but please be more specific about your current boot configuration and maybe I can make some suggestions that won't hurt you too badly.