Module Name: src Committed By: tsutsui Date: Mon Nov 23 13:25:02 UTC 2009
Modified Files: src/distrib/utils/sysinst/arch/macppc: md.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/distrib/utils/sysinst/arch/macppc/md.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/utils/sysinst/arch/macppc/md.c diff -u src/distrib/utils/sysinst/arch/macppc/md.c:1.41 src/distrib/utils/sysinst/arch/macppc/md.c:1.42 --- src/distrib/utils/sysinst/arch/macppc/md.c:1.41 Sat Sep 19 14:57:29 2009 +++ src/distrib/utils/sysinst/arch/macppc/md.c Mon Nov 23 13:25:02 2009 @@ -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();