|
Message
From: Jure Menart <jure@k...>
Date: Sun, 26 Oct 2003 17:48:50 +0100
Subject: [openrisc] or1ksim port to FreeBSD
Hi,
I made a patch, which supports building or1ksim on FreeBSD 5.x (I didn't
test earlier versions, but there shouldn't be any problem).
I don't have check in CVS permissions, so I would be really grateful if anyone
would take time and commit patched version of or1ksim.
Patch get be retrieved from:
http://hannanges.kom.org/stuff/freebsd_or1ksim.patch
Changes I've made:
- include malloc.h changed with stdlib.h (where there isn't
stdlib.h included before), because FreeBSDs libc has malloc &
stuff now defined in stdlib.h.
- strndup() in peripheral/channels/ is linked with libroken (defined in
roken.h). All necessary checks are performed in configure process.
- ceil() is linked with libm (math library).
- few necessary #ifdef __FreeBSD__ in code
- xterm.c is not fully functional, I replaced on_exit() with atexit(),
but there is not the same functionality. For solution please, read
below.
- in testbench/ there is minor change in test script. When using
tail(1), I've changed "-n 2" argument to the first place after tail
(yes silly, but FreeBSD's getopt() demands options in the first
place and then other arguments). There shouldn't be any problems
with that on Linux systems.
I've made a patch appliable to the todays snapshot from CVS (I've checked out
at about 16:30 in slovenian time).
Patch should be applied:
cd <path to directory or1ksim>
patch -p1 u < <path to patch>/freebsd.patch
Problems with on_exit() in xterm.c:
on_exit() function does not conform to the standard ISO 9899 and there isn't
this function in BSDs C library. Because I'm new at this project I don't want
to make any big changes to the code, without asking (and getting approval)
first. These are few solutions:
1. Most changes in code, but most clean
I think we should add global data to the channel_ops structure and work with
this global data (initialize it in init() functions, free it in close()
functions,...). There will be no more problems with passing arguments to the
on_exit() function, and we could easily used standard atexit() function. I
would recommend that we add this global data to all files (not only to the
xterm.c) in peripheral/channels so there will be much cleaner and consistent
code. There will be few changes (open, close, free... function wouldn't take
any arguments) but the code would be more portable.
I could make this patch within a week.
2. Not clean solution
Another solution is to _globalize_ data only in xterm.c - but I think this
would make code unconsistent.
(I could make even another xterm.c and than in configure process decide which
on to use - but I think it's really not nice solution)
3. Ignore the problem
Ignore the problem and hope that everything will be alright ;-) Well I really
think we shouldn't do that.
I would really appreciate any comments and ideas on this one, so I could make
or1ksim fully functional on FreeBSD.
Best regards,
Jure Menart
|
 |