How do you create an iso compatible with virtualbox?

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
smilinggoomba
Posts: 3
Joined: Thu Aug 18, 2011 6:13 am

How do you create an iso compatible with virtualbox?

Post by smilinggoomba »

I'm a beginner programmer who just finished the wiki's Bare Bones tutorial. I made a floppy image and booted it with qemu, but when I made an iso and tried to boot it with virtualbox, it gave me the error:
"Could not get the storage format of 'awesome.iso' ". Any help? Thanks!
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: How do you create an iso compatible with virtualbox?

Post by Combuster »

Virtualbox should not be able to trip over correct ISO images, otherwise you'd permanently require physical media to install an OS in the VM.

Therefore your image or your use thereof is broken. Why? I don't know because you haven't told us anything meaningful.
"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 ]
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: How do you create an iso compatible with virtualbox?

Post by turdus »

If I'm right, your problem is that VB does not like your plain iso, which looks like a dd image.

You have 2 options:
1. use VB tools (VBoxManage convertfromraw) to convert iso to vdi (slow, but simple)
2. harder to prepare, but easier to use method
2.1 create a flat, non-compressed, pre-allocated vdi image
2.2 with a hexeditor locate the grub identifier and the MBR in it
2.3 chop everything after, including the MBR, so you'll have a plain vdi header (1024 bytes in my case)
2.4 after compilation you can create vdi by merging this header and the fresh iso like
cat vdiheader.bin mydisk.iso >mydisk.vdi
and voilá, it works like a charm.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: How do you create an iso compatible with virtualbox?

Post by jnc100 »

I use grub-mkrescue to create ISO images with grub pre-installed. As far as I am aware these are 'standard' ISO images (if that term means anything) and they load fine with virtual box. How are you creating your image?

Regards,
John.
smilinggoomba
Posts: 3
Joined: Thu Aug 18, 2011 6:13 am

Re: How do you create an iso compatible with virtualbox?

Post by smilinggoomba »

I use the "cat" utility provided with my copy of ubuntu.
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: How do you create an iso compatible with virtualbox?

Post by Combuster »

Forum rules wrote:Giving hackers the ability to reproduce the problem in a controlled environment is especially important if you are reporting something you think is a bug in code. When you do this, your odds of getting a useful answer and the speed with which you are likely to get that answer both improve tremendously.
It might help to give us the idea that you've actually read that. Like posting the exact commands.

Other than that, the probable usage of cat alone is not going to make a valid ISO image. Please go read one of several tutorials on the wiki on how things are normally done. It is the only advice I can give because I only see that you did something really stupid but I lack every bit of information as to what and why you did it and therefore can't cover any lack of understanding on your part.

In other words: if you keep asking stupid questions, you'll never learn anything from the responses.
"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 ]
smilinggoomba
Posts: 3
Joined: Thu Aug 18, 2011 6:13 am

Re: How do you create an iso compatible with virtualbox?

Post by smilinggoomba »

The complete command is: "cat stage1 stage2 pad kernel.bin > floppy.img". "Pad" is a file used as padding to avoid the kernel starting in the middle of a block, "Kernel.bin" is my kernel, and "stage1" & "stage2" are files from GRUB to boot my kernel.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: How do you create an iso compatible with virtualbox?

Post by egos »

Combuster wrote:Other than that, the probable usage of cat alone is not going to make a valid ISO image.
If you have seen bad English in my words, tell me what's wrong, please.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: How do you create an iso compatible with virtualbox?

Post by Brendan »

Hi,
smilinggoomba wrote:I use the "cat" utility provided with my copy of ubuntu.
To boot from CD, you need to use and "ISO9660" format CD image (with or without optional extensions like Rock Ridge, Joliet, etc). On top of that the ISO9660 image must also use the "El Torito" extension.

That means that there's a lot of stuff to take care of before you've got a valid/usable boot CD (or CD image). For example, to use El Torito (to make the CD bootable) for "floppy emulation", you'd need a bunch of unused (2048-byte) sectors, a table describing the primary volume, a boot catalogue/table, an entry for your floppy image (saying where it starts, how big it is, etc), then the (1440 KiB?) floppy image. On top of that (for the ISO9660 file system) you'd need a root directory and 2 path tables.

All of these tables, structures, etc have specific requirements (specific contents, specific fields with specific values, etc, and some must be at a specific location on the CD/image).

Basically, it's radically different to a floppy disk (where no file system is used and you can do whatever you like), and there's no way that "cat" will ever work.

I'd recommend using an existing tool (like "nkisofs" which is probably already installed on your Ubuntu machine). The alternative is the "do it yourself" method - for that you'd need to get the specifications for both El Torito and ISO9660 and read/understand them before creating some sort of utility of your own.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply