Page 5 of 83

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 23, 2015 7:18 am
by PeterHolbrook
DANADAX wrote:This year's (2015) GSOC has a nice little approved project, specifically for OS 9.
Already pointed out above by Cat_7.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 23, 2015 7:43 am
by DANADAX
Whoops! Sorry about that.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 23, 2015 8:12 am
by PeterHolbrook
No harm done.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 23, 2015 4:08 pm
by adespoton
Cool... sounds like a bunch of the OpenBIOS changes required have already been completed :)

Also of note: http://qemu-project.org/Outreachy_2015_MayAugust -- Outreachy attempts to dovetail with GSOC, so any of you looking for more resources on implementing fixes/finding mentors, check there too.

And of course, a number of us on here would be more than happy to clarify odd bits of classic Mac hardware/OS behaviour.

Tracking updates: Oh yes, and if anyone has the answers to the questions posed in those progress reports, drop one of the participants a line so they can work through that bit a bit faster :)

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 23, 2015 11:11 pm
by adespoton
Oh, by the way... for anyone wanting to try out qemu, the following currently works under 10.10:

First step, you need to install XCode from the App store.

Next, you need to install Homebrew. Open up Terminal.app and paste in this:

Code: Select all

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You'll probably want to run

Code: Select all

brew update
and

Code: Select all

brew doctor
as well -- especially if you've got macports installed.

Next, do

Code: Select all

brew install qemu
This will get the latest stable version (currently 2.3.0) and have it set up in your path, ready to run.

Then the commands listed earlier in this thread will cleanly launch OS X 10.2 through 10.4 PPC.

If you want a clickable app, download Platypus which will let you put anything you'd type in Terminal.app into a runnable .app -- it's extremely configurable. You can drop your disk image (currently I'm using a raw PearPC .img file) into the app itself so you always know where it is. You could also drop neozeed's compiled binary of qemu-ppc into the app if you want the whole thing stand-alone.

For that matter, you could use Platypus to script up everything mentioned above (check for XCode, download if it isn't there, check for brew, install if absent, check for qemu-ppc, install if absent), even ask (via do applescript "Display dialog ...") for an installed image or have it create a blank image and select an install disc image.

If I get some spare time, I might whip something like this up myself and make it available :)

I just re-read through this thread, and it appears that we may be able to run Classic once the OS 9 support is complete :)

Hmm... and since brew includes tun/tap, I could probably auto-configure network support for OS X in the script above.

I tested out the configuration, and it seems to run slightly slower than PearPC, but it's still usable on recent hardware. My 2009 iMac struggled, but my 2015 MBP with discrete GPU does quite nicely :D

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Wed Jun 24, 2015 5:17 am
by PeterHolbrook
adespoton wrote:If I get some spare time, I might whip something like this up myself and make it available :)
That would be utterly awesome. That way we could have an up-to-date version of something like Q!, but capable of running not just Tiger with sound and all, but Classic as well. Looking forward to it.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Wed Jun 24, 2015 6:04 am
by Cat_7
Classic once the OS 9 support is complete
Yes, it seems the issues classic is having in OSX are linked to having Qemu boot Mac OS 9 directly.
But I gather network hardware for OSX is not yet supported and sound might be bridge too far when considering the speed (or lack thereof) of the emulation.

Best,
Cat_7

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Wed Jun 24, 2015 4:12 pm
by adespoton
QEMU emulates the RealTek NIC, and there's a community-based kext for that for OS X -- so there might be some implementation issues that need to be worked out (and a kext manually installed), but it should definitely be doable. But yes; this is one extra step beyond just setting up a TAP interface either way.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 30, 2015 3:56 pm
by Cat_7
I just learner that there is progress in booting Mac OS 9 up to the grey screen before happy/sad Mac.

Best,
Cat_7

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 30, 2015 5:51 pm
by PeterHolbrook
Cat_7 wrote:I just learner that there is progress in booting Mac OS 9 up to the grey screen before happy/sad Mac.

Best,
Cat_7
Is there a link for that interesting piece of news?

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 30, 2015 6:59 pm
by Cat_7
There is no link, I learned this from a qemu developer I contacted, knowing how eager you are to know the latest on this front ;-)

We might just get there this year.

Best,
Cat_7

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Tue Jun 30, 2015 8:08 pm
by PeterHolbrook
Thank you for the information.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Mon Jul 06, 2015 3:59 am
by adespoton
OK: Here's my first pass at creating something usable. There's still lots of features to add, but this will create a fully-enclosed app that will run OS X 10.2 through 10.4, either from an existing HD image or from a CD/DVD install image. It will also keep qemu up to the latest version, and will auto-run the emulator if everything is already configured. At this point, you'll have to edit the script to change any extra features; eventually I'll add proper configuration support, etc.

So... open Script Editor.app, paste the following code block into the blank window, and save it as an Application from the drop-down in the Save dialog. It'll do the rest for you :)

Code: Select all

set gccPath to false
set brewPath to false
set qemuppcPath to false
set imagePath to false
set cdPath to ""
set resPath to (quoted form of (POSIX path of (path to me))) & "/Contents/Resources/"
set brewInstall to "ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\""
set brewUpdate to "/usr/local/bin/brew update"
set qemuInstall to "/usr/local/bin/brew install qemu"
set qemuUpgrade to "/usr/local/bin/brew upgrade qemu"

try
	set gccPath to do shell script "which gcc"
end try

if gccPath = false then
	display dialog "Sorry, XCode must be installed from the App Store along with the command-line tools to set this up." buttons {"OK"} default button 1 with icon stop giving up after 29
	return 0
else
	try
		set brewPath to do shell script "ls /usr/local/bin/brew"
	end try
	
	if brewPath = false then
		display dialog "HomeBrew is not installed.  Would you like to install it now?" buttons {"No thanks.", "Yes please!"} default button 2 with icon stop giving up after 29
		if the button returned of the result is "No thanks." then
			display dialog "Qemu setup terminated." buttons {"OK"} with icon caution giving up after 29
		else
			do shell script brewInstall
		end if
	end if
	
	try
		set qemuppcPath to do shell script "ls /usr/local/bin/qemu-system-ppc"
	end try
	
	if qemuppcPath = false then
		display dialog "QEMU PPC is not installed.  Would you like to install it now?" buttons {"No thanks.", "Yes please!"} default button 2 with icon stop giving up after 29
		if the button returned of the result is "No thanks." then
			display dialog "Qemu setup terminated." buttons {"OK"} with icon caution giving up after 29
		else
			do shell script brewUpdate
			do shell script qemuInstall
		end if
	end if
	
	do shell script brewUpdate
	try
		do shell script qemuUpgrade
	end try
	
	try
		set imagePath to do shell script "ls " & resPath & "HD.qcow2"
	end try
	
	if imagePath = false then
		display dialog "HDD image not found. What would you like to do?" buttons {"Create VM from raw image", "Create VM from Scratch"} default button "Create VM from Scratch" with icon note giving up after 29
		if the button returned of the result is "Create VM from Scratch" then
			set cdFile to choose file with prompt "Select OS X PPC 10.2-10.4 Install CD image:" of type {"CDR", "TOAST", "ISO", "IMG"}
			set cdFile to (quoted form of (POSIX path of cdFile))
			set cdPath to " -boot order=dc -cdrom " & cdFile
			do shell script "/usr/local/bin/qemu-img create -q -f qcow2 " & resPath & "HD.qcow2 6G"
		else if the button returned of the result is "Create VM from raw image" then
			--Select file(s)
			set imageFile to choose file with prompt "Select installed PearPC or other functional OS X 10.2-10.4 PPC HD image:" of type {"IMG", "DMG", "BOCHS", "QCOW2", "VPC", "VHDX", "NULL-AIO", "NBD", "BLKDEBUG", "SHEEPDOG", "BLKVERIFY", "QED", "NULL-CO", "VVFAT", "IMAGE", "VMDK", "RAW", "PARALLELS", "QUORUM", "VDI", "FTPS", "TFTP", "CLOOP", "QCOW", "FTP", "HTTPS", "HTTP", "FILE", "HOST_DEVICE"}
			
			--Convert file into posix path
			set imageFile to (quoted form of (POSIX path of imageFile))
			
			--Now we have our file path, so let's convert it
			do shell script "/usr/local/bin/qemu-img convert -O qcow2 " & imageFile & " " & resPath & "HD.qcow2"
		else
			return 0
		end if
	end if
	
	do shell script "/usr/local/bin/qemu-system-ppc -m 1024 -hda " & resPath & "HD.qcow2" & cdPath & " -prom-env 'boot-args=-v' -serial stdio"
	-- to do:
	-- look for config file
	-- no config: ask if running for first time
end if

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Mon Jul 06, 2015 11:07 am
by PeterHolbrook
adespoton wrote:OK: Here's my first pass at creating something usable. There's still lots of features to add, but this will create a fully-enclosed app that will run OS X 10.2 through 10.4, either from an existing HD image or from a CD/DVD install image. It will also keep qemu up to the latest version, and will auto-run the emulator if everything is already configured. At this point, you'll have to edit the script to change any extra features; eventually I'll add proper configuration support, etc.
Wonderful! Many thanks!

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Wed Jul 08, 2015 8:50 am
by Cat_7
Hi,

Expect some really good news soon. Cormac Obrien is preparing instructions for us to try Mac OS 9.2 in Qemu!

Best,
Cat_7

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Wed Jul 08, 2015 11:21 am
by kikyoulinux
Oh, really? I can't wait it.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Wed Jul 08, 2015 4:07 pm
by adespoton
Cool! I'll update my script when his instructions come through :D

I'm also planning to do install CD and disk image detection, to figure out exactly which OS is being run. That should help with some autoconfig, and it'll also cut down on the number of visible branches needed during setup :)

Of course, Cormac's changes will need to hit the homebrew cask before it'll be a one-click setup.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 12:49 am
by cobrien
Be forewarned that you don't really get past the splash/loading screen, and the mouse doesn't work, but hopefully this will tide you guys over for the time being :D

The OS may crash and abruptly shut down the emulator as soon as the splash screen appears. If this happens, hold shift to disable automatic shutdown (this happens because it encounters an illegal instruction). Have fun!

GSoC 2015: QEMU OS 9 Support - Testing

My contact info is at the bottom of the page if you have questions.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 1:25 am
by uyjulian
Image

I expected a bomb message. Oh well!
Oh, and my cursor is always the spinning pinwheel and won't let me select the window.
I guess this is normal, since you said mouse support isn't added yet.

Also, I wonder why the font in the bomb message is very smooth..? I thought MacOS 9 doesn't do anti-aliasing

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 4:06 am
by kikyoulinux
Extensions off mode also hangs the emulation. But anyway, good job! :razz:

Image

Image

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 4:20 pm
by adespoton
julialy wrote: I expected a bomb message. Oh well!
Oh, and my cursor is always the spinning pinwheel and won't let me select the window.
I guess this is normal, since you said mouse support isn't added yet.

Also, I wonder why the font in the bomb message is very smooth..? I thought MacOS 9 doesn't do anti-aliasing
So it appears to be getting as far as the illegal instruction -- that's good!
The font issue is interesting; examining your snapshot, the same system font is being used for the error message and the "Starting Up..." message, but the boot message has the appropriate blockiness, while the error message does indeed appear to be handled by the host's font compositer. Interesting, as I remember OS 9 being exactly the opposite; any ROM-based messages were blocky, while rudimentary antialiasing was available for all OS-level text.

Here's a challenge for everyone: Will MacsBug run in QEmu? If it will, that'll provide a bit more debug info (from inside the emulator instead of running qemu in debug mode) when the illegal instruction hits. I figure it has a much higher likelihood of working than in PearPC and SheepShaver, since the chip is more completely emulated here.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 4:47 pm
by uyjulian
Image

Floppy disk question mark (can't find system folder) when I try to boot the disk from hdd. (-boot a -hda /path/to/disk/image). I take it that it's not supported yet?

Also, booting is a bit of a hit or miss. If it's a miss, these two lines get repeated in the terminal:

CUDA: read: reg=0x0 val=30
CUDA: read: reg=0xd val=00

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 5:04 pm
by adespoton
What happens if you try booting an earlier OS?

btw: SheepShaver images should work fine in QEMU if you set the RAW filetype flag -- unless the image is a DMG, in which case, set the DMG flag. So you can do install and config in SheepShaver and then attempt to deploy in QEMU.

I had similar issues with a clean install of OS X 10.2 in QEMU, so the bug isn't limited to OS 9; but an already installed 10.2 runs fine.

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 5:39 pm
by cobrien
adespoton wrote:Here's a challenge for everyone: Will MacsBug run in QEmu?
Getting MacsBug to work is actually our next order of business!

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Posted: Thu Jul 09, 2015 6:36 pm
by adespoton
Excellent! I recommend using Mac OS 8.6 and MacsBug 6.6.3 for a first test, as 6.6.3 is the latest and most stable, and 8.6 will avoid throwing a number of issues builds of OS 9 may have with MacsBug into the mix. Worth using to compare 8.6 with 9.2 anyway.