Mac OS 9 and earlier require that OpenBIOS has Apple's copyright message in the root node, under the copyright property. This patch adds that message. This patch also removes the code from the adler32 word that did the same thing. Operating systems might need to read the copyright message before the adler32 word is called. So this patch takes care of that problem by supplying the copyright message at startup. This makes the copyright adding code in the adler32 word obsolete. Only the Macintosh emulator will have this message added to the root node. Other machines such as PREP don't run Apple's software so the copyright message will not be added to them.
Signed-off-by: John Arbuckle programmingkidx@gmail.com
Index: arch/ppc/qemu/init.c =================================================================== --- arch/ppc/qemu/init.c (revision 1378) +++ arch/ppc/qemu/init.c (working copy) @@ -739,6 +739,32 @@ RET(s2 << 16 | s1); }
+/* Encodes and decodes a string */ +static void string_encoder (unsigned char *string, int length) { + const int encoder = 1; + int i; + for (i = 0; i < length; i++) { + string[i] ^= encoder; + } +} + +/* + * Adds the copyright string to the root node. + * Classic Mac OS requires it to boot. + */ +static void add_copyright() +{ + const int size_of_string = 60; + unsigned char message[size_of_string + 1]; + snprintf(message, size_of_string + 1, "%s", "Bnqxshfiu!0892,3110!@qqmd!Bnl" + "qtuds-!Hob/!@mm!Shfiur!Sdrdswde"); + string_encoder(message, size_of_string); + push_str(message); + fword("encode-string"); + push_str("copyright"); + fword("property"); +} + void arch_of_init(void) { @@ -827,10 +853,19 @@ fword("encode-int"); push_str("clock-frequency"); fword("property"); + + /* + * We might figure out how to run the classic Mac OS on the g3beige + * target one day + */ + add_copyright(); + break;
case ARCH_MAC99: case ARCH_MAC99_U3: + /* Kept here because PREP isn't made to run Apple's software */ + add_copyright(); case ARCH_PREP: default:
Index: arch/ppc/qemu/qemu.fs =================================================================== --- arch/ppc/qemu/qemu.fs (revision 1378) +++ arch/ppc/qemu/qemu.fs (working copy) @@ -99,19 +99,6 @@ \ -------------------------------------------------------------------------
: adler32 ( adler buf len -- checksum ) - \ Since Mac OS 9 is the only system using this word, we take this - \ opportunity to inject a copyright message that is necessary for the - \ system to boot. - " Copyright 1983-2001 Apple Computer, Inc. THIS MESSAGE FOR COMPATIBILITY ONLY" - encode-string " copyright" - " /" find-package if - " set-property" $find if - execute - else - 3drop drop - then - then - ( adler buf len )
" (adler32)" $find if
On Fri, Feb 05, 2016 at 12:20:51AM -0500, Programmingkid wrote:
Mac OS 9 and earlier require that OpenBIOS has Apple's copyright message in the root node, under the copyright property. This patch adds that message. This patch also removes the code from the adler32 word that did the same thing. Operating systems might need to read the copyright message before the adler32 word is called. So this patch takes care of that problem by supplying the copyright message at startup. This makes the copyright adding code in the adler32 word obsolete. Only the Macintosh emulator will have this message added to the root node. Other machines such as PREP don't run Apple's software so the copyright message will not be added to them.
Although the Adler32 thing was a neat trick, at this point I think adding it at startup is the best approach for compatibility, sadly.
Why not just add it in tree.fs in plaintext though? Your solution seems kind of overcomplicated.
@@ -827,10 +853,19 @@ fword("encode-int"); push_str("clock-frequency"); fword("property");
/*
* We might figure out how to run the classic Mac OS on the g3beige
* target one day
*/
add_copyright();
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
- Alyssa
On 05/02/16 08:23, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 12:20:51AM -0500, Programmingkid wrote:
Mac OS 9 and earlier require that OpenBIOS has Apple's copyright message in the root node, under the copyright property. This patch adds that message. This patch also removes the code from the adler32 word that did the same thing. Operating systems might need to read the copyright message before the adler32 word is called. So this patch takes care of that problem by supplying the copyright message at startup. This makes the copyright adding code in the adler32 word obsolete. Only the Macintosh emulator will have this message added to the root node. Other machines such as PREP don't run Apple's software so the copyright message will not be added to them.
Although the Adler32 thing was a neat trick, at this point I think adding it at startup is the best approach for compatibility, sadly.
Why not just add it in tree.fs in plaintext though? Your solution seems kind of overcomplicated.
If you look back at the archives, the concern is whether or not having an Apple copyright string visible in the source and at runtime could cause legal issues with OpenBIOS and ultimately QEMU.
Realistically I don't think Apple could care that much, but without confirmation from Apple themselves (and the fact that this could also affect QEMU) then I'd much rather take the safe option.
ATB,
Mark.
On Fri, 5 Feb 2016, Mark Cave-Ayland wrote:
If you look back at the archives, the concern is whether or not having an Apple copyright string visible in the source and at runtime could cause legal issues with OpenBIOS and ultimately QEMU.
Realistically I don't think Apple could care that much, but without confirmation from Apple themselves (and the fact that this could also affect QEMU) then I'd much rather take the safe option.
I have no idea about legal things either but if at the end the copyright string becomes visible in the device tree, however it's put there, does it change anything if it's plain text or obfuscated in the source? It would still be there only obfuscated. Wouldn't adding a different string that's enough to make the OS happy but saying "not copyright Apple" that was also suggested be better to clearly show why it's there but avoid problems by having a false copyright notice?
As legal things are, they could sew someone anyway just for trying to use MacOS on non-Apple hardware which is probably not allowed by its license so maybe the copyright message would not cause much more problems.
Regards, BALATON Zoltan
On 05/02/16 12:49, BALATON Zoltan wrote:
On Fri, 5 Feb 2016, Mark Cave-Ayland wrote:
If you look back at the archives, the concern is whether or not having an Apple copyright string visible in the source and at runtime could cause legal issues with OpenBIOS and ultimately QEMU.
Realistically I don't think Apple could care that much, but without confirmation from Apple themselves (and the fact that this could also affect QEMU) then I'd much rather take the safe option.
I have no idea about legal things either but if at the end the copyright string becomes visible in the device tree, however it's put there, does it change anything if it's plain text or obfuscated in the source? It would still be there only obfuscated. Wouldn't adding a different string that's enough to make the OS happy but saying "not copyright Apple" that was also suggested be better to clearly show why it's there but avoid problems by having a false copyright notice?
Yeah, that's kind of how we ended up with what we have at the moment. In what we've seen so far (i.e. OS 9), the check isn't exact but that's not to say that all versions will be the same. The obfuscation was really a safeguard so that if we have to include the message verbatim moving forward then it's still not visible in the source.
As legal things are, they could sew someone anyway just for trying to use MacOS on non-Apple hardware which is probably not allowed by its license so maybe the copyright message would not cause much more problems.
Well probably :) The problem here is that no-one actually knows and I'm currently erring on the side of over-engineering outside of having any concrete legal advice.
ATB,
Mark.
On Fri, 5 Feb 2016, Mark Cave-Ayland wrote:
Yeah, that's kind of how we ended up with what we have at the moment. In what we've seen so far (i.e. OS 9), the check isn't exact but that's not to say that all versions will be the same.
OK, but going with a string that is just enough for the OS versions we intend to support but not the exact copyright string may be less likely to cause legal problems and could postpone this question to when it is proven that we really need the whole string.
Well probably :) The problem here is that no-one actually knows and I'm currently erring on the side of over-engineering outside of having any concrete legal advice.
Unfortunately common sense does not really help in legal questions (maybe even an expert opinion is not sure unless tested on a trial) so we can only guess but I don't see how over-engineering could help here.
On Fri, 5 Feb 2016, Programmingkid wrote:
That could cause problems. There might be versions of the Mac OS that depend on the whole copyright string being there.
In the first place, there might be reasons why Mac OS depends on this copyright notice and this may be that copying this message is protected by some law. This is similar to the key needed by Mac OS X.
I don't know if they would ever sue someone for doing that. If they did it would be all the hackintosh websites that would go down first. I say we stay away from Apple's naughty list and error on the side of caution.
It could be argued that including a string obfuscated is more effort to circumvent this protection which is probably worse than just including the string in plain text until asked not to do that so I'm not sure doing obfuscation is really better.
On the other hand we could also do the same as for OS X that the string has to be passed on the command line, which could avoid any legal problems on the side of QEMU or OpenBIOS.
Regards, BALATON Zoltan
On 05/02/16 17:53, BALATON Zoltan wrote:
On Fri, 5 Feb 2016, Mark Cave-Ayland wrote:
Yeah, that's kind of how we ended up with what we have at the moment. In what we've seen so far (i.e. OS 9), the check isn't exact but that's not to say that all versions will be the same.
OK, but going with a string that is just enough for the OS versions we intend to support but not the exact copyright string may be less likely to cause legal problems and could postpone this question to when it is proven that we really need the whole string.
Well probably :) The problem here is that no-one actually knows and I'm currently erring on the side of over-engineering outside of having any concrete legal advice.
Unfortunately common sense does not really help in legal questions (maybe even an expert opinion is not sure unless tested on a trial) so we can only guess but I don't see how over-engineering could help here.
I've just posted an updated patchset which effectively makes it so that only the bootloader ever sees the message. It seems to me that there is a difference here in intent between directly expressing a copyright that isn't true vs. providing a synthetic response for clients that refuse to work without it, but really IANAL.
ATB,
Mark.
On Feb 5, 2016, at 7:49 AM, BALATON Zoltan wrote:
On Fri, 5 Feb 2016, Mark Cave-Ayland wrote:
If you look back at the archives, the concern is whether or not having an Apple copyright string visible in the source and at runtime could cause legal issues with OpenBIOS and ultimately QEMU.
Realistically I don't think Apple could care that much, but without confirmation from Apple themselves (and the fact that this could also affect QEMU) then I'd much rather take the safe option.
I have no idea about legal things either but if at the end the copyright string becomes visible in the device tree, however it's put there, does it change anything if it's plain text or obfuscated in the source?
I would say definite yes.
It would still be there only obfuscated. Wouldn't adding a different string that's enough to make the OS happy but saying "not copyright Apple" that was also suggested be better to clearly show why it's there but avoid problems by having a false copyright notice?
That could cause problems. There might be versions of the Mac OS that depend on the whole copyright string being there.
As legal things are, they could sew someone anyway just for trying to use MacOS on non-Apple hardware which is probably not allowed by its license so maybe the copyright message would not cause much more problems.
I don't know if they would ever sue someone for doing that. If they did it would be all the hackintosh websites that would go down first. I say we stay away from Apple's naughty list and error on the side of caution.
On Feb 5, 2016, at 3:23 AM, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 12:20:51AM -0500, Programmingkid wrote:
Mac OS 9 and earlier require that OpenBIOS has Apple's copyright message in the root node, under the copyright property. This patch adds that message. This patch also removes the code from the adler32 word that did the same thing. Operating systems might need to read the copyright message before the adler32 word is called. So this patch takes care of that problem by supplying the copyright message at startup. This makes the copyright adding code in the adler32 word obsolete. Only the Macintosh emulator will have this message added to the root node. Other machines such as PREP don't run Apple's software so the copyright message will not be added to them.
Although the Adler32 thing was a neat trick, at this point I think adding it at startup is the best approach for compatibility, sadly.
Why not just add it in tree.fs in plaintext though? Your solution seems kind of overcomplicated.
Mark and I don't like the idea of having Apple's copyright in OpenBIOS's code. Apple does have an army of lawyers ready to go after anyone who does something they don't like.
@@ -827,10 +853,19 @@ fword("encode-int"); push_str("clock-frequency"); fword("property");
/*
* We might figure out how to run the classic Mac OS on the g3beige
* target one day
*/
add_copyright();
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
- Alyssa
On Feb 5, 2016, at 10:04 AM, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Ok, I will send another patch that removes the add_copyright() from the ARCH_HEATHROW case.
Thank you.
On 05/02/16 15:09, Programmingkid wrote:
On Feb 5, 2016, at 10:04 AM, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Ok, I will send another patch that removes the add_copyright() from the ARCH_HEATHROW case.
Thank you.
I've been thinking about this a bit more when looking over your patch and have come to following conclusions:
- I think the obfuscation is reasonable, but after more thought I think ROT13 is a better bet (easier to work with, symmetrical)
- I'd prefer as much of this to be in Forth as possible; many previous issues with OpenBIOS were caused by the Forth/C divide
- I don't think it matters so much if an extra property is there for g3beige; things are much more likely to blow up if a property isn't there
- The patch still leaves the copyright property visible before boot
Possibly I may have another similarly over-engineered solution to this; let me see if I can rustle up something.
ATB,
Mark.
On Feb 5, 2016, at 10:18 AM, Mark Cave-Ayland wrote:
On 05/02/16 15:09, Programmingkid wrote:
On Feb 5, 2016, at 10:04 AM, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Ok, I will send another patch that removes the add_copyright() from the ARCH_HEATHROW case.
Thank you.
I've been thinking about this a bit more when looking over your patch and have come to following conclusions:
- I think the obfuscation is reasonable, but after more thought I think
ROT13 is a better bet (easier to work with, symmetrical)
I thought xor was simple enough, but I can see how ROT13 might be even easier to deal with.
- I'd prefer as much of this to be in Forth as possible; many previous
issues with OpenBIOS were caused by the Forth/C divide
More people know C than Forth. If we stick to C, then more people can help. Also I think C is easier to work with (IMHO).
- I don't think it matters so much if an extra property is there for
g3beige; things are much more likely to blow up if a property isn't there
If only I know this a few minutes sooner...
- The patch still leaves the copyright property visible before boot
Shouldn't be a problem. Apple might be searching the web for trouble makers, but what their searches will find is garbled text in a file at best in OpenBIOS.
Possibly I may have another similarly over-engineered solution to this; let me see if I can rustle up something.
Ok. We will be waiting for your patch.
On Fri, 5 Feb 2016, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Just to confirm, you've done this on an actual Beige G3 hardware?
Regards, BALATON Zoltan
On Fri, Feb 05, 2016 at 07:31:16PM +0100, BALATON Zoltan wrote:
On Fri, 5 Feb 2016, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Just to confirm, you've done this on an actual Beige G3 hardware?
It's irrelevant now, and now I'm sorry for having mentioned it at all..! But yes, I pulled my Beige G3 machine out to check the escc-legacy properties a few days ago and haven't packed it away yet, so I thought I'd quickly look at this too.
- Alyssa
On 05/02/16 18:35, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 07:31:16PM +0100, BALATON Zoltan wrote:
On Fri, 5 Feb 2016, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Just to confirm, you've done this on an actual Beige G3 hardware?
It's irrelevant now, and now I'm sorry for having mentioned it at all..! But yes, I pulled my Beige G3 machine out to check the escc-legacy properties a few days ago and haven't packed it away yet, so I thought I'd quickly look at this too.
The MacOS 8 page in wikipedia has a support matrix which indicates that a special version of the OS was required.
ATB,
Mark.
On Sat, 6 Feb 2016, Mark Cave-Ayland wrote:
On 05/02/16 18:35, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 07:31:16PM +0100, BALATON Zoltan wrote:
On Fri, 5 Feb 2016, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 09:49:37AM -0500, Programmingkid wrote:
The Beige G3 doesn't have a copyright string in OF, so this seems silly (if we eventually add some hack to boot via OF anyway, then we could always add it then).
Are you sure the Beige G3 doesn't have a copyright string?
Well, I did 'dev /' and '.properties' and it doesn't list one. I'm not too surprised, since boot-device is the Toolbox ROM, so there was no code which would need to check for one.
Just to confirm, you've done this on an actual Beige G3 hardware?
It's irrelevant now, and now I'm sorry for having mentioned it at all..! But yes, I pulled my Beige G3 machine out to check the escc-legacy properties a few days ago and haven't packed it away yet, so I thought I'd quickly look at this too.
The MacOS 8 page in wikipedia has a support matrix which indicates that a special version of the OS was required.
Only for 8.0 version according to that matrix (presumably due to missing drivers in that version for stuff we don't emulate anyway, such as video or sound) but from 8.1 it should support Beige G3. For PoweMac G4 (mac99) 8.6 special version is needed or MacOS 9.0, but we were talking about G3 above.
Regards, BALATON Zoltan