;======================================================
; SEL32 System Engineering Labs 32 bit computer
; UTX - Ver 2.1B hardware configuration
; CPU - V6 8M Sel32 Powernode
; MFP - 7e00 Model 8002 Multi-Function Processor
; SBA - 7e00/7e08 MFP SCSI Disk controller
;            sba0 Model 8821 300MB
;            sba0 <-> dsk/scsidiska0
;            sba1 Model 8821 300MB
;            sba1 <-> dsk/scsidiska1
; LPR - 7ef8/7ef9 Model 924X High Speed Line Printer
; COM - 7ee0 8512 8-line async communications
; CON - 7efc/7efd Console Terminal
; RTC - 7f06 50 HZ Real-Time clock
; ITM - 7f04 38.4MS Interval timer
; MT  - 1000 8051 Buffered Tape Processor
;            mta0 <- tapes/utx21b1.tap
; EC  - 0e00 Model 8516 Ethernet
;======================================================
; Set hostname
set env HOST=sel32
; Set local IP address
;set env IP=192.168.0.20
set env IP=192.168.1.5
;======================================================
; Set debug output
;set debug -n sel.log
;set debug stderr
;
; Set directory for disk images
mkdir dsk
mkdir tapes
; Set tape image filename
set env FILE1=utx21b1.tap
if exist "tapes/%FILE1%" goto exists1
; Set github.com URL for downloading files
set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/
if not exist "tapes/%FILE1%" echof "file %FILE1% missing, trying %FILE1%.tgz"
cd tapes
if exist "%FILE1%.tgz" goto nocurl1
echof "fetching %FILE1%.tgz file from github.com\n"
curl -LJO %GITURL%/%FILE1%.tgz
if not exist "%FILE1%.tgz" echof "FAILED - file %FILE1% not available"; exit 1
:nocurl1
echof "untar %FILE1%.tgz file\n"
tar -xzf %FILE1%.tgz
cd ..
:exists1
echof "file %FILE1% present, doing install"
;
; Set tape image filename
set env FILE2=utx21b2.tap
if exist "tapes/%FILE2%" goto exists2
if not exist "tapes/%FILE2%" echof "file %FILE2% missing, trying %FILE2%.tgz"
cd tapes
if exist "%FILE2%.tgz" goto nocurl2
echof "fetching %FILE2%.tgz file from github.com\n"
curl -LJO %GITURL%/%FILE2%.tgz
if not exist "%FILE2%.tgz" echof "FAILED - file %FILE2% not available"; exit 1
:nocurl2
echof "untar %FILE2%.tgz file\n"
tar -xzf %FILE2%.tgz
cd ..
:exists2
echof "file %FILE2% present, doing install"
;
; Set tape image filename
set env FILE3=utx21b3.tap
if exist "tapes/%FILE3%" goto exists3
if not exist "tapes/%FILE3%" echof "file %FILE% missing, trying %FILE%.tgz"
cd tapes
if exist "%FILE3%.tgz" goto nocurl3
echof "fetching %FILE3%.tgz file from github.com\n"
curl -LJO %GITURL%/%FILE3%.tgz
if not exist "%FILE3%.tgz" echof "FAILED - file %FILE% not available"; exit 1
:nocurl3
echof "untar %FILE3%.tgz file\n"
tar -xzf %FILE3%.tgz
cd ..
:exists3
echof "file %FILE3% present, doing install"
;
; CPU type and memory
;set CPU 32/97 4M
;set CPU V6 4M
set CPU V6 8M
;set CPU V9 4M
;set CPU V9 8M
;
; CPU debug options
;set cpu debug=cmd;exp;inst;detail;trap;xio;irq
; Set instruction trace history size
;set cpu history=10000
; useful options
;set cpu debug=exp;irq;xio;trap;cmd
;;set cpu debug=cmd;exp;irq;trap;xio
;set cpu debug=cmd;irq;trap;exp
;;set cpu debug=irq;trap;exp;xio
;set cpu debug=irq;xio
;
; RTC realtime clock
set RTC enable
; address is 7f06
set RTC 50
;set RTC 60
; RTC debug options
;set RTC debug=cmd
;
; ITM interval timer
; address is 7f04
; set itm 3840
;set ITM debug=cmd
;
; IOP at channel 7e00
; useful options
;set iop debug=cmd;exp
;set iop debug=cmd
; make iop online
;set iop enable
; set iop channel address
;set iop0 dev=7e00
;
; MFP at channel 7e00
; useful options
;set mfp debug=cmd;exp
; make mfp online
set mfp enable
; set mfp channel address
set mfp0 dev=7e00
;set mfp0 dev=7600
;
; EC at channel 0e00
; useful options
;set ec debug=cmd;exp
; set the mode
set EC mode=1
; make ec online
set ec enable
; set ec channel address
set ec0 dev=0e00
at ec tap:tap0
;
; COM 8-Line
;set com debug=cmd;
;set coml0 enable
;set coml1 enable
;set coml2 enable
;set coml3 enable
;set coml4 enable
;set coml5 enable
;set coml6 enable
;set coml7 enable
;
; Enable telnet sessions on port 4747
;set comc enable
;at comc 4747
;
; LPR
;set lpr debug=cmd;detail
;set lpr enable
set lpr enable
; LPR output file
;at lpr lprout
at lpr lprout
;
; CON Console
; useful options
;set con debug=cmd;exp;detail
;set con debug=cmd;exp;
; enable console
set con enable
; set console address
; set con0 enable
set con0 dev=7efc
; set con1 enable
set con1 dev=7efd
;
; MTA Buffered tape processor
;set mta debug=cmd;exp;detail;data
; useful options
;set mta debug=cmd;detail;exp
;
; enable the MTA to change channel
set mta enable
; set mt channel
set mta0 dev=1000
; attach in/out tape files
;at mta0 mpxsdt.tap
;at mta0 nbctape.tap
set mta0 locked
at mta0 tapes/utx21b1.tap
;at mta0 utx21a1.tap
;at mta1 temptape.tap
;at mta1 utx21a2.tap
;at mta2 output.tap
;at mta0 sim32sdt.tap
;at mta0 diag.tap
;
; DMA disk processor II/UDP
;set dma enable
; set disk chan to 0800
;set dma0 dev=800
; set disk type to MPX MH300
;set dma0 type=MH300
; set disk type to UTX 9346
;set dma0 type=9346
;set dma0 type=8155
;set dma0 type=8887
;set dma0 type=8148
; Attach diskfile
;at dma0 utx0disk
;at dma0 utx1disk
;at dma0 sim32disk
;at dma0 diagdisk
;
;set dma debug=cmd;exp;detail;data
; useful options
;set dma debug=cmd;exp
;set dma debug=exp;cmd;detail
;
; SDA SCFI disk processor
;set sda debug=cmd;exp;data;detail
; Attach diskfiles
;at sda0 scsidisk0
;at sda1 scsidisk1
;
; SBA MFP SCSI bus 1 disk processor
set sba enable
; set disk chan to 7600
;set sba0 dev=7600
set sba0 dev=7e00
;set sba1 dev=7e08
; set disk type to MPX MH300
set sba0 type=8821
set sba1 type=8821
;set sba0 type=SD300
;set sba0 type=SD150
;set sba0 type=8820
;set sba debug=cmd;exp;data;detail
;set sba debug=cmd;exp;detail
; Attach diskfiles
at sba0 -i dsk/scsidiska0
at sba1 -i dsk/scsidiska1
;
; SBB MFP SCSI bus 2 disk processor
;;set sbb enable
; set disk chan to 7640
;set sbb0 dev=7640
;;set sbb0 dev=7e40
; set disk type to MPX MH300
;set sbb0 type=SD300
;set sbb0 type=8821
;;set sbb0 type=SD150
;set sbb0 type=8820
;set sbb debug=cmd;exp;data;detail
;;set sbb debug=cmd;exp;detail
; Attach diskfiles
;;at sbb0 scsidiskb0
;at sbb1 scsi1disk
;
; DPA high speed disk processor
; enable the HSDP to change channel
;set dpa enable
; set channel addr
;set dpa0 dev=800
; set disk type to UTX 8887
;set dpa0 type=8887
; Attach diskfiles
;at dpa0 utxdsk.dsk
;at dpa0 utx0hsdp
;at dpa1 utx1hsdp
;
;set dpa debug=cmd;detail;exp
; useful options
;set dpa debug=cmd;exp;detail
;
; set console switches
deposit CSW 0
;
;UTX boot tape options
;set GPR 7 to 0x00 to boot in multi-user mode
;set GPR 7 to 0x01 to prompt for unix filename
;set GPR 7 to 0x02 to boot in single user mode
;set GPR 7 to 0x10 to disable swapping and paging
;set GPR 7 to 0x20 to boot from device specified in GPR6
;set GPR 7 to 0x40 to allow progress messages on boot
;deposit BOOTR[7] 40
;deposit BOOTR[7] 52
deposit BOOTR[7] 42
;deposit BOOTR[7] 2
;deposit BOOTR[6] 800
;deposit BOOTR[0] ffffffff
;
; Set register content at boot for SEL diagnostics
; uncomment next line to get diag loader prompt
;deposit bootr[0] ffffffff
;deposit bootr[1] 0
;deposit bootr[2] 0
;
; do not allow cpu to idle
; works around a reboot issue with UTX
; if allowed, installation will hang checking root file system
set cpu noidle
;
expect "#" continue
expect "#" send "prep /dev/rsd0a\r"; continue
expect "Ready to prep /dev/rsd0a" send "yes\r"; continue
expect "Which option ?" send "2\r"; continue
expect "Please select a drive type:" send "7\r"; continue
expect "#" continue
expect "#" continue
expect "#" continue
expect "Do you really want to do this <no>?" send "yes\r"; continue
expect "Which option ?" send "0\r"; continue
;
expect "#" continue
expect "#" continue
expect "#" send "prep /dev/rsd1a\r"; continue
expect "Which option ?" send "2\r"; continue
expect "Please select a drive type:" send "7\r"; continue
expect "#" continue
expect "#" continue
expect "#" continue
expect "Do you really want to do this <no>?" send "yes\r"; continue
expect "Ready to prep /dev/rsd1a" send "yes\r"; continue
expect "Which option ?" send "0\r"; continue
expect "#" continue
expect "#" continue
expect "#" send "newfs /dev/sd0a\r"; continue
expect "#" continue
expect "#" send "newfs /dev/sd0d\r"; continue
expect "#" continue
expect "#" send "newfs /dev/sd0e\r"; continue
expect "#" continue
expect "#" send "mount /dev/sd0a /mnt\r"; continue
expect "#" send "cd /mnt\r"; continue
expect "#" send "restore r\r"; continue
expect "#" send 'bin/echo "/dev/sd0a / 4.3 rw,noquota 1 1" >etc/fstab\r'; continue
expect "#" send 'bin/echo "#/dev/sd0b is the default swap partition" >>etc/fstab\r'; continue
expect "#" send 'bin/echo "/dev/sd0d /usr.POWERNODE 4.3 rw,noquota 1 2" >>etc/fstab\r'; continue
expect "#" send "cd /\r"; continue
expect "#" send "umount /dev/sd0a\r"; continue
expect "#" send "halt\r"; continue
;expect "#" send "/mnt/etc/reboot\r"; continue
; Boot from mag tape
bo mta0
; Set expect script to load UTX 2.1B
deposit BOOTR[7] 2
at mta0 tapes/utx21b2.tap
;set sba debug=cmd;exp;data;detail
;
expect "#" continue
expect "#" send "mount /dev/sd0d /usr.POWERNODE\r"; continue
expect "#" send "rm /restoresymtable\r"; continue
expect "#" send "cd /usr.POWERNODE\r"; continue
;expect "#" send "mkdir src\r"; continue
expect "#" send "restore rf /dev/rmt0\r"; continue
expect "then enter tape name (default: /dev/rmt0)" at mta0 tapes/utx21b3.tap; send "\r"; continue
expect "#" send "rm /usr.POWERNODE/restoresymtable\r"; continue
expect "#" send "cd /\r"; continue
expect "#" send "/ranlib.sh\r"; continue
;expect "#" send 'echo "/dev/sd0d /usr.POWERNODE 4.3 rw,noquota 1 2" >>/etc/fstab\r'; continue
expect "#" send 'echo "/dev/sd0e /usr.POWERNODE/src 4.3 rw,noquota 1 3" >>/etc/fstab\r'; continue
expect "echo" continue
;expect "#" send "mount /dev/sd0e /usr.POWERNODE/src\r"; at mta0 tapes/utx21b_src.tap; continue
;expect "#" send "cd /usr.POWERNODE/src\r"; continue
;expect "#" send "tar xf /dev/rmt0\r"; continue
expect "#" send "ed /etc/rc.boot\r"; continue
expect "1522" send "/preen/\r"; continue
expect "#" send "s/#/ /\r.+1\r"; continue
expect "#" continue
expect "echo" send "d\r"; 'expect "\r\n" send "/noname/\r"; continue' ; continue
expect "/bin/hostname noname" send "s/noname/%HOST%/\rw\rq\r"; continue
expect "#" send "ed /etc/hosts\r"; continue
expect "128" send "/sysname/\r"; continue
expect "sysname" continue
expect "sysname" send "d\r"; 'expect "\r\n" send "i\r%IP%    %HOST%\r.\rw\rq\r"; continue'; continue
expect "#" send "ed /etc/rc.local\r" ; continue
expect "3849" send "/echo 'Setup/\r"; continue
expect "#" send "s/# //\r"; 'expect "\r\n" send "/en0 inet/\r"; continue' ; continue
expect "#" continue
expect "#" send "s/# //\r"; 'expect "\r\n" send "w\rq\r"; continue'; continue
expect "#" continue
expect "#" send "newfs /dev/sd1c\r"; continue
expect "#" continue
expect "#" send "mkdir /home\r"; continue
expect "#" send 'echo "/dev/sd1c /home 4.3 rw,noquota 2 1" >>/etc/fstab\r'; continue
expect "echo" continue
expect "#" send "mount /dev/sd1c /home\r"; continue
expect "#" send "df\r"; continue
expect "#" send 'bin/echo "stty intr \003" >>/.profile\r'; continue
expect "#" send 'bin/echo "Run runscsi21b.ini to run installed UTX 21b"\r'; continue
;expect "#" send "reboot\r"; continue
expect "#" send "halt\r"; continue
expect "sim>" send "q\r"; continue
;Boot from disk sba0
bo sba0
;stop simh execution
quit
