Friday, September 2, 2016

Catching up

Hi, folks!

The last few months have been mostly a matter of making some small, steady progress. This blog is intended as my reference notes, so here's the notes:

1)
The tap stuff I wrote about seems to mostly be irrelevent. After adding a script[1] to /etc, when using qemu I'm able to just do:

-net nic -net tap

And the tap interface "just works".

Simh/vax seems to work too -somewhat. Still ironing that out.

2)
Qemu has the -saveconfig and -readconfig options. They save a hell of a lot of typing!

3)
I saved the following off of the debian/sparc page for the sake of reference:

As mentioned earlier, the Debian SPARC64 port only supports 64 bit SPARC processors which correspond to the following sun4 architectures / processors.

    sun4u
        SPARC64 VI
        SPARC64 VII
        SPARC64 VII+
        UltraSPARC I
        UltraSPARC II
        UltraSPARC III
        UltraSPARC IV
    sun4u1
        UltraSPARC II
    sun4us
        SPARC64V
        SPARC64V+
    sun4v
        SPARC T3
        SPARC T4
        SPARC T5
        SPARC T7
        SPARC64 X
        SPARC64 X+
        UltraSPARC T1
        UltraSPARC T2
        UltraSPARC T2+

The Debian SPARC64 port is stable on most machines using these architectures / processors, but not all of them. Kernel support for the hardware found in these machines is the biggest factor in whether a particular machine is supported or not.
That's really about it. PCem has made great progress, but because reasons I haven't played with it much.  Neozeed has compiled a version with networking for the latest version ...it doens't compile on Linux, and using it on wine is flaky.

I guess it's simh/qemu/virtualbox for now!

[1](/etc/qemu-ifup):
 #!/bin/sh
#
# Copyright IBM, Corp. 2010 
#
# Authors:
#  Anthony Liguori
#
# This work is licensed under the terms of the GNU GPL, version 2.  See
# the COPYING file in the top-level directory.

# Set to the name of your bridge
BRIDGE=br0

# Network information
NETWORK=192.168.53.0
NETMASK=255.255.255.0
GATEWAY=192.168.53.1
DHCPRANGE=192.168.53.2,192.168.53.254

# Optionally parameters to enable PXE support
TFTPROOT=
BOOTP=

do_brctl() {
    brctl "$@"
}

do_ifconfig() {
    ifconfig "$@"
}

do_dd() {
    dd "$@"
}

do_iptables_restore() {
    iptables-restore "$@"
}

do_dnsmasq() {
    dnsmasq "$@"
}

check_bridge() {
    if do_brctl show | grep "^$1" > /dev/null 2> /dev/null; then
    return 1
    else
    return 0
    fi
}

create_bridge() {
    do_brctl addbr "$1"
    do_brctl stp "$1" off
    do_brctl setfd "$1" 0
    do_ifconfig "$1" "$GATEWAY" netmask "$NETMASK" up
}

enable_ip_forward() {
    echo 1 | do_dd of=/proc/sys/net/ipv4/ip_forward > /dev/null
}

add_filter_rules() {
do_iptables_restore <# Generated by iptables-save v1.3.6 on Fri Aug 24 15:20:25 2007
*nat
:PREROUTING ACCEPT [61:9671]
:POSTROUTING ACCEPT [121:7499]
:OUTPUT ACCEPT [132:8691]
-A POSTROUTING -s $NETWORK/$NETMASK -j MASQUERADE
COMMIT
# Completed on Fri Aug 24 15:20:25 2007
# Generated by iptables-save v1.3.6 on Fri Aug 24 15:20:25 2007
*filter
:INPUT ACCEPT [1453:976046]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1605:194911]
-A INPUT -i $BRIDGE -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i $BRIDGE -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i $BRIDGE -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i $BRIDGE -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -i $1 -o $1 -j ACCEPT
-A FORWARD -s $NETWORK/$NETMASK -i $BRIDGE -j ACCEPT
-A FORWARD -d $NETWORK/$NETMASK -o $BRIDGE -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o $BRIDGE -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i $BRIDGE -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Fri Aug 24 15:20:25 2007
EOF
}

start_dnsmasq() {
    do_dnsmasq \
    --strict-order \
    --except-interface=lo \
    --interface=$BRIDGE \
    --listen-address=$GATEWAY \
    --bind-interfaces \
    --dhcp-range=$DHCPRANGE \
    --conf-file="" \
    --pid-file=/var/run/qemu-dnsmasq-$BRIDGE.pid \
    --dhcp-leasefile=/var/run/qemu-dnsmasq-$BRIDGE.leases \
    --dhcp-no-override \
    ${TFTPROOT:+"--enable-tftp"} \
    ${TFTPROOT:+"--tftp-root=$TFTPROOT"} \
    ${BOOTP:+"--dhcp-boot=$BOOTP"}
}

setup_bridge_nat() {
    if check_bridge "$1" ; then
    create_bridge "$1"
    enable_ip_forward
    add_filter_rules "$1"
    start_dnsmasq "$1"
    fi
}

setup_bridge_vlan() {
    if check_bridge "$1" ; then
    create_bridge "$1"
    start_dnsmasq "$1"
    fi
}

setup_bridge_nat "$BRIDGE"

if test "$1" ; then
    do_ifconfig "$1" 0.0.0.0 up
    do_brctl addif "$BRIDGE" "$1"
fi

No comments:

automating zfs mounts -a quick and very dirty script

 #!/bin/sh for x in obj xsrc src pkgsrc pkgsrc/distfiles pkgsrc/packages pkg         do zfs create ext/$x zfs set mountpoint=/usr/$x ext/$x ...