Running Vax NetBSD on mipsel Ci20 creator board (via simh)

The title might be  a little misleading since we are not running NetBSD directly off the Ci20 board, but via SimH-current using the vax simulator.

There is an official guide from the NetBSD project on how to do this here http://www.netbsd.org/ports/vax/emulator-howto.html

I will just re-trace the steps and comment on the differences I have done to get the system up and running.

Prerequisites:

SimH-current from https://github.com/simh/simh

In order to build the simulator you need to apt-get a few things first

root@ci20:~# apt-get install libgles2-mesa libpcrecpp0 libsdl2-2.0-0 
libxcb-randr0 libasound2-dev libavahi-common-dev pkg-config 
libdbus-1-dev libavahi-client-dev libdrm-dev x11proto-dri2-dev 
x11proto-gl-dev x11proto-xext-dev libxext-dev x11proto-xf86vidmode-dev 
libxxf86vm-dev x11proto-fixes-dev libxfixes-dev x11proto-damage-dev 
libxdamage-dev libxcb-glx0-dev libxcb-dri2-0-dev libxcb-dri3-dev 
libxcb-render0-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev 
libxcb-sync-dev libxcb-present-dev libxshmfence-dev libx11-xcb-dev 
libwayland-dev libegl1-mesa-dev mesa-common-dev libgl1-mesa-dev 
libgles2-mesa-dev libpcre3-dev libglib2.0-dev libglu1-mesa-dev libice-dev 
libpulse-dev libudev-dev x11proto-render-dev libxrender-dev libxcursor-dev 
libxi-dev x11proto-xinerama-dev libxinerama-dev libxkbcommon-dev 
x11proto-randr-dev libxrandr-dev x11proto-scrnsaver-dev libxss-dev 
libsm-dev libxt-dev x11proto-video-dev libxv-dev libsdl2-dev libpcap-dev
bridge-utils uml-utilities

then we can build the simulator (Im using git from pkgsrc-current ( http://45.76.81.249/pkgsrc/debian8-ci20/)

root@ci20:~# git clone https://github.com/simh/simh.git
root@ci20:~# cd simh 
root@ci20:~# make vax 
root@ci20:~# ls -la /root/simh/BIN      <--- compiled vax binary here

Next we should copy the compiled vax binary to our working directory where we will keep our simulator files

Preparing for Installation:

We start first by creating the working directory and getting the latest NetBSD VAX installation image

– Update 12.03.2018 – just learned the hard way that the VAX NetBSD 7.x is has flawed GCC compiler (you wont be able to bootstrap pkgsrc)  currently working on the NetBSD-8_BETA PoC (also it is confirmed that NetBSD 6.1.5 GCC is fine)

  • Update 12.03.2018 – NetBSD-8_BETA custom GENERIC kernel needs to be built without a few options to save final size
  • With help from @kittenpies3 a following diff was used   http://coypu.sdf.org/netbsd8-vax-diff
  • But for the installation to work we need to have this enabled in the GENERIC kernel
  • -file-system	TMPFS		# Efficient memory file-system
    +#file-system	TMPFS		# Efficient memory file-system

    I have compiled a custom kernel and rebuild the vax userland for NetBSD8_BETA which you can get here http://45.76.81.249/pkgsrc/vax-simh/NetBSD-8_BETA-VAX.iso

root@ci20:~# mkdir -p /home/ci20/NetBSD
root@ci20:~# cd /home/ci20/NetBSD
root@ci20:~# wget http://45.76.81.249/pkgsrc/vax-simh/NetBSD-8_BETA-VAX.iso 
root@ci20:~# cp /root/simh/BIN/vax .

Next we need to create the dua0 disk image disk.dd , I have used 512 MB size via the following command

dd if=/dev/zero of=disk.dd bs=1024 count=512K

Next we prepate the netbsd.ini configuration file for the vax simulator

;
; Load CPU microcode
load -r /home/ci20/NetBSD/ka655x.bin
;
;
; This virtual machine has 64M memory
set cpu 128m
;
; Define disk drive types. RA92 is largest-supported VAX drive.
set rq0 ra92
set rq3 cdrom
;
; Attach defined drives to local files
attach rq0 /home/ci20/NetBSD/disk.dd
;
; Attach the CD-ROM to its file (read-only)
attach -r rq3 /home/ci20/NetBSD/NetBSD-7.1.1-vax.iso
;
; Disable unused devices. It's also possible to disable individual devices,
; using a construction like "set rq2 disable" if desired.
;
set rl disable
set ts disable
;
; Attach Ethernet to a network interface
set xq mac=08-00-2B-AA-BB-CC
attach xq tap:tap0
;
; Now start the emulator
boot cpu

Next we prepare our network script to get the networking going (This is not only specific to the Ci20 device, but can be used in other scenarios) – basically we assume your internet connection is through the wireless network interface wlan0 ; call this file networking.sh (if your network IP range matches the below, please change accordingly to another subnet)

#Setup tap and bridge 
tunctl -t tap0 -u ci20 
ifconfig tap0 up
brctl addbr br0
brctl addif br0 eth0 
brctl setfd br0 0
ifconfig eth0 10.0.2.1 up 
ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
brctl addif br0 tap0
ifconfig tap0 0.0.0.0 
sysctl net.ipv4.ip_forward=1
iptables -A FORWARD --in-interface eth0 -j ACCEPT
iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE

Copy over from the simh working directory the VAX/ka655x.bin ROM file

root@ci20:~#cp /root/simh/VAX/ka655x.bin /home/ci20/NetBSD/

Installing NetBSD:

before we load the simulator, make sure we get the network script executed

root@ci20:~#/home/ci20/NetBSD/networking.sh

Next we load the simulation

root@ci20:~#/home/ci20/NetBSD/vax netbsd.ini

In the VMB prompt boot the ISO CDROM

>>> boot dua3

Now you will get to configure NetBSD for VAX, and the installer will start copying over the sets, consider not to install X11 stuff since we are most probably not going to need it (theoretically we can through x11vnc, but the performance of the simulated system won’t be great at all)

NETWORK SETUP

In order to get the network working along the networking.sh script please use the following values for the qt0 network interface – setup network as manual – no dhcp

  • media type (none)
  • ip 10.0.2.10-10.0.2.100
  • default route 10.0.2.2
  • DNS 8.8.8.8 or 8.8.4.4

Once the installation is done (takes quite some time, be patient) we need to do one final important step,  enter a rot shell from the installation menu and mount the  /dev/ra0a somewhere and copy over the custom kernel from /netbsd to /dev/ra0a/netbsd

# mount /dev/ra0a /mnt 
# cp /netbsd /mnt
# umount /mnt 
# shutdown -p now

we can now  boot the dua0 disk from the VMB prompt.

>>> boot dua0

NetBSD should now boot; here is an example from my session; please note that it takes approximately 8 minutes to boot to the login prompt :)

>>>boot dua0
(BOOT/R5:0 DUA0

2..
-DUA0
 1..0..


>> NetBSD/vax boot [1.11] <<
>> Press any key to abort autoboot 0
nfs_open: must mount first.
open netbsd.vax: Device not configured
> boot netbsd
3101284+172988 [230096+220228]=0x38d948
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California. All rights reserved.

NetBSD 7.1.1 (GENERIC.201712222334Z)
MicroVAX 3800/3900
total memory = 127 MB
avail memory = 119 MB
kern.module.path=/stand/vax/7.1/modules
mainbus0 (root)
cpu0 at mainbus0: KA655, CVAX microcode rev 6 Firmware rev 83
lance at mainbus0 not configured
uba0 at mainbus0: Q22
dz1 at uba0 csr 160100 vec 304 ipl 17
mtc0 at uba0 csr 174500 vec 774 ipl 17
mscpbus0 at mtc0: version 5 model 3
mscpbus0: DMA burst size set to 4
uda0 at uba0 csr 172150 vec 770 ipl 17
mscpbus1 at uda0: version 3 model 3
mscpbus1: DMA burst size set to 4
qt0 at uba0 csr 174440 vec 764 ipl 17
qt0: delqa-plus in Turbo mode, hardware address 08:00:2b:aa:bb:cc
mt0 at mscpbus0 drive 0: TK50
mt1 at mscpbus0 drive 1: TK50
mt2 at mscpbus0 drive 2: TK50
mt3 at mscpbus0 drive 3: TK50
ra0 at mscpbus1 drive 0: RA92
ra1 at mscpbus1 drive 1: RD54
ra2 at mscpbus1 drive 2: RD54
racd0 at mscpbus1 drive 3: RRD40
ra0: size 2940951 sectors
ra1: attempt to bring on line failed: unit offline (not mounted) (code 3, subcode 1)
ra2: attempt to bring on line failed: unit offline (not mounted) (code 3, subcode 1)
racd0: size 1331200 sectors
boot device: ra0
root on ra0a dumps on ra0b
root file system type: ffs
Sat Mar 10 22:16:45 UTC 2018
Starting root file system check:
/dev/rra0a: file system is clean; not checking
swapctl: setting dump device to /dev/ra0b
swapctl: adding /dev/ra0b as swap device at priority 0
Starting file system checks:
Loaded entropy from /var/db/entropy-file.
Setting tty flags.
Setting sysctl variables:
ddb.onpanic: 1 -> 0
Starting network.
Hostname: netbsd
IPv6 mode: host
Configuring network interfaces: qt0.
Adding interface aliases:.
add net default: gateway 10.0.2.2
Waiting for DAD completion for statically configured addresses...
Building databases: dev, utmp, utmpx.
Starting syslogd.
Mounting all file systems...
Clearing temporary files.
Creating a.out runtime link editor directory cache.
Checking quotas: done.
Setting securelevel: kern.securelevel: 0 -> 1
swapctl: setting dump device to /dev/ra0b
Starting virecover.
Checking for core dump...
savecore: no core dump
Starting local daemons:.
Updating motd.
/etc/rc: WARNING: Ignoring non-executable file /etc/rc.d/sshd
/etc/rc: WARNING: Ignoring non-executable file /etc/rc.d/postfix
Starting inetd.
Starting cron.
Sat Mar 10 22:23:54 UTC 2018

NetBSD/vax (netbsd) (console)

login: Mar 10 22:29:06 netbsd su: user to root on /dev/pts/0


NetBSD/vax (netbsd) (console)

login: root
Password:
Mar 10 23:41:13 netbsd login: ROOT LOGIN (root) on tty console
Last login: Sat Mar 10 20:25:31 2018 on console
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California. All rights reserved.

NetBSD 7.1.1 (GENERIC.201712222334Z)

Welcome to NetBSD!

Terminal type? [unknown] vt220
Terminal type is vt220. 
We recommend that you create a non-root account and use su(1) for root access.
netbsd#

Important to note from the above, if we enable OpenSSH during installation, we will get stuck when the ssh-host keys would get generated (I had no time to wait till it finishes, so I cannot really say how log it would take)

What I did during the boot is when we get stuck on the “Updating motd ” this means that the system is loading sshd now and since there are no ssh keys present it tries to generate them, anyways it will look like it is stuck here, so we can ctrl+c to skip sshd loading and then do the same for the postfix post-installation tasks during boot.

By default NetBSD 7.1.1 will install with SHA1 password cipher, now when logging in as root for the first time, bear in mind that the process takes quite some time (SimH VAX + Ci20 mipsel). So once we are logged in, I have changed the following things to make life a little easier here:

  • Set the terminal to vt220 when logging in

Fix permanently, by modifying the $user/.profile as follows

export HOST="$(hostname)"
export TERM=vt220 
#if [ -x /usr/bin/tset ]; then
# eval $(tset -sQrm 'unknown:?unknown')
#fi

Next we should change the local password algo to speedup the login process; degrading to DES … SHA1 or Blowfish make no sense on the SIMH VAX platform.

netbsd# cat /etc/passwd.conf 

# $NetBSD: passwd.conf,v 1.3 2010/12/03 21:40:04 jmmv Exp $
#
# passwd.conf(5) -
# password configuration file
#

default:
 localcipher = old 
 ypcipher = old

Also I had to disable the sshd and postfix rc scripts from running  (chmod -x )

netbsd# ls -al /etc/rc.d/sshd 
-r--r--r-- 1 root wheel 1296 Dec 23 03:17 /etc/rc.d/sshd
netbsd# ls -al /etc/rc.d/postfix 
-r--r--r-- 1 root wheel 2270 Dec 23 03:17 /etc/rc.d/postfix
netbsd#

To get sshd running on the SimH VAX NetBSD simulation I had to generate the ssh_host keys on some other machine

  ssh-keygen -f ./ssh_host_rsa_key -N '' -t rsa
  ssh-keygen -f ./ssh_host_dsa_key -N '' -t dsa
  ssh-keygen -f ./ssh_host_ecdsa_key -N '' -t ecdsa
  ssh-keygen -f ./ssh_host_ecdsa_key -N '' -t ed25519
  ssh-keygen -f ./ssh_host_ed25519_key -N '' -t ed25519

And copy paste the contents to the simulated VAX NetBSD into /etc/ssh/

drwxr-xr-x 2 root wheel 512 Mar 10 20:08 .
drwxr-xr-x 27 root wheel 2048 Mar 11 00:04 ..
-r--r--r-- 1 root wheel 1780 Dec 23 03:17 ssh_config
-rw------- 1 root wheel 672 Mar 10 20:22 ssh_host_dsa_key
-rw-r--r-- 1 root wheel 604 Mar 10 20:23 ssh_host_dsa_key.pub
-rw------- 1 root wheel 227 Mar 10 20:07 ssh_host_ecdsa_key
-rw-r--r-- 1 root wheel 176 Mar 10 20:06 ssh_host_ecdsa_key.pub
-rw------- 1 root wheel 411 Mar 10 20:08 ssh_host_ed25519_key
-rw-r--r-- 1 root wheel 96 Mar 10 20:08 ssh_host_ed25519_key.pub
-rw------- 1 root wheel 1681 Mar 10 20:25 ssh_host_rsa_key
-rw-r--r-- 1 root wheel 396 Mar 10 20:25 ssh_host_rsa_key.pub
-r--r--r-- 1 root wheel 10263 Dec 23 03:17 ssh_known_hosts
-r--r--r-- 1 root wheel 3739 Dec 23 03:17 sshd_config

And added a dummy sshd loader into the /etc/rc.local

echo -n 'Starting local daemons:'
/usr/sbin/sshd

Either load sshd directly or reboot, connecting to the VAX NetBSD should work (again be patient, ssh connection takes some time to run)

So we are pretty much done for the basic part. Feel free to explore what NetBSD has to offer on the VAX platform – you have many tools at your disposal

GCC for example

netbsd# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: vax--netbsdelf
Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=vax--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/vax/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/vax/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/vax/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/vax --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=vax--netbsdelf --with-sysroot=/var/obj/mknative/vax/usr/7/src/destdir.vax
Thread model: posix
gcc version 4.8.5 (nb2 20150115)

Plus I wonder how much hardcore would be to bootstrap pkgsrc on the simulated VAX NetBSD on the Ci20 creator board :) Might be worth a try and some few weeks for automated retro fun.

 

About astr0baby

Please run Adblock or similar... we have been told to do so since Carl Sagan wrote the Contact .
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.