File: README.zlib

package info (click to toggle)
oskit 0.97.20000202-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 58,008 kB
  • ctags: 172,612
  • sloc: ansic: 832,827; asm: 7,640; sh: 3,920; yacc: 3,664; perl: 1,457; lex: 427; makefile: 337; csh: 141; awk: 78
file content (174 lines) | stat: -rw-r--r-- 6,982 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
========================================================================

 How to build and install zlib for the OS Kit.

========================================================================

1. First, build and install the OS Kit.  Remember the --prefix directory
in which the OS Kit was installed.  I will refer to the prefix directory
as $prefix in this document.

I'm setting a csh variable here to my prefix:

    set prefix = /home/css/grad/gback/CVS/flava/inst


2. Get and untar zlib.tar.gz from somewhere, for instance,
from the zlib homepage at http://www.cdrom.com/pub/infozip/zlib/
I got version 1.1.2.  Note that I hadn't had any luck building it unless
I built it in the directory where I untared it.  That is because despite
its name, their configure script does not use GNU's autoconf.  I personally
don't blame them for not using this piece of wonder-software.

Now add $prefix/bin to your path:

    set path = ($prefix/bin $path)

and set some environment variables:

    setenv CC i486-oskit-gcc
    setenv AR "i486-linux-ar cr"
    setenv RANLIB i486-linux-ranlib

Note that you must set $CC to the script that resides in $prefix/bin,
whereas AR and RANLIB must be set to the tools you used to build the OS Kit.
You will find the latter in your build directory in Makeconf, look for lines
that export these variables:

Excerpt from my Makeconf:
    export AR       = i486-linux-ar
    export RANLIB   = i486-linux-ranlib

Now we're ready to configure libz:

    gback@marker [45](/x/gback/zlib-1.1.2) > ./configure --prefix=$prefix
    Building static library libz.a version 1.1.2 with i486-oskit-gcc.
    Checking for mmap support... No.

and to make and install it:

    gback@marker [101](/x/gback/zlib-1.1.2) > make
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c example.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c adler32.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c compress.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c crc32.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c gzio.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c uncompr.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c deflate.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c trees.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c zutil.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c inflate.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c infblock.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c inftrees.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c infcodes.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c infutil.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c inffast.c
    i486-linux-ar cr libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o  zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -o example example.o -L. -lz
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -c minigzip.c
    i486-oskit-gcc -O3 -DHAVE_UNISTD_H -o minigzip minigzip.o -L. -lz

    gback@marker [102](/x/gback/zlib-1.1.2) > make install
    i486-linux-ar cr libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o  zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
    cp zlib.h zconf.h /home/css/grad/gback/CVS/flava/inst/include
    chmod 644 /home/css/grad/gback/CVS/flava/inst/include/zlib.h /home/css/grad/gback/CVS/flava/inst/include/zconf.h
    cp libz.a /home/css/grad/gback/CVS/flava/inst/lib
    cd /home/css/grad/gback/CVS/flava/inst/lib; chmod 755 libz.a
    cd /home/css/grad/gback/CVS/flava/inst/lib; if test -f libz.so.1.1.2; then  rm -f libz.so libz.so.1;  ln -s libz.so.1.1.2 libz.so;  ln -s libz.so.1.1.2 libz.so.1;  (ldconfig || true)  >/dev/null 2>&1;  fi

You should now have a libz.a library in your $prefix/lib directory.
Make sure you do:

gback@marker [49](/x/gback/zlib-1.1.2) > ls -l $prefix/lib/libz.a 
-rw-r--r--  1 gback  cs-rsrch  66572 May 30 14:55 /home/css/grad/gback/CVS/flava/inst/lib/libz.a

BTW, the example that was build is a fully functional multiboot kernel.
You can test it by adding the following lines to the main function in 
example.c:

--- example.c   Wed Mar 11 05:53:36 1998
+++ ../zlib-1.1.2/example.c     Sat May 30 15:36:08 1998
@@ -509,6 +509,13 @@
     uLong uncomprLen = comprLen;
     static const char* myVersion = ZLIB_VERSION;
 
+#ifdef OSKIT
+    fd_set_console();
+    fs_init(oskit_bmod_init());
+    if (argc > 1) argv[1] = "foo.gz";	/* see test_gzio */
+    if (argc > 2) argv[2] = "foo.gz";	/* see test_gzio */
+#endif
+
     if (zlibVersion()[0] != myVersion[0]) {
         fprintf(stderr, "incompatible zlib version\n");
         exit(1);

This will give you a RAM disk root filesystem and enable stderr.
Don't forget to type make again!

You can either use mkbsdimage to build a BSD image or use the netboot
kernel to test it.  In the following example, I'm using the netboot 
kernel to get the kernel from /x/gback/zlib-1.1.2 on host marker.cs.utah.edu
(note that you must normally give the IP address of the host -- refer to
the netboot documentation for details).

    NetBoot> marker:/x/gback/zlib-1.1.2/example
    Root server: 155.99.212.61, dir: /x/gback/zlib-1.1.2,
      file: example,  cmdline: ` -retaddr 0x07fdae68 -h -f'
    Mounting /x/gback/zlib-1.1.2...
    Looking up example...
    Kernel will be at 00100000-0012b128 text+data 100224 bss 76200
    Loading example...
    Shutting down timer
    MultiBoot Info (flags: 0x5<MEMORY,CMDLINE>)
      PC Memory: lower 640K, upper 129892K
      Kernel command line: ` -retaddr 0x07fdae68 -h -f'
    Booting kernel...

    uncompress(): hello, hello!
    gzread(): hello, hello!
    gzgets() after gzseek: hello!
    inflate(): hello, hello!
    large_inflate(): OK
    after inflateSync(): hello, hello!
    inflate with dictionary: hello, hello!
    _exit(0) called; rebooting...

Pretty cool, isn't it?

You can also boot it as a BSD or Linux kernel and boot it directly
from the boot prompt.  I show the BSD kernel here:

    mkbsdimage example			# creates Image
    cp /home/css/x/gback/zlib-1.1.2/Image /zlibImage

    >> FreeBSD BOOT @ 0x10000: 638/65532 k of memory, serial/dual console
    Boot default: 0:sd(0,a)kernel

    Boot: /zlibImage
    Booting 0:sd(0,a)/zlibImage @ 0x100000
    text=0x5000 data=0x5c2b0 bss=0x2adc symbols=[+0x274+0x4+0x1290+0x4+0xda3]
    total=0x16603b entry point=0x100000
    MultiBoot->BSD boot adaptor (compiled Apr  6 1998)
    using extended memory 00163d8c-08000000
    kernel at 00100000-0012b128 text+data 100224 bss 76200
    MultiBoot Info (flags: 0x7<MEMORY,BOOT_DEVICE,CMDLINE>)
      PC Memory: lower 640K, upper 130048K
      Boot device: {128,255,0,255}
      Kernel command line: `-h -f root=sd0a '
    Booting kernel...

    uncompress(): hello, hello!
    gzread(): hello, hello!
    gzgets() after gzseek: hello!
    inflate(): hello, hello!
    large_inflate(): OK
    after inflateSync(): hello, hello!
    inflate with dictionary: hello, hello!
    _exit(0) called; rebooting...


Written by Godmar Back <gback@cs.utah.edu>
University of Utah
May 30, 1998