Difference between revisions of "Create bootable images, and bootable CD-Rom's"

From Wiki [en] OpenMandriva
Jump to: navigation, search
(via dd)
Line 191: Line 191:
 
<pre>dd if=<iso_name> of=<usb_drive> bs=4M</pre>
 
<pre>dd if=<iso_name> of=<usb_drive> bs=4M</pre>
  
Replace <code><iso_name></code> with the path to the ISO and <code><usb_drive></code> with the device node of the USB drive, i.e. <code>/dev/sdb</code>.
+
Replace <code><iso_name></code> with the path to the ISO and <code><usb_drive></code> with the device node of the USB drive, i.e. <code>/dev/sdc</code>.
 
+
{{Warning|Be careful as an error in the command line can give a disastrous result.
 
+
Be sure that the name of the device (/dev/sdc, /dev/sdd, ...) is the one you want to use.
 +
<br/>You can use '''fdisk -l''' or '''journalctl -f''' to check the name of the device.}}
 
[[Category:Howto]]
 
[[Category:Howto]]

Revision as of 08:26, 19 February 2017

Warn02.png
This wiki article may have one or more issues, and require cleanup or review in order to comply with the OpenMandriva Wiki Quality Standards.
Please help improve it or discuss these issues on the talk page. The following reason was given: Better Title Needed

Creating a CD-ROM

Most modern PCs can boot from CD-ROM and in the near future most computers
will not even have floppy drives. Therefore we present an alternative
configuration using a CD-ROM. In our method we are essentially creating three
levels of disk image files:


  • At the outermost level there is the iso file created by mkisofs.
  • At the intermediate level there is the diskette image file that the BIOS can boot from.
  • At the innermost level there is the compressed RAM disk image.

We have to start at the innermost level.

Creating the RAM disk image

Creating the RAM disk image for a CD is really the same as for a diskette, only
this time we will fit the modules.tar.gz file into the RAM disk and hence
the RAM disk will be larger. Run the following commands (put them in a shell script):

cd $MYBOOT

dd if=/dev/zero of=initrd.img bs=1k count=3000

mke2fs -F -N 300 initrd.img

mount -o loop initrd.img mnt

cp -a rootfs/* mnt

cp modules.tar.gz mnt/lib

umount initrd.img

gzip -9 initrd.img

Creating the Diskette Image

On the CD-ROM we will use a diskette image of 2.88MB. Real diskettes of this
size are really rare, but most PCs can boot from a diskette image on a CD.

First prepare an image file of a 2.88MB diskette and copy GRUB to it.


dd if=/dev/zero of=isoboot.img bs=1k count=2880

mke2fs -F isoboot.img

mount -o loop isoboot.img mnt

mkdir mnt/boot

mkdir mnt/boot/grub

cp grub-0.92/stage1/stage1 mnt/boot/grub

cp grub-0.92/stage2/stage2 mnt/boot/grub

Next create the file mnt/boot/grub/menu.lst with the following contents:


title Linux Installation Disk

root (fd0)

kernel (fd0)/boot/kernel

initrd (fd0)/boot/initrd.img.gz

Unmount and run GRUB:

umount mnt

grub-0.92/grub/grub

Inside GRUB type the following commands:

device (fd0) isoboot.img

root (fd0)

setup (fd0)

quit


Now the diskette image (hopefully) contains a working boot loader. Keep a copy

of this image, so you can add your kernels and RAM disk images later.

Finally copy your RAM disk and kernel to it:


mount -o loop isoboot.img mnt

cp linux-2.4.21/arch/i386/boot/bzImage mnt/boot/kernel

cp initrd.img.gz mnt/boot

umount mnt


This diskette image is already quite full, so this spells the worst for newer
software versions or extensions. As a first measure we can remove the Ethernet
drivers from modules.tar.gz. If we can boot from a CD-ROM, we may as
well assume we have a CD-ROM and we can install from there. Otherwise you can
consider the isolinux CD boot loader, which does not use diskette
images, but can use kernels and RAM disk images anywhere on the CD.
It's worth considering the removal of both module support and network support
from the kernel and to compile most common SCSI host adapters directly into
the kernel. Functionality related to modules and networking can then also be
removed from Busybox.

Creating the Bootable CD

First create a directory tree for the ISO image.

mkdir iso
mkdir iso/boot
mkdir iso/data

Next copy some files to the data subdirectory (in our example we use a
hypothetical file distro.tar.gz and copy the diskette image
to the boot directory.

cp distro.tar.gz iso/data

cp isoboot.img iso/boot

Now create the ISO image.

mkisofs -o bootcd.iso -b boot/isoboot.img \

        -c boot/boot.catalog -r iso

Finally burn it to a CD-ROM. Use the appropriate device ID.

cdrecord dev=0,1,0 -eject -pad -data bootcd.iso

This CD is bootable and from the booted Linux you should be able to mount the CD-ROM to access the data files.

Booting from USB

It is also possible to boot this release from a USB storage device. To transfer the live/installation you may use the ROSA Image Writer available from our repos:

urpmi rosa-imagewriter

Or, if you do not have OpenMandriva Lx:
Windows (32-bit)
Linux x86 (32 bit)
Linux x86_64 (64 bit)
Mac OS


At least 2GB of flash drive capacity is recommended. Persistent storage is not necessary. Note that this will erase everything on your USB!

via dd

You may alternatively dd the image to your USB stick:

dd if=<iso_name> of=<usb_drive> bs=4M

Replace <iso_name> with the path to the ISO and <usb_drive> with the device node of the USB drive, i.e. /dev/sdc.

Warning.png

Be careful as an error in the command line can give a disastrous result. Be sure that the name of the device (/dev/sdc, /dev/sdd, ...) is the one you want to use.


You can use fdisk -l or journalctl -f to check the name of the device.