NetBSD Problem Report #53727
From www@NetBSD.org Mon Nov 12 19:17:21 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 6AB8C7A150
for <gnats-bugs@gnats.NetBSD.org>; Mon, 12 Nov 2018 19:17:21 +0000 (UTC)
Message-Id: <20181112191720.2EAAD7A1F0@mollari.NetBSD.org>
Date: Mon, 12 Nov 2018 19:17:20 +0000 (UTC)
From: scole_mail@gmx.com
Reply-To: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Subject: boot floppy doesn't work for openfirmware version 1 machines?
X-Send-Pr-Version: www-1.0
>Number: 53727
>Category: port-macppc
>Synopsis: boot floppy doesn't work for openfirmware version 1 machines?
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: tsutsui
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 12 19:20:00 +0000 2018
>Closed-Date: Tue Nov 20 13:24:40 +0000 2018
>Last-Modified: Tue Nov 20 13:24:40 +0000 2018
>Originator: scole_mail
>Release: current
>Organization:
none
>Environment:
NetBSD dstar 8.0_STABLE NetBSD 8.0_STABLE (GENERIC) #0: Mon Oct 22 14:40:16 PDT 2018 scole@dstar:/home/scole/nbsd/cvs/8_0/obj/sys/arch/i386/compile/GENERIC i386
>Description:
I have some changes I've been working on (that aren't checked in yet) to get the install media working for ppc601 machines. The install boot floppy (e.g. boot1.fs) doesn't work for versions later than 1.22 of src/sys/arch/macppc/stand/ofwboot/ofdev.c
It seems like there is some issue with a 'partition zero' bootloader and ofdev.c:search_mac_label() not working with the boot floppy, and that the netbsd kernel can't be found on the filesystem. Using search_dos_label() works though.
Here is some output with some debugging turning on.
0 > boot fd:0 -
OF_open bootpath=fd
read stage 2 blocks: 01234567. done!
starting stage 2...
>> NetBSD/macppc OpenFirmware Boot, Revision 1.12 (Sat Nov 10 17:50:12 UTC 2018)
parsefilepath: path = /netbsd
parsefilepath: Checking /netbsd: dhandle = -1
parsefilepath: filename = /netbsd
parsefilepath: path = /netbsd
parsefilepath: Checking /netbsd: dhandle = -1
parsefilepath: filename = /netbsd
devopen: devname = fd, filename = /netbsd
devopen: opened_name = fd/netbsd
ofdev devname fd
open /netbsd: Device not configured
parsefilepath: path = /netbsd.gz
parsefilepath: Checking /netbsd.gz: dhandle = -1
parsefilepath: filename = /netbsd.gz
parsefilepath: path = /netbsd.gz
parsefilepath: Checking /netbsd.gz: dhandle = -1
parsefilepath: filename = /netbsd.gz
devopen: devname = fd, filename = /netbsd.gz
devopen: opened_name = fd/netbsd.gz
ofdev devname fd
open /netbsd.gz: Device not configured
parsefilepath: path = /netbsd.macppc
parsefilepath: Checking /netbsd.macppc: dhandle = -1
parsefilepath: filename = /netbsd.macppc
parsefilepath: path = /netbsd.macppc
parsefilepath: Checking /netbsd.macppc: dhandle = -1
parsefilepath: filename = /netbsd.macppc
devopen: devname = fd, filename = /netbsd.macppc
devopen: opened_name = fd/netbsd.macppc
ofdev devname fd
open /netbsd.macppc: Device not configured
>How-To-Repeat:
Try booting boot1.fs on an OF1 machine. (Maybe OF2 and OF3 also?)
>Fix:
Here is a patch that forces search_dos_label() to be used instead of search_mac_label() when a floppy and OF1 machines are used. If it is looks okay, I can check it in.
Unfortunately, I don't have other machines to test this on. The current boot floppy probably should be checked to see if this issue affects OF2 and OF3 machines as well.
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/stand/ofwboot/ofdev.c,v
retrieving revision 1.26
diff -b -u -r1.26 ofdev.c
--- ofdev.c 19 Feb 2012 12:02:55 -0000 1.26
+++ ofdev.c 12 Nov 2018 19:11:20 -0000
@@ -444,7 +444,15 @@
/* Else try APM or MBR partitions */
struct drvr_map *map = (struct drvr_map *)buf;
- if (map->sbSig == DRIVER_MAP_MAGIC)
+ /*
+ * XXX using search_mac_label(), my powermac 7200
+ * fails booting with the boot floppy. Other machines
+ * and openfirmware versions may need this check also
+ */
+ if (ofw_version == 1 && strncmp(devname,"fd",2) == 0)
+ error = search_dos_label(&ofdev, 0, buf,
+ &label, 0);
+ else if (map->sbSig == DRIVER_MAP_MAGIC)
error = search_mac_label(&ofdev, buf, &label);
else
error = search_dos_label(&ofdev, 0, buf,
>Release-Note:
>Audit-Trail:
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Subject: Re: port-macppc/53727: boot floppy doesn't work for openfirmware version 1 machines?
Date: Tue, 13 Nov 2018 08:55:42 -0800
As discussed in
http://mail-index.netbsd.org/port-macppc/2018/11/13/msg002551.html
patch is needed for both OFW1 and OFW2 machines? So how about something
like?
Summary of changes: (A/? = New, R/D = Removed, M = Modified)
=============================================================
M ofdev.c
Apply patch with "cd .../src/sys/arch/macppc/stand/ofwboot ; patch -s -p0 < .../patchfile"
Index: ofdev.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/stand/ofwboot/ofdev.c,v
retrieving revision 1.26
diff -b -u -r1.26 ofdev.c
--- ofdev.c 19 Feb 2012 12:02:55 -0000 1.26
+++ ofdev.c 13 Nov 2018 16:36:23 -0000
@@ -444,7 +444,11 @@
/* Else try APM or MBR partitions */
struct drvr_map *map = (struct drvr_map *)buf;
- if (map->sbSig == DRIVER_MAP_MAGIC)
+ /* OF1 & OF2 won't boot floppy with faked APM */
+ if (ofw_version < 3 && strncmp(devname,"fd",2) == 0)
+ error = search_dos_label(&ofdev, 0, buf,
+ &label, 0);
+ else if (map->sbSig == DRIVER_MAP_MAGIC)
error = search_mac_label(&ofdev, buf, &label);
else
error = search_dos_label(&ofdev, 0, buf,
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: scole_mail@gmx.com
Cc: gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-macppc/53727: boot floppy doesn't work for openfirmware version
1 machines?
Date: Thu, 15 Nov 2018 00:36:52 +0900
> http://mail-index.netbsd.org/port-macppc/2018/11/13/msg002551.html
> patch is needed for both OFW1 and OFW2 machines? So how about something
> like?
:
> - if (map->sbSig == DRIVER_MAP_MAGIC)
> + /* OF1 & OF2 won't boot floppy with faked APM */
> + if (ofw_version < 3 && strncmp(devname,"fd",2) == 0)
> + error = search_dos_label(&ofdev, 0, buf,
> + &label, 0);
> + else if (map->sbSig == DRIVER_MAP_MAGIC)
There are two thoughts:
- To check floppy devices, we already have is_floppyboot() in boot.c
(it can also handle the "real" device names like swim3 etc.)
- I don't think checking dos label (i.e. FDISK/MBR partition table)
against a floppy makes sense here.
(most floppies don't have MBR so it just returns ERDLAB in the MAGIC
check in search_dos_label())
Maybe we should rather check ustarfs, or just skip label checks
on floppies?
---
Izumi Tsutsui
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: scole_mail@gmx.com
Cc: gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-macppc/53727: boot floppy doesn't work for openfirmware version1
machines?
Date: Thu, 15 Nov 2018 01:26:34 +0900
> Maybe we should rather check ustarfs, or just skip label checks
> on floppies?
This patch seems working (not tested on harddisks though):
Index: ofdev.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/stand/ofwboot/ofdev.c,v
retrieving revision 1.26
diff -u -p -d -r1.26 ofdev.c
--- ofdev.c 19 Feb 2012 12:02:55 -0000 1.26
+++ ofdev.c 14 Nov 2018 16:23:20 -0000
@@ -437,10 +437,11 @@ devopen(struct open_file *of, const char
ofdev.type = OFDEV_DISK;
ofdev.bsize = DEV_BSIZE;
/* First try to find a disklabel without partitions */
- if (strategy(&ofdev, F_READ,
+ if (!floppyboot &&
+ (strategy(&ofdev, F_READ,
LABELSECTOR, DEV_BSIZE, buf, &nread) != 0
|| nread != DEV_BSIZE
- || getdisklabel(buf, &label)) {
+ || getdisklabel(buf, &label))) {
/* Else try APM or MBR partitions */
struct drvr_map *map = (struct drvr_map *)buf;
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: port-macppc/53727: boot floppy doesn't work for openfirmware version1 machines?
Date: Wed, 14 Nov 2018 08:39:13 -0800
Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> writes:
>> Maybe we should rather check ustarfs, or just skip label checks
>> on floppies?
>
> This patch seems working (not tested on harddisks though):
>
> Index: ofdev.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/macppc/stand/ofwboot/ofdev.c,v
> retrieving revision 1.26
> diff -u -p -d -r1.26 ofdev.c
> --- ofdev.c 19 Feb 2012 12:02:55 -0000 1.26
> +++ ofdev.c 14 Nov 2018 16:23:20 -0000
> @@ -437,10 +437,11 @@ devopen(struct open_file *of, const char
> ofdev.type = OFDEV_DISK;
> ofdev.bsize = DEV_BSIZE;
> /* First try to find a disklabel without partitions */
> - if (strategy(&ofdev, F_READ,
> + if (!floppyboot &&
> + (strategy(&ofdev, F_READ,
> LABELSECTOR, DEV_BSIZE, buf, &nread) != 0
> || nread != DEV_BSIZE
> - || getdisklabel(buf, &label)) {
> + || getdisklabel(buf, &label))) {
> /* Else try APM or MBR partitions */
> struct drvr_map *map = (struct drvr_map *)buf;
>
Yes, that seems like a better way to go. I don't have a working hard
disk to check with either. Do you want to commit it?
Thanks
Responsible-Changed-From-To: port-macppc-maintainer->tsutsui
Responsible-Changed-By: tsutsui@NetBSD.org
Responsible-Changed-When: Thu, 15 Nov 2018 13:34:44 +0000
Responsible-Changed-Why:
I'll test and commit a fix.
State-Changed-From-To: open->analyzed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Thu, 15 Nov 2018 13:34:44 +0000
State-Changed-Why:
As discussed.
State-Changed-From-To: analyzed->needs-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Fri, 16 Nov 2018 15:25:22 +0000
State-Changed-Why:
Fix committed:
http://mail-index.netbsd.org/source-changes/2018/11/16/msg100658.html
(sorry for a wrong commit log)
State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 18 Nov 2018 16:41:14 +0000
State-Changed-Why:
[pullup-8 #1097] [pullup-7 #1651]
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53727 CVS commit: [netbsd-8] src/sys/arch/macppc/stand/ofwboot
Date: Sun, 18 Nov 2018 19:33:44 +0000
Module Name: src
Committed By: martin
Date: Sun Nov 18 19:33:44 UTC 2018
Modified Files:
src/sys/arch/macppc/stand/ofwboot [netbsd-8]: ofdev.c version
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1097):
sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27
Fix boot failure from installation floppies. PR port-macppc/53727
Also bump version to denote a visible fix.
Should be pulled up to netbsd-8 and netbsd-7.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.32.1 src/sys/arch/macppc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.13 -r1.13.52.1 src/sys/arch/macppc/stand/ofwboot/version
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53727 CVS commit: [netbsd-7] src/sys/arch/macppc/stand/ofwboot
Date: Sun, 18 Nov 2018 19:41:38 +0000
Module Name: src
Committed By: martin
Date: Sun Nov 18 19:41:38 UTC 2018
Modified Files:
src/sys/arch/macppc/stand/ofwboot [netbsd-7]: ofdev.c version
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1651):
sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27
Fix boot failure from installation floppies. PR port-macppc/53727
Also bump version to denote a visible fix.
Should be pulled up to netbsd-8 and netbsd-7.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.14.1 src/sys/arch/macppc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.13 -r1.13.34.1 src/sys/arch/macppc/stand/ofwboot/version
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Tue, 20 Nov 2018 13:24:40 +0000
State-Changed-Why:
Pulled up.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.