Saturday, October 3, 2009

OpenBSD - Howto create bootable media (thumb drive)

  1. Boot from CD or start your OpenBSD VM.
  2. At the "Install, Upgrade or Shell" prompt, select the shell.
  3. Insert the pen drive. You will see kernel messages about the insertion, including the virtual SCSI drive # assigned to the drive. For this example, I will use "sd0" but it may be another number.
  4. Put an MBR on the drive, reserve all space as a single MBR partition for OpenBSD:
    # fdisk -iy sd0
  5. Put an OpenBSD disklabel on the drive, assign all available space as a single "a" partition on sd0:
    # disklabel -E sd0
    Use "a a" to add partition a, take the defaults for all prompts, once the partition is created, use the "q" command to exit the disklabel program. Answer "y" to write the disklabel.
  6. Format the "a" partition on sd0 as an OpenBSD FFS partition:
    # newfs sd0a
  7. Mount it:
    # mount /dev/sd0a /mnt
  8. Copy the second stage boot loader and the ramdisk kernel to it:
    # cp /bsd.rd /mnt
    # cp /usr/mdec/boot /mnt
  9. Create an /etc/boot.conf on the drive so you do not have to request the ramdisk kernel manually at boot time:
    # mkdir /mnt/etc
    # echo set image /bsd.rd > /mnt/etc/boot.conf
  10. Install the PBR:
    # /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot sd0
  11. Unmount the pen drive:
    # umount /mnt

No comments: