Q40 Linux Loader
================

will load and bootstrap a linux kernel image. Unless invoked with the '-f'
option, the loader will ask for confirmation before transfering control to 
linux.
Before that it behaves like any QDOS job, ie can be safely killed or suspended
at any time. Currently there is no sensible QDOS/SMSQ shutdown procedure so 
the user is responsible to exit all applications that might have open files
and similar precautions.

Start as

	ex lxx;"loader-args -- kernel-args"

optionaly with any form of redirection, recommended especially to capture 
output from '-v' and '-d' options. See below for examples of redirection. 

loader args:
   required args:
	       -k kernel_name : linux image file (vmlinux)
	       -m mem         : physical ram in MB
   optional args:
	       -v             : verbose
               -d             : turn on SRAM early debugging, writes '%LX$' 
				signature into SRAM and clears it. Don't do 
				that if you store valuable information there.
				See also "Getting SRAM contents" and "debug=mem"
				kernel argument.
	       -r ramdisk_name: initial rd image file, should be gzipped
	       -p             : pause for medium insertion before loading anything,
				useful if starting from floppy
	       -c CPU         : CPU type - 68060 around?
               -f             : do not ask questions or wait for confirmation,
                                intended for automatic startup scripts

	As could be expected, the '-p' and '-f' flags can't be specified
	together.
	
kernel args:
   required args:
	root=/dev/somedev     : see below fo examples, not always needed
				when initial ramdisk is used.

   optional args:
 anything the linux kernel understands, see /usr/src/linux/Documentation and
 man bootparam for details. The exact details also depend on kernel configuration.
 WARNING: do not use any options that call for IRQ autoprobing!!
 A few examples:

	root=/dev/hdb2    : use 2nd partition of hdb as root
	hda=swapdata	  : required if disk was formated on a PC
	hda=noprobe	  : don't probe (and use) hda
	hda=cyl,head,sect : don't specify unless absolutely neccessary, should
		            be used together with hda=noprobe
	ideX=base,ctl,irq 
			     specify additional ide-interfaces, use hex 
			     numbers as 0xnnn. 2 interfaces have compiled in
			     defaults.
	init=/bin/bash	  : use that when init-scripts are broken,
	init=/bin/ash.static : when libs are broken as well..
	root=/dev/ram	  : root on ramdisk -- may be needed depending
			    on ramdisk (exactly when there is no /linuxrc)
	debug=mem	  : print kernel startup messages into SRAM - use
			    if nothing else works
			    See also "Getting SRAM contents" and '-d' option
        parport=0x378,none 
	parport=0x278,none
			  : tell kernel about parports. This is default values for
			    1st and 2nd parport, specifying them this way avoids 
		            possible IRQ autoprobing and is therefore recommended.
			    If your parports work with interrupts substitute the
			    irq number for "none"
	console=device,options
	console=ttyS1,9600n8
			  use serial port 1 (=2nd!), no parity, 8 bits as system 
			  console.. should be suitable to use a QL with a terminal
			  emulator as controlling terminal. 
			  See also Documentation/serial-console.txt.

    more optional args:
 args of the form 'key=value' not evaluated by the kernel will be evaluated as
 environment variables and set for pid 1 (init unless specified otherwise)

    even more optional args:
 rest of the args will be passed as arguments to pid 1 (init). Arguments valid
 for init:

	single		  : Single  user  mode boot. In this mode /etc/inittab 
			is examined and the bootup rc scripts  are  usually  run
			before the single user mode shell is started.

	1-5		  : runlevel to boot - changes default runlevel

	emergency	  : Boot  directly  into a single user shell without run
			ning any other startup scripts.


Examples of redirection
-----------------------

Taken mostly from c68 documentation:

	ex lxx;"loader-args -- kernel-args >& filename"

 redirect stdin and stderr to 'filename' - if 'filename' already exists
 it is overwritten.

	ex lxx;"loader-args -- kernel-args >>& filename"

 redirect stdin and stderr to 'filename' - if 'filename' already exists
 the output gets appended.

	ex lxx,#1,#4,#4;"loader-args -- kernel-args"

 lxx expect input from #1 and sends output (stderr,stdout) to #4 which
 could be a previously opened file, printer or con_ channel.

Redirecting stdin should be done only together with '-f' option.

Both c68 and TK2 offer more functionality than described here, see
QdosC68.doc and TK2 manual for more details.


Getting SRAM contents
---------------------

The Q40 has 2040 bytes of static RAM which usually survives resets and
several years of powerdown. This is excellently suited for startup debuging
as implemented with '-d' and 'debug=mem'.
AFAIK neither QDOS nor SMSQ uses the SRAM for now, however beware that this
could change.

'lxx' displays it (or outputs it to a redirected channel) if invoked with the
'-d' option. Often it is simpler or more flexible to do this from SuperBasic 
as demonstrated in this examples:

1000 Rem display SRAM contents to #1
1010 DEFine PROCedure psr
1020 FOR i=HEX("ff020000") TO HEX("ff021fdc") STEP 4
1025  c=PEEK(i)
1030  IF c THEN PRINT CHR$(c);: PAUSE 1
1040 END FOR i
1050 END DEFine

1100 Rem output SRAM contents to "file"
1110 DEFine PROCedure psf(file)
1115 LOCal ch
1117 ch=FOP_NEW(file)
1120 FOR i=HEX("ff020000") TO HEX("ff021fdc") STEP 4
1125  c=PEEK(i)
1130  PRINT #ch,CHR$(c);
1140 END FOR i
1145 CLOSE#ch
1150 END DEFine

As you can see the bytes are stored from $FF020000 to $FF021FDC (every 4th byte)
so it is pretty easy to write own programs for this.
