shithub: riscv

Download patch

ref: 4354c401c17953b910c0c5acd7e661b6740b4973
parent: 780c5dfd1a0e26d6f6320284529d87ecc11650a7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Apr 12 17:30:28 EDT 2018

cpurc: remove obsolete device binds, run diskparts after $sysname is known. remove /env/boottime. document.

--- a/rc/bin/cpurc
+++ b/rc/bin/cpurc
@@ -1,10 +1,13 @@
 #!/bin/rc
 # this file is run if service=cpu
 
-date > /env/boottime
+# parallelism for mk
+NPROC=`{wc -l </dev/sysstat}
 
-for(i in m i P S t u '$')
+# bind all likely devices
+for(i in t S P '$')
 	bind -a '#'^$i /dev >/dev/null >[2=1]
+rm -f /env/i
 
 mount -qb /srv/cons /dev
 
@@ -23,22 +26,28 @@
 # usb listener
 nusbrc
 
-# name translation, cs sets /dev/sysname
-ndb/cs
-sysname=`{cat /dev/sysname}
-
 # site-specific startup
 if(test -e /rc/bin/cpurc.local)
 	. /rc/bin/cpurc.local
 
-if (~ $#sysname 0 || ~ $sysname ''){
+# cs sets sysname (cpurc.local may already have started it so check)
+if(! test -e /srv/cs && ! test -e /net/cs)
+	ndb/cs
+sysname=`{cat /dev/sysname}
+if(~ $#sysname 0 || ~ $sysname ''){
 	sysname=cirno			# default
 	echo -n $sysname >/dev/sysname
 }
 prompt=($sysname^'# ' '	')
 
-# parallelism for mk
-NPROC=`{wc -l </dev/sysstat}
+# set up any partitions
+diskparts
+
+# start up local swapping
+disk=`{ls /dev/sd*/swap >[2]/dev/null}
+if (! ~ $#disk 0)
+	swap $disk(1) >/dev/null >[2=1]
+rm -f /env/disk
 
 # cpu-specific startup
 if(test -e /cfg/$sysname/cpurc)
--- a/rc/bin/termrc
+++ b/rc/bin/termrc
@@ -2,8 +2,11 @@
 # this file is run if service=terminal
 TIMESYNCARGS=(-rLa1000000)
 
+# parallelism for mk
+NPROC=`{wc -l </dev/sysstat}
+
 # bind all likely devices
-for(i in S f k t m i v L P u U A '$' Σ κ)
+for(i in v t m i f S P L A '$')
 	bind -a '#'^$i /dev >/dev/null >[2=1]
 rm -f /env/i
 
@@ -24,15 +27,6 @@
 # usb listener
 nusbrc
 
-# set up any partitions
-diskparts
-
-# start up local swapping
-disk=`{ls /dev/sd*/swap >[2]/dev/null}
-if (! ~ $#disk 0)
-	swap $disk(1) >/dev/null >[2=1]
-rm -f /env/disk
-
 # we do this before we have a name.  we may need to do network
 # setup so that we can get a name.
 if(test -e /rc/bin/termrc.local)
@@ -47,8 +41,14 @@
 	echo -n $sysname >/dev/sysname
 }
 
-# parallelism for mk
-NPROC=`{wc -l </dev/sysstat}
+# set up any partitions
+diskparts
+
+# start up local swapping
+disk=`{ls /dev/sd*/swap >[2]/dev/null}
+if (! ~ $#disk 0)
+	swap $disk(1) >/dev/null >[2=1]
+rm -f /env/disk
 
 # machine specific startup (e.g., for devices not probed)
 if(test -e /cfg/$sysname/termrc)
--- a/sys/man/8/cpurc
+++ b/sys/man/8/cpurc
@@ -33,12 +33,8 @@
 .B $terminal
 these scripts start appropriate network processes and
 administrative daemons and enable swapping.
-.I Cpurc
+.I Termrc
 sets
-.B /env/boottime
-to the time
-.I cpurc
-was executed and
 .B /env/NPROC
 to a value suitable for parallel compilation in
 .IR mk (1).
@@ -54,9 +50,6 @@
 .BR $sysname ,
 .I termrc
 will execute it next.
-Automatic initialization of the mouse and
-VGA on a PC is suppressed, if the user is
-.BR none .
 These files should be edited by local installations
 to reflect the configuration of their systems.
 .PP