# status

boots, uses uart as console, rtc, runs dis programs, basic network
support (dhcp & mount working), might read some sd cards, can read
nand flash pages.

todo:
- writing kernels to nand (can be done from u-boot, also should be possible from userland):  will implement raw flash device, like flash(3) but with oob data to be read/written too.  then implement a program to write an image (that executes erase and such).
- better nand support
- next step for sata support:  improve devbs.c and change devsata.c so it uses it.
- find & fix crash with latest uboot
- l2 cache, does not seem to speed up much.  something wrong?
- delay/microdelay calibration
- perform register file read after register writes to different registers
- lower power.  make sure we don't go into sdram self-refresh when we were just doing something useful.
- more ethernet (fewer interrupts, more checks for idleness when configuring, phy)
- better sdio
- improve uart (mode setting)
- unbreak cesa.c, use it again
- more gpio, devgpio.c
- usb
- later: twsi,spi,i2s,pciexpress


# intro

this is to be a port of inferno to the kirkwood soc, and the
sheevaplug in particular/at first.

this is work in progress.


# instructions

make sure the contents of this directory are available in
$ROOT/os/kirkwood/.

make sure $ROOT/os/init/sheevainit.b is the same as
$ROOT/os/kirkwood/sheevainit.b (by copy, symlink or bind).

for compiling a kernel, the program "mkuimage" is needed.  build &
install it it by "cd mkuimage && mk install".

to compile a kernel, "mk install".  this will create "uisheeva" and
"uisheeva.gz" (the same kernels, but one is compressed).  these are
in the "uimage" format, as expected by the sheevaplug's bootloader
u-boot.


# booting

for development it is easiest to boot from dhcp/tftp.  the dhcp
server should have a boot file name (the kernel, e.g.  uisheeva.gz)
and a "next server" (the ip address of the tftp server) configured.

after reset, hit some keys to prevent u-boot from auto-booting.
the following commands boot inferno:

	dhcp    # configure ethernet
	tftp    # fetch kernel
	bootm   # boot the kernel

the default boot command can be set like so:

	setenv bootcmd 'dhcp; tftp; bootm'
	saveenv

booting from nand flash is also possible.  the first 1mb of nand
is used for u-boot.  we'll use the linux convention of the 4mb after
that for the kernel and the remainder of the memory for the file
system.  u-boot has commands to write to flash memory.  the kernel
should be in RAM at that point (which you can do by reading from
the network, SD card, etc.).  for example:

	bootp
	tftp  # fetches kernel from network, places it at 0x2000000 in my u-boot
	nand erase 0x00100000 0x00400000  # erase 4mbyte, starting at 1mbyte offset
	nand write.e 0x2000000 0x00100000 0x00400000  # write kernel from RAM (where tftp put it) to nand at 1mbyte offset.  this writes 4m.
	                                              # .e skips bad blocks.  it is probably wise to write only the size of the kernel to flash.

to boot this flash kernel:

	nand read.e 0x2000000 0x00100000 0x00400000
	bootm 0x2000000


once booted, to configure network with dhcp, and provide shells on
the telnet port:

	run /netrc


# licence

the kernel code is released under the same licence as the inferno-os
code.

mkuimage is public domain, written by mechiel lukkien, reachable
at mechiel@ueber.net or mechiel@xs4all.nl.