[comp.os.minix] Compiling Minix ar

greg@mobius.Viewlogic.COM (Gregory Larkin) (01/09/91)

OK, call me crazy, but.....

I posted this morning about doing source code patching for Minix on a
SPARCStation to get 1.5.10 sources.  Well, I have transferred all of
the source code successfully and now I want to start patching.

The only problem is this:  the .a files from Minix are not the same
format as SunOS .a files, thus the Sun ar(1) cannot extract the Minix
.a files.

So I think "No problem, I'll just compile ar.c from Minix on the Sun".
Well, this does and doesn't work.  cc(1) will not compile it, gcc(1)
will..  So I go with gcc!!

I have a working executable, but I used Sun header files, so it will 
not recognize the Minix .a format yet.

I noticed the presence of a file /usr/include/ar.h (both in Minix and
SunOS).  I would expect this file to be included by ar.c, but it is
not!!!  It is not included by any .h file that ar.c includes, either!

Does anyone know how I can compile Minix's ar.c on the Sun, with the
correct ar.h information??

Thanks for any help,
--
Greg Larkin (ASIC Engineer)
Viewlogic Systems, Inc. (The CAE Company)
293 Boston Post Road West ____________________________________________
Marlboro, MA 01752        |"This is a fragile ball we are living on; |
508 480 0881 x321         |it's a miracle and we are destroying it.."|
Email: greg@Viewlogic.COM |Peter Garrett, Midnight Oil               |
                          --------------------------------------------

greg@mobius.Viewlogic.COM (Gregory Larkin) (01/09/91)

More info on this problem.....

I'm just guessing, but (I'm not a CS person!!) I think the problem
I'm having is that (obviously) the SPARCstation uses different byte-
ordering and/or sizes for ints, longs, etc.

Doing a sum(1) on the PC for the file h.a says: 22515 46
On the SPARC, it says:                          22515 23

I assume this indicates that Minix and SunOS have different block
size definitions.  Does it indicate anything else?

If I do an od(1) on the file h.a on the PC, the first record of the
file is "177545" which just happens to be the archive magic number 
for Minix.

If I do an od(1) on the SPARC, the first record is "062777", which 
is *not* the correct number..

Therefore, can anyone enlighten me about the byte differences between
PCs and SPARCstations and more importantly,

Is there anyway I can extract .a files on the SPARC????

Thanks a lot,
--
Greg Larkin (ASIC Engineer)
Viewlogic Systems, Inc. (The CAE Company)
293 Boston Post Road West ____________________________________________
Marlboro, MA 01752        |"This is a fragile ball we are living on; |
508 480 0881 x321         |it's a miracle and we are destroying it.."|
Email: greg@Viewlogic.COM |Peter Garrett, Midnight Oil               |
                          --------------------------------------------

thomas@trane.UUCP (Thomas Driemeyer) (01/12/91)

In article <1991Jan8.152501@mobius.Viewlogic.COM>, greg@mobius.Viewlogic.COM (Gregory Larkin) writes:
> The only problem is this:  the .a files from Minix are not the same
> format as SunOS .a files, thus the Sun ar(1) cannot extract the Minix
> .a files.

Here is a short hack that extracts files from a Minix archive on a non-Minix
system. I used it on a Sun-3 to extract the sources from the Minix-ST 1.1
distribution disks. It's called marx, Minix Archive Extractor.
Usage: marx minixarchive.a*

I don't have Minix 1.5, but I think the archive format didn't change.
The code assumes it's running on a big-endian machine, the lines that
need to be changed if not are marked. Like I said, a hack.

I hope this helps.

Thomas Driemeyer
...!pacbell!trane!thomas


begin 644 marx.c
M+RH*("H@36EN:7@@87(@+7@*("H*("H@17AT<F%C=',@9FEL97,@9G)O;2!A
M($UI;FEX(&%R8VAI=F4N($UI;FEX(&%R8VAI=F5S(&%R92!Q=6ET92!A<F-H
M86EC(&%N9 H@*B!I;F-O;7!A=&EB;&4@=&\@56YI>"]"4T0@87)C:&EV97,N
M"B J($QI;F5S(&UA<FME9"! 0$ @9&5P96YD(&]N('1H92!B>71E('-E>"P@
M22=M('1O;R!L87IY('1O('=R:71E('-O;65T:&EN9PH@*B!P;W)T86)L92X@
M5&AE(&-O9&4@=V]R:W,@;VX@82!3=6XM,RX*("H@075T:&]R.B!P>7)A;6ED
M(7!A8V)E;&PA=')A;F4A=&AO;6%S+"!P=6)L:6,@9&]M86EN"B J+PH*(VEN
M8VQU9&4@/'-T9&EO+F@^"@HC9&5F:6YE($U!1TE#(#!X,F-F9@D)"2\J0$! 
M*B\*"G-T<G5C="!H9'(@>PH)8VAA<@EH7VYA;65;,31=.PH)8VAA<@EH7V1A
M=&5;-%T["@EC:&%R"6A?=6ED6S)=.PH)8VAA<@EH7V=I9#L*"6-H87():%]M
M;V1E.PH)=6YS:6=N960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