Sunday, December 9, 2012

A Plan to Connect

So, my first challenge is to get Plan 9 connected to my network (and the internet) and then use my freshly compiled drawterm on my Mac to access the system.

It turns out that the Raspberry Pi system is delivered as a standalone system in the distribution image.  The original cmdline.txt in the boot partition does not set up the networking, but an alternative supplied script 'cmdline-demo-net.txt' does also perform the extra network configuration.  It's simply a matter of some file renaming to get the networking going (though I also needed to preserve the extra 'kbargs=-b' setting that I had added to the cmdline.txt in order to have a working mouse).

Anyway, the cmdline.txt to boot Plan 9 with the network (doing a DHCP lookup of IP settings) is:
readparts=1 nobootprompt=local user=glenda kbargs=-b ipconfig=

Having booted up, you can then confirm the IP details at any time by doing:
cat /net/ndb

To enable remote access from drawterm for a specific user, the user must have authentication configured and there much be a TCP listener set up so that connections launch an instance of Plan9's /bin/cpu program to serve the remote terminal.

The following two lines can be typed at the shell (rc) prompt to temporarily enable this on the running Plan 9 system:

echo 'key proto=p9sk1 dom=plan9 user=glenda !password=PASSWORD' >/mnt/factotum/ctl
aux/listen1 -t tcp!*!ncpu /bin/cpu -R &

The first line sets up authentication credentials for the user glenda (the default Plan 9 user).
In keeping with Plan 9's fundamental design of talking to services and devices via read and writes on a namespace of files that are projected into the filesystem, a password is associated with the glenda user by writing a defining like of text to the factotum authentication agent's control (ctl) file.

The second line starts a listen1 process that starts /bin/cpu server (-R means 'server'), launching this for connections on the network service tcp!*!ncpu (tcp protocol, any address, ncpu well-known port).  The -t option has listen1 run as the calling user (I was logged in as glenda on the console).

My next step will be to learn the appropriate way to set up a permanent listener and authentication for any user wishing to connect in this way.

On a separate note, apparently the provided Pi image also includes full sources and is capable of building itself.  This is accomplished with the command:
cd /sys/src/9/bcm; mk
("bcm" btw is the hardware specific source directory for 'broadcom', which is the manufacturer of the ARM chip in the Raspberry Pi).

No comments:

Post a Comment