NetBSD Problem Report #55380

From tsutsui@ceres.dti.ne.jp  Fri Jun 12 18:21:05 2020
Return-Path: <tsutsui@ceres.dti.ne.jp>
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 A3E221A9219
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 12 Jun 2020 18:21:05 +0000 (UTC)
Message-Id: <202006121820.05CIKvSb003456@ceres.dti.ne.jp>
Date: Sat, 13 Jun 2020 03:20:57 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: sysinst/Makefile.inc has confusing MBR and GPT defaults
X-Send-Pr-Version: 3.95

>Number:         55380
>Category:       install
>Synopsis:       sysinst/Makefile.inc has confusing MBR and GPT defaults
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 12 18:25:00 +0000 2020
>Last-Modified:  Sat Jun 13 15:25:02 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0
>Organization:
>Environment:
System: all
Architecture: all
Machine: all
>Description:
MBR and GPT supports are enabled by "NO_MBR" and "NO_GPT" macro
in src/usr.sbin/sysinst/arch/*/Makefile.

However there is inconsistency the default values:
---
.if ${NO_GPT:Uno} != "yes"
CPPFLAGS+=	-DHAVE_GPT
GPT_DIR=${.CURDIR}/../../../../sbin/gpt
SRCS+=	gpt.c gpt_uuid.c
CPPFLAGS.gpt_uuid.c+=	-I${GPT_DIR}
CPPFLAGS.gpt.c+=	-I${GPT_DIR}
.endif
.if ${NO_MBR:Uyes} != "yes"
CPPFLAGS+=	-DHAVE_MBR
SRCS+=	mbr.c
.endif
---

For MBR, "NO_MBR=yes" is default, so ports which require MBR
should set "NO_MBR=no" in MD Makefiles.

For GPT, NO_GPT=no is default, so ports which "do not" require GPT
should set "NO_MBR=yes" in MD Makefiles.

On most ports don't define "NO_GPT=yes" in MD Makefiles
so unnecessary GPT support is pulled into sysinst on many ports.

>How-To-Repeat:
Code inspection.

>Fix:
For GPT, it's better to use positive "HAVE_GPT=yes" macro
and make its default to "no"?

For MBR, it's much easier to check "LABELUSESMBR" macro in
<machine/disklabel.h>?

No idea about "NO_CLONE" macro (I don't know what it means).

---
Izumi Tsutsui

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/55380: sysinst/Makefile.inc has confusing MBR and GPT
 defaults
Date: Sat, 13 Jun 2020 17:24:28 +0200

 On Fri, Jun 12, 2020 at 06:25:01PM +0000, Izumi Tsutsui wrote:
 > For GPT, it's better to use positive "HAVE_GPT=yes" macro
 > and make its default to "no"?

 Yes for the former, but the default should be to support GPT everwhere,
 even if it can not be used for boot disks.

 > For MBR, it's much easier to check "LABELUSESMBR" macro in
 > <machine/disklabel.h>?

 Interesting idea, I'll check.

 > No idea about "NO_CLONE" macro (I don't know what it means).

 The "clone" functionality is usefull for exceptional cases like when cloning
 a mac "driver partition" or AmigaOS boot parts from one disk to another.
 It takes some space though, so for installers with tight space requirements
 is disabeled via NO_CLONE.

 Martin

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.