[comp.os.minix] Building kernel under MINIX-386

hgv@daphne.network.com (Harry G. Varnis) (02/13/91)

I swear this is my last novice/startup posting!

I've got MINIX-386 running (good stuff!) but am not setup to easily boot
a 16-bit operating environment now to use the regular cpp for kernel's .x
files.  I've tried using GNU cpp but get something roughly like "unterminated
constant expression" for start.x, etc.

Pointers/instruction on the cpp situation under MINIX-386 would be
appreciated.

Much Thanks,
-- 
Harry Varnis         <hgv@anubis.network.com>          (612) 424-4888

kevin@nuchat.sccsi.com (Kevin Brown) (02/13/91)

In article <1991Feb12.175520.20681@ns.network.com> hgv@daphne.network.com (Harry G. Varnis) writes:
>
>I swear this is my last novice/startup posting!
>
>I've got MINIX-386 running (good stuff!) but am not setup to easily boot
>a 16-bit operating environment now to use the regular cpp for kernel's .x
>files.  I've tried using GNU cpp but get something roughly like "unterminated
>constant expression" for start.x, etc.
>
>Pointers/instruction on the cpp situation under MINIX-386 would be
>appreciated.

I ran into the very same problem.

I have two versions of cpp on my system: GNU cpp and a version of cpp written
by Martin Minow.  That version of cpp is available via ftp from 
plains.nodak.edu (under pub/Minix/oz, I think).  It is the latter version
that I use.

In order to get it to work properly, you have to change the Makefile in the
kernel.  You need to add -E to CPPFLAGS.  That will cause it to show the
"errors" it generates above, but it will return zero anyway.  Presumably
you could do the same thing for GNU cpp, but GNU cpp generates some other
error that it considers fatal.

I don't know why the people writing cpp didn't write them in such a way
that an "unterminated string constant" is a WARNING instead of an error!

Anyway, grab Minow's cpp, fix up cpp3.c so that the error message it prints
when you give it a bad option is done with multiple fprintf()s instead of
one with line continuation (I think this is necessary to get bcc to compile
it), and you should be in business (I am, at least)...

>Much Thanks,

No problem.  :-)

>Harry Varnis         <hgv@anubis.network.com>          (612) 424-4888


--
Kevin Brown						Disclaimer: huh?
nuchat!kevin@uunet.uu.net				csci31f7@cl.uh.edu 

Minix -- the Unix[tm] of the 90's.  System V -- the Multics of the 90's.  :-)

eesrajm@cc.brunel.ac.uk (Andrew J Michael) (02/15/91)

In article <1991Feb12.175520.20681@ns.network.com>, hgv@daphne.network.com (Harry G. Varnis) writes:
> 
> I swear this is my last novice/startup posting!
> 
> I've got MINIX-386 running (good stuff!) but am not setup to easily boot
> a 16-bit operating environment now to use the regular cpp for kernel's .x
> files.  I've tried using GNU cpp but get something roughly like "unterminated
> constant expression" for start.x, etc.
> 
> Pointers/instruction on the cpp situation under MINIX-386 would be
> appreciated.
> 
> Much Thanks,
> -- 
> Harry Varnis         <hgv@anubis.network.com>          (612) 424-4888


I assume that you are trying to build a completely gcc-compiled kernel.  I've
currently got mm and fs running, but the kernel itself is more difficult.

There are two problems here.  The obvious one is that gcc (or more accurately,
gas) uses the AT&T 386 assembler syntax rather than the Intel one.  You will
therefore need to convert all the statements in *.x to AT&T syntax.

Secondly, and perhaps less obvious, gcc is a 32-bit compiler, and expects the
code it produces to be running in 32-bit protected mode.  On startup, the
MINIX kernel isn't in protected mode; this change is made partway through the
start.x file.  You therefore have to be very careful what you actually tell
the assembler to do, and in any case gas will insist on producing 32-bit
addresses for jumps.  In fact I'm not even sure if it is possible to get this
all to work, but I'm still trying.

My thanks at this point to Bruce Evans, who keeps holding my hand, and is
probably laughing his head off at the idea of ME telling someone else about
the wonders of the 386 ......

Andy Michael


-- 
Andy Michael (eesrajm@cc.brunel.ac.uk)      "You might think that.  I
85 Hawthorne Crescent                        couldn't possibly comment."
West Drayton
Middlesex                                  
UB7 9PA