Introduction
------------

When running a LINUX build inside the LINUX source-tree for SPARC the output
image is <linux-dir>/arch/sparc/boot/image for Linux 3.4 and older and
<linux-dir>/vmlinux for Linux 3.5 and newer. This image however cannot be run
directly and it is linked to virtual addresses. The image expects among other
things an initialized romvector and the MMU to be switched on. The script
mklinuximg sets up such an environment. The output of mklinuximg can be uploaded
using GRMON, simulated in TSIM or serve as input to MKPROM2 for PROM bootloader
generation.

Invocation
----------

Usage:
$0 <linux-image> <out-file> [-freq <frequency>] [-base <baseaddr>] [-cmdline <string>]
     [-amp <string>] [-ethmac <string>] [-ipi <irq_num>] [-ioarea <ioarea>] [-uartidx <index>]
     [-maxcpu <num>] [-wakediscpus] [--version] [-xml <file>] [-flat]
  <linux-image> linux image, for Linux 3.4 and older <linux-dir>/arch/sparc/boot/image.
                and for Linux 3.5 and newer <linux-dir>/vmlinux.
  <out-file>    output image that can be uploaded using GRMON or run in TSIM.

 optional parameters:
  -base <baseaddr>  optional baseaddress. The default is 0x40000000.
  -cmdline <string> kernel parameter string. Default is "console=ttyS0,38400".
  -freq <frequency> optional frequency parameter in case if it cannot be retrieved from the Timer scalar.
  -amp <string>     optional string of format <idx0>=<val0>:<idx1>=<val1>:... that sets for core index
                    n property ampopts to value n. Example 0=4:1=6 will set core index 0's ampopts to 4
                      and core index 1's ampopts to 6.
  -ethmac <string>  set the ethernet mac address as 12 dgt hex. Default: 00007ccc0145
  -ipi <irq_num>    IRQ number used by Linux SMP for IPIs. May not be shared. Allowed values: 1..14
  -ioarea <ioarea>  GRLIB AMBA Plug&Play I/O AREA Base address. Defaults to 0xfff00000
  -uartidx <index>  Select UART by index for PROM Console. Default 0 (first UART0)
  -maxcpu <num>     Disable/Limit number of Linux CPUs 1..8 (default 8)
  -wakediscpus      Wake the disabled/limited CPUs
  --version         Print version of mklinuximg
  -xml <file>       Specify an xml file that adds extra properties and nodes to the device tree.
  -flat             Create a flat device-tree.

Files
-----

 mklinuximg      Script that create config files and build environment for the
                 sources in src/ and include/.
 README.txt      This file.
 CHANGES         Changelog.
 VERSION         Contains version number of mklinuximg and required linux version
                 number.
 xml-format.txt  Documentation on the xml format for files used with the -xml parameter
 example.xml     Example file on how to use the -xml parameter.

Linux
-----

The LINUX version has to be newer than 2.6.36.

Prom tree changes
-----------------

Using the option "-xml <file>" the prom tree can be changed to remove core nodes, to
add and remove properties to core nodes and to add subtree nodes to core nodes.

Documentation on the xml format can be found in xml-format.txt (and as output of
scanxml -d).

For an example on how to use the xml format, see the example file example.xml.
