This series changes the injection of the fake copyright message such that it is included just before control is handled to the client. The motivation behind this is that older versions of the MacOS bootloader don't call the adler32 word which means the injection is omitted and boot fails.
The first patch is actually a build fix (and will likely be applied separately) while the rest of the patchset ensures that the message is only visible to the bootloader client as discussed on the mailing list.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (7): pci.c: fix build for non-SPARC/PPC platforms string.fs: add functions to support ROT13 string encoding/decoding ppc: move fake copyright notice generation into a separate word ppc: use ROT13 encoding for fake copyright message ciface.fs: implement optional (exit) hook when returning control back to the interpreter ppc: add complimentary delete-fake-copyright word ppc: move fake copyright hooks from adler32 word
openbios-devel/arch/ppc/qemu/init.c | 3 +++ openbios-devel/arch/ppc/qemu/qemu.fs | 33 +++++++++++++++++++++++++-------- openbios-devel/drivers/pci.c | 9 +++++---- openbios-devel/forth/lib/string.fs | 28 ++++++++++++++++++++++++++++ openbios-devel/forth/system/ciface.fs | 8 ++++++++ 5 files changed, 69 insertions(+), 12 deletions(-)
Commit r1377 accidentally broke compilation with -Werror for platforms without a default PCI interrupt implementation. Supply a suitable (empty) stub in order to keep the compiler quiet.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 6d0af12..5062f30 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -1500,19 +1500,20 @@ static void ob_pci_host_set_interrupt_map(phandle_t host)
/* Device address is in 1st 32-bit word of encoded PCI address for config space */ if ((addr & PCI_RANGE_TYPE_MASK) == PCI_RANGE_CONFIG) { -#ifdef CONFIG_SPARC64 +#if defined(CONFIG_SPARC64) ncells += pci_encode_phys_addr(props + ncells, 0, 0, addr, 0, 0); props[ncells++] = intno; props[ncells++] = dnode; props[ncells++] = SUN4U_INTERRUPT(addr, intno); -#endif - -#ifdef CONFIG_PPC +#elif defined(CONFIG_PPC) ncells += pci_encode_phys_addr(props + ncells, 0, 0, addr, 0, 0); props[ncells++] = intno; props[ncells++] = dnode; props[ncells++] = arch->irqs[intno - 1]; props[ncells++] = 3; +#else + /* Keep compiler quiet */ + dnode = dnode; #endif } }
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/forth/lib/string.fs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/openbios-devel/forth/lib/string.fs b/openbios-devel/forth/lib/string.fs index eb64749..97b109c 100644 --- a/openbios-devel/forth/lib/string.fs +++ b/openbios-devel/forth/lib/string.fs @@ -125,3 +125,31 @@ : parse-hex ( str len -- value ) base @ hex -rot $number if 0 then swap base ! ; + + +\ ----------------------------------------------------- +\ miscellaneous functions +\ ----------------------------------------------------- + +: rot13-c! ( c-addr -- ) + \ ROT13 the char at the given address + dup c@ \ ( c-addr char ) + dup h# 41 >= over h# 5a <= and if \ A-Z + h# 41 - h# 0d + h# 1a mod h# 41 + swap c! + else + dup h# 61 >= over h# 7a <= and if \ a-z + h# 61 - h# 0d + h# 1a mod h# 61 + swap c! + else + 2drop + then + then +; + +: rot13-str ( str len -- newstr len ) + \ Return a copy of the string encoded ROT13 + strdup 0 begin + 2 pick over chars + rot13-c! + 1+ 2dup = + until + drop +;
Let's factor this a bit better...
: rot13 ( c - c ) dup upc [char] A [char] M between IF d# 13 + EXIT THEN dup upc [char] N [char] Z between IF d# 13 - THEN ;
: $rot13 ( str len -- ) bounds ?DO i c@ rot13 i c! LOOP ;
: rot13-str ( str len -- newstr len ) strdup 2dup $rot13 ;
Hope I didn't mess this up ;-)
Segher
On Fri, Feb 05, 2016 at 06:09:01PM +0000, Mark Cave-Ayland wrote:
diff --git a/openbios-devel/forth/lib/string.fs b/openbios-devel/forth/lib/string.fs index eb64749..97b109c 100644 --- a/openbios-devel/forth/lib/string.fs +++ b/openbios-devel/forth/lib/string.fs @@ -125,3 +125,31 @@ : parse-hex ( str len -- value ) base @ hex -rot $number if 0 then swap base ! ;
+\ ----------------------------------------------------- +\ miscellaneous functions +\ -----------------------------------------------------
+: rot13-c! ( c-addr -- )
- \ ROT13 the char at the given address
- dup c@ \ ( c-addr char )
- dup h# 41 >= over h# 5a <= and if \ A-Z
- h# 41 - h# 0d + h# 1a mod h# 41 + swap c!
- else
- dup h# 61 >= over h# 7a <= and if \ a-z
h# 61 - h# 0d + h# 1a mod h# 61 + swap c!
- else
2drop
- then
- then
+;
+: rot13-str ( str len -- newstr len )
- \ Return a copy of the string encoded ROT13
- strdup 0 begin
- 2 pick over chars + rot13-c!
- 1+ 2dup =
- until
- drop
+;
On 13/02/16 01:32, Segher Boessenkool wrote:
Let's factor this a bit better...
: rot13 ( c - c ) dup upc [char] A [char] M between IF d# 13 + EXIT THEN dup upc [char] N [char] Z between IF d# 13 - THEN ;
: $rot13 ( str len -- ) bounds ?DO i c@ rot13 i c! LOOP ;
: rot13-str ( str len -- newstr len ) strdup 2dup $rot13 ;
Hope I didn't mess this up ;-)
Yeah, your Forth is obviously much better then mine ;) Thanks for this, I'll include it in the next revision of the copyright patchset (albeit with a few minor cosmetic tweaks).
ATB,
Mark.
Separate this out rather than keeping it as part of adler32.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/ppc/qemu/qemu.fs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/qemu.fs b/openbios-devel/arch/ppc/qemu/qemu.fs index 11e344a..9f7e027 100644 --- a/openbios-devel/arch/ppc/qemu/qemu.fs +++ b/openbios-devel/arch/ppc/qemu/qemu.fs @@ -95,13 +95,11 @@ variable keyboard-phandle 0 keyboard-phandle ! ; PREPOST-initializer
\ ------------------------------------------------------------------------- -\ Adler-32 wrapper +\ fake copyright notice handling \ -------------------------------------------------------------------------
-: 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. +: insert-fake-copyright + \ As required for MacOS 9 and below " Copyright 1983-2001 Apple Computer, Inc. THIS MESSAGE FOR COMPATIBILITY ONLY" encode-string " copyright" " /" find-package if @@ -111,6 +109,17 @@ variable keyboard-phandle 0 keyboard-phandle ! 3drop drop then then +; + +\ ------------------------------------------------------------------------- +\ Adler-32 wrapper +\ ------------------------------------------------------------------------- + +: 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. + insert-fake-copyright
( adler buf len )
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/ppc/qemu/qemu.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/qemu.fs b/openbios-devel/arch/ppc/qemu/qemu.fs index 9f7e027..7b296b5 100644 --- a/openbios-devel/arch/ppc/qemu/qemu.fs +++ b/openbios-devel/arch/ppc/qemu/qemu.fs @@ -100,8 +100,8 @@ variable keyboard-phandle 0 keyboard-phandle !
: insert-fake-copyright \ As required for MacOS 9 and below - " Copyright 1983-2001 Apple Computer, Inc. THIS MESSAGE FOR COMPATIBILITY ONLY" - encode-string " copyright" + " Pbclevtug 1983-2001 Nccyr Pbzchgre, Vap. GUVF ZRFFNTR SBE PBZCNGVOVYVGL BAYL" + rot13-str encode-string " copyright" " /" find-package if " set-property" $find if execute
This allows us to optionally intercept and execute code before returning back to the Forth interactive console.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/forth/system/ciface.fs | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/openbios-devel/forth/system/ciface.fs b/openbios-devel/forth/system/ciface.fs index fd6c54e..85a6076 100644 --- a/openbios-devel/forth/system/ciface.fs +++ b/openbios-devel/forth/system/ciface.fs @@ -326,6 +326,14 @@ external
: exit ( -- ) ." EXIT" + + \ Execute (exit) hook if one exists + s" (exit)" $find if + execute + else + 2drop + then + outer-interpreter ;
This simply removes the copyright property generated by insert-fake-copyright.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/ppc/qemu/qemu.fs | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/openbios-devel/arch/ppc/qemu/qemu.fs b/openbios-devel/arch/ppc/qemu/qemu.fs index 7b296b5..9e2479d 100644 --- a/openbios-devel/arch/ppc/qemu/qemu.fs +++ b/openbios-devel/arch/ppc/qemu/qemu.fs @@ -111,6 +111,16 @@ variable keyboard-phandle 0 keyboard-phandle ! then ;
+: delete-fake-copyright + \ Remove all traces of fake copyright property + active-package + " /" find-package if + active-package! + " copyright" delete-property + then + active-package! +; + \ ------------------------------------------------------------------------- \ Adler-32 wrapper \ -------------------------------------------------------------------------
Instead insert the fake copyright just before we call the client with go and remove it before control is returned back to the interpreter.
This effectively hides the notice from everyone except for bootloaders.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/ppc/qemu/init.c | 3 +++ openbios-devel/arch/ppc/qemu/qemu.fs | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/init.c b/openbios-devel/arch/ppc/qemu/init.c index 2b5b8e1..1a1aecb 100644 --- a/openbios-devel/arch/ppc/qemu/init.c +++ b/openbios-devel/arch/ppc/qemu/init.c @@ -601,6 +601,9 @@ go(void) { ucell addr;
+ /* Insert fake copyright notice for OS 9 and below */ + fword("insert-fake-copyright"); + feval("saved-program-state >sps.entry @"); addr = POP();
diff --git a/openbios-devel/arch/ppc/qemu/qemu.fs b/openbios-devel/arch/ppc/qemu/qemu.fs index 9e2479d..da273c2 100644 --- a/openbios-devel/arch/ppc/qemu/qemu.fs +++ b/openbios-devel/arch/ppc/qemu/qemu.fs @@ -121,18 +121,16 @@ variable keyboard-phandle 0 keyboard-phandle ! active-package! ;
+: (exit) + \ Clean up before returning to the interpreter + delete-fake-copyright +; + \ ------------------------------------------------------------------------- \ Adler-32 wrapper \ -------------------------------------------------------------------------
: 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. - insert-fake-copyright - - ( adler buf len ) - " (adler32)" $find if execute else
On Fri, Feb 05, 2016 at 06:08:59PM +0000, Mark Cave-Ayland wrote:
This series changes the injection of the fake copyright message such that it is included just before control is handled to the client. The motivation behind this is that older versions of the MacOS bootloader don't call the adler32 word which means the injection is omitted and boot fails.
Great, thanks! Seems to work fine for me.
The first patch is actually a build fix (and will likely be applied separately) while the rest of the patchset ensures that the message is only visible to the bootloader client as discussed on the mailing list.
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
- Alyssa
On 05/02/16 18:33, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 06:08:59PM +0000, Mark Cave-Ayland wrote:
This series changes the injection of the fake copyright message such that it is included just before control is handled to the client. The motivation behind this is that older versions of the MacOS bootloader don't call the adler32 word which means the injection is omitted and boot fails.
Great, thanks! Seems to work fine for me.
Excellent!
The first patch is actually a build fix (and will likely be applied separately) while the rest of the patchset ensures that the message is only visible to the bootloader client as discussed on the mailing list.
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
Does adding a call to delete-fake-copyright in ciface_quiesce() as found in arch/ppc/qemu/methods.c help here?
ATB,
Mark.
On Sat, Feb 06, 2016 at 10:40:10AM +0000, Mark Cave-Ayland wrote:
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
Does adding a call to delete-fake-copyright in ciface_quiesce() as found in arch/ppc/qemu/methods.c help here?
Not in Finnix, at least. Judging by the messages at bootup, the device-tree is constructed before calling quiesce. I think this is kind of unavoidable though.
I would change 'fake copyright notice' to 'fake copyright property' in the comments (both in go() and in qemu.fs), but anyway this seems good to me.
- Alyssa
On 11/02/16 07:51, Alyssa Milburn wrote:
On Sat, Feb 06, 2016 at 10:40:10AM +0000, Mark Cave-Ayland wrote:
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
Does adding a call to delete-fake-copyright in ciface_quiesce() as found in arch/ppc/qemu/methods.c help here?
Not in Finnix, at least. Judging by the messages at bootup, the device-tree is constructed before calling quiesce. I think this is kind of unavoidable though.
I would change 'fake copyright notice' to 'fake copyright property' in the comments (both in go() and in qemu.fs), but anyway this seems good to me.
Great, thanks for the review! If there are no further comments, I'll commit this tomorrow.
ATB,
Mark.
On Fri, 12 Feb 2016, Mark Cave-Ayland wrote:
On 11/02/16 07:51, Alyssa Milburn wrote:
On Sat, Feb 06, 2016 at 10:40:10AM +0000, Mark Cave-Ayland wrote:
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
Does adding a call to delete-fake-copyright in ciface_quiesce() as found in arch/ppc/qemu/methods.c help here?
Not in Finnix, at least. Judging by the messages at bootup, the device-tree is constructed before calling quiesce. I think this is kind of unavoidable though.
I would change 'fake copyright notice' to 'fake copyright property' in the comments (both in go() and in qemu.fs), but anyway this seems good to me.
Great, thanks for the review! If there are no further comments, I'll commit this tomorrow.
I still think that including the actual copyright string (even if obfuscated) is legally more questionable than using a string that is clearly for compatibility only as suggested before in these posts:
http://www.openfirmware.info/pipermail/openbios/2015-May/008703.html http://www.openfirmware.info/pipermail/openbios/2015-June/008710.html
I think Apple expected the year part to be updated every year so it can be expected that those chars are not checked and if we ever find a Mac OS version that does, we could change it then. This would also avoid the unnecessarily complicated obfuscation that may not have any usefulness against legal problems and just make this a one line forth patch. But IANAL so I don't really know what I'm talking about so I don't mind either way. (Do you have any reason to think that the obfuscated version is better than the straightforward way? If not why not keep it simple?)
Regards, BALATON Zoltan
This time sending the reply to OpenBios...
On 2016-Feb-12 16:40 , BALATON Zoltan wrote:
[...] I still think that including the actual copyright string (even if obfuscated) is legally more questionable than using a string that is clearly for compatibility only as suggested before in these posts:
http://www.openfirmware.info/pipermail/openbios/2015-May/008703.html http://www.openfirmware.info/pipermail/openbios/2015-June/008710.html
I think Apple expected the year part to be updated every year so it can be expected that those chars are not checked and if we ever find a Mac OS version that does, we could change it then. This would also avoid the unnecessarily complicated obfuscation that may not have any usefulness against legal problems and just make this a one line forth patch. But IANAL so I don't really know what I'm talking about so I don't mind either way. (Do you have any reason to think that the obfuscated version is better than the straightforward way? If not why not keep it simple?)
The presence of "copyright <company>" in plain text in either sources or binary attracts lawyer's attention. When I was employed by Oracle, had we been interested in picking up OpenBios sources for some reason (a couple of projects suggested it a couple of times), the presence of "copyright apple" (with or without a year, with or without a comment saying "we don't mean it") would have flat completely blocked any such attempt.
You're better off with an obfuscated string which doesn't match blind string comparisons.
On Fri, 12 Feb 2016, Tarl Neustaedter wrote:
The presence of "copyright <company>" in plain text in either sources or binary attracts lawyer's attention. When I was employed by Oracle, had we been interested in picking up OpenBios sources for some reason (a couple of projects suggested it a couple of times), the presence of "copyright apple" (with or without a year, with or without a comment saying "we don't mean it") would have flat completely blocked any such attempt.
Even if the plain text string says:
Copyright IS NOT BY Apple Computer, Inc; THIS STRING IS JUST FOR COMPATIBILITY WITH MacOS
or something like that? So it's not a comment with a string that looks like a copyright message but actually clearly not a copyright message.
You're better off with an obfuscated string which doesn't match blind string comparisons.
I think we don't agree on this (they will find it anyway once they list the device tree from anything they boot with it so I don't think obfuscation solves any problem just tries to hide it) but as I've said I don't mind it either way just think the obfuscation is ugly and probably unnecessary overcautiousness (is that a word in English?) until there's some evidence that it's needed. And we could still add that complication when there is some evidence in the future.
Regards, BALATON Zoltan
On 2016-Feb-12 19:09 , BALATON Zoltan wrote:
Even if the plain text string says:
Copyright IS NOT BY Apple Computer, Inc; THIS STRING IS JUST FOR COMPATIBILITY WITH MacOS
Yup. It says "copyright" and it has "name of corporation who isn't us". Everything else is just lawsuit bait. Seriously.
You're better off with an obfuscated string which doesn't match blind string comparisons.
I think we don't agree on this (they will find it anyway once they list the device tree from anything they boot with it so I don't think obfuscation solves any problem just tries to hide it) but as I've said I don't mind it either way just think the obfuscation is ugly and probably unnecessary overcautiousness (is that a word in English?) until there's some evidence that it's needed. And we could still add that complication when there is some evidence in the future.
One of the things the lawyers do is search binaries and source code for the string "copyright". If it's ROT13, they don't find it. And as I understand the latest patch, the unencrypted version doesn't appear in the device tree until just before calling MacOS, and is removed right after.
With legal departments in the USA, it's not whether someone can win a lawsuit that makes them nervous. It's whether someone can manage to *file* a lawsuit. Although, just writing a piece of paper isn't enough, it has to pass "the giggle test" (seriously). If it makes the judge giggle, the lawsuit gets tossed before it sees the light of day and doesn't make anyone nervous. If the judge doesn't toss it, legal departments go into overdrive and people start getting fired.
So no legal department is going to allow use of code that shows a naked string saying "copyright" and "apple" in the same sentence. It does not matter if the words say "we don't mean it", it has the name of a corporation with a large legal department, it's safer for the lawyer to say "no". They tend to be remarkably unhumorous about things which might cost them their jobs.
On Fri, Feb 12, 2016 at 08:18:58PM -0500, Tarl Neustaedter wrote:
So no legal department is going to allow use of code that shows a naked string saying "copyright" and "apple" in the same sentence. It does not matter if the words say "we don't mean it", it has the name of a corporation with a large legal department, it's safer for the lawyer to say "no". They tend to be remarkably unhumorous about things which might cost them their jobs.
And the exact same is true for having it in the run-time device tree.
Since when are we "a company in the USA", btw?
Segher
On 13/02/16 00:09, BALATON Zoltan wrote:
On Fri, 12 Feb 2016, Tarl Neustaedter wrote:
The presence of "copyright <company>" in plain text in either sources or binary attracts lawyer's attention. When I was employed by Oracle, had we been interested in picking up OpenBios sources for some reason (a couple of projects suggested it a couple of times), the presence of "copyright apple" (with or without a year, with or without a comment saying "we don't mean it") would have flat completely blocked any such attempt.
Even if the plain text string says:
Copyright IS NOT BY Apple Computer, Inc; THIS STRING IS JUST FOR COMPATIBILITY WITH MacOS
or something like that? So it's not a comment with a string that looks like a copyright message but actually clearly not a copyright message.
You're better off with an obfuscated string which doesn't match blind string comparisons.
I think we don't agree on this (they will find it anyway once they list the device tree from anything they boot with it so I don't think obfuscation solves any problem just tries to hide it) but as I've said I don't mind it either way just think the obfuscation is ugly and probably unnecessary overcautiousness (is that a word in English?) until there's some evidence that it's needed. And we could still add that complication when there is some evidence in the future.
I would say that my experience more closely matches Tarl's in this respect in that a written copyright statement in source code does cause problems during an audit, regardless of the intent behind it.
Remember that most legal people are not software engineers (and vice-versa too) so if they come across a verbatim copyright notice in the code then it can cause problems, particularly if the people examining the source code do not have a software background. In my experience this comes down to a difference of green-lighting a project straight away compared with months of legal delay. Having said that I would expect any competent legal technical firm to eventually find in favour of OpenBIOS, but IANAL and it takes time.
As I mentioned before, I'm fairly sure that Apple aren't losing too many sleepless nights over this. It is possible to spend a lot more engineering time on this (self-destructing properties on read, anyone?) but I think the proposed patch is currently a good compromise with respect to an afternoon's coding and being able to remove explicit references from the source code.
ATB,
Mark.
On Fri, Feb 12, 2016 at 10:40:33PM +0100, BALATON Zoltan wrote:
I still think that including the actual copyright string (even if obfuscated) is legally more questionable than using a string that is clearly for compatibility only as suggested before in these posts:
http://www.openfirmware.info/pipermail/openbios/2015-May/008703.html http://www.openfirmware.info/pipermail/openbios/2015-June/008710.html
I think Apple expected the year part to be updated every year so it can be expected that those chars are not checked and if we ever find a Mac OS version that does, we could change it then.
That would have to be a new Mac OS version, one that doesn't exist yet!
This would also avoid the unnecessarily complicated obfuscation that may not have any usefulness against legal problems and just make this a one line forth patch.
Yes. The obfuscation makes it seem like we cannot include the "real thing", which we actually *can* (and no, IANAL either); but we do want to indicate this is not an Apple firmware to *help our users*.
Segher
On 12/02/16 20:47, Mark Cave-Ayland wrote:
On 11/02/16 07:51, Alyssa Milburn wrote:
On Sat, Feb 06, 2016 at 10:40:10AM +0000, Mark Cave-Ayland wrote:
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
Does adding a call to delete-fake-copyright in ciface_quiesce() as found in arch/ppc/qemu/methods.c help here?
Not in Finnix, at least. Judging by the messages at bootup, the device-tree is constructed before calling quiesce. I think this is kind of unavoidable though.
I would change 'fake copyright notice' to 'fake copyright property' in the comments (both in go() and in qemu.fs), but anyway this seems good to me.
Great, thanks for the review! If there are no further comments, I'll commit this tomorrow.
It looks like there is a bit more discussion here, so I'll go ahead and commit just the build fix (first patch in the series) for the moment.
I'll try and post an updated v2 soon based upon the feedback I've received so far.
ATB,
Mark.
On 06/02/16 10:40, Mark Cave-Ayland wrote:
On 05/02/16 18:33, Alyssa Milburn wrote:
On Fri, Feb 05, 2016 at 06:08:59PM +0000, Mark Cave-Ayland wrote:
This series changes the injection of the fake copyright message such that it is included just before control is handled to the client. The motivation behind this is that older versions of the MacOS bootloader don't call the adler32 word which means the injection is omitted and boot fails.
Great, thanks! Seems to work fine for me.
Excellent!
The first patch is actually a build fix (and will likely be applied separately) while the rest of the patchset ensures that the message is only visible to the bootloader client as discussed on the mailing list.
This means it is available in the guest OSes too (e.g. in the devicetree under /sys on Linux), which I hope is OK.
Does adding a call to delete-fake-copyright in ciface_quiesce() as found in arch/ppc/qemu/methods.c help here?
Actually I've got a much better idea - the MacOS boot loaders create a /rom/macos node in the device tree in order for the next stage loader to access the toolbox. Hence we only need to insert the copyright property if we detect this node has been created.
I'll include this in the next revision of the copyright patchset for testing as it seems to work well here.
ATB,
Mark.
On Feb 5, 2016, at 1:08 PM, Mark Cave-Ayland wrote:
This series changes the injection of the fake copyright message such that it is included just before control is handled to the client. The motivation behind this is that older versions of the MacOS bootloader don't call the adler32 word which means the injection is omitted and boot fails.
The first patch is actually a build fix (and will likely be applied separately) while the rest of the patchset ensures that the message is only visible to the bootloader client as discussed on the mailing list.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (7): pci.c: fix build for non-SPARC/PPC platforms string.fs: add functions to support ROT13 string encoding/decoding ppc: move fake copyright notice generation into a separate word ppc: use ROT13 encoding for fake copyright message ciface.fs: implement optional (exit) hook when returning control back to the interpreter ppc: add complimentary delete-fake-copyright word ppc: move fake copyright hooks from adler32 word
openbios-devel/arch/ppc/qemu/init.c | 3 +++ openbios-devel/arch/ppc/qemu/qemu.fs | 33 +++++++++++++++++++++++++-------- openbios-devel/drivers/pci.c | 9 +++++---- openbios-devel/forth/lib/string.fs | 28 ++++++++++++++++++++++++++++ openbios-devel/forth/system/ciface.fs | 8 ++++++++ 5 files changed, 69 insertions(+), 12 deletions(-)
-- 1.7.10.4
Just tried out this patch set. It applied and compiled just fine. It runs Mac OS 9.2 with the CR-LF patch applied. Mac OS 8.5 does boot but stops at an error message about RTAS being missing. Debian Linux boots just fine. Fedora seems ok (minus the other unrelated problems it has).
It now takes some work just to see that copyright message. :) Excellent job.