Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/sysinst/arch/macppc Don't try installboot(8) i...



details:   https://anonhg.NetBSD.org/src/rev/a78419317594
branches:  trunk
changeset: 749257:a78419317594
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Nov 23 13:25:02 2009 +0000

description:
Don't try installboot(8) if offset of PART_A is not zero.

As man page says, installboot(8) is required only OpenFirmware 1 and 2
machines and even on such machines the root partition has to be at the
beginning of the disk to make installboot(8) work.

On OpenFirmware version 3 machines, the strategy provided by
installboot(8) doesn't work, and they need to have an extra
native partition (HFS or FAT16) which can be recognized by
the newer firmware to put a loadable bootloader.
If PART_A has some offset, we can assume the disk is partitioned
for a machine with OF3, which does't require installboot(8).

Eventually, we should provide an independent partitioning method
for OpenFirmware 3 machines (fdisk MBR partition + FAT16 partition
for ofwboot.xcf as OpenBSD does), but it may require some new API
to get OF version in sysinst.

diffstat:

 distrib/utils/sysinst/arch/macppc/md.c |  27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 5ea2f0be4d60 -r a78419317594 distrib/utils/sysinst/arch/macppc/md.c
--- a/distrib/utils/sysinst/arch/macppc/md.c    Mon Nov 23 12:23:20 2009 +0000
+++ b/distrib/utils/sysinst/arch/macppc/md.c    Mon Nov 23 13:25:02 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.41 2009/09/19 14:57:29 abs Exp $      */
+/*     $NetBSD: md.c,v 1.42 2009/11/23 13:25:02 tsutsui Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -154,6 +154,31 @@
 {
        const char *bootfile = "/boot";
 
+       /*
+        * XXX
+        * Only OpenFirmware version 1 and 2 machines need installboot(8)
+        * and it uses a faked Apple partition map with the primary bootxx.
+        * installboot(8) assumes that root partition is at the beginning of
+        * the disk and put a faked Apple partition map at the top of
+        * the partition, so it won't work if root partition has some
+        * offset from physical block 0 where the Apple driver descriptor
+        * map resides on.
+        * 
+        * On OpenFirmware version 3 machines, the strategy used on OF1/2
+        * machines doesn't work (they don't recognize boot code info
+        * in Apple partition map entries) and they need to have
+        * an extra native partition (HFS or MSDOSFS) which can be
+        * recognized by the newer firmware to put a loadable bootloader.
+        * installboot(8) against partition `a' on such machines might
+        * corrupt existing disklabel or a valid Apple partition map.
+        *
+        * Currently there is no way to see OF version on running machine
+        * yet, so assume partition a has some offset on OF3 machines
+        * and don't try installboot(8) in that case.
+        */
+       if (bsdlabel[PART_A].pi_offset != 0)
+               return 0;
+
        printf (msg_string(MSG_dobootblks), diskdev);
        cp_to_target("/usr/mdec/ofwboot", bootfile);
        sync();



Home | Main Index | Thread Index | Old Index