Subject: booting raid support (Re: RaQ1 / Stock NetBSD Recovery ISO)
To: None <list-netbsd-port-cobalt@rangat.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 07/18/2007 23:22:52
> Speaking of bootloaders, I have some local changes to the cobalt
> bootloader to make it support booting from a RAIDFrame Mirror
>
> I guess I should send-pr these, but if someone with commit access is
> reading...
> http://www.rangat.org/rthille/Computer/NetBSD/Misc/sys-arch-cobalt-stand-boot-wd.c.diff
I think it's better to handle an offset of RF_PROTECTED_SECTORS
for FS_RAID in wdstrategy() rather than wdgetdisklabel().
How about this patch instead? (untested)
---
Index: wd.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/stand/boot/wd.c,v
retrieving revision 1.5
diff -u -r1.5 wd.c
--- wd.c 11 Dec 2005 12:17:06 -0000 1.5
+++ wd.c 18 Jul 2007 14:21:07 -0000
@@ -43,6 +43,7 @@
#include <machine/param.h>
#include <machine/stdarg.h>
+#include <dev/raidframe/raidframevar.h> /* For RF_PROTECTED_SECTORS */
#include "boot.h"
#include "wdvar.h"
@@ -254,7 +255,8 @@
{
int i, nsect;
daddr_t blkno;
- struct wd_softc *wd = f;
+ struct wd_softc *wd;
+ struct partition *pp;
if (size == 0)
return (0);
@@ -262,8 +264,13 @@
if (rw != F_READ)
return EOPNOTSUPP;
+ wd = f;
+ pp = &wd->sc_label.d_partitions[wd->sc_part];
+
nsect = howmany(size, wd->sc_label.d_secsize);
- blkno = dblk + wd->sc_label.d_partitions[wd->sc_part].p_offset;
+ blkno = dblk + pp->p_offset;
+ if (pp->p_fstype == FS_RAID)
+ blkno += RF_PROTECTED_SECTORS;
for (i = 0; i < nsect; i++, blkno++) {
int error;
---
Izumi Tsutsui