Create bootable CD, USB disk etc.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kendfrey
Member
Member
Posts: 45
Joined: Mon Oct 17, 2011 7:44 am

Create bootable CD, USB disk etc.

Post by kendfrey »

I have a working bootable floppy image that runs on Bochs. I want to start testing on real hardware, but I can't get a bootable anything working. I tried making a bootable CD image, but I couldn't get Bochs to boot from it, so I didn't waste a CD. I tried making a bootable USB stick, but it froze our old computer before I could open setup, and my newer PC said 'Operating system not found' when I booted from the USB stick. Can someone explain how to make something bootable that I can boot from? (I don't have any floppy disks)
theseankelly
Posts: 20
Joined: Sat Oct 22, 2011 4:17 pm

Re: Create bootable CD, USB disk etc.

Post by theseankelly »

Some issues I've run into that may or may not be helpful

1) Bochs will only boot from CD if its the only device listed as a boot device, it seems. So, if you have something like first device: floppy, second device: cd, don't expect it to default to CD when no floppy image is mounted. I have no idea why. Maybe that'll be your problem.

If not, check out this post for taking your bootable floppy and putting it onto a CD
http://wiki.osdev.org/Genisoimage

2) USB Stick should be pretty easy -- just need to make sure your first sector is the standard 512 bytes with the bootloader signature at the end just like floppy. Use dd to copy it over. If that doesn't work, maybe your BIOS isn't configured to boot from USB.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Create bootable CD, USB disk etc.

Post by Casm »

kendfrey wrote:I have a working bootable floppy image that runs on Bochs. I want to start testing on real hardware, but I can't get a bootable anything working. I tried making a bootable CD image, but I couldn't get Bochs to boot from it, so I didn't waste a CD. I tried making a bootable USB stick, but it froze our old computer before I could open setup, and my newer PC said 'Operating system not found' when I booted from the USB stick. Can someone explain how to make something bootable that I can boot from? (I don't have any floppy disks)
A CD doesn't have a boot sector in the normal sense. The operating system loader is loaded directly by the BIOS without an intervening boot sector. On hard disks the first sector of the disk has a master boot record, which contains a partition table and some code to load a boot sector from whichever partition is marked as having an operating system on it.

So I would read up on the El Torito specification for CDs, and the master boot record for hard disks. However, the master boot record might become antique in the next few years as EFI systems start to become the norm.
kendfrey
Member
Member
Posts: 45
Joined: Mon Oct 17, 2011 7:44 am

Re: Create bootable CD, USB disk etc.

Post by kendfrey »

theseankelly wrote:USB Stick should be pretty easy -- just need to make sure your first sector is the standard 512 bytes with the bootloader signature at the end just like floppy. Use dd to copy it over. If that doesn't work, maybe your BIOS isn't configured to boot from USB.
My BIOS has an option to boot from USB storage, so I assume it is supported. I used PowerISO to create a bootable USB drive from a floppy image. It did something, since my USB drive went from 8GB to 1.44MB. Could PowerISO be the problem?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Create bootable CD, USB disk etc.

Post by Brynet-Inc »

Why would you write an ISO image to a USB thumb drive?
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Create bootable CD, USB disk etc.

Post by Combuster »

It did something, since my USB drive went from 8GB to 1.44MB. Could PowerISO be the problem?
Unlikely that software ships with showstopper bugs.

What you see is that your stick contains a single FAT12 partition of 1.4M in size, something that would probably have been there on a real floppy too. The question is if the bios thinks your USB stick is a floppy, or rather treat it as a harddrive.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
bonch
Member
Member
Posts: 52
Joined: Thu Aug 18, 2011 11:19 pm

Re: Create bootable CD, USB disk etc.

Post by bonch »

I can make bootable .iso files by opening bootloader.bin (or whatever) in MagicISO and exporting it as "bootable image file". Makes (for me) .iso files that boot on VirtualBox, Bochs and real hardware.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Create bootable CD, USB disk etc.

Post by egos »

CD/DVD
Run e.g. Nero Burning ROM and choose New Compilation -> CD-ROM (Boot). Then set following settings:

Code: Select all

Boot:
  Source of boot image data
    Image file: your_iso_bootloader.bin
  Enable expert settings (for advanced users only!)
    Kind of emulation: No Emulation
    Boot message:
    Load segment of sectors (hex): 7C0
    Number of loaded sectors: 4
Or:

Code: Select all

Boot:
  Source of boot image data
    Image file: your_floppy_image.bin
  Enable expert settings (for advanced users only!)
    Kind of emulation: Floppy Emulation 1,44 MB
    Boot message:
    Load segment of sectors (hex): 7C0
    Number of loaded sectors: 1
USB-HDD
Run e.g. HxD and choose Extras -> Open disk -> Physical disks ->Removable Disk1. Then write (check it is present) your MBR boot loader and mark boot partiton as active in partition table. Then find (or open it as logical disk) the partition and write your stage 1 boot loader.

USB-FDD
Run e.g. HxD and choose Extras -> Open disk -> Physical disks ->Removable Disk1. Then write your floppy disk image.
If you have seen bad English in my words, tell me what's wrong, please.
kendfrey
Member
Member
Posts: 45
Joined: Mon Oct 17, 2011 7:44 am

Re: Create bootable CD, USB disk etc.

Post by kendfrey »

I did get a bootable CD working on Bochs, but I had to EXPLICITLY choose to boot from CD. Still not sure how to boot from USB.
Post Reply