9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] simple question: I want boot to bring up an rc prompt in boot()
@ 2006-04-07 18:20 Ronald G Minnich
  2006-04-07 19:42 ` Russ Cox
  2006-04-07 19:54 ` Steve Simon
  0 siblings, 2 replies; 4+ messages in thread
From: Ronald G Minnich @ 2006-04-07 18:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Is there some simple way to set up an (e.g.) pccpu such that when boot()
runs, after it sets up the basic namespace, it drops me into an rc
prompt? This would help me with debugging.

In the past I've done this by hacking on boot.c; I'm wondering if I'm
missing something.

thanks

ron


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] simple question: I want boot to bring up an rc prompt in boot()
  2006-04-07 18:20 [9fans] simple question: I want boot to bring up an rc prompt in boot() Ronald G Minnich
@ 2006-04-07 19:42 ` Russ Cox
  2006-04-07 19:54 ` Steve Simon
  1 sibling, 0 replies; 4+ messages in thread
From: Russ Cox @ 2006-04-07 19:42 UTC (permalink / raw)
  To: 9fans

If you look at the now-deprecated /sys/src/9/pc/pcfl,
you'll see how to start rc and just skip the boot program
entirely.

Russ



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] simple question: I want boot to bring up an rc prompt in boot()
  2006-04-07 18:20 [9fans] simple question: I want boot to bring up an rc prompt in boot() Ronald G Minnich
  2006-04-07 19:42 ` Russ Cox
@ 2006-04-07 19:54 ` Steve Simon
  1 sibling, 0 replies; 4+ messages in thread
From: Steve Simon @ 2006-04-07 19:54 UTC (permalink / raw)
  To: 9fans

> Is there some simple way to set up an (e.g.) pccpu such that when boot()
> runs, after it sets up the basic namespace, it drops me into an rc
> prompt?

Not sure if this is what you mean but
you can put init=/386/bin/rc in your plan9.ini
to prevent cpurc/termrc from being run and drop
you striaght into a shell.

-Steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] simple question: I want boot to bring up an rc prompt in boot()
@ 2006-04-07 20:09 jmk
  0 siblings, 0 replies; 4+ messages in thread
From: jmk @ 2006-04-07 20:09 UTC (permalink / raw)
  To: 9fans

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-07 20:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-07 18:20 [9fans] simple question: I want boot to bring up an rc prompt in boot() Ronald G Minnich
2006-04-07 19:42 ` Russ Cox
2006-04-07 19:54 ` Steve Simon
2006-04-07 20:09 jmk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).