Subject: Re: More progress
To: Ian Fry <Ian.Fry@sophos.com>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm26
Date: 11/26/2001 20:38:52
On Mon, 26 Nov 2001, Ian Fry wrote:
> Okay, I tried this again yesterday, and this is what I've found - mostly from
> memory, so some of the details may not be accurate:
>
> disklabel -i -I wd0 allows a disklabel to be written to disk, and not
> affect the RISC OS partition, but the kernel always reports 'wd0: no disk
> label' - it seems that the in-core label isn't getting initialised.
>
> disklabel -R -r wd0 <label> labels the disk and the in-core label is set,
> but trashes any RISC OS partition.
Hmm. It looks like disklabel(8) has lots of code that's conditional on
__arm32__, which is rather poor. Try rebuilding it with this patch:
Index: Makefile
===================================================================
RCS file: /cvsroot/basesrc/sbin/disklabel/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- Makefile 2001/11/19 13:55:06 1.40
+++ Makefile 2001/11/26 20:36:51
@@ -42,4 +42,9 @@
CPPFLAGS+= -DSAVEBOOTAREA
.endif
+.if (${MACHINE} == "acorn32" || ${MACHINE} == "arm26")
+# Support FileCore boot block
+CPPFLAGS+= -DUSE_ACORN
+.endif
+
.include <bsd.prog.mk>
Index: disklabel.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/disklabel/disklabel.c,v
retrieving revision 1.99
diff -u -r1.99 disklabel.c
--- disklabel.c 2001/10/19 01:16:37 1.99
+++ disklabel.c 2001/11/26 20:36:52
@@ -146,13 +146,13 @@
static struct mbr_partition *readmbr(int);
#endif /* USE_MBR */
-#ifdef __arm32__
+#ifdef USE_ACORN
static u_int filecore_partition_offset;
static u_int get_filecore_partition(int);
static int filecore_checksum(u_char *);
-#endif /* __arm32__ */
+#endif /* USE_ACORN */
-#if defined(USE_MBR) || (defined(__arm32__) && defined(notyet))
+#if defined(USE_MBR) || (defined(USE_ACORN) && defined(notyet))
static void confirm(const char *);
#endif
@@ -297,7 +297,7 @@
}
#endif /* USE_MBR */
-#ifdef __arm32__
+#ifdef USE_ACORN
/*
* Check for the presence of a RiscOS filecore boot block
* indicating an ADFS file system on the disc.
@@ -307,7 +307,7 @@
* is found to be ADFS only.
*/
filecore_partition_offset = get_filecore_partition(f);
-#endif /* __arm32__ */
+#endif /* USE_ACORN */
switch (op) {
@@ -452,7 +452,7 @@
(void)strncpy(lp->d_packname, name, sizeof(lp->d_packname));
}
-#if defined(USE_MBR) || (defined(__arm32__) && defined(notyet))
+#if defined(USE_MBR) || (defined(USE_ACORN) && defined(notyet))
static void
confirm(const char *txt)
{
@@ -466,7 +466,7 @@
if (first != 'y' && first != 'Y')
exit(0);
}
-#endif /* USE_MBR || __arm32__ && notyet */
+#endif /* USE_MBR || USE_ACORN && notyet */
int
writelabel(int f, const char *boot, struct disklabel *lp)
@@ -515,10 +515,10 @@
}
#endif /* USE_MBR */
-#ifdef __arm32__
+#ifdef USE_ACORN
/* XXX */
sectoffset = (off_t)filecore_partition_offset * DEV_BSIZE;
-#endif /* __arm32__ */
+#endif /* USE_ACORN */
/*
* First set the kernel disk label,
@@ -689,7 +689,7 @@
}
#endif /* USE_MBR */
-#ifdef __arm32__
+#ifdef USE_ACORN
/*
* static int filecore_checksum(u_char *bootblock)
*
@@ -835,7 +835,7 @@
}
return (0);
}
-#endif /* __arm32__ */
+#endif /* USE_ACORN */
/*
* Fetch disklabel for disk.
@@ -858,10 +858,10 @@
sectoffset = (off_t)dosdp->mbrp_start * DEV_BSIZE;
#endif /* USE_MBR */
-#ifdef __arm32__
+#ifdef USE_ACORN
/* XXX */
sectoffset = (off_t)filecore_partition_offset * DEV_BSIZE;
-#endif /* __arm32__ */
+#endif /* USE_ACORN */
if (lseek(f, sectoffset, SEEK_SET) < 0 ||
read(f, bootarea, BBSIZE) != BBSIZE)
@@ -955,11 +955,11 @@
sectoffset = (off_t)dosdp->mbrp_start * DEV_BSIZE;
#endif /* USE_MBR */
-#ifdef __arm32__
+#ifdef USE_ACORN
/* XXX */
sectoffset = (off_t)filecore_partition_offset
* DEV_BSIZE;
-#endif /* __arm32__ */
+#endif /* USE_ACORN */
if (lseek(f, sectoffset, SEEK_SET) < 0 ||
read(f, boot, BBSIZE) != BBSIZE)
--
Ben Harris <bjh21@netbsd.org>
Portmaster, NetBSD/arm26 <URL:http://www.netbsd.org/Ports/arm26/>