Linux from img

Discussions about using Linux guests in VirtualBox.
Post Reply
Maxbester
Posts: 2
Joined: 2. Apr 2013, 19:47

Linux from img

Post by Maxbester »

Hello,

I have a linux img file designed to run on an ARM processor. I would like to test it in a virtual machine. Is it possible to create a vdi file from it? Or maybe extract files and create the vdi from them...?

Thanks
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Linux from img

Post by mpack »

Well, assuming it's an image of a whole disk then you can certainly create a VDI from it (VBoxManage convertfromraw). You can mount it in a VM and view the contents. What you can't do is execute any programs held on that drive (including any part of the operating system or boot sectors), because VirtualBox can't execute ARM code.

RPi image?
Maxbester
Posts: 2
Joined: 2. Apr 2013, 19:47

Re: Linux from img

Post by Maxbester »

So sad VirtualBox can't execute ARM code...

Yes this is about a RPi image.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Linux from img

Post by mpack »

VirtualBox is a hypervisor, not a simulator. In a hypervisor the guest code runs on the host processor, but I/O accesses are blocked and handled by simulations. Your host CPU can't run ARM code.

The only way you can run ARM code on a PC is with a simulator, and it will be unusably slow (like, around 1000x slower than the RPi).

Interesting fact, I work with the person who designed the RPi (PBL on the schematics). On the ARM boards he's done for us in the past the standard way to develop for them was using a cross compiler and IDE (in this case, an ARM C compiler and tools that run on the PC). I used the original tools by ARM Ltd, but gcc tools are available too. But, if you want to simulate a working Linux on a PC then it will have to be done using x86 and then ported to ARM. The port should be easy, e.g. ARM default byte order is the same as x86, and 32bits is a natural word size on both. Arithmetic works the same too (2s complement, right shift of -1 == -1).
Post Reply