Port-sandpoint archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Synology PPCBoot SK98 network bug fix
Hi,
> We can do that. But then you still have to modify your code, because
> currently it will continue looking for RAID, even if there had already
> been a valid partition.
How about the attached? It will only check that partition 'a' is of type
RAID, and apply p_offset to rf_offset. (I have altered my disklabels, so
that wd0a and wd1a are the RAID components).
> You already tried an older, known to work, altboot? Or can you isolate
> the problem by using a small network, with just one switch, a server
> and your NAS?
A summary of the problem is: "Don't write to flash at address 0xFFF40000,
because the adapter MAC address is stored there. Turning the adapter MAC
address into a multicast MAC address is not a good idea". ;-)
Thanks,
J
--
My other computer also runs NetBSD / Sailing at Newbiggin
http://www.netbsd.org/ / http://www.newbigginsailingclub.org/
Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sandpoint/stand/altboot/dsk.c,v
retrieving revision 1.5
diff -u -r1.5 dsk.c
--- src/sys/arch/sandpoint/stand/altboot/dsk.c 6 Mar 2011 13:55:12 -0000
1.5
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c 20 Jun 2011 12:01:37 -0000
@@ -43,6 +43,8 @@
#include <sys/disklabel.h>
#include <sys/bootblock.h>
+#include <sys/param.h>
+#include <dev/raidframe/raidframevar.h>
#include <machine/bootinfo.h>
#include <machine/stdarg.h>
@@ -296,7 +298,7 @@
struct disklabel *dlp;
struct partition *pp;
char *dp;
- int i, first;
+ int i, first, rf_offset;
bsdp = NULL;
(*d->lba_read)(d, 0, 1, iobuf);
@@ -310,24 +312,39 @@
}
}
skip:
+ rf_offset = 0;
first = (bsdp) ? bswap32(bsdp->mbrp_start) : 0;
(*d->lba_read)(d, first + LABELSECTOR, 1, iobuf);
dp = iobuf /* + LABELOFFSET */;
for (i = 0; i < 512 - sizeof(struct disklabel); i++, dp += 4) {
dlp = (struct disklabel *)dp;
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC) {
- goto found;
+ if (dlp->d_partitions[0].p_fstype == FS_RAID) {
+ printf("%s%c: raid\n", d->xname, i + 'a');
+ snprintf(d->xname, sizeof(d->xname), "raid.");
+ rf_offset = dlp->d_partitions[0].p_offset +
+ RF_PROTECTED_SECTORS;
+ (*d->lba_read)(d, rf_offset + LABELSECTOR, 1,
+ iobuf);
+ dp = iobuf /* + LABELOFFSET */;
+ for (i = 0; i < 512 - sizeof(struct disklabel);
i++, dp += 4) {
+ dlp = (struct disklabel *)dp;
+ if (dlp->d_magic == DISKMAGIC &&
+ dlp->d_magic2 == DISKMAGIC)
+ goto found;
+ }
+ } else /* Not RAID */
+ goto found;
}
}
d->dlabel = NULL;
printf("%s: no disklabel\n", d->xname);
return;
found:
- d->dlabel = allocaligned(sizeof(struct disklabel), 4);
- memcpy(d->dlabel, dlp, sizeof(struct disklabel));
for (i = 0; i < dlp->d_npartitions; i += 1) {
const char *type;
pp = &dlp->d_partitions[i];
+ pp->p_offset += rf_offset;
type = NULL;
switch (pp->p_fstype) {
case FS_SWAP: /* swap */
@@ -341,8 +358,11 @@
break;
}
if (type != NULL)
- printf("%s%c: %s\n", d->xname, i + 'a', type);
+ printf("%s%c: %s\t(%u)\n", d->xname, i + 'a', type,
+ pp->p_offset);
}
+ d->dlabel = allocaligned(sizeof(struct disklabel), 4);
+ memcpy(d->dlabel, dlp, sizeof(struct disklabel));
}
static void
Home |
Main Index |
Thread Index |
Old Index