NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-arm/54640: Wrong RAW_PART in MAKEDEV(8) for hpcarm and zaurus
>Number: 54640
>Category: port-arm
>Synopsis: Wrong RAW_PART in MAKEDEV(8) for hpcarm and zaurus
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: port-arm-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 22 13:15:01 +0000 2019
>Originator: Izumi Tsutsui
>Release: NetBSD 8.1
>Organization:
>Environment:
System: NetBSD (GENERIC)
Architecture: arm
Machine: zaurus, hpcarm
>Description:
On NetBSD/hpcarm and NetBSD/zaurus, RAW_PART is 3 by historical reasons,
unlike other arm ports as evbarm and acorn32 etc.
However it looks MAKEDEV(8) scripts in etc.tgz from NetBSD/hpcarm 8.1
and NetBSD/zaurus 8.1 have incorrect RAW_PART number (2, not 3).
Then all disk device nodes without partition suffix have wrong minor,
so all commands that use opendisk(3) (like disklabel(8) and fdisk(8))
fail to open the raw device if disk name without /dev path is passed.
>How-To-Repeat:
disklabel(8) or fdisk(8) on NetBSD/zaurus 8.1:
---
# fdisk ld0
fdisk: cannot opendisk /dev/rld0: Device not configured
# disklabel ld0
disklabel: /dev/rld0: Device not configured
# disklabel /dev/rld0d
# /dev/rld0d:
type: ESDI
:
---
MAKEDEV(8) in etc.tgz:
% ftp -o - http://cdn.netbsd.org/pub/NetBSD/NetBSD-8.1/zaurus/binary/sets/etc.tgz | tar -zxvf - ./dev/MAKEDEV
./dev/MAKEDEV
tar: ustar vol 1, 316 files, 4290560 bytes read, 0 bytes written in 1 secs (4290560 bytes/sec)
% grep -h -A 5 ro= dev/MAKEDEV
ro=2
mkdev ${name}${unit} b $blk $(($unit * 8 + $ro)) 640 $g_operator
mkdev r${name}${unit} c $chr $(($unit * 8 + $ro)) 640 $g_operator
mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator
mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator
--
ro=2
mkdev ${name}${unit} b $blk $(($unit * 8 + $ro)) 640 $g_operator
mkdev r${name}${unit} c $chr $(($unit * 8 + $ro)) 640 $g_operator
mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator
mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator
--
ro=2
mkdev ${name}${unit} b $blk $(($unit * 16 + $ro)) 640 $g_operator
mkdev r${name}${unit} c $chr $(($unit * 16 + $ro)) 640 $g_operator
mkdev ${name}${unit}a b $blk $(($unit * 16 + 0)) 640 $g_operator
mkdev ${name}${unit}b b $blk $(($unit * 16 + 1)) 640 $g_operator
--
ro=2
mkdev ${name}${unit} b $blk $(($unit * 8 + $ro)) 640 $g_operator
mkdev r${name}${unit} c $chr $(($unit * 8 + $ro)) 640 $g_operator
mkdev ${name}${unit}a b $blk $(($unit * 8 + 0)) 640 $g_operator
mkdev ${name}${unit}b b $blk $(($unit * 8 + 1)) 640 $g_operator
--
ro=2
rn=c
mkdev ${name}${unit} b $blk $(($unit * $doff + $ro)) 640 $g_operator
mkdev r${name}${unit} c $chr $(($unit * $doff + $ro)) 640 $g_operator
%
>Fix:
I'm not sure how each etc.tgz for arm is built,
but check src/etc/MAKEDEV.awk and src/etc/MAKEDEV.tmpl?
https://nxr.netbsd.org/xref/src/etc/MAKEDEV.awk?r=1.25#126
---
126 while (1) {
127 inc = top "arch/" incdir "/include/disklabel.h"
128 if (system("test -f '" inc "'") != 0) {
129 print "ERROR: can't find kernel include file '" inc "'" > "/dev/stderr"
130 exit 1
131 }
132 incdir = 0
133 while (getline < inc) {
134 if ($1 == "#define" && $2 == "MAXPARTITIONS")
135 diskpartitions = $3
136 else if ($1 == "#define" && $2 == "OLDMAXPARTITIONS")
137 diskbackcompat = $3
138 else if ($1 == "#define" && $2 == "RAW_PART")
139 RAWDISK_OFF = $3
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index