HTTPS SSH
this is a port of Plan 9 from Bell Labs to the loongson
machines. currently the 2E machine (Lemote Fuloong 2E
minicomputer) and 2F machine (Lemote Yeeloong 2F 8089A
and 8101B laptops) are supported. the current status is

- 32 bit kernel (though cpu is 64 bit)
  64 bit kernel is in progress (not included)
- floating point is supported
- ethernet (rtl8139) is supported
- serial console is supported (2E only)
- ps/2 keyboard is supported
- ps/2 mouse is supported (only tested on 2F)
- video is partially supported (see below)
- ide disk is experimentally supported (2E only)
- rtc is supported

- usb is NOT supported yet
- audio is NOT supported yet

the directories here are:
9/	kernel sources
9/2f/	2F machine specific kernel sources
dist/	stuff for building bzroot, the in-kernel root file system
lib*/	machine-dependent library sources
ape/	machine-dependent ape library sources
cmd/	machine-dependent command sources
spim/	the /spim directory, just like /386 etc.
patch/	patches needed to build/run this port

the kernel is compatible with recent sources from Bell Labs
(2014-06 or later).

HOW TO BUILD

first, you need a /spim directory, which contains all the
machine-dependent stuff. As / does not allow creation, you may 
want to make this directory by hand, depending on the file
system. For fossil,

% echo 'fsys main create /active/spim sys sys d775' >> /srv/fscons

it is necessary to rebuild vl with the up-to-date sources
(2013-04 or later), so that the binaries are 16K aligned by
default. also, a patch on vl to fix the endianess of floating
point needs to be applied. to do this, sync with sources,
apply the patch by 'mk patch', and then 'mk install' in
/sys/src/cmd/vl. 'mk patch' also applies a patch to libmach
for debugging this architecture (on any host architecture)
and a patch to vc for fixing a small issue. rebuild vc and
libmach as well.

the mkfile will then build the userland: creating directories
as needed, copying files to the system, building libraries,
building commands, making a bzroot as the root file system for
the bzroot kernel, and building the kernel. simply run

% mk

will do this in the above order. you may also only build part
of them, as the following:

% mk spim	# prepare /spim directory (NOT creating it)
% mk lib	# build libraries
% mk cmd	# build commands
% mk bzroot	# make the bzroot, the root for bzroot kernel
% mk kernel	# build the default kernel

alternatively, you may want to build the kernel by hand. to do
it, bind/copy '9' directory to /sys/src/9/loongson and mk.
currently there are two kernels: 'lnbzroot' (default) is the
bzroot kernel, and 'lncpu' is the cpu server.

to build the kernel for 2F machine, bind '2f' directory to the
front of /sys/src/9/loongson to use 2F specific files.
similarly there are two kernels: 'ln2fbzroot' and 'ln2fcpu'. 

HOW TO BOOT

if using PMON as the boot loader, press DEL to enter its
console at start-up. use 'load' command to load the kernel.
if you load the kernel from tftp:

> ifaddr rtl0 <ip>	# configure network if needed
> load tftp://<hostip>/<file>

alternatively, you could copy the kernel to disk and load
from it:

> load /dev/fs/ext2@wd0/path/to/kernel

'wd0' or 'wd0a' for the 1st partition, 'wd0b' for the 2nd
partition, etc.

once loaded, boot it with 'g' command:

> g

the command line arguments of 'g' are passed as plan9.ini
options, with the format 'name=value'. value should not
contain space.

if using other bootloader or a different version of PMON,
configure it accordingly.

for the bzroot kernel, when prompted at
root is from (local, tcp)[local]:

type 'local!/boot/bzroot' (no quote) to boot into the bzroot.
it is also possible to boot with a remote file server by
choosing 'tcp', even with bzroot kernel.

currently only the default setting for video is supported.
it is 640x480x16 on my 2E machine, and 1024x600x16 on my 2F
laptop. if it is different on your machine, use plan9.ini
option to set it, like

> g vgasize=640x480x16 sysname=loongson user=glenda

if the mouse is not configured automatically, type the
following in a shell to enable it:

% echo ps2 > '#m'/mousectl

have fun :)