Subject: MPC860 port, various questions
To: , <tech-embed@netbsd.org>
From: Arne Jansen <a.jansen@biodata.de>
List: port-powerpc
Date: 04/30/2001 14:46:45
Hi,

we decided to use NetBSD for an embedded project on a MPC860,
so I am currently doing the port. I am now at the point where
I have the box up and running in multiuser mode.
Starting point was the work available on the net from David
Querbach (softfloat) and Tsubai Masanari (arch/mpc860 tree).
So far so good, but I still have several problems for which
I seek help:

 - nfs: Currently the box boots as a diskless client and nfs
   mounting works fine, except writing files: if I build
   pwd.db with pwd_mkdb, the db is corrupt. The first 4096
   bytes are 0. Tracking down the problem, I found that it
   occurs with backward seeks. The code fragment
     fd = open("testfile", O_WRONLY | O_TRUNC | O_CREAT, 0666);
     memset(buf, 1, 4096);
     pwrite(fd, buf, 1024, 4096);
     pwrite(fd, buf, 1024, 0);
     close(fd);
   produces a corrupted file with the first 4096 bytes set to
   zero. Using lseek() instead of pwrite() renders the same. If
   the second write writes 4096 instead of 1024 bytes, the file
   is written correctly. I used NetBSD-current, trying the same
   sources on an i386 works fine.
   Any suggestions/ideas where I might start debugging? I'm not
   familiar with NFS )-:
 - cache: if I enable the instruction cache, the box crashes in
   an early boot phase (no output yet). I am not sure at which
   point in bootup to enable the cache and if there is cache
   support built into the powerpc port. What might be critical
   with cache operation?
 - stdargs: when using gcc 2.95.2/3, varargs do not work. The
   problem seems to be a broken gcc/incompatible header.
   __builtin_args_info[4] returns 1 instead of 12. It seems to
   me that the gcc guys realised the problem but fixed it by
   building a new way to handle varargs and left the old way
   broken. So the netbsd (arch/powerpc/include/stdarg.h) headers
   are incompatible.
 - stdargs: when using egcs 1.1.1 the above described problem
   do not occur. But there is a problem with added softfloat
   support, because the header assumes hardware floating point.
   I modified the header, but am not sure how to integrate the
   modification into the tree, i.e. which macro to use
   (SOFTFLOAT? _SOFT_FLOAT? __SOFT_FLOAT?).
 - Did anyone build a flash filesystem taking flash write cycles
   and limited space (compression) into account?
 - Are there instructions available to build an embedded system
   with very limited ROM (4 MB) with a list of files required
   (or suggested) for minimal operation, and stripped down rc files?
 - (more to follow)

I would be very glad about any hints on any of these topics.

If anyone is interested in the work if have done, please contact me.
The next I have to do is clean up the code and try to integrate it
into the NetBSD tree. Unfortunately I am new to NetBSD and do not
know the tree structure/makefiles well enough to do a proper inte-
gration on my own. So if anyone likes to see an official port,
I'm afraid that someone has to help with this.
For example there are many options how to configure the hardware,
which port pins to use, which SCC to use as console etc. How should
this configuration be done? Hardcoded into a .c file under arch/...
or via config?

Again, if anyone is willing to help or interested in the work already
done, feel free to contact me. But before I can give any work away
I feel I have to contact David Querbach and Tsubai Masanari if I may
redistribute their work, even if I don't find any copyright notices
in it.

Arne