
This note describes how to use a single source tree to maintain multiple
kernels where each kernel has been tailored for say a different product.

  This note describes how to allow a kernels to be created with its  
  own CONFIGuration options, and /etc/, /htdocs, /local files.

Please see the comments in brecis/compilescripts/Makefile
which also describes these steps in slightly different detail.

The following instructions provide a "cookbook" for what you need to do.  Lets
take the example of where we want to create a specific kernel for "myproduct".
    
  1) Create the file linux/arch/mipsnommu/defconfig-brecis.myproduct with
	 the desired kernel configuration options.  You can use an existing
	 defconfig-xxx file as a starting point.
	 
  2) If required, create romdisk/etc.myproduct to contain the /etc files that
	 are unique to your product. These files replace what is in the tar file 
	 romdisk.tgz.
	(The files in romdisk.tgz for /etc are replaced, the files not specified
	are left untouched).  There is a FAQ that describes how to change
	romdisk.tgz.
 
  3) If required, create romdisk/htdocs.myproduct to contain /htdocs files.
  	  (/htdocs contain web pages, cgi scripts, etc)
  
  4) If required, create romdisk/local.myproduct to contain /local files.
  
  5) If required, create romdisk/BOOT.FILES.myproduct with the programs
	 desired.  Only programs specified are copied into /bin and /sbin.
	 All other programs are ignored and thus are not in the kernel image.
	 
	 If /BOOT.FILES.myproduct does not exist, all the files in uC-src/bin 
	 and uC-src/sbin are copied.

  6) If required, create uC-src/defconfig.myproduct with the userland programs
	desired.
	 
  7) Configure the build method (dependent upon shell being used):
	 a) setenv TYPE_SYSTEM ".myproduct"    (used for csh)
	 b) TYPE_SYSTEM=".myproduct"; export TYPE_SYSTEM   (used for sh or bash)

  8) If "myproduct" uses FreeS/WAN, edit romdisk/Makefile to add
	"myproduct" to the list of systems that have freeswan installed:

	if [ "${TYPE_SYSTEM}" = ".freeswan" \
		-o "${TYPE_SYSTEM}" = ".big"  \
		-o "${TYPE_SYSTEM}" = ".myproduct" \
		-o "${TYPE_SYSTEM}" = ".fpga" ] ; \
	then \
	...


  9) If "myproduct" uses NFS, add "myproduct" to 
	the LOCALNFSTARGETS environment variable:
	 a) setenv LOCALNFSTARGETS "myproduct"    (used for csh)
	 b) LOCALNFSTARGETS="myproduct"; export LOCALNFSTARGETS   (used for sh or bash)

	otherwise, if "myproduct" will be built the same way as NORMALTARGETS

  10) "cd brecis/compilescripts"
	  "make linuxall"
	  (or "make redokernel" if you already have userland compiled and
	  desire to change only the kernel.)
	The above environment variables must be set each time you wish
	to build or rebuild.
	  
  11) Alternatively  you may edit uClinux/brecis/compilescripts/Makefile
	adding "myproduct" to the NFSTARGETS if "myproduct" uses NFS.

Example:
NFSTARGETS	:= nfs 

Where you have more than one product to tailor, simply use another name
such as myproductOne and repeat the steps above.

The following targets currently exist:
*	default = routing with quite a few userland commands
*	big = most kernel configuration options turned on.
		most userland commands built.
		big is NOT suitable for running or testing
	eng = BRECIS engineering kernel and userland build used internally.
	flash - kernel and userland configuration meant to be stored in flash
		and booted from flash.
	fpga - used internally.  Please do not use.
	fpgapci - used internally.  Please do not use.
	freeswan = configuration using freeswan with BRECIS security engine
	nat = "default" kernel with nat filtering added
	nfs = kernel configuration with NFS (client) turned on allowing
		userland to be imported via nfs.
*	small = routing only kernel, minimal userland commands
*	small.nat = routing + nat masquerading only, minimal userland commands

Those targets with a leading asterisk have an existing
	uC-src/defconfig.${TYPE_SYSTEM} used to build the 
	uC-src/.config file which controls which userland commands get built.
	A target without an existing uC-src/defconfig.${TYPE_SYSTEM}
	uses uC-src/defconfig to create the uC-src/.config file which
	controls which userland commands get built.

To select a target, do "make <target>".
The following are examples:
"make default" - to make the default kernel and userland.
	Doing "make distclean linuxall" will also cause the 
	default kernel and userland to get built.
 "make big" - to make big linux kernel with many Configuration options, 
	re-use userland.
 "make eng" - to make default linux kernel with engineering selected options, 
	re-use userland.
 "make freeswan" - to make default linux kernel with freeswan turned on, 
	re-use userland.
 "make nat" - to make default linux kernel with NAT (and ftp) turned on, 		re-use userland.
 "make nfs" - to make default linux kernel with NFS (client) turned on, 
	re-use userland.
 "make small" - to make very small linux kernel with routing, re-use userland.
 "make small.nat" - to make very small linux kernel with NAT on eth0, 
	re-use userland.
Other targets are built using the same mechanism.
NOTE: userland will be re-used so long as the same <target> is built.
	Userland will be re-built when going from one <target> to another.
	The file, uClinux/brecis/compilescripts/Makefile.type_system,
	is used to remember the last <target> built.

