NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-mips/48905: MACHINE_ARCH fails to be passed to all commands during bootstrap on linux/mipseb

>Number:         48905
>Category:       port-mips
>Synopsis:       MACHINE_ARCH fails to be passed to all commands during 
>bootstrap on linux/mipseb
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 14 02:15:00 +0000 2014
>Originator:     nullvibe
>Release:        pkgsrc/CVS 05-21-2014
Linux debian-mips 3.2.0-4-4kc-malta #1 Debian 3.2.51-1 mips GNU/Linux
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
Grab the 3.2.0 kernel and Debian Wheezy image from here:

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 \

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:


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.
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 @@
-       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
@@ -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 
+       run_cmd "(cd $pkgsrcdir/$1 && $bmake MACHINE_ARCH=$machine_arch 

Home | Main Index | Thread Index | Old Index