[comp.os.minix] Minix-386 works!

hp@vmars.tuwien.ac.at (Peter Holzer) (12/03/90)

Last week I asked for help with my problems with Minix-386.
The symptom was that init died before it could do anything.

Various people have sent me their guesses at what I could have done
wrong. After becoming more and more confused because I had done
everything right, I read the following article:

obrien@torolab2.iinus1.ibm.com (Kevin O'Brien) writes:

>I also had this problem. After spending some time with db, and putting
>print statements in fs and mm, I discovered that init was using more
>stack space than the 0x1c bytes that INIT_STK (I think thats the name)
>was defined as. It got a segmentation error and was killed. This is why,
>at least in my case, init doesn't appear when you hit F1. I made the
>initial stack for init very large (by changing the constant mentioned
>above, my first attempt, doing a chmem, had no effect - init is special!)
>and after rebuilding init worked like a charm.

This set me in the right direction. A few printfs in the fs and mm
assured me that init got a segmentation error (signal 11) before it
could call sync () (The first action in main ()). Now that I knew this I
inspected the startup code and found that I had linked with the wrong
one! 

John Nall wrote in his tutorial:

cc -3 -D_MINIX -D_POSIX_SOURCE init.c -o /etc/system/init

This links with the default startup code crtso.o . Init needs a special
startup code instead, just like kernel, mm, and fs.
The correct way to compile init is:

cc -3 -c -D_MINIX -D_POSIX_SOURCE init.c
ld -3 -i -o /etc/system/init /usr/local/lib/i386/head.o init.o	\
	/usr/local/lib/i386/libc.a

The paths may be different, if you have bcc installed somewhere else or
want the executable on a floppy.

John, if you are listening, could you change this in your tutorial. I am
sure others will fall into the same trap (Although not everybody will
follow you as blindly as I did :-)

Happy again,
	Peter.

--
|    _  | Peter J. Holzer                       | Think of it   |
| |_|_) | Technical University Vienna           | as evolution  |
| | |   | Dept. for Real-Time Systems           | in action!    |
| __/   | hp@vmars.tuwien.ac.at                 |     Tony Rand |