NetBSD Problem Report #48905

From www@NetBSD.org  Sat Jun 14 02:13:49 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B7538A653F
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Jun 2014 02:13:49 +0000 (UTC)
Message-Id: <20140614021348.2654BA6555@mollari.NetBSD.org>
Date: Sat, 14 Jun 2014 02:13:48 +0000 (UTC)
From: nullvibe.pkgsrc@mailinator.com
Reply-To: nullvibe.pkgsrc@mailinator.com
To: gnats-bugs@NetBSD.org
Subject: MACHINE_ARCH fails to be passed to all commands during bootstrap on linux/mipseb
X-Send-Pr-Version: www-1.0

>Number:         48905
>Category:       pkg
>Synopsis:       MACHINE_ARCH fails to be passed to all commands during bootstrap on linux/mipseb
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    maya
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 14 02:15:00 +0000 2014
>Closed-Date:    Sun Oct 30 22:23:20 +0000 2016
>Last-Modified:  Sun Oct 30 22:23:20 +0000 2016
>Originator:     nullvibe
>Release:        pkgsrc/CVS 05-21-2014
>Organization:
>Environment:
Linux debian-mips 3.2.0-4-4kc-malta #1 Debian 3.2.51-1 mips GNU/Linux
>Description:
bootstrap's build_package()'s bmake command is missing a MACHINE_ARCH=, which along with 'uname -m' responding as 'mips' instead of 'mipseb' on linux has been causing bootstrap to fail.

This issue probably doesn't affect little-endian MIPS devices since linux refers to those as 'mipsel' just as pkgsrc does.

It should be noted however that the supplied patch ONLY fixes this for 32 bit, big-endian MIPS devices. big-endian MIPS64 devices will run into the same problem, as might builds on certain ARM devices
>How-To-Repeat:
Grab the 3.2.0 kernel and Debian Wheezy image from here:

http://people.debian.org/~aurel32/qemu/mips/

Drop them in a directory, and run it via qemu with a command like:

qemu-system-mips -m 256 -M malta \
-kernel vmlinux-3.2.0-4-4kc-malta \
-hda debian_wheezy_mips_standard.qcow2 \
-append "root=/dev/sda1 console=tty0 console=ttyS0,115200n8" \
-netdev tap,id=mainnet -device pcnet,netdev=mainnet \
-chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0 \
-chardev socket,id=charmonitor,path=/tmp/mips.monitor,server,nowait \
-vnc 0.0.0.0:30

For networking functionality, a nic attached to a network card needs to be a member of a bridge, and the tap interface created by qemu-system-mips also needs to be added to it. You're on your own for creating the bridge interface since it varies by distro, but the lazy way to automatically add the tap interface to it when qemu starts up is to drop some lines into an /etc/qemu-ifup script along the lines of:

#!/bin/bash

ifconfig $1 up
brctl addif br0 $1

exit 0


From there, you might have to install build-essentials, cvs, and other pre-requisites, but it should be mostly business as usual as far as getting to this failure point from there.
>Fix:
The fix involves adding MACHINE_ARCH=$machine_arch to the list of bmake arguments in build_package(), as well as adding "-e 's/mips$/mipseb/'" to the machine_arch= line under the Linux section.

The following patch does both:

--- bootstrap.orig	2014-06-13 20:57:59.314923360 +0000
+++ bootstrap	2014-06-14 00:20:04.233999467 +0000
@@ -680,7 +680,7 @@
 	fi
 	need_sed=no
 	set_opsys=no
-	machine_arch=`uname -m | sed -e 's/i.86/i386/'`
+	machine_arch=`uname -m | sed -e 's/i.86/i386/' -e 's/mips$/mipseb/'`
 	# Support multiarch systems.
 	if [ "$machine_arch" = "x86_64" -a "$abi" = "32" ]; then
 		machine_arch=i386
@@ -1214,7 +1214,7 @@
 # build and register packages
 # usage: build_package <packagedirectory> [additional arguments]
 build_package() {
-	run_cmd "(cd $pkgsrcdir/$1 && $bmake USE_DESTDIR=no -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)"
+	run_cmd "(cd $pkgsrcdir/$1 && $bmake MACHINE_ARCH=$machine_arch USE_DESTDIR=no -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)"
 }

 #

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-mips-maintainer->pkg-manager
Responsible-Changed-By: asau@NetBSD.org
Responsible-Changed-When: Sat, 14 Jun 2014 18:13:00 +0000
Responsible-Changed-Why:
Problem in pkgsrc.


From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/48905 (MACHINE_ARCH fails to be passed to all commands
 during bootstrap on linux/mipseb)
Date: Sat, 14 Jun 2014 21:08:35 +0200

 Should this be merged with PR/48906?
  Thomas

From: Aleksej Saushev <asau@inbox.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/48905 (MACHINE_ARCH fails to be passed to all commands during bootstrap on linux/mipseb)
Date: Sun, 15 Jun 2014 00:17:39 +0400

 Thomas Klausner <wiz@NetBSD.org> writes:

 >  Should this be merged with PR/48906?

 That PR has broader scope.
 This PR is about practical problem of bootstrapping on some linux-based system.

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/48905 (MACHINE_ARCH fails to be passed to all commands
 during bootstrap on linux/mipseb)
Date: Mon, 16 Jun 2014 03:52:25 +0000

 On Sat, Jun 14, 2014 at 07:10:05PM +0000, Thomas Klausner wrote:
  >  Should this be merged with PR/48906?

 No; the idea was to commit this fix before the freeze, and then rework
 the script afterwards along the lines of 48906, but it looks like we
 didn't make it in time. :-|

 -- 
 David A. Holland
 dholland@netbsd.org

Responsible-Changed-From-To: pkg-manager->maya
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Sun, 30 Oct 2016 22:23:20 +0000
Responsible-Changed-Why:
I have such hardware


State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 30 Oct 2016 22:23:20 +0000
State-Changed-Why:
I can confirm bootstrap works fine on a franken-debian
squeeze (EdgeOS) on big endian mips. let me know if
you still have different issues.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.