9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: 9fans <9fans@cse.psu.edu>
Subject: [9fans] replacing 9load
Date: Mon,  5 Dec 2005 15:47:14 -0500	[thread overview]
Message-ID: <ee9e417a0512051247l3cceabe1o5996db34d52f191d@mail.gmail.com> (raw)

For quite a few years, various of us have talked about
replacing 9load.  When Jim and I replaced b.com with the
combination of ld.com and 9load, we considered using a stock
Plan 9 kernel instead.  Sean Quinlan took a few steps toward
making this possible: he added the configuration environment
#ec, the Dev.shutdown routines, and /dev/reboot.  With
these, one can use the kernel as an impromptu boot loader
already.  I believe Ron Minnich does just that in some of
his machines.

There are a few things 9load does that the kernel depends
on.  The main one is loading plan9.ini from somewhere and
leaving it in memory.  A secondary one is setting up the APM
BIOS interface, and in the original VESA code written for
Inferno, 9load was responsible for setting up the VGA.  With
the new realmode code (or better, if someone would write it,
VM86 code) in the kernel, the APM and VESA can be done by
the kernel proper.  That leaves plan9.ini.

Plan9.ini serves two related but different purposes.  The
first is to give the kernel hints about hardware
recognition.  The second is to specify a few aspects of the
software configuration.  Ideally, it would be nice if
plan9.ini could become optional.

Hardware recognition was a much bigger problem in the old
ISA days.  Plan9.ini was, at the time, an excellent
alternative to recompiling the kernel to hard-wire all the
constants about your machine.  Now that we have PCI and its
device ids, you don't need to tell the kernel what hardware
you have anymore.  It knows, usually better than you.

That leaves the software configuration: mouse, vga, serial
console, kernel location, root file system location, boot
menu, etc.  The mouse and vga could possibly be
auto-detected, and the new vga resize code (if it works)
makes it possible to correct a bad guess about the user's
desired screen size.

The other options in plan9.ini -- the serial console, the
kernel and root file system, the boot menu -- can't just be
guessed.  Jim has been playing with loading plan9.ini via
PXE/TFTP, which is great for a real single-file-server Plan 9
setup, though it won't satisfy the single-machine users.
I don't expect this part of plan9.ini to go away, though one
could make 9load do without it in the general case (scan the
local 9fats for files named 9pc*, for example).

When I put the new mmu code into the kernels, I didn't feel
like putting it into 9load too.  Instead I wrote a small
binary that turns a gzipped kernel into a 9load binary that
the PBS bootstrap could load into memory.  You run

	cat load 9pcload.gz >9load
	
to produce a 9load from a kernel.  I have put this in
/n/sources/contrib/rsc/load.

This new program means that you can build yourself a special
pcload kernel with some 9load-like user-level program
installed as /boot/boot instead of the usual boot.  It would
find plan9.ini, present any prompts if needed, find and load
a kernel, and then /dev/reboot into it.  You could put
dossrv, ext2srv, fossil, venti, kfs, factotum, mount, tftp,
ftpfs, hget, etc., into the root file system, to load
kernels off of any conceivable medium.

While a new 9load using the real kernel could be great, it's
not very high on my or Jim's to do list, since the current
9load suffices, and we're more interested in what happens
once the kernel is in memory than the mundane and now
all-too-familiar details of the x86 boot process.

I encourage those of you grumbling for a new 9load to attack
one of the following problems:

    - write vm86 code for the kernel to replace the realmode
      code.  vm86 code should be safer and more reliable
      and will make the vesa and apm code run on more machines.

    - write a mouse auto-detector: scan the usb, try ps2,
      scan the serial ports.  this should be almost trivial.

    - write a vga size auto-detector: try aux/vga -m vesa -p
      and fetch and parse the edid information from the
      monitor.  aux/vga does most of this already.

    - write a user-level program to be the `9load' in a
      9pcload kernel.  the program should have generic "get me
      a plan9.ini" and "get me a kernel" interfaces, like the
      current 9load, so that many boot methods can be plugged
      in.

Ironically, once this is all done we'll have moved full circle to
where Plan 9 was many years ago, when the hobbit boot loader
was just a Plan 9 kernel with a different load address and a
special boot program that let you set environment variables,
examine memory, attach to file servers, run programs that
were downloaded, and load and boot a kernel.

Russ


             reply	other threads:[~2005-12-05 20:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 20:47 Russ Cox [this message]
2005-12-05 20:52 ` William Josephson
2005-12-05 21:02 ` Ronald G Minnich
2005-12-05 21:06   ` Charles Forsyth
2005-12-05 23:22     ` Ronald G Minnich
2005-12-05 21:21   ` Russ Cox
2005-12-05 23:27     ` Ronald G Minnich
2005-12-05 23:33       ` Russ Cox
2005-12-06  0:19         ` Ronald G Minnich
  -- strict thread matches above, loose matches on Subject: below --
2005-12-04  4:48 [9fans] Replacing 9load Uriel
2005-12-04  7:01 ` jmk
2005-12-04 16:00 ` Russ Cox
2005-12-04 16:56   ` Nigel Roles
2005-12-04 19:07     ` Charles Forsyth
2005-12-04 19:29       ` jmk
2005-12-04 22:13         ` C H Forsyth
2005-12-05 19:42 ` David Leimbach
2005-12-05 20:11   ` jmk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee9e417a0512051247l3cceabe1o5996db34d52f191d@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).