[OpenBIOS] [PATCH] ppc: add Apple copyright hack to Adler-32
Cormac O'Brien
i.am.cormac.obrien at gmail.com
Wed Jun 10 01:21:52 CEST 2015
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.
Signed-off-by: Cormac O'Brien <i.am.cormac.obrien at 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
+ else
+ ." Can't find " type cr
+ then
+ then
+
+ " (adler32)" $find if
+ execute
+ else
+ 3drop 0
+ ." Can't find" type cr
+ then
+;
--
2.4.2
More information about the OpenBIOS
mailing list