On 10/06/15 00:21, Cormac O'Brien wrote:
This patch modifies the adler32 word to set an Apple copyright string in the device tree in order to allow Mac OS 9 to boot.
I think it's worth mentioning something here along the lines of "Since OS 9 checks the copyright string on boot and the OS 9 bootloader is one of the only users of adler32, use this word as a convenient injection point for a fake copyright message which is enough to fool OS 9 into booting". It's really just nit-picking on clarifying the message in the source below.
Signed-off-by: Cormac O'Brien i.am.cormac.obrien@gmail.com
arch/ppc/qemu/init.c | 2 +- arch/ppc/qemu/qemu.fs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c index d31b8ba..a5073a3 100644 --- a/arch/ppc/qemu/init.c +++ b/arch/ppc/qemu/init.c @@ -1003,7 +1003,7 @@ arch_of_init(void) /* Implementation of filll word (required by BootX) */ bind_func("filll", ffilll);
- bind_func("adler32", adler32);
bind_func("(adler32)", adler32);
bind_func("platform-boot", boot); bind_func("(go)", go);
diff --git a/arch/ppc/qemu/qemu.fs b/arch/ppc/qemu/qemu.fs index 458af1b..939985a 100644 --- a/arch/ppc/qemu/qemu.fs +++ b/arch/ppc/qemu/qemu.fs @@ -93,3 +93,31 @@ variable keyboard-phandle 0 keyboard-phandle ! :noname set-defaults ; PREPOST-initializer
+\ ------------------------------------------------------------------------- +\ 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.
- " /" find-package if
- " set-property" $find if
( adler buf len phandle xt )
>r >r
" Copyright 1983-2001 Apple Computer, Inc. THIS MESSAGE FOR COMPATIBILITY ONLY"
encode-string " copyright"
r> r> execute
You should be able to get away with not using the R stack here - have a look at using 2swap instead.
- else
." Can't find " type cr
Whilst it's nice to have error checking, I could probably live without this particular else clause, since if the / node in the device tree is missing then the adler32 word is likely to be the very least of our problems...
- then
- then
- " (adler32)" $find if
- execute
- else
- 3drop 0
- ." Can't find" type cr
Maybe add (adler32) here so we know what can't be found?
- then
+;
Other than that, I think the patch looks good.
ATB,
Mark.