From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Subject: Re: [9fans] simple question: I want boot to bring up an rc prompt in boot() Date: Fri, 7 Apr 2006 16:09:57 -0400 From: jmk@plan9.bell-labs.com To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 32f2e28c-ead1-11e9-9d60-3106f5b1d025 You can replace the binary produced by boot.c by a shell script as follows: in your kernel config file, change the 'bootdir' section to include all the programmes you will use in the shell script, e.g. bootdir /386/bin/rc /rc/lib/rcmain /386/bin/bind /386/bin/sed /386/bin/srv /386/bin/cat /386/bin/cp /386/bin/rm /386/bin/echo /386/bin/mount /386/bin/sleep /386/bin/ip/ipconfig /386/bin/auth/factotum /386/bin/ls /386/bin/ps /386/bin/auth/wrkey boot.rc boot and in the appropriate kernel architecture subdirectory (in this case '386') create the shell script you want to run as /boot in boot.rc, e.g. #!/boot/rc -m /boot/rcmain cpuserver=yes cd /boot echo boot... bind -a '#I' /net bind -a '#l0' /net bind -a '#S' /dev bind '#p' /proc bind '#d' /fd bind -a /boot / ipconfig -D authaddr=`{sed -n 's/ auth=(.*)/\1/p' /net/ndb|sed 1q} if(~ $authaddr '') authaddr=xxx.xxx.xxx.xxx fsaddr=`{sed -n 's/ fs=(.*)/\1/p' /net/ndb|sed 1q} if(~ $fsaddr '') fsaddr=xxx.xxx.xxx.xxx factotum -sfactotum -S -a $authaddr if(! srv tcp!$fsaddr!564 boot) exec ./rc -m/boot/rcmain -i if(! mount -c /srv/boot /root) exec ./rc -m/boot/rcmain -i bind -ac /root / rootdir=/root rootspec='' /$cputype/init -c exec ./rc -m/boot/rcmain -i where xxx.xxx.xxx.xxx is replaced by local default ip addresses for the auth and file servers. --jim