Page 1 of 1
Developing under OS-X
Posted: Tue May 08, 2012 1:26 pm
by Wolfos
Well, what works is assembling to binary with nasm, but I obviously don't have a floppy drive, so I would like to test under a virtual machine (Virtualbox). Now I tried making a disk image, but I'm stuck. How do you create a disk image from raw data that works under Virtualbox?
Re: Developing under OS-X
Posted: Tue May 08, 2012 1:42 pm
by bluemoon
You have to create an image file in format it understand.
http://www.virtualbox.org/manual/ch05.html#vdidetails
There is probably some tools to convert from raw image to the listed format too. Try google it.
As a side note, I'm not familiar with virtualbox but qemu support plain file as disk image, ie. each 512 byte is exactly the same sector position in the disk view from guest machine. it support i386 and x86_64 and is easily install with macport / sudo port install qemu.
Re: Developing under OS-X
Posted: Tue May 08, 2012 1:50 pm
by Wolfos
Alright, then I'll just try Qemu. Thanks!
Re: Developing under OS-X
Posted: Tue May 08, 2012 3:19 pm
by ATXcs1372
bluemoon wrote:There is probably some tools to convert from raw image to the listed format too. Try google it.
VirtualBox has it's own tool for this.
Create a DMG/IMG using hdiutil or even just dd then use
Code: Select all
VBoxManage convertFromRaw --format VDI input.dmg output.vdi
Here is a link to the actual VirtualBox documentation for it
Re: Developing under OS-X
Posted: Tue May 08, 2012 3:31 pm
by ATXcs1372
berkus wrote:I would still recommend bochs.app over any other tool for osdev on osx.
I've found QEMU to be faster on the new i5 and i7 based Macs.
Granted, I am emulating multiple cores (large slowdown) as well as a resolution of 1440 x 900 (some buffer copies can be intensive)
Otherwise I absolutely agree.
Re: Developing under OS-X
Posted: Tue May 08, 2012 3:42 pm
by Griwes
I think that the key factor here isn't speed, but ease of debugging - and I highly doubt that any other emulator will ever (or at least soon) become superior to bochs in terms of debugging.
Re: Developing under OS-X
Posted: Wed May 09, 2012 12:46 am
by iansjack
The best tool for programming OS stuff on a Mac (IMO) is Linux running in a VM. Then on the VM Linux run your OS under SimNow (for low-level debugging) or qemu (for C source level debugging). I've not tried Bochs, but SimNow is superb for assembler-level debugging.
It sounds a bit perverse running VMs within VMs, but I find it far easier than setting up the appropriate development environment on OS X.
Re: Developing under OS-X
Posted: Wed May 09, 2012 6:02 am
by turdus
iansjack wrote:The best tool for programming OS stuff on a Mac (IMO) is Linux running in a VM.
WTF?!? What's wrong with it's native stuff? You have bash, vim, perl, binutils, gcc, llvm, gnu/make, nasm, fasm, dd... everything you'll ever need for OSDEV. You can create and mount FAT natively. Only thing to do is a cross-compiler (same as with Linux), that's all (or you can use objconv).
I think using linuxvm is a very very bad advice.
Re: Developing under OS-X
Posted: Wed May 09, 2012 6:04 am
by bluemoon
iansjack wrote:The best tool for programming OS stuff on a Mac (IMO) is Linux running in a VM.
LoL, by definition this is not
programming OS stuff on a Mac, but is programming on Linux.
Re: Developing under OS-X
Posted: Wed May 09, 2012 6:07 am
by bluemoon
turdus wrote:You have bash, vim, perl, binutils, gcc, llvm, gnu/make, nasm, fasm, dd... everything you'll ever need for OSDEV. You can create and mount FAT natively. Only thing to do is a cross-compiler (same as with Linux), that's all (or you can use objconv).
I would add building gdb to the list as well. Mac's built-in gdb won't work with elf. But then, develop on mac is totally workable, as I'm just doing that.
Re: Developing under OS-X
Posted: Wed May 09, 2012 6:57 am
by gerryg400
bluemoon wrote:turdus wrote:You have bash, vim, perl, binutils, gcc, llvm, gnu/make, nasm, fasm, dd... everything you'll ever need for OSDEV. You can create and mount FAT natively. Only thing to do is a cross-compiler (same as with Linux), that's all (or you can use objconv).
I would add building gdb to the list as well. Mac's built-in gdb won't work with elf. But then, develop on mac is totally workable, as I'm just doing that.
+1 from me too. You also have Eclipse and Xcode. I use vmware fusion and connect a cross-gdb to the vmware kernel debugger to debug my OS. I also use VMware serial ports tailed to a terminal for kernel logging. The only time I need Windows or Linux is to occasionally check that my build scripts work on those OS's.
[Edit] Okay, I also occasionally use Linux to reformat my virtual disks when my ext2 driver trashes them.
Re: Developing under OS-X
Posted: Wed May 09, 2012 8:07 am
by bluemoon
gerryg400 wrote:I also occasionally use Linux to reformat my virtual disks when my ext2 driver trashes them.
I always have a copy of clean disk image, so when I messed up the testing image, I'd just
"cp initial.img testing.img".
Re: Developing under OS-X
Posted: Wed May 09, 2012 2:05 pm
by iansjack
bluemoon wrote:iansjack wrote:The best tool for programming OS stuff on a Mac (IMO) is Linux running in a VM.
LoL, by definition this is not
programming OS stuff on a Mac, but is programming on Linux.
I think you confuse Macs and OS X; they are not the same thing. It is programming in Linux on a Mac (it sure as hell isn't a PC!).
Re: Developing under OS-X
Posted: Wed May 09, 2012 2:08 pm
by iansjack
turdus wrote:iansjack wrote:The best tool for programming OS stuff on a Mac (IMO) is Linux running in a VM.
WTF?!? What's wrong with it's native stuff? You have bash, vim, perl, binutils, gcc, llvm, gnu/make, nasm, fasm, dd... everything you'll ever need for OSDEV. You can create and mount FAT natively. Only thing to do is a cross-compiler (same as with Linux), that's all (or you can use objconv).
I think using linuxvm is a very very bad advice.
Well, I think it's useful to keep my cross-compiling environment jailed from my native environment. I can take snapshots of the environment, play about with it and revert easily if I don't like the results.
It suits me. If it doesn't suit you, that's fine.
Re: Developing under OS-X
Posted: Wed May 09, 2012 2:10 pm
by iansjack
bluemoon wrote:gerryg400 wrote:I also occasionally use Linux to reformat my virtual disks when my ext2 driver trashes them.
I always have a copy of clean disk image, so when I messed up the testing image, I'd just
"cp initial.img testing.img".
I always have a clean copy of my entire development environment. Same logic.