Re: Compilation of Minix kernel and clock & system tasks on Linux done!
- From: "Antoine Leca" <root@xxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Nov 2008 13:17:37 +0100
En
news:57289c91-e142-45fb-b2b9-979fefc5cc5f@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
kashyap va escriure:
The Minix kernel and the clock and system tasks can now be built
(compile only) on a Linux box like this -
svn co \
http://powerpack.googlecode.com/svn/trunk/ powerpack-read-only
cd powerpack-read-only/src
make
It will build an ELF kernel that GRUB can understand!!!
Nice effort.
However, I see a couple of problems at first sight:
* The code in multiboot.h and boot.S is inappropriate for licensing reasons:
either you make your whole project GPL (but please make it clear); or you've
to restrict yourself to not include any GPL'ed code; I believe you should
also include the src/LICENSE from the original distribution.
* I do not understand clearly why you are using nasm instead of GNU
assembler (using asmconv); anyway, the code in several .nasm files like
lib/i386/misc/io*.nasm seems to be using 16-bit mnemonics and conventions,
but producing the codebytes adequate for 32-bit mode (obtained with ndisasm
but you didn't pass the -b32 option?): the assembled result will be wrong
when passed to nasm -f elf (which expects normal 32-bit code.) Other .nasm
files in the distribution seem to not be translated at all from the original
Xenix/ACK dialect.
* Do pass the -ffreestanding flag to GCC when compiling the kernel, else GCC
may intend some nasty optimisations which are usually OK for hosted code
(i.e. code linked with a standard libc.a library), but could prove wrong for
a kernel; check the relevant
http://gcc.gnu.org/onlinedocs/gcc-V.V/gcc/C-Dialect-Options.html (replace
V.V with the appropriate value) page for the gory details; this may have the
effect to request the link-in of several more str* or mem* functions, which
GCC will _not_ substitute automatically like it does in -fhosted mode: then
use the appropriate #define mem... __builtin_mem... if needed.
* You forgot to pass -D_EM_WSIZE=4 -D_EM_PSIZE=4 (or perhaps =__WORDSIZE
instead of hardcoded 4), which are predefined by ACK compiler and assumed by
several source files, but unknown to vanilla GCC. ACK used to predefine
also -D_EM_SSIZE=2 -D_EM_LSIZE=4 -D_EM_FSIZE=4 -D_EM_DSIZE=8, but I doubt
they are actually used in the code. Of course the right fix here is to
recode all this stuff to avoid such explicit dependance, but it could prove
quite a bit trickier. The nastier use I saw was in
include/minix/sys_config.h (which is included almost everywhere :-( ):
/* Word size in bytes (a constant equal to sizeof(int)). */
#if __ACK__ || __GNUC__
#define _WORD_SIZE _EM_WSIZE
#define _PTR_SIZE _EM_WSIZE
#endif
Since that code is clearly a derivative of 2.0.4 (only difference is the
addition of ||__GNUC__) and not related at all with Minix-VMD, my guess is
that this is a quick fix/hack (actually r765 in SVN tree,
https://gforge.cs.vu.nl/plugins/scmsvn/viewcvs.php?rev=765&root=minix&view=rev),
in phase with Minix' port of GCC, which adds this "feature" of pre-#defining
_EM_?SIZE, and fails to document it loudly :-(... See
gcc/config/i386/minix.h; in SVN it's r1765 for GCC3
(https://gforge.cs.vu.nl/plugins/scmsvn/viewcvs.php?rev=1765&root=minix&view
=rev); or r2441 for GCC4
(https://gforge.cs.vu.nl/plugins/scmsvn/viewcvs.php?rev=2441&root=minix&view
=rev, easier to browse.)
Antoine
.
- Follow-Ups:
- References:
- Prev by Date: Interview A.Tanenbaum
- Next by Date: Re: Solution for Pseudo Stacks of Tasks
- Previous by thread: ANNOUNCE: Compilation of Minix kernel and clock & system tasks on Linux done!
- Next by thread: Re: Compilation of Minix kernel and clock & system tasks on Linux done!
- Index(es):
Relevant Pages
|