Skip to contentSkip to conversation

ppc: Add MacOS VGA driver ROM

PATCH In review Benjamin Herrenschmidt 6 participants 16 messages Jul 27, 2016 – Aug 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: Add MacOS VGA driver ROM

The project is at https://github.com/ozbenh/QemuMacDrivers

This adds a native MacOS driver in ROM (which can be picked up by MacOS once OpenBIOS has been updated if Mark accepts the patches I sent him) which allows MacOS classic (tested 9.2.1) and MacOS X (tested 10.1.4 and 10.4) to properly use QEMU std VGA (10.1.x doesn't work at all without it, the others get the ability to change resolution and color depth).

Building the ROM is tricky and requires CodeWarrior for MacOS so I include a pre-built binary.

---
 hw/ppc/mac_newworld.c |   8 ++++++++
 pc-bios/qemu_vga.ndrv | Bin 0 -> 12808 bytes
 2 files changed, 8 insertions(+)
 create mode 100644 pc-bios/qemu_vga.ndrv
hw/ppc/mac_newworld.c +8 -0
index 7d25106..5029345 100644
@@ -511,6 +511,13 @@ static int core99_kvm_type(const char *arg)
     return 2;
 }
 
+#define MAC_CORE99_COMPAT                               \
+    {                                                   \
+        .driver   = "pci-vga",                          \
+        .property = "romfile",                          \
+        .value    = "qemu_vga.ndrv",                    \
+    },
+
 static void core99_machine_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -520,6 +527,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = MAX_CPUS;
     mc->default_boot_order = "cd";
     mc->kvm_type = core99_kvm_type;
+    SET_MACHINE_COMPAT(mc, MAC_CORE99_COMPAT);
 }
 
 static const TypeInfo core99_machine_info = {
pc-bios/qemu_vga.ndrv new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..0b1549d1c5978f87aed2b6e496a23fbaf18dbea4
GIT binary patch
#1 lore raw
Quoted 10 lines · Benjamin Herrenschmidt

The project is at https://github.com/ozbenh/QemuMacDrivers

This adds a native MacOS driver in ROM (which can be picked up by MacOS once OpenBIOS has been updated if Mark accepts the patches I sent him) which allows MacOS classic (tested 9.2.1) and MacOS X (tested 10.1.4 and 10.4) to properly use QEMU std VGA (10.1.x doesn't work at all without it, the others get the ability to change resolution and color depth).

Quoted 2 lines

Building the ROM is tricky and requires CodeWarrior for MacOS so I include a pre-built binary.

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and the prebuilt blob will be used instead.

Not sure who the right person to talk to about that would be.

Quoted 151 lines
---
 hw/ppc/mac_newworld.c |   8 ++++++++
 pc-bios/qemu_vga.ndrv | Bin 0 -> 12808 bytes
 2 files changed, 8 insertions(+)
 create mode 100644 pc-bios/qemu_vga.ndrv
hw/ppc/mac_newworld.c +8 -0
index 7d25106..5029345 100644
@@ -511,6 +511,13 @@ static int core99_kvm_type(const char *arg)
     return 2;
 }
 
+#define MAC_CORE99_COMPAT                               \
+    {                                                   \
+        .driver   = "pci-vga",                          \
+        .property = "romfile",                          \
+        .value    = "qemu_vga.ndrv",                    \
+    },
+
 static void core99_machine_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -520,6 +527,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = MAX_CPUS;
     mc->default_boot_order = "cd";
     mc->kvm_type = core99_kvm_type;
+    SET_MACHINE_COMPAT(mc, MAC_CORE99_COMPAT);
 }
 
 static const TypeInfo core99_machine_info = {
pc-bios/qemu_vga.ndrv new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..0b1549d1c5978f87aed2b6e496a23fbaf18dbea4
GIT binary patch
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#2 lore raw
Quoted 11 lines · David Gibson
Quoted 10 lines · Benjamin Herrenschmidt

The project is at https://github.com/ozbenh/QemuMacDrivers

This adds a native MacOS driver in ROM (which can be picked up by MacOS once OpenBIOS has been updated if Mark accepts the patches I sent him) which allows MacOS classic (tested 9.2.1) and MacOS X (tested 10.1.4 and 10.4) to properly use QEMU std VGA (10.1.x doesn't work at all without it, the others get the ability to change resolution and color depth).

Quoted 7 lines
Quoted 2 lines

Building the ROM is tricky and requires CodeWarrior for MacOS so I include a pre-built binary.

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and the prebuilt blob will be used instead.

Not sure who the right person to talk to about that would be.

I think Stefan handles the logistics there now. CC'ed him.

The reason for the submodule is so that on tar releases, the source gets included automatically. That way we can ensure that we always include all GPL sources that we deliver binaries for.

Alex

#3 lore raw
Quoted 18 lines · Alexander Graf
Quoted 17 lines · David Gibson
Quoted 10 lines · Benjamin Herrenschmidt

The project is at https://github.com/ozbenh/QemuMacDrivers

This adds a native MacOS driver in ROM (which can be picked up by MacOS once OpenBIOS has been updated if Mark accepts the patches I sent him) which allows MacOS classic (tested 9.2.1) and MacOS X (tested 10.1.4 and 10.4) to properly use QEMU std VGA (10.1.x doesn't work at all without it, the others get the ability to change resolution and color depth).

Quoted 2 lines

Building the ROM is tricky and requires CodeWarrior for MacOS so I include a pre-built binary.

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and the prebuilt blob will be used instead.

Quoted 8 lines
Quoted 1 line

Not sure who the right person to talk to about that would be.

I think Stefan handles the logistics there now. CC'ed him.

The reason for the submodule is so that on tar releases, the source gets included automatically. That way we can ensure that we always include all GPL sources that we deliver binaries for.

Jeff Cody now admins the qemu-project.org server, including the git repos.

Jeff, please create a mirror git repo for
https://github.com/ozbenh/QemuMacDrivers at
git://git.qemu-project.org/QemuMacDrivers.git with nightly mirroring.

Once Jeff has set up the mirror repo, please send a new revision of this patch that makes roms/QemuMacDrivers a git-submodule(1) pointing to
git://git.qemu-project.org/QemuMacDrivers.git.

Please double-check that the binary ROM included in the patch corresponds to the QemuMacDrivers commit referenced by the git-submodule(1) before sending the patch.

Thanks,
Stefan

#7 lore raw
In reply to David Gibson
Quoted 5 lines · David Gibson

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and the prebuilt blob will be used instead.

Not sure who the right person to talk to about that would be.

Probably Peter, and that git repo will eventually grow more ROMs as I add virtio drivers for MacOS :-)

But for now, let's first agree (or not) with Mark how we deal with this on the openbios side.

My preference is to rework the PCI stack there and add proper f-code support, so I can package the drivers using f-code. But that will probably take a while, in the meantime, the raw PEF which is what I added here is I think a reasonable compromise.

In fact I wouldn't be completely against doing the virtio driers in forth ;-)

But he might have other ideas.

Cheers
,Ben.

#4 lore raw
In reply to Stefan Hajnoczi
Quoted 5 lines · Stefan Hajnoczi

Jeff, please create a mirror git repo for
https://github.com/ozbenh/QemuMacDrivers at
git://git.qemu-project.org/QemuMacDrivers.git with nightly mirroring.

Quoted 8 lines

Once Jeff has set up the mirror repo, please send a new revision of this
patch that makes roms/QemuMacDrivers a git-submodule(1) pointing to
git://git.qemu-project.org/QemuMacDrivers.git.

Please double-check that the binary ROM included in the patch corresponds to the QemuMacDrivers commit referenced by the git-submodule(1) before sending the patch.

Ok, we don't yet need to do all of this though as there are still some open questions about how we expose the ROM to MacOS via OpenBIOS as a consequence the format of the ROM file.

You can still mirror the git repo, any change will be done there, but let's not include the submodule and/or apply the patch before Mark and I have sorted the OpenBIOS side.

Cheers,
Ben.

#5 lore raw
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 5 lines · Stefan Hajnoczi

Jeff, please create a mirror git repo for
https://github.com/ozbenh/QemuMacDrivers at
git://git.qemu-project.org/QemuMacDrivers.git with nightly mirroring.

Quoted 8 lines

Once Jeff has set up the mirror repo, please send a new revision of this
patch that makes roms/QemuMacDrivers a git-submodule(1) pointing to
git://git.qemu-project.org/QemuMacDrivers.git.

Please double-check that the binary ROM included in the patch corresponds to the QemuMacDrivers commit referenced by the git-submodule(1) before sending the patch.

Quoted 8 lines

Ok, we don't yet need to do all of this though as there are still some open questions about how we expose the ROM to MacOS via OpenBIOS as a consequence the format of the ROM file.

You can still mirror the git repo, any change will be done there, but let's not include the submodule and/or apply the patch before Mark and I have sorted the OpenBIOS side.

For whenever you are ready:

The mirror is in place at git://git.qemu-project.org/QemuMacDrivers.git, and it should be updating nightly/daily.

Thanks,
Jeff

#6 lore raw
Quoted 5 lines · Jeff Cody

For whenever you are ready:

The mirror is in place at git://git.qemu-
project.org/QemuMacDrivers.git, and
it should be updating nightly/daily.

Thanks Jeff !

Cheers,
Ben.

#8 lore raw
In reply to David Gibson

Hi,

Quoted 3 lines

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and the prebuilt blob will be used instead.

Correct. Also rules in roms/Makefile to build the thing, to document the build process and to simplify the maintainer's job on updates.

cheers,
Gerd

#9 lore raw
Quoted 9 lines · Gerd Hoffmann

  Hi,

Quoted 2 lines

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and

the

Quoted 1 line

prebuilt blob will be used instead.

Correct.  Also rules in roms/Makefile to build the thing, to document the build process and to simplify the maintainer's job on updates.

That's the part we cannot provide unfortunately. There is sadly no toolchain that can produce a MacOS PEF binary other than hosted in MacOS itself. In fact I don't think Apple XCode can either, which leaves us with CodeWarrior (commercial) or MPW (which I think at some point became free but I didn't find it and it doesn't work on OS X afaik).

So we'll have to stick to the images I build for now at least though the git repo does have the .xml CW project fie.

Cheers,
Ben.

#10 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

So, I believe qemu convention is to include the ROM source via a submodule - even though it won't typically be built from there and

the

Quoted 1 line

prebuilt blob will be used instead.

Correct. Also rules in roms/Makefile to build the thing, to document the build process and to simplify the maintainer's job on updates.

Quoted 6 lines

That's the part we cannot provide unfortunately. There is sadly no toolchain that can produce a MacOS PEF binary other than hosted in MacOS itself. In fact I don't think Apple XCode can either, which leaves us with CodeWarrior (commercial) or MPW (which I think at some point became free but I didn't find it and it doesn't work on OS X afaik).

Firmware builds often have specific requirements, such as only working on $arch due to firmware not being cross-buildable (thats why there are the prebuilt binaries in the first place). So if those makefile rules work only on macos with CodeWarrior installed that is perfectly fine.

cheers,
Gerd

#11 lore raw
Quoted 11 lines · Gerd Hoffmann
Quoted 6 lines

That's the part we cannot provide unfortunately. There is sadly no toolchain that can produce a MacOS PEF binary other than hosted in MacOS itself. In fact I don't think Apple XCode can either, which leaves us with CodeWarrior (commercial) or MPW (which I think at some point became free but I didn't find it and it doesn't work on OS X afaik).

Firmware builds often have specific requirements, such as only working on $arch due to firmware not being cross-buildable (thats why there are the prebuilt binaries in the first place).  So if those makefile rules work only on macos with CodeWarrior installed that is perfectly fine.

Right though in that case it's not a Makefile, it's a CodeWarrior project in .xml form ;-) It is included in the git repo.

CodeWarrior for MacOS X does come with command line versions of the tools, I plan to look into doing a Makefile once I've sorted out the various arguments for these things at least.

Cheers,
Ben.

#12 lore raw
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines · Gerd Hoffmann
Quoted 6 lines

That's the part we cannot provide unfortunately. There is sadly no toolchain that can produce a MacOS PEF binary other than hosted in MacOS itself. In fact I don't think Apple XCode can either, which leaves us with CodeWarrior (commercial) or MPW (which I think at some point became free but I didn't find it and it doesn't work on OS X afaik).

Quoted 7 lines
Quoted 4 lines

Firmware builds often have specific requirements, such as only working on $arch due to firmware not being cross-buildable (thats why there are the prebuilt binaries in the first place). So if those makefile rules work only on macos with CodeWarrior installed that is perfectly fine.

Right though in that case it's not a Makefile, it's a CodeWarrior project in .xml form ;-) It is included in the git repo.

Good, that simplifies the makesfile rules to something like:

macosdrivers:
(cd $submodule: cw-build-tool $args $project.xml) cp -v $submodule/$binary ../pc-bios

Quoted 3 lines

CodeWarrior for MacOS X does come with command line versions of the tools, I plan to look into doing a Makefile once I've sorted out the various arguments for these things at least.

Yes, you do that once, put it into roms/Makefile, and the next time you just do "make -C roms macosdrivers" instead of sorting out the various arguments *again*.

Bonus: Any possible contributers will have an easier start too.

cheers,
Gerd

#13 lore raw
Quoted 9 lines · Gerd Hoffmann
Quoted 3 lines

CodeWarrior for MacOS X does come with command line versions of the tools, I plan to look into doing a Makefile once I've sorted out the various arguments for these things at least.

Yes, you do that once, put it into roms/Makefile, and the next time you just do "make -C roms macosdrivers" instead of sorting out the various arguments *again*.

Bonus: Any possible contributers will have an easier start too.

I did notice that having Makefiles in the roms directory make git submodule barf ... I had to remove them for it to be able to clone the submodules.

Cheers,
Ben.

#14 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Gerd Hoffmann
Quoted 3 lines

CodeWarrior for MacOS X does come with command line versions of the tools, I plan to look into doing a Makefile once I've sorted out the various arguments for these things at least.

Yes, you do that once, put it into roms/Makefile, and the next time you just do "make -C roms macosdrivers" instead of sorting out the various arguments *again*.

Quoted 5 lines
Quoted 1 line

Bonus: Any possible contributers will have an easier start too.

I did notice that having Makefiles in the roms directory make git submodule barf ... I had to remove them for it to be able to clone the submodules.

I mean roms/Makefile, not roms/$submodule/Makefile

cheers,
Gerd

#15 lore raw
Quoted 5 lines · Gerd Hoffmann
Quoted 3 lines

I did notice that having Makefiles in the roms directory make git submodule barf ... I had to remove them for it to be able to clone the submodules.

I mean roms/Makefile, not roms/$submodule/Makefile

I see, ok well, we'll see when I get a chance to look at doing Makefiles for OS X... right now I build this using an IDE so it won't do that much good.

Anyway, not terribly urgent. I'm reworking a whole pile of the Mac emulation, trying to bring it to a more decent state, so that's only part of the picture.

Cheers,
Ben.