From owner-freebsd-ppc@FreeBSD.ORG Sat Dec 24 12:03:31 2011 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57B1D10656D5 for ; Sat, 24 Dec 2011 12:03:31 +0000 (UTC) (envelope-from freebsd-ppc@dino.sk) Received: from loki.netlab.sk (loki.netlab.sk [84.245.65.11]) by mx1.freebsd.org (Postfix) with ESMTP id D26568FC15 for ; Sat, 24 Dec 2011 12:03:30 +0000 (UTC) Received: from atom.dino.sk (fw1.dino.sk [84.245.95.252]) (AUTH: LOGIN milan, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by loki.netlab.sk with ESMTPSA; Sat, 24 Dec 2011 12:57:30 +0100 id 00033CED.4EF5BE2A.00013020 Date: Sat, 24 Dec 2011 13:03:15 +0100 From: Milan Obuch To: freebsd-ppc@freebsd.org Message-ID: <20111224130315.0cc68c60@atom.dino.sk> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd8.2) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEX+/v7++v6YOTrq8PCcuIX989UvOSj++v0BNCbpAAAAB3RJTUUHsQwfFzs7RBhzUQAAAhJJREFUOI1dU8GOqzAMNKIoV1bvwD1i0ysqrHplIdBrVSX7ATSbd03VVvn9tQNtQy0hjAdn7LED4AAcPtWm9RV+MPSfxhBLx9ajd6X/ngB6/mTwnRSZua7i7Ca+0ctZKo4Qmz+JY13X6I3nFZBxIYW1PbgfQ5RP8g0XlltEWGf3cV03joYpRnFbvYDKbXjZlXyyhEZA4lI+cN3NaVXE4VKjSwTExO10eTEkkJVqIAD5z0nUBQJluQDRSQjcrBiHAJxZlAH5CUMBMC7OcJ4LMQNnxhZ1HYPscMc6J4UlWRMNwzOpCcAHKSICd1EDn83abdREIbXsHkD1OinP1aCUCOEVRaa1lMcvywUWdYgk13JQUpYNKmvXQ8Kw5ML9YI5h8SakctBc7E/IYuLhYd/zZIk+1gM1vNweQBvHE0j+oYah3sMqAytQYlZk6+ANaaawJdu3OFzYGMZ3iGpa3qMlq9ZH0VZTgrCtw/ngdYkEIIpSbP1bWQAdFdX9vocBdkH2qVjVmuMu3gI5rjs814EUdrCZgWlPaxZZ3RiLFUtr+ud0PXwp2dnQSNXgePt6AZpBj6UMJ7VQkzN4utVeaSW1Dhn/kblGrKeMvNGnzwX4zuEDarYz1KdPtR60Gul0Gued+515SJXhCsl+Tx/3kY/UDvicPll9mfu50t3tvQ/thZpJYgeuwdSKNJ6tCD98MCgoxLDaPxbwqqwPWaWiAAAAAElFTkSuQmCC X-Face: ak5rwz4-aUa>hPFZlcg,bXxn.(TN}e9DGFrKU\.i_'B[&5=pAd9o"j)5VSUYW:BRQG#^42Ev$Il|; Ztn=,C X-Operating-System: FreeBSD/amd64 8.2-STABLE Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Multiboot setup on Mac mini X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2011 12:03:31 -0000 Hi, as I managed to install both 9-PRERELEASE and 10-CURRENT along with supplied MacOS on HDD in Mac mini, I hacked a bit on multiboot setup. Openfirmware allows for flexible scripting similar to that of our loader, but before even our boot blocks come to the show. OPT method (holding OPT key - ALT in PC parlance) while turning on Mac means scanning devices for bootable partitions. It looks simple, graphics selection of bootable partition with mouse, but there are some drawbacks. First, it is slow, mostly becasue of scanning devices (at least HDD and CD, if present), maybe graphics is not the speediest, too. What was not satisfactory for me is impossibility to distinguish various non-MacOS bootable partitions - they are presented as disc icons all alike, bootable CD, if present, looks different. MacOS partition is denoted with X in circle put over disc icon and text label under it, but I did not find the way to do something similar to my partitions' icons. After some browsing I found Openfirmware uses Forth - just like our loader at least for i386 and amd64 does - and so I decided to play with it a bit, too. First, I modified boot block so it takes an argument telling which partition should be used to mount rootfs, not finding it via some magic. Then I was able to boot system from any partition just writing 'boot hd:,\ppc\boot1.elf hd:' in OpenFirmware prompt, using where my modified block is installed and beeing system partition I would like to boot from. Then I modified bootinfo file... FreeBSD/powerpc bootloader FreeBSD $FreeBSD: src/sys/boot/powerpc/boot1.chrp/bootinfo.txt,v 1.2 2008/10/31 00:52:31 nwhitehorn Exp $ MacRISC MacRISC3 MacRISC4 begin s" 1. Apple Mac OS X" type cr s" 2. FreeBSD 9-PRERELEASE" type cr s" 3. FreeBSD 10-CURRENT" type cr s" 4. OpenFirmware prompt" type cr cr key dup 31 = if drop " boot hd:3,\\:tbxi" eval else dup 32 = if drop " boot hd:2,\ppc\boot1.elf hd:4" eval else dup 33 = if drop " boot hd:2,\ppc\boot1.elf hd:6" eval else 34 = if exit else s" ?" type cr cr then then then then 0 until and it works the way I intended... almost. I have set boot-command to invoke 'boot hd:2,\ppc\bootinfo.txt' instead of standard mac-boot. After switching on Mac mini, I hear boot chime, and when monitor comes on, I see there load-size=800 adler32=23467718 1. Apple Mac OS X 2. FreeBSD 9-PRERELEASE 3. FreeBSD 10-CURRENT 4. OpenFirmware prompt Method not found; ihandle=0 phandle=0 Apple PowerMac10,1 4.8.9f4BootROM built on 03/23/05 at 14:22:23 Copyright 1994-2005 Apple Computer, Inc. Welcome to Open Firmware, the system time and date is: nn/nn/nnnn nn:nn:nn To continue booting, type "mac-boot" and press return. To shut down, type "shut-down" and press return. ok 0 > So my script is definitelly being called, as seen menu is drawn, but something bad happens and script is being stopped. Now I can simply write 'boot hd:2,\ppc\bootinfo.txt' on console and menu is drawn, again, this time waiting for keypress to select desired partition to boot an acting on it correctly. Is someone here who knows Open Firmware and sees what's wrong with my script or can suggest some work-around, if I hit some bug elsewhere? Regards, Milan N. B. Merry Christmas and no bugs in system in New Year :)