This file contains instructions for the SiS 630 based mainboards.

Unfortunately, there is a step in this HOWTO that could be hazardous. The 
hazards include (but are not limited to)
1) destroying your motherboard
2) hurting yourself
3) killing yourself

Because of these hazards, you must take full responsibility if you
decide to install LinuxBIOS following these procedures. Neither Los
Alamos National Labs nor any lab personnel can be held responsible for
any adverse consequences of your attempt to follow these procedures.

WARNING: we assume you've built kernels, know how to open up your PC,
and how to yank the flash part out while power is on and put in a
different part. There is NO WARRANTY, express or implied, with this
software. In fact, if you don't know what you're doing, and you get
careless, you're going to end up with a nice paperweight instead of a
motherboard, an emergency room bill, or a funeral service.

			YOU HAVE BEEN WARNED.

	Now that we're done with the mandatory US legal jargon
		(how I hate lawyers ...)

The mainboards that are "known good" are:
Matsonic MS7308E
Winfast 6300MAX

Mainboards with SiS630 that we KNOW will not work are:
Any ASUS (uses the wrong kind of flash part)
Matsonic MS7308D (no Ethernet connector)

Vendors we have experience with that work:
www.aaronix.com

Clueless vendors, who ship the wrong board:
www.dknypc.com (we ordered MS7308E, they shipped MS7308D, but invoiced MS7308E)

Vendors who might work:
www.eurocomla.com (we don't know yet -- have not tried them)

Linux distribution: RedHat 6.2 or later. We haven't tried anything else. 
	They may all work fine. 

Other software notes: You MUST have 'as' version 2.9.5 or later. 
			You MUST have ssh to connect to sourceforge

Recommended: you really ought to get a 32-DIP Zero Insertion Force (ZIF)
socket for the flash part. This makes taking out flash and putting in Disk
On Chip much easier. 

You need to have a LinuxBIOS machine (the machine that runs LinuxBIOS)
and a build machine (which will let you build LinuxBIOS). These can be
one and the same machine. In this HOWTO we assume they're the same. 
We nevertheless refer to a 'build' machine and 'LinuxBIOS' machine in case you
want to use a different machine. 

Also, freebios and linuxbios still share the same source tree. We use the 
name 'linuxbios' where it makes sense, and 'freebios' otherwise. But they 
are the same source base. 

----
NOTE: these steps are tested up to step 3, and work. 
The steps for loading linuxbios are simple:
0) get linux installed on your LinuxBIOS machine
1) Get Linuxbios source from the sourceforge
2) get a 2.4.7 kernel, patch it, then build it
3) config and build linuxbios
4) Get the MTD utilities from http://www.linux-mtd.infradead.org/ 
	and build the 'erase' utility
5) Set up the 'flash_on' program in your path
6) put a Disk On Chip into the flash socket
7) Burn the chip
8) hit reset. You're up.

---
Step 0) 
	Get Linux installed on your LinuxBIOS machine. We have used 
	RedHat 6.2, but any recent Linux distribution should work, such
	as Mandrake 7.0. 

Step 1)
o	You need to get linuxbios source.
	cd to the directory you want the source tree to be.
	Then:
	export CVS_RSH=ssh (or in tcsh setenv CVS_RSH ssh)
cvs -d:pserver:anonymous@cvs.freebios.sourceforge.net:/cvsroot/freebios login 
	(at the password prompt, just hit <return>)

cvs -z3 -d:pserver:anonymous@cvs.freebios.sourceforge.net:/cvsroot/freebios co freebios 


Step 2)
o 	go to www.kernel.org and get linux-2.4.7

o	Once you have pulled this file down and untar'ed it, 
	apply the proper patch from the freebios/src/kernel_patches 
	directory.  The patch is:

	linux-2.4.7-sis.patch
	Your patch command will look like this:
	cd linux_directory
	patch -p1 < ~/freebios/src/kernel_patches/linux-2.4.7-sis.patch
o	Now copy config-2.4.7-sis to .config, then
	make oldconfig
	make clean
	make dep
	make vmlinux
	make modules
	make modules_install
	make bzdisk (You should test boot this floppy disk just to be safe)

	You now have a kernel for linuxbios.
	And then try booting this kernel on the LinuxBIOS to make sure it works. 
	If you want, you can also install this kernel on the LinuxBIOS machine,
	and install the modules as well, since you will need the Disk On Chip
	modules to burn the Disk On Chip part. 

Step 3:

o	You now need to figure out where you want to put your build images. 
	DO NOT PUT THESE IN THE LINUXBIOS SOURCE TREE. 
	You want to put them OUTSIDE THE TREE, so you can always
	cvs update
	and not lose any of your build directory. 
	Linuxbios does all the builds in a single directory, much as BSD does. 
	To build linuxbios requires a Makefile, a crt0.S file, and a ld script
	file. These are generated by a config tool located in 
	freebios/utils/config
	The config tool is a Python program originally written by 
	Dean Risinger of the ACL. 
	To build the initial Makefile, assembly stub, and ld script, 
	you need to build a config file (simple), run the config tool,
	cd to the build directory, and type 'make'. 

	Here is a config file for the winfast 6300

	# This will make a target directory of ./winfast
	# Note that this is RELATIVE TO WHERE YOU ARE WHEN YOU RUN THE 
	# CONFIG TOOL. Make it absolute if you like
	target winfast 

	# Leadtek WinFast 6300 MAX mainboard
	mainboard leadtek/winfast6300

	# Enable Serial Console for debugging
	# It will come up at 115200,8n1
	option SERIAL_CONSOLE

	# Enable MicroCode update and L2 Cache init for PII and PIII
	option UPDATE_MICROCODE
	option CONFIGURE_L2_CACHE

	# Use the internal VGA frame buffer device
	option HAVE_FRAMEBUFFER

	# Path to your kernel (vmlinux)
	# NOTE; you need a path to your test12 kernel here. 
	linux /usr/src/linux-2.4.7-sis

	# Kernel command line parameters
	commandline root=/dev/hda1 

	# We're using disk on chip. Tell it where to find the docipl code
	docipl northsouthbridge/sis/630/ipl.S
	# Tell Config that we're going to use DOC Millenium as the source
	# of the compressed image
	option USE_DOC_MIL


	
	The target command names the build directory. The mainboard command
	names the mainboard. We have set options for a serial console which
	will get you linuxbios debug output via the serial port; updating
	microcode on the PIII (mandatory for coppermine!); configuring the
	L2 cache (harmless, leave it in); framebuffer init (leave it in
	if you want a console). You have to tell it where to find the vmlinux
	you build (the 'linux' command); and finally you need a commandline
	for now. 

	That's the file. 
	To run the config tool, you need two args: the first is the
	name of a config file, and the second is the (absolute) pathname
	of the freebios source tree. 

	The config tool is NLBConfig.py. Make sure you use that and not
	LBConfig.py, the older version. 

	Here's what it looks like when you run it. 

 	python ~/src/freebois/util/config/NLBConfig.py winfast.config ~/src/freebios
	winfast is not a directory. 
 	I know I should make this, but I'm too paranoid
 	To fix this, type
	mkdir -p  winfast
 	then run this program again

	Note this first time, we got an error, since I forgot to make
	the 'target' directory.
	So, for the second run, I do the mkdir, then run the tool:

	mkdir -p winfast

	python ~/src/freebios/util/config/NLBConfig.py winfast.config ~/src/freebios

	The output of the tool is:
	Will place Makefile, crt0.S, ldscript.ld in  winfast
	Process config file:  /users/rminnich/src/freebios/src/mainboard/leadtek/winfast6300/Config
	Process config file:  /users/rminnich/src/freebios/src/northsouthbridge/sis/630/Config
	Added ram init file:  northsouthbridge/sis/630/raminit.inc
	Process config file:  /users/rminnich/src/freebios/src/cpu/p5/Config
	Process config file:  /users/rminnich/src/freebios/src/cpu/p6/Config
	Process config file:  /users/rminnich/src/freebios/src/lib/Config
	Trying to create  winfast/Makefile
	Trying to create  winfast/ldscript.ld
	Trying to create  winfast/crt0.S
	Check for crt0.S param file: /users/rminnich/src/freebios/src/include/northsouthbridge/sis/630/param.h
 	Adding include to crt0.S for this parameter file

	OK, all those messages are normal. Now we do a make:

	cd winfast
	make

	We now have three files to be loaded into the Disk On Chip. The first
	is called docipl. It is 512 bytes. The second is called linuxbios.strip,
	and is the binary image of the linuxbios that gets loaded into Doc. 
	The third file  is your kernel, and is stripped and compressed, 
	vmlinux.bin.gz

	-rw-------    1 rminnich CIC-ACL       512 Dec 20 08:41 docipl
	-rwx------    1 rminnich CIC-ACL     33494 Dec 20 08:41 linuxbios.strip*
	-rwx------    1 rminnich CIC-ACL    756069 Dec 20 08:41 vmlinux.bin.gz*


	You're now ready to burn the Disk On Chip, but first .... 

Step 4) Get the MTD utilities from http://www.linux-mtd.infradead.org/ 
	(see the instructions at that site)
	cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd
	cd mtd/util
	sh -x MAKEDEV
	make
	(You need the erase utility)
	Install the erase utility where it is in your path. 

Step 5) Set up flash_on utiliy
	flash_on.c is found in freebios/util/sis/flash_on.c
	cd to that directory, make the utility, and put it in your path
	(i.e. /usr/bin or in your private path)
	(e.g. cp erase /usr/bin)

Step 6) 
	NOTE: BE ADVISED THAT THIS STEP CAN HURT OR KILL YOU!
	YOU ARE WORKING WITH A POWERED-ON COMPUTER AT THIS POINT. 
	THE COMPUTER NEEDS TO BE OPENED  UP, AND YOU NEED TO REMOVE A CHIP
	WHILE THE COMPUTER IS ON. 
	IF YOU HAVE NOT DONE THIS TYPE OF WORK, DO NOT DO IT!
	WE TAKE NO RESPONSIBILITY FOR ANYTHING THAT HAPPENS AT THIS STEP.
	BEFORE DOING THIS STEP WITH POWER ON, YOU SHOULD TRY IT WITH POWER OFF.

	Figure out if you're going to burn the DoC on the build or LinuxBIOS
	machine. It has to be the machine with MTD modules. 

	Open the machine (LEAVE THE POWER ON), yank the flash, and 
	plug in the DoC. We recommend you practice this first with the 
	power off. Make sure that whatever you do, you are not shorting 
	things out. Avoid using a metal tool!

	NOTE: YOU CAN HURT YOURSELF AT THIS STEP. We can't take any
	responsibility for what happens to you here. If you haven't 
	done this, or are not trained, or have a history of getting
	hurt by hardware, DON'T DO IT.

Step 7) Run the following script:
	RUN THIS SCRIPT FROM THE BUILD DIRECTORY FOR LINUXBIOS
	Run the burn_mtd script from freebios/util/mtd
	Here's how it looks when you run it:
	(We'll fill this in later, sorry!)


Step 8) POWER OFF THE MACHINE. DoC requires this. 
	Turn it back on. Linuxbios should come up in a few seconds. 

If it doesn't work: 

1) if you can, hook up a serial line to your LinuxBIOS machine, 
   settings 115200,8n1
   and see what messages come out. If you can capture them, send them
   to linuxbios@lanl.gov with a description of your problem. 



