SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files
Zdisk v2.15 - Kent Robotti <robotti@godmail.com> - (6-4-2004)

This 'zdisk' script will expect to find syslinux/syslinux, syslinux/ isolinux.bin, and syslinux/keymaps.tgz in the same directory as it is.

Usage: ./zdisk -serial -[fd|cd|initrd|image] -k path_to_kernel

-i path_to_initrd_contents.tgz -m module_directory

The default initrd contents are "-i rescue.tgz".


Floppy instructions!

Putting the rescue system on a 1.44mb or 1.722mb dos formatted floppy.

Tell zdisk where the chosen kernel is, the kernel can't be more than 765Kb in size to fit on a 1.44mb formatted floppy, unless you reduce the size of the initrd contents.

The kernel can't be more than 1040Kb in size to fit on a 1.722mb formatted floppy, unless you reduce the size of the initrd contents.

This script will format the floppy to the needed size, if not already.

The kernel must have ram disk and initial ram disk (initrd) support. The kernel config file should have something like this. # Block devices
#
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y

Some possible paths to the kernel.

# ./zdisk -fd -k /vmlinuz
# ./zdisk -fd -k /boot/vmlinuz
# ./zdisk -fd -k /usr/src/linux/arch/i386/boot/zImage # ./zdisk -fd -k /usr/src/linux/arch/i386/boot/bzImage

If you want to include any module(s) put the module(s) in a directory, and tell zdisk what directory they're in.

# ./zdisk -fd -k /vmlinuz -m /foo/boo

The above means zdisk will expect to find /foo/boo/module1.o /foo/boo/module2.o etc.


Cdrom instructions!

# ./zdisk -cd -k path_to_kernel -i path_to_initrd_contents.tgz

-m module_directory

If you want to put the rescue system on a cd disk, you'll need 'mkisofs' on your system to create the iso image.

Since the bootable cd image can be as large as the cd capacity (about 650mb), you can add to the initrd contents 'rescue.tgz etc.' if you want to.

Remember it has to be loaded into memory, 650mb compressed loaded into memory would require about 1300mb of ram.

Just extract the initrd contents 'rescue.tgz etc.' and add to it, then tar gzip it.

zdisk-2.14# mkdir rescue-cd

          # tar xzvpf rescue.tgz -C rescue-cd  
          # cd rescue-cd

For example if you wanted to add bash, put bash in rescue-cd/bin and the libraries it requires in rescue-cd/lib.

# ldd /bin/bash

        libtermcap.so.2 => /lib/libtermcap.so.2 (0x40016000)
        libdl.so.2 => /lib/libdl.so.2 (0x4001b000)
        libc.so.6 => /lib/libc.so.6 (0x4001e000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

You can also create this link in `rescue-cd/bin# ln -sf bash sh'.

If you wanted to add network support you would probably need at least.

/etc/protocols /etc/hosts /etc/services /etc/nsswitch.conf /lib/libresolv /lib/libnss_files /lib/libnss_dns /lib/libnss_compat /bin/hostname /sbin/ifconfig /sbin/route

After you add to it or make any changes, tar gzip it.

rescue-cd# tar cvzpf ../rescue-cd.tgz *

The initrd contents would then be "-i rescue-cd.tgz".

Do this to create a bootable cd iso image of the rescue system.

# ./zdisk -cd -k path_to_kernel -i path_to_initrd_contents.tgz

Then you have to use a program like 'cdrecord' to write 'rescue.iso' to the cd disk.

The example below assumes a scsi cd writer on device 0,6,0 with a 4x speed.

# cdrecord -scanbus "To find the device your cd writer is on!"

Cdrecord release 1.9 Copyright (C) 1995-2000 Jorg Schilling scsibus0:
0,6,0) 'TOSHIBA ' 'XM-3401TASUNSLCD' '3593' Removable CD-ROM etc...

# cdrecord -v speed=4 dev=0,6,0 rescue.iso

If you need to erase the cd-rw first.

# cdrecord -v blank=fast speed=4 dev=0,6,0 rescue.iso

Get the CD-Writing-HOWTO from: http://ibiblio.org/pub/Linux/docs/HOWTO

You can then boot the cd disk, if your bios supports it and is set to boot from the cdrom drive first.


Initrd instructions!

If you want to boot the linux system from a dos/win9x system on your hard drive, do this.

# ./zdisk -initrd -i path_to_initrd_contents.tgz -m module_directory

The above will create 'linux.gz' from initrd contents 'rescue.tgz etc.', you can then boot 'linux.gz' from your dos/win9x system using loadlin.

Since this initrd image 'linux.gz' will be booted from your hard drive, it's size can be larger.

Remember it has to be loaded into memory, 8mb compressed loaded into memory would require about 16mb of free ram etc.

Create a directory on your dos/win9x system and put linux.gz, loadlin.exe, and a kernel in it.

C:\ mkdir ramlinux
C:\ramlinux\linux.gz
C:\ramlinux\kernel
C:\ramlinux\loadlin.exe

Boot it!

You can't boot linux in windows, quit windows and restart in dos mode. Dos mode is when windows is closed and all you have is a C:\ prompt.

C:\ramlinux> loadlin kernel initrd=linux.gz ramdisk_size=8192 root=/dev/ram0 rw

You can create a 'linux.bat' file with this below in it.

@echo off
loadlin kernel initrd=linux.gz ramdisk_size=8192 root=/dev/ram0 rw

C:\ramlinux> linux

The ramdisk size is the amount of RAM required to hold the uncompressed initrd image 'linux.gz'.

The zdisk script will tell you this when it creates linux.gz.

Image instructions!

# ./zdisk -image -k path_to_kernel -i path_to_initrd_contents.tgz

-m module_directory

If you want to create a 1.44mb or 1.722mb bootable image version that can be written to a floppy, the first zdisk option should be '-image'.


Serial console instructions!

If you want to use a serial console the first option shuld be '-serial'.

# ./zdisk -serial -fd -k path_to_kernel -i path_to_initrd_contents.tgz

-m module_directory

End!


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.