Subject: single-user shell on Dreamcast
To: None <port-sh3@netbsd.org>
From: Hiroyuki Bessho <bsh@grotto.iijnet.or.jp>
List: port-sh3
Date: 10/17/2000 00:36:47
I made sh3 kernel with file system image which has sh and init on it,
uploaded the kernel to DC, and got this.

  NetBSD 1.5G (TINY) #16: Mon Oct 16 23:32:02 JST 2000
      bsh@kamasu.grotto.iijnet.or.jp:/u0/work/current/dreamcast/compile/TINY
  total memory = 16384 KB
  avail memory = 13744 KB
  using 230 buffers containing 920 KB of memory
  mainbus0 (root)
  shb0 at mainbus0
  scif0 at shb0 port 0xffe80000-0xffe8000f irq 12
  scif0: console
  biomask c0000000 netmask c0000000 ttymask e0000000
  md0: internal 640K image area
  rn_init: radix functions require max_keylen be set
  boot device: <unknown>
  root on md0a dumps on md0b
  readclock: -1900/0/0/0/0/0(0)
  WARNING: clock time is invalid.
  WARNING: reset to epoch time!
  init: copying out flags `-s' 3
  init: copying out path `/sbin/init' 11
  # echo Hello World!
  Hello World!
  # echo *
  bin dev dist etc kern mnt mnt2 sbin tmp usr
  # echo bin/*
  bin/-sh bin/sh
  # echo sbin/*
  sbin/init
  # 

    Thank you for previous advice on MACHINE/MACHINE_ARCH things.
What I did to my local tree were:

+ I have sys/arch/dreamcast/{conf,dreamcast,include}.  Not so much
  difference to sys/arch/evbsh3/ yet.  Almost all include/foo.h just
  #includes corresponding sh3/foo.h.

+ I also have distrib/dreamcast to make some ramdisk-kernels.

+ sys/arch/dreamcast/include/endian_machdep.h is like this:

  #ifndef __LITTLE_ENDIAN__	/* compiling with -ml */
  #if 0  /* Doesn't work for cpp  */
  #error You are compiling with wrong option.
  #endif
  #endif

  #define _BYTE_ORDER _LITTLE_ENDIAN
  #include <sh3/endian_machdep.h>

+ compile the tree with MACHINE=dreamcast and MACHINE_ARCH=sh3, using
  shel-netbsdcoff toolkit.  This requires sys/arch/sh3 can be compiled
  for both big and little endian.

This way so far works fine to me, but many files are duplicated for
evbsh3/mmeye/dreamcast.  I hope NetBSD developers discuss further on
this and make a good decision.  It will be important also for people
who want to start hpcsh3 (HP's CE device, etc.).


Currently I'm aware of some problems like:

  + can't get date/time from RTC.
  + sleep() doesn't work.

I'm going to play with these, and any suggestions will be appreciated.

It took me about a month to get this working.  Besides not having much
free time, it was because I choose at first to compile the tree with
ELF format, and got several problems.  It seems sh3 ELF support is
incomplete yet.  I'll come up with this issue later.

----
bsh.