Subversion Repositories tendra.SVN

Rev

Rev 6 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 1
<?xml version="1.0" standalone="no"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4
 
5
<!--
6
  $Id$
7
-->
8
 
9
<book>
10
  <bookinfo>
11
    <title>Validation of TenDRA Capability to Implement a Set of Commands for
12
      the Linux Operating System</title>
13
 
14
    <corpauthor>The TenDRA Project</corpauthor>
15
 
16
    <authorgroup>
17
      <author>
18
        <firstname>Fran&ccedil;ois</firstname>
19
        <surname>de Ferri&egrave;re</surname>
20
        <affiliation>
21
          <orgname>Open Software Foundation Research Institute</orgname>
22
        </affiliation>
23
      </author>
24
 
25
      <author>
26
        <firstname>Fred</firstname>
27
        <surname>Roy</surname>
28
        <affiliation>
29
          <orgname>Open Software Foundation Research Institute</orgname>
30
        </affiliation>
31
      </author>
32
 
33
      <editor>
34
        <firstname>Jeroen</firstname>
35
        <surname>Ruigrok van der Werven</surname>
36
      </editor>
37
    </authorgroup>
38
 
39
    <abstract>
40
      <para>This report describes work done under contract to the Defence
41
        Research Agency (DRA) of the U.K.  It is an extension of an earlier
42
        contract to assess the capability of the DRA TenDRA technology to
43
        express a fully portable operating system implementation.</para>
44
    </abstract>
45
  </bookinfo>
46
 
47
  <chapter>
48
    <title>Executive Summary</title>
49
      <para>During a first phase of the project the main goal was to examine
50
        the extent to which the TenDRA technology could be used to compile a
51
        complete operating sytem. This experiment was carried out on the
52
        Unixware operating system on an Intel 486 platform. Although Unix
53
        sources are known to be compiler dependent, it was found that most of
54
        the code could be compiled with no, or minor, modifications.  Details
55
        of the results can be found in a
56
        <biblioref linkend="Ferri&egrave;re95-2">report</biblioref>.
57
      </para>
58
 
59
      <para>The goal of this second phase of the project was
60
        to study the feasibility of producing Unix commands in architecture
61
        neutral (ANDF) format which could be readily ported to different
62
        hardware platforms running the same operating system.  The target
63
        system chosen for this second phase was Linux, which was available on
64
        both the Intel and DEC Alpha platforms (although the latter was
65
        incomplete at the beginning of the project).</para>
66
 
67
      <para>The experiment carried out during this second phase was very
68
        successful.  A significant amount of complex code was converted to the
69
        architecture neutral ANDF format, and the portability of this code was
70
        demonstrated. However, due to time constraints, the number of commands
71
        ported to both platforms was more limited than had been hoped.  The
72
        project also provided some interesting lessons about the strengths and
73
        limitations of the ANDF/TenDRA technology and about API issues.This is
74
        the final report on work undertaken on the Linux operating system on
75
        the Intel/i386 and Digital/Alpha platforms.</para>
76
  </chapter>
77
 
78
  <chapter>
79
    <title>2. Objectives and Description</title>
80
 
81
    <sect1>
82
      <title>2.1 Objectives</title>
83
 
84
      <para>In previous work, we performed validation, performance and
85
        robustness testing of the TenDRA technology to ensure its capability
86
        to implement and fully bootstrap a UNIX-like operating system. We also
87
        provided an assessment of the capability of TenDRA technology to
88
        express a fully portable operating system implementation. This work
89
        was very successful, and the results are reported in a
90
        <biblioref linkend="Ferri&egrave;re95-2">summary report</biblioref>.
91
      </para>
92
 
93
      <para>However, though we originally planned to conduct this first
94
        experiment on two different architectures, an Intel/486 and a
95
        Sun/Sparc platforms running UnixWare, it was completed only for the
96
        Intel/486 platform.  After discussions with DRA, it was then decided
97
        to focus the second part of the project on the Unix commands, and to
98
        switch from the UnixWare to the Linux operating system. The
99
        motivations for a revised plan were:</para>
100
 
101
      <itemizedlist>
102
        <listitem>OSF is developing a Linux server for the Intel/486 and
103
          PowerPC platforms, and we would like to deliver the set of
104
          associated commands in ANDF format. In the event, native Linux
105
          commands for PowerPC became available in the meantime.</listitem>
106
 
107
        <listitem>Repeating on the Sparc platform the work already done on the
108
          i486 platform would bring little added-value, while requiring a
109
          significant amount of work.  The major benefit of the work on a
110
          second platform would be to demonstrate that a set of commands along
111
          with its API can be defined in ANDF format and then installed on two
112
          different platforms.</listitem>
113
      </itemizedlist>
114
 
115
      <para>Thus, the objective of the second part of the project is the
116
        production in ANDF format of Linux commands, and their installation on
117
        two platforms. This will demonstrate the ability of the TenDRA
118
        technology to produce a set of architecture neutral commands and, at
119
        completion of the project, will provide a set of freely distributable
120
        commands in ANDF format.</para>
121
 
122
      <para>The project, which lasted 9 months, started on July 1995, and was
123
        finished at the end of March 1996.</para>
124
 
125
      <para>This report summarizes all the work done under the contract for
126
        this second part of the project.</para>
127
    </sect1>
128
 
129
    <sect1>
130
      <title>2.2 General description</title>
131
 
132
      <para>The commands, one part of a Unix system, are based on some
133
        standard APIs, XPG3 for example, plus some extensions, which together
134
        form the interface shared with the libraries against which they are
135
        built. The commands should not have any assembly code, unlike the
136
        other parts of a Unix system.</para>
137
 
138
      <para>As for other software OSF already ported to ANDF, the port of the
139
        Linux commands is done in three steps:</para>
140
 
141
      <itemizedlist>
142
        <listitem>The NAT-NAT step, which consists in rebuilding the commands
143
          with the native compilation chain, to ensure that they can be
144
          regenerated from their source files.</listitem>
145
 
146
        <listitem>The DRA-NAT step, for which the TenDRA technology is used as
147
          a replacement of the native compilation chain to build the commands,
148
          using the native system header files, as for a classical compilation
149
          chain. This part involves dealing with discrepancies between the
150
          native and the TenDRA code generators.</listitem>
151
 
152
        <listitem>The DRA-DRA step, which will consist in using the TenDRA
153
          technology as a portability tool. The API shared by the commands and
154
          libraries is defined, and used to produce the commands in
155
          architecture independent ANDF code. This code will be installed and
156
          validated on the selected machines.</listitem>
157
      </itemizedlist>
158
 
159
      <para>We initially planned to conduct the experiment on the Intel/i386
160
        and IBM/PowerPc platforms, both running the Linux operating system.
161
        However, the Linux system for the IBM/PowerPC platform was still under
162
        development at the time we needed it, in December 1995. So we decided
163
        to replace it by a Digital/Alpha platform, the only other platform for
164
        which a Linux port was sufficiently advanced at that time.  However,
165
        it is a 64-bit platform, so this switch was more of a challenge,
166
        because of the fundamental change in data sizes. It provided
167
        additional tests of the TenDRA portability attributes.</para>
168
 
169
      <para><A NAME="90"></A></para>
170
    </sect1>
171
  </chapter>
172
 
173
  <chapter>
174
    <title>3. Description of Project phases</title>
175
 
176
    <para>In this section we specify the tasks which have been performed under
177
      this project.</para>
178
 
179
    <para>The set of commands which were ported to ANDF was split into two
180
      subsets:</para>
181
 
182
    <itemizedlist>
183
      <listitem>The <I>level 1</I> subset corresponds to the level achieved
184
        with UnixWare at the end of the first project (about 100 commands out
185
        of 600).  These commands conform to a standard interface (Posix or
186
        XPG) with some simple extensions. They do not use extensions which are
187
        difficult to port from one system to another.  This set includes about
188
        150 Linux commands.</listitem>
189
 
190
      <listitem>The <I>level 2</I> subset corresponds to the maximum which can
191
        be reasonably achieved for a given system. While we could expect about
192
        twice as many commands as for level 1, we only compiled about 75 more
193
        commands.</listitem>
194
    </itemizedlist>
195
 
196
    <sect1>
197
      <title>Phase 1: level 1 commands on Intel/i386</title>
198
 
199
      <para>The objective is to produce a ``level 1'' set of Linux commands in
200
        ANDF format for the Intel platform. This requires the production of
201
        the associated API, also in ANDF format (token library).</para>
202
 
203
      <para>The major tasks for this phase are:</para>
204
 
205
      <sect2>
206
        <title>T1. Linux installation.</title>
207
 
208
        <itemizedlist>
209
          <listitem>Install the Linux system.</listitem>
210
 
211
          <listitem>Install a compilation environment.</listitem>
212
 
213
          <listitem>Install the Linux source code.</listitem>
214
        </itemizedlist>
215
 
216
        <para><emphasis>Prerequisite:</emphasis> Linux system for
217
          Intel.</para>
218
 
219
        <para><emphasis>Delivery:</emphasis> System running.</para>
220
      </sect2>
221
 
222
      <sect2>
223
        <title>T2. TenDRA installation.</title>
224
 
225
        <itemizedlist>
226
          <listitem>Install the TenDRA technology for Linux.</listitem>
227
        </itemizedlist>
228
 
229
        <para><emphasis>Prerequisite:</emphasis>TenDRA technology &amp;
230
          T1.</para>
231
 
232
        <para><emphasis>Delivery:</emphasis> TenDRA installed.</para>
233
      </sect2>
234
 
235
      <sect2>
236
        <title>T3. Level 1 commands port.</title>
237
 
238
        <itemizedlist>
239
          <listitem>Define the level 1 set of Linux commands.</listitem>
240
 
241
          <listitem>Compile the level 1 commands in NAT-NAT mode.</listitem>
242
 
243
          <listitem>Compile the level 1 commands in DRA-NAT mode.</listitem>
244
        </itemizedlist>
245
 
246
        <para><emphasis>Prerequisite:</emphasis> Linux source code, T1 &amp;
247
          T2.</para>
248
 
249
        <para><emphasis>Delivery:</emphasis> Level 1 commands compiled with
250
          TenDRA in native mode.</para>
251
      </sect2>
252
 
253
      <sect2>
254
        <title>T4. Level 1 commands API definition.</title>
255
 
256
        <itemizedlist>
257
          <listitem>Define the non-explicit API used by this set of commands.
258
            Machine dependent code issues will be addressed
259
            specifically.</listitem>
260
        </itemizedlist>
261
 
262
        <para><emphasis>Prerequisite:</emphasis> Linux source code.</para>
263
 
264
        <para><emphasis>Delivery:</emphasis> Set of ANDF header files for this
265
          level 1 API.</para>
266
      </sect2>
267
 
268
      <sect2>
269
        <title>T5. ANDFization of Level 1 commands.</title>
270
 
271
        <itemizedlist>
272
          <listitem>Produce the level 1 commands with the TenDRA technology,
273
            using the ANDF definition of the API defined in the previous
274
            task.</listitem>
275
        </itemizedlist>
276
 
277
        <para><emphasis>Prerequisite</emphasis>: Linux source code, T2 &amp;
278
          T4.</para>
279
 
280
        <para><emphasis>Delivery</emphasis>: Level 1 commands in ANDF
281
          format.</para>
282
      </sect2>
283
 
284
      <sect2>
285
        <title>T6. Level 1 commands API installation.</title>
286
 
287
        <itemizedlist>
288
          <listitem>Build the token library for the level 1 commands
289
            API.</listitem>
290
        </itemizedlist>
291
 
292
        <para><emphasis>Prerequisite</emphasis>: T2 &amp; T4.</para>
293
 
294
        <para><emphasis>Delivery</emphasis>: Token library for this level 1
295
          API.</para>
296
      </sect2>
297
 
298
      <sect2>
299
        <title>T7. Level 1 commands installation and validation.</title>
300
 
301
        <itemizedlist>
302
          <listitem>Install the commands in ANDF format produced in task T5.
303
          </listitem>
304
 
305
          <listitem>Validate the commands using adhoc tests.</listitem>
306
 
307
          <listitem>Write a report that describes the results obtained and
308
            the problems encountered.</listitem>
309
        </itemizedlist>
310
 
311
        <para><emphasis>Prerequisite</emphasis>: T2, T5 &amp; T6.</para>
312
 
313
        <para><emphasis>Delivery</emphasis>: Report on level 1 commands on
314
          Intel.</para>
315
      </sect2>
316
    </sect1>
317
 
318
    <sect1>
319
      <title>Phase 2: level 1 commands on Digital/Alpha</title>
320
 
321
      <para>The objective is to validate that the commands produced during the
322
        first phase can be easily ported to the Alpha platform.</para>
323
 
324
      <para>The major tasks, during this phase, are:</para>
325
 
326
      <sect2>
327
        <title>T8. Linux installation.</title>
328
 
329
        <itemizedlist>
330
          <listitem>Install the Linux system.</listitem>
331
 
332
          <listitem>Install a compilation environment, including header files
333
            and libraries.</listitem>
334
        </itemizedlist>
335
 
336
        <para><emphasis>Prerequisite</emphasis>: Linux system for
337
          Alpha.</para>
338
 
339
        <para><emphasis>Delivery</emphasis>: System running.</para>
340
      </sect2>
341
 
342
      <sect2>
343
        <title>T9. TenDRA installation.</title>
344
 
345
        <itemizedlist>
346
          <listitem>Adapt the TenDRA technology for Linux on the
347
            Alpha.</listitem>
348
 
349
          <listitem>Install the TenDRA technology.</listitem>
350
        </itemizedlist>
351
 
352
        <para><emphasis>Prerequisite</emphasis>: TenDRA technology &amp;
353
          T8.</para>
354
 
355
        <para><emphasis>Delivery</emphasis>: TenDRA installed.</para>
356
      </sect2>
357
 
358
      <sect2>
359
        <title> T10. Level 1 commands API installation.</title>
360
 
361
        <itemizedlist>
362
          <listitem>Build the token library for the level 1 commands
363
            API.</listitem>
364
        </itemizedlist>
365
 
366
        <para><emphasis>Prerequisite</emphasis>: T4 &amp; T9.</para>
367
 
368
        <para><emphasis>Delivery</emphasis>: Token library for this level 1
369
          API.</para>
370
      </sect2>
371
 
372
      <sect2>
373
        <title> T11. Level 1 commands installation and validation.</title>
374
 
375
        <itemizedlist>
376
          <listitem>NAT-NAT and DRA-NAT check.</listitem>
377
 
378
          <listitem>Install the commands in ANDF format produced in task
379
            T5.</listitem>
380
 
381
          <listitem>Validate the commands using adhoc tests.</listitem>
382
 
383
          <listitem>Write a report that describes the results obtained and
384
            the problems encountered.</listitem>
385
        </itemizedlist>
386
 
387
        <para><emphasis>Prerequisite</emphasis>: T5, T9 &amp; T10.</para>
388
 
389
        <para><emphasis>Delivery</emphasis>: Report on level 1 commands on
390
          Alpha.</para>
391
      </sect2>
392
    </sect1>
393
 
394
    <sect1>
395
      <title>Phase 3: level 2 commands on Intel/i386 and Digital/Alpha</title>
396
 
397
      <para>The objective during this phase is to validate further the ANDF
398
        tools by trying to extend the ANDF commands to a broader set that will
399
        include some ``difficult'' cases.</para>
400
 
401
      <para>The major tasks are:</para>
402
 
403
 
404
      <sect2>
405
        <title>T12. Level 2 commands port.</title>
406
 
407
        <itemizedlist>
408
          <listitem>Define the level 2 set of Linux commands, by extension of
409
            the level 1 set.</listitem>
410
 
411
          <listitem>Compile the level 2 commands in NAT-NAT mode on
412
            Intel.</listitem>
413
 
414
          <listitem>Compile the level 2 commands in NAT-NAT mode on
415
            Alpha.</listitem>
416
 
417
          <listitem>Compile the level 2 commands in DRA-NAT mode on
418
            Intel.</listitem>
419
 
420
          <listitem>Compile the level 2 commands in DRA-NAT mode on
421
            Alpha.</listitem>
422
        </itemizedlist>
423
 
424
        <para><emphasis>Prerequisite</emphasis>: Linux source code, T1, T2, T8
425
          &amp; T9.</para>
426
 
427
        <para><emphasis>Delivery</emphasis>: Level 2 commands compiled with
428
          TenDRA in native mode.</para>
429
      </sect2>
430
 
431
      <sect2>
432
        <title>T13. Level 2 commands API definition.</title>
433
 
434
        <itemizedlist>
435
          <listitem>Extend the level 1 API to include the interfaces used by
436
            the level 2 commands.</listitem>
437
        </itemizedlist>
438
 
439
        <para><emphasis>Prerequisite</emphasis>: Linux source code &amp;
440
          T4.</para>
441
 
442
        <para><emphasis>Delivery</emphasis>: Set of ANDF header files for this
443
          level 2 API.</para>
444
      </sect2>
445
 
446
      <sect2>
447
        <title>T14. Level 2 commands ANDFization.</title>
448
 
449
        <itemizedlist>
450
          <listitem>Produce the level 2 commands with the TenDRA technology,
451
            using the ANDF definition of the API defined in the previous
452
            task.</listitem>
453
        </itemizedlist>
454
 
455
        <para><emphasis>Prerequisite</emphasis>: Linux source code, T2, T9
456
          &amp; T13.</para>
457
 
458
        <para><emphasis>Delivery</emphasis>: Level 2 commands in ANDF
459
          format.</para>
460
      </sect2>
461
 
462
      <sect2>
463
        <title>T15. Level 2 commands API installation.</title>
464
 
465
        <itemizedlist>
466
          <listitem>Build the token library for the level 2 commands API on
467
            Intel.</listitem>
468
 
469
          <listitem>Build the token library for the level 2 commands API on
470
            Alpha.</listitem>
471
        </itemizedlist>
472
 
473
        <para><emphasis>Prerequisite</emphasis>: T2, T9 &amp; T13.</para>
474
 
475
        <para><emphasis>Delivery</emphasis>: Token library for this level 2
476
          API.</para>
477
      </sect2>
478
 
479
      <sect2>
480
        <title>T16. Level 2 commands installation and validation.</title>
481
 
482
        <itemizedlist>
483
          <listitem>Install the commands in ANDF format produced in task T14
484
            on Intel.</listitem>
485
 
486
          <listitem>Install the commands in ANDF format produced in task T14
487
            on Alpha.</listitem>
488
 
489
          <listitem>Validate the commands using adhoc tests.</listitem>
490
 
491
          <listitem>Write an intermediate report and a final
492
            report.</listitem>
493
        </itemizedlist>
494
 
495
          <para><I>Prerequisite</I>: T2, T9, T14 &amp; T15.</para>
496
 
497
          <para><I>Delivery</I>: Intermediate report on level 2 commands, and
498
            final report.</para>
499
      </sect2>
500
    </sect1>
501
  </chapter>
502
 
503
  <chapter>
504
    <title>4. Project environment</title>
505
 
506
    <sect1>
507
      <title>4.1 LINUX operating system</title>
508
 
509
      <para>Linux is a free Unix-like operating system, first developed by
510
        Linus Torvalds on an Intel platform; ``official'' releases exist since
511
        October 1991.</para>
512
 
513
  <para>It has now been ported to Digital/Alpha and ports to other
514
  machines, including PowerPC andPowerMAC, are under way.</para>
515
  <sect2>
516
  <title>Linux on Intel/i386</title>
517
  <para><A NAME="10407">There are many distributions of Linux for the Intel
518
  platform; we installed the Slackware distribution, based on the Linux 1.1
519
  version.</A></para>
520
  <para><A NAME="10408">We downloaded it from the ftp site:<BR/></A><A
521
  HREF="ftp://sunsite.unc.edu/pub/Linux/distributions/slackware">sunsite.unc.edu:/pub/Linux/distributions/slackware</A></para>
522
  <para><A NAME="10536">The version we installed was Linux 1.1.59, available since
523
  October 1994. Since then, newer versions have been released, but we stuck to
524
  this version throughout the project since it worked well, and because all the
525
  packages it included were easily available in source form (see below).</A></para>
526
  </sect2>
527
  <sect2>
528
  <title>Source code for Linux commands used by the project</title>
529
  <para><A NAME="10411">We downloaded the source code of the Linux commands from
530
  the ftp site:<BR/></A><A
531
  HREF="ftp://sunsite.unc.edu/pub/Linux/distributions/slackware/source">sunsite.unc.edu:/pub/Linux/distributions/slackware/
532
  source</A>.</para>
533
  <para><A NAME="10397">This means that the versions of commands available on our
534
  development machine for Linux/i386 were matching the source code we used as base
535
  for the project, except in a few cases for which the source code had been
536
  revised.</A></para>
537
  </sect2>
538
  <sect2>
539
  <title>Linux on Digital/Alpha</title>
540
  <para><A NAME="1551">For the Alpha platform, Linux is available from the `BLADE'
541
  distribution, and more recently from the Red Hat distribution.</A></para>
542
  <para>A 32-bit version of Linux/Alpha was first released in
543
  January 1995; then a 64-bit version was available in November 1995, which
544
  included most of the capabilities provided by the Linux/Intel system. We
545
  downloaded the BLADE_0.3 release, consisting of more than thirty floppy images,
546
  from the ftp site:<BR/><A HREF="ftp://ftp.digital.com/pub/DEC/Linux-Alpha">ftp.digital.com:/pub/DEC/Linux-Alpha</A></para>
547
  <para>Since December 1995, another Linux/Alpha distribution has
548
  become available from the RedHat company; it is built from the same components,
549
  but newer versions, as the BLADE release.</para>
550
 
551
  <para>An interesting feature of the current Linux/Alpha ports, is
552
  that they provide rather extensive binary compatibility with Digital Unix. This
553
  compatibility has been used to cross-build on Digital Unix for Linux/Alpha, and
554
  also for a few features which were not available in the Linux/Alpha BLADE
555
  release.</para>
556
</sect2>
557
  </sect1>
558
  <sect1>
559
  <title>4.2 Hardware platforms and environment</title>
560
  <para>The Intel platform was an Intel/i486 PC machine, with
561
      most disk space available through NFS.</para>
562
 
563
  <para>The Digital/Alpha platform was built specifically for
564
  this project, around a <I>Digital AXPpci 33</I> motherboard. In fact, at the
565
  time we set-up the machine, the Linux/Alpha ports were only running on a few
566
  Alpha-based machines.</para>
567
 
568
  <para>A Linux kernel had to be rebuilt for this machine in order
569
  to add support for the 3COM Ethernet board we used, and for the NFS-client
570
  capability. Most disk space was thus available through an NFS file system,
571
  shared with the Intel platform.</para>
572
  </sect1>
573
 
574
  <sect1>
575
  <title>4.3 TenDRA technology</title>
576
  <para>We started the project on an Intel platform with a snapshot of the
577
    TenDRA technology from April 1995, which included support for the
578
    Linux/Intel platform. This snapshot was based on the ANDF 3.1
579
    specification.</para>
580
 
581
  <para>We switched to the November 1995 TenDRA snapshot, based on ANDF 4.0,
582
    when we setup the second platform, in order to use the tools for the
583
    Digital Unix/Alpha platform. Because of the high degree of compatibility
584
    between Digital Unix and Linux on Alpha, we could use the TenDRA
585
    technology on a DigitalUnix/Alpha platform to cross-build executables for
586
    the Linux/Alpha platform.</para>
587
 
588
  <para>The ANDF 4.0 intermediate file format is not upward compatible with
589
    the ANDF 3.1 one, which required that we rebuild the intermediate ANDF
590
    files for the Linux commands we had already built.</para>
591
 
592
  <para>ANDF 4.0 contains increased capability, though not required by this
593
    project, and forms the basis for the X/Open preliminary
594
    specification XANDF.</para>
595
</sect1>
596
</chapter>
597
 
598
  <chapter>
599
    <title>5. Descriptions and Results of Project phases</title>
600
  <para>In the next paragraphs, we describe the way we accomplished
601
  the various tasks of the project and we summarize their results.</para>
602
  <sect1>
603
    <title>5.1 Linux installation</title>
604
  <para>At the beginning of the project, we installed the Linux operating
605
    system release 1.1 on an Intel/i386 machine. In December 1995, after a few
606
    months of work on the Intel/i386 platform, we installed Linux on the
607
    second platform for the project, which is a Dec/Alpha. Linux was first
608
    released on this platform at the beginning of 1995.</para>
609
  <sect2>
610
  <title>Linux/i386 installation (including the source code for commands)</title>
611
  <para>A machine with Linux 1.1.59 from the Slackware
612
  distribution, including the native compilation chain and libraries from GNU, was
613
  setup for the project.</para>
614
  <para>The Linux system is available on several anonymous ftp
615
  sites. The one we used was at  sunsite.unc.edu, where a distribution of the
616
  sources and binaries of the Intel/Linux commands from Slackware was available
617
  under the /pub/Linux/distributions/slackware directory. Note that the current
618
  Slackware distribution at the time of writing of this report is based on Linux
619
  3.0.</para>
620
  <para>In the Slackware Linux distribution for Intel/ix86, the
621
      delivery of the source code for commands is split into a large number of
622
      <I>packages</I>. The contents of each source package must be compiled
623
      and installed individually. For example, the <I>awk</I> command,
624
      actually <I>gawk</I>, belongs to the <B>bin</B> package which contains
625
      56 commands, while the <I>bc</I> command belongs to the <B>bc</B>
626
      package which contains only this one command.  Consequently, we did not
627
      download the whole set of sources for the Linux commands, but selected a
628
      few packages containing the sources of the commands we intended to build
629
      first. We also had a look at the Caldera Linux source distribution, and
630
      it appeared to be organized in the same way.</para> <para>
631
      A Slackware Linux package for source code distribution is
632
      made of a compressed tar files (usually only one), optional patch
633
      file(s), and a shell script. The execution of this shell script installs
634
      the source files from the tar file(s), applies patches if necessary,
635
      optionally performs a self-configuration step, runs the makefile(s) for
636
      the compilation, and finally generates a binary package which holds the
637
      resulting executables. This procedure has been adapted to fit the
638
      NAT-NAT, DRA-NAT and DRA-DRA development steps on two platforms, as
639
      described in the section<A HREF="linux_re.htm#4846">Setting up the
640
      build environment</A>.</para>
641
 
642
  <para>Note that each package has a private version number. Thus
643
  packages can be maintained and released independently. Moreover, some packages
644
  (e.g. the <B>bin</B> package) are a collection of several `subpackages', each
645
  of which has its own version number.</para>
646
  </sect2>
647
  <sect2>
648
  <title>Linux/Alpha installation</title>
649
  <para>The Linux Operating System port to the Digital Alpha architecture
650
    started two years ago. The first user-installable distribution was
651
    available in January 95, from the `BLADE' distribution, and was a 32-bit
652
    version. Then came a 64-bit version which was made compatible with Digital
653
    Unix with respect to basic C language types:</para>
654
 
655
  <informaltable>
656
    <row>
657
      <entry>int:</entry>
658
      <entry>32-bit</entry>
659
    </row>
660
 
661
    <row>
662
      <entry>long:</entry>
663
      <entry>64-bit</entry>
664
    </row>
665
 
666
    <row>
667
      <entry>pointer:</entry>
668
      <entry>64-bit</entry>
669
    </row>
670
  </informaltable>
671
 
672
  <para>While it is still under development, Linux/Alpha is now robust and
673
    includes most of the capabilities provided by the Linux/Intel
674
    system.</para>
675
 
676
  <para>The BLADE distribution was the first available distribution for
677
    Linux/Alpha. For the project, we retrieved the November 95 BLADE_0.3
678
    release, based on the Linux 1.3 development kernel, at the following
679
    site:</para>
680
 
681
  <para><A HREF="ftp://ftp.digital.com/pub/DEC/Linux-Alpha">	ftp.digital.com:/pub/DEC/Linux-Alpha</A></para>
682
 
683
  <para>This release consists of more than thirty 3.5'' floppy images (not
684
    including X-Window). The source code for the commands is not a part of
685
    this distribution. Since then, several new versions for the boot firmware,
686
    kernel, compiler and libraries have been released, but, as we encountered
687
    minor problems only with BLADE_0.3, we did not upgrade our system.</para>
688
 
689
  <para>Since December 95, another distribution of Linux for Dec/Alpha is also
690
    available from the RedHat company; the current version is:</para>
691
 
692
  <para><A HREF="ftp://ftp.redhat.com/pub/redhat/redhat-2.1/axp">ftp.redhat.com:/pub/redhat/redhat-2.1/axp</A></para>
693
 
694
  <para>This distribution includes all the source packages for the components
695
    it is made from, along with some fixes and additions, in both binary and
696
    source forms. It is possible to unpack a RedHat Linux/Alpha 2.1 set while
697
    not running the RedHat Linux, but, as a proprietary packaging format is
698
    used, one should install the packaging tools (<I>rpm</I>) first.</para>
699
 
700
  <para>At the time we setup the machine, Linux/Alpha was operational only on
701
  a few variants of Digital Alpha-based systems. So, we selected an entry
702
  level and rather inexpensive board, the Digital AXPpci 33
703
  Alpha PC motherboard, around which we built a machine. Our Linux/Alpha system
704
  currently comprises the following:</para>
705
 
706
  <itemizedlist>
707
    <listitem>an 8-slot enclosure with 200W power supply and fan</listitem>
708
 
709
    <listitem>Digital AXPpci 33 motherboard, Windows NT (ARC) firmware, PS/2
710
      style keyboard interface, 233 Mhz Alpha processor</listitem>
711
    <listitem>2x16MB, 36-bit, 70ns SIMMs</listitem>
712
    <listitem>256 KB, 20ns cache [optional part]</listitem>
713
    <listitem>a Number 9 GXE VGA display adapter (ISA)</listitem>
714
    <listitem>a dumb VGA display</listitem>
715
    <listitem>a PS/2 style keyboard</listitem>
716
    <listitem>a 3.5''/1440K floppy disk drive</listitem>
717
    <listitem>a SCSI-2 hard disk (a DECpc 2.0GB disk from Digital)</listitem>
718
    <listitem>a 3COM Ethernet Link-II (aka 3c503) controller (ISA).</listitem>
719
  </itemizedlist>
720
 
721
  <para>We installed the BLADE_0.3 distribution on our machine, including the
722
    C compilation chain and libraries. In order to use the 3COM Ethernet
723
    board, we had to rebuild the kernel. We used almost all of the default
724
    kernel build parameters, except for the Ethernet adapter, for the settings
725
    for the `TGA graphics' support (switched to `no') and for the NFS-client
726
    feature (selected). Note that a kernel rebuild takes more than half an
727
    hour on our system.</para>
728
 
729
  <para>A very interesting feature of the current releases of
730
    Linux/Alpha is that they provide an almost perfect <B>binary compatibility
731
    with Digital Unix</B>. This was of great help to us, as will be described
732
    later.</para>
733
 
734
  <para>Among the various updates to the Linux/Alpha boot
735
    loader, kernel, C compiler and libraries, commands, ..., which have been
736
    made by the Linux-Alpha development teams, we have used only a
737
    few:</para>
738
 
739
  <itemizedlist>
740
    <listitem>upgrade of the <command>sed</command> command: some sed scripts
741
      used for modifying the system headers when building the APIs with TenDRA
742
      caused the original <command>sed</command> command to abort.</listitem>
743
 
744
    <listitem>upgrade of a few system headers, extracted from the azstarnet
745
      <filename>inc-and-libs-0.38.tar.gz</filename> file.</listitem>
746
  </itemizedlist>
747
 
748
  <para><A NAME="2048">These two updates were downloaded from the
749
    site</A></para>
750
 
751
  <para><A HREF="ftp://ftp.azstartnet.com/pub/linux/axp">
752
    ftp.azstartnet.com:/pub/linux/axp</A></para>
753
 
754
  <para><A NAME="6416">We encountered a few problems with the BLADE_0.3
755
    release on the AXPpci Alpha board:</A></para>
756
 
757
 
758
  <itemizedlist>
759
    <listitem>The floppy disk driver sometimes entered a time-out, as
760
      indicated by a console message.</listitem>
761
 
762
    <listitem>Some shell scripts failed until a #!/bin/sh line, or equivalent,
763
      was inserted. According to a member of the Linux/Alpha development team,
764
      it is caused by the kernel command loader, and was fixed in new kernel
765
      releases. We worked-around this problem by patching a number of shell
766
      script files included with various source packages we were building on
767
      Linux/Alpha: we realized too late that it would have been preferable to
768
      upgrade the kernel.</listitem>
769
 
770
    <listitem>Linux/Alpha failed to mount an NFS file system served by a HP-UX
771
      release 8 machine. Fortunately, this problem disappeared when using a
772
      server running Solaris or HP-UX release 9: we had to move our
773
      development tree to such a host.</listitem>
774
 
775
    <listitem>As mentioned above, the sets of source files were shared through
776
      NFS between a Linux/Intel, a Digital Unix and a Linux/Alpha platform.
777
      Occasionally, Linux/Alpha lost access to a file that had been updated
778
      recently by another NFS client: the error message `<I>Stale NFS file
779
      handle</I>' was displayed.  Unmounting/remounting the NFS file system
780
      usually cured such problems.</listitem>
781
 
782
    <listitem>During kernel rebuilds, the compilation of at least one file
783
      failed because of lack of memory: in the makefiles for kernel rebuild,
784
      the gcc compiler is called with the `-pipe' option, which speeds up the
785
      build but is not safe when compiling large source files. We wrote a
786
      small shell script which redoes a compilation without the `-pipe'
787
      option. (This problem was fixed by a subsequent kernel release:
788
      <I>tcpip.c</I> was split into several parts...)</listitem>
789
  </itemizedlist>
790
</sect2>
791
  </sect1>
792
 
793
  <sect1>
794
  <title>5.2 TenDRA installation</title>
795
  <para>We first installed the TenDRA technology on the Linux/i386
796
  platform, from the April 1995 snapshot. Later, we installed the November 1995
797
  release, the first to include support for the Dec/Alpha machine, in order to
798
  start work on the Linux/Alpha platform. However, because this snapshot was not
799
  upward compatible with the previous TenDRA release, we also had to install it on
800
  the Linux/i386 platform. We did not upgrade to the February 1996 snapshot,
801
  though it is compatible with the previous one. We only used it in a few cases
802
  when we had a bug in a command and wanted to make sure that it was not due to a
803
  problem already fixed in TenDRA.</para>
804
  <sect2>
805
  <title>TenDRA installation on Intel/i386</title>
806
  <para>The TenDRA snapshot from April 1995, based on TDF 3.1,
807
  included support for the Linux/i386 platform. So, the installation on our
808
  machine was straightforward. We only had to recompile the tcc driver, and to
809
  modify some environment and startup files to fine tune the level of checking.</para>
810
  <para>When we started to work on the second platform, we had to
811
  install the November 1995 snapshot of the TenDRA technology (see below). This
812
  was DRA's first snapshot based on TDF 4.0, and it included significant changes
813
  to the installation procedure. We had some difficulties to install this
814
  snapshot, due to a few bugs in the new installation procedures, but once
815
  installed the technology appeared to work well.</para>
816
  <para><A NAME="2200"></A></para>
817
  </sect2>
818
  <sect2>
819
  <title>TenDRA installation on Dec/Alpha</title>
820
  <para><A NAME="5003">The TenDRA snapshot from November 1995 was the first
821
  snapshot with support for the Dec/Alpha platform, but was not upward compatible
822
  with the one installed on the Intel platform (TenDRA 4.0 versus TenDRA 3.1). So,
823
  the TenDRA snapshot from November 1995 was installed on both the Intel/i386 and
824
  the Dec/Alpha platforms.</A></para>
825
  <para><A NAME="2174">DRA provide support for the DigitalUnix/Alpha platform, not
826
  for the Linux/Alpha one. However, we benefited from the compatibility between
827
  Digital Unix and Linux to solve this problem.We made three different
828
  installations of the TenDRA technology for Alpha, among which the 2nd was fully
829
  operational for Linux/Alpha:</A></para>
830
 
831
 
832
  <para><A NAME="2151"></A></para>
833
  <itemizedlist>
834
  <listitem>First installation on native Digital Unix/alpha. 
835
  <A NAME="2152"></A></listitem>
836
  <listitem>Second installation, still on Digital Unix, but for cross-development for
837
  Linux/Alpha (termed <I>lin_alpha_cross</I>). 
838
  <A NAME="2153"></A></listitem>
839
  <listitem>Third installation on Linux/Alpha (termed <I>lin_alpha</I>). 
840
  </listitem></itemizedlist>
841
  <para><A NAME="2154">The first installation was straightforward and worked very
842
  well. The main purpose was to ensure that the TenDRA technology worked correctly
843
  on Dec/Alpha.</A></para>
844
  <para><A NAME="2279">For the second installation, we created a new target
845
  platform termed `lin_alpha_cross'. Most of the `lin_alpha_cross' files are
846
  shared with Digital Unix, using symbolic links to directories or files, since
847
  only a few files differ between the two targets. The main purpose of these
848
  changes was to use Linux/Alpha system header files when compiling, instead of
849
  the Digital Unix system header files, and Linux/Alpha libraries and startup
850
  files when link-editing. For example, we changed three files inside the <I>&lt;target_platform&gt;/private/env</I>
851
  directory named <I>default</I>, <I>system</I> and <I>tcc_diag</I>. For the
852
  same reason, we created a specific `lin_alpha_cross' subdirectory in lib/system
853
  to hold some replacement system header files when cross-compiling with the <I>-Ysystem</I>
854
  option (i.e. in DRA-NAT mode). The target dependent directories and files used
855
  when (cross-)building APIs for Linux/Alpha, e.g. located under the <I>src/apis/libs</I>
856
  directory, were also made specific.</A></para>
857
  <para><A NAME="2291">Using this installation, we could cross-compile and
858
  cross-link on Digital Unix for Linux, without any problem. The binary
859
  compatibility between Linux/Alpha and Digital Unix was thus a key factor of
860
  success.</A></para>
861
  <para><A NAME="2156">The third TenDRA installation for Linux/Alpha was readily
862
  derived from the previous one. We benefited again from the binary compatibility
863
  with Digital Unix: we ran the TenDRA compilation chain, built for Digital Unix,
864
  on top of Linux/Alpha, without the necessity to port it or recompile it.
865
  However, to do so, we had to copy and install the shared library tools of
866
  Digital Unix on Linux/Alpha because TenDRA uses shared libraries, for which
867
  there is currently no support in Linux/Alpha. The Digital Unix shared libraries
868
  mechanism works fine under Linux! This trick could have be avoided if we had
869
  re-linked the TenDRA tools under Digital Unix using its statically-linked
870
  libraries.</A></para>
871
  <para><A NAME="2157">In order to use the Linux/Alpha native assembler and
872
  link-editor instead of those from Digital Unix, we wrote a front-end shell
873
  script to the TenDRA installer (trans). This shell script calls the actual trans
874
  tool with an option to output a source assembly file instead of the `binary
875
  assembly' files used by the Digital Unix as1 tool. Similarly, we wrote a
876
  front-end shell script which emulates the call made by tcc to as1 by a call to
877
  the Linux as tool. We give below the changes to the settings in &lt;lin_alpha&gt;/private/env/default
878
  for the third installation:</A></para>
879
  <para><A NAME="2158"></A></para>
880
  <literallayout>+TRANS	``/..../linux/1.3.45/alpha/private/bin/trans.sh''
881
  +AS1	``/..../linux/1.3.45/alpha/private/bin/as1.sh''
882
  +AS	``/usr/bin/as -nocpp'' # seems unused
883
  +LD	``/usr/bin/ld -G8 -O1''
884
  </literallayout>
885
  <para><A NAME="2162">However, despite these modifications, the port of the TenDRA
886
  installer to Linux/Alpha could not be completed. In some cases, the TenDRA
887
  installer appeared to generate assembly instructions that are not recognized by
888
  the Linux/Alpha assembler. For example, the following lines could not be
889
  assembled properly by Linux/Alpha:</A></para>
890
  <para><A NAME="2163"></A></para>
891
  <literallayout>.extern __ctype_ 8
892
  	Error: Rest of line ignored. First ignored character is `8'
893
   stq $fp, 8($sp)
894
  	Warning: Illegal operands
895
   bis $17,$17,$fp
896
  	Warning: Illegal operands
897
   .frame $fp, 360, $26, 0
898
  	Error: bad absolute expression; zero assumed
899
  </literallayout>
900
  <para><A NAME="2164">We now understand it is not surprising that we were unable
901
  to use the TenDRA installer for Digital Unix/Alpha on Linux/Alpha. ANDF
902
  installer output needs to be tailored for different target operating systems
903
  according to the assembler and/or link editor interfaces supported by the target
904
  operating system. In our case we attempted to use the assembler interface, and
905
  the errors and warnings above are examples where this interface differs between
906
  Digital Unix/Alpha and Linux/Alpha. Debugger support and even some details of
907
  the procedure calling conventions may also need to be taken into account when
908
  tailoring an ANDF installer to a different operating system.</A></para>
909
 
910
  <para>Since we had already set up a cross-development TenDRA
911
  environment for Linux/Alpha, hosted by Digital Unix, we continued to use it and
912
  discontinued use of the `lin_alpha' installation. We actually installed TenDRA
913
  on an NFS file server (used by the Linux/ i386, the Digital Unix and the
914
  Linux/Alpha platforms).</para>
915
</sect2>
916
</sect1>
917
<sect1>
918
  <title>5.3 Build environment with TenDRA</title>
919
  <sect2>
920
  <title>Definition of the set of Linux commands</title>
921
  <para><A NAME="2647">The definition of the set of commands has not been done once
922
  for all. It has been done on the Intel/i386 platform, during the first part of
923
  the project, in two steps, level1 and level2, as described in </A><A
924
  HREF="linux_re.htm#90">Description of Project phases</A>. Each step has been
925
  performed as an incremental process. Each time new commands were selected, a
926
  whole cycle of API definition (<A HREF="linux_re.htm#2743">&#167;  5.4</A>),
927
  command ANDFization (<A HREF="linux_re.htm#2745">&#167;  5.5</A>), API
928
  installation (<A HREF="linux_re.htm#6139">&#167;  5.6</A>) and command
929
  installation and validation (<A HREF="linux_re.htm#1788">&#167;  5.7</A>) was
930
  performed.</para>
931
  <para><A NAME="2632">During the first phase of the project, a number of commands
932
  have been compiled in DRA-DRA mode on the Unixware platform (see </A><A
933
  HREF="linux_re.htm#6567">[2]</A>). We started by locating these commands in the
934
  packages from the Slackware Linux source distribution for Intel/ix86. Since
935
  these commands were among the simplest ones to ANDFize on Unixware, they were
936
  good candidates to start with. Provided that a full binary installation was made
937
  on our Linux/i386 platform, a command could be located in a package by searching
938
  for its name in the list of packages under the<I> /var/adm/packages</I>
939
  directory. This directory contains one text file per installed package, which
940
  records the names of the commands it contains (actually the relative
941
  installation path from / is provided for each command). When the name of the
942
  package which holds a command has been found, we just had to connect to the ftp
943
  site, find the directory of the same name in the Slackware source distribution,
944
  and download the files under this directory.</para>
945
  <para><A NAME="2495">Among the 103 Unixware commands ANDfized during the previous
946
  phase of this project, we found 59 commands with similar name in Linux,
947
  scattered among 11 packages: <I>bc, bin, bsdgames, diff, find, grep, gzip,
948
  sh_utils, txtutils </I>and <I>util</I>. Moreover, these packages also contained
949
  some additional commands which appeared to be good candidates for easy
950
  ANDFization. However, we excluded a few of them which were compiled but not
951
  delivered in the binary package, or which seemed too dependent on the target
952
  platform (e.g. the
953
  <I>fdformat</I> command which formats floppy disks). We also selected four
954
  additional packages, <I>tar, cpio, xlock</I> and <I>xgames</I>, in order to
955
  complete the <I>level 1</I> set of commands.</A></para>
956
  <para><A NAME="2572">The definition of the <I>level 2</I> set of commands was
957
  more difficult than for <I>level 1</I>, because we had to reject a number of
958
  commands, for various reasons discussed below.</A></para>
959
  <para><A NAME="11235">First, we tried to include in the <I>level 2</I> set of
960
  commands more commands from X11, as we successfully experimented the ANDFization
961
  of a few of them for<I> level 1</I>. However it appeared that this was not so
962
  easy: the sources for these commands had not been packaged by Slackware, but
963
  were provided inside a huge collection of sources named <I>Xfree86</I> (from
964
  the Xfree86 Project, Inc.), itself derived from the X Consortium X11R6 code. An
965
  attempt to perform the first step of the build of Xfree86 on Linux/i386, which
966
  consisted in producing Makefiles from Imakefiles, failed. With some rewriting,
967
  we managed to produce a Makefile for a simple Xfree86 command, <I>xclock</I>,
968
  and successfully compiled it. However, we did not spend much time on
969
  understanding the installation procedures of Xfree86, and, since it would have
970
  taken us too much time per command to rewrite every Makefile, we set aside
971
  Xfree86.</A></para>
972
  <para><A NAME="2574">Then we excluded one package, <I>groff</I>, because it was
973
  mostly coded in C++. We found also that some native Linux header files, used in
974
  several packages, offer BSD compatibility but in a way that could not be
975
  straightforwardly adapted to TenDRA. This issue is discussed in </A><A
976
  HREF="linux_re.htm#2743">&#167;  5.4</A>.</para>
977
  <para><A NAME="2577">We have included in the <I>level 2 </I>set of commands some
978
  commands which represent quite large amounts of source code: <I>m4, elvis</I>
979
  (a <I>vi</I> clone), <I>joe</I> (another editor), <I>less</I>, <I>perl</I>
980
  and <I>elm</I>. The ultimate step of this experiment would have been to build
981
  ``monsters'' such as <I>bash</I> and <I>emacs</I>.</A></para>
982
  <para><A NAME="2578">Finally, we evaluated the number of commands distributed
983
  with a Linux system, and we found about 700 executable binary files in the
984
  /usr/bin, /bin, /usr/X11/bin, /usr/openwin/bin, /usr/games, /sbin and /usr/sbin
985
  directories. We examined some of these commands in the Slackware packages, and
986
  concluded that there could be candidates for ANDFization. But we were limited by
987
  time constraints to include such commands. Also, we did not port to the 2nd
988
  platform, nor validate, all the commands operational on the 1st platform. Here
989
  again, time is the main reason why we did not complete the port. We estimate
990
  that an additional 1.5 engineer-month would have been sufficient to complete the
991
  task, apart from some commands which may have been difficult to port.</A></para>
992
  <para><A NAME="3621">The <I>level1 </I>and <I>level2</I> set of commands
993
  include 236 commands: these commands were installed and validated on Linux/i386
994
  (cf. section 4.7 on this point).</A></para>
995
  <para><A NAME="6370">In the list below, the commands in <B>bold</B> (149) have
996
  been installed and validated on both Linux/i386 and Linux/Alpha, as opposed to
997
  the commands listed in plain characters, which are available on the first
998
  platform only.</A></para>
999
  <para><A NAME="6384">The few (13) commands listed in <I>italic</I> were ported
1000
  to both platforms, but their validation failed, or was not completed, on the
1001
  second platform.</A></para>
1002
  <para><A NAME="6390">Finally, in the `[p out of m]' statements, p is the
1003
  best-case number of commands we ported, while m is the maximum number of them
1004
  with respect to a given Slackware Linux package.</A></para>
1005
 
1006
 
1007
  <para><A NAME="3592"></A></para>
1008
  <itemizedlist>
1009
  <listitem>aaa_base package [9 commands out of 9]: fromdos, funzip, mtools, todos,
1010
  unzip, unzipsfx, zip, zipnote, zipsplit. 
1011
  <A NAME="4856"></A></listitem>
1012
  <listitem>ash package [1 command out of 1] : ash. 
1013
  <A NAME="3593"></A></listitem>
1014
  <listitem>bc package [1 command out of of 1]: <B>bc</B>. 
1015
  <A NAME="3594"></A></listitem>
1016
  <listitem>bin package [48 commands out of 56]: at, <B>bban, bpe, chgrp, chmod, chown</B>,
1017
  compress, <B>cp</B>, crond, crontab, <B>ctags, dd, df,</B> dircolors, <B>du</B>,
1018
  ed, <B>elvis, elvprsv, elvrec</B>, file, fiz, <B>fmt</B>, <I>gawk</I>, <B>ginstall</B>,
1019
  indent, <B>ln, ls, man, mkdir, mkfifo, mknod, mv, patch, ref, rm, rmdir</B>,
1020
  sed, <B>shar, sysvbanner, time, touch, tput</B>, unarj, <B>unshar, uudecode,
1021
  uuencode, which</B>, zoo. 
1022
  <A NAME="3595"></A></listitem>
1023
  <listitem>bsdgames package [13 command out of 36]: bcd, caesar, factor, fish, monop,
1024
  morse, number, paranoia, ppt, primes, rain, worm, worms. 
1025
  <A NAME="3596"></A></listitem>
1026
  <listitem>byacc package [1 command out of 1]: <B>byacc</B>. 
1027
  <A NAME="3597"></A></listitem>
1028
  <listitem>cpio package [2 commands out of of 2]: <I>cpio, mt-GNU</I>.  
1029
  </listitem>
1030
  <listitem>diff package [4 commands out of 4]: <B>cmp, diff, diff3, sdiff</B>. 
1031
  <A NAME="3599"></A></listitem>
1032
  <listitem>elm package [9 commands out of 9]: <I>answer</I>, <B>elm</B>, <I>elmalias</I>,
1033
  <B>fastmail, filter, frm,</B><I> newalias, newmail</I>, <B>readmsg</B>. 
1034
  <A NAME="3600"></A></listitem>
1035
  <listitem>find package [6 commands out of of 6]: <B>bigram, code, find, frcode,
1036
  locate, xargs</B>. 
1037
  <A NAME="3601"></A></listitem>
1038
  <listitem>flex package [1 command out of 1]: <B>flex</B>. 
1039
  <A NAME="3602"></A></listitem>
1040
  <listitem>getty package [2 commands out of 2]: getty, uugetty. 
1041
  <A NAME="3603"></A></listitem>
1042
  <listitem>grep package [1 command of 1]: <B>grep</B>. 
1043
  <A NAME="3604"></A></listitem>
1044
  <listitem>gzip package [1 command out of of 1]: <B>gzip</B>. 
1045
  <A NAME="3605"></A></listitem>
1046
  <listitem>ispell package [6 commands out of 6]: <B>buildash, icombine, ijoin,
1047
  ispell, sq, unsq</B>. 
1048
  <A NAME="3606"></A></listitem>
1049
  <listitem>joe package [2 commands out of 2]: joe, termidx. 
1050
  <A NAME="3607"></A></listitem>
1051
  <listitem>less package [2 commands out of 2]: <B>less, lesskey</B>. 
1052
  <A NAME="3608"></A></listitem>
1053
  <listitem>m4 package [2 commands out of 2]:<B> ansi2knr, m4</B>. 
1054
  <A NAME="3609"></A></listitem>
1055
  <listitem>perl package [4 commands out of 4]:<I> a2p, perl4.036, sperl4.036,
1056
  tperl4.036</I>. 
1057
  <A NAME="3610"></A></listitem>
1058
  <listitem>ps package [11 commands out of of 12]: free, fuser, killall, ps, pstree,
1059
  psupdate, tload, uptime, vmstat, w.procps, w.bassman. 
1060
  <A NAME="3611"></A></listitem>
1061
  <listitem>rcs package [8 commands out of 8]: <B>ci, co, ident, merge, rcs, rcsdiff,
1062
  rcsmerge, rlog</B>. 
1063
  <A NAME="3612"></A></listitem>
1064
  <listitem>sh_utils package [24 commands out of 24]:<B> basename, date, dirname,
1065
  echo, env, expr, id, logname, nice, pathchk, printenv, printf, pwd, sleep, stty,
1066
  su, tee, test, tty, uname, users, who, whoami, yes</B>. 
1067
  <A NAME="3613"></A></listitem>
1068
  <listitem>sudo package [2 commands out of 2]: sudo.bin, visudo. 
1069
  <A NAME="3614"></A></listitem>
1070
  <listitem>tar package [3 commands out of of 3]: <B>tar</B>, <I>rmt</I>, testpad. 
1071
  <A NAME="3615"></A></listitem>
1072
  <listitem>tcpip package [7 commands out of 31 (from the net-tools subset)]: arp,
1073
  ifconfig, plipconfig, rarp, route, netstat, slattach. 
1074
  <A NAME="3616"></A></listitem>
1075
  <listitem>txtutils package [22 commands out of 22]: <B>cat, cksum, comm, csplit,
1076
  cut, expand, fold, head, join, nl, od, paste, pr, sort, split, sum, tac, tail,
1077
  tr, unexpand, uniq, wc</B>. 
1078
  <A NAME="3617"></A></listitem>
1079
  <listitem>util package [35 commands out of 57]: agetty, <B>arch, banner, chfn,
1080
  chroot, chsh, col, colcrt, colrm, column, ddate, frag, hexdump, hostname, ipcrm,
1081
  ipcs, last, login, mesg, more, newgrp, passwd, rdev</B>, readprofile, <B>renice,
1082
  rev, setsid, sln</B>, strings, swapon, <B>ul, vipw, wall</B>, <I>zdump</I>,
1083
  <B>zic</B>. 
1084
  <A NAME="3618"></A></listitem>
1085
  <listitem>xgames package [8 commands out of 13] : maze, xcolormap, spider, xtetris,
1086
  xlander, xminesweep, xroach, xvier. 
1087
  <A NAME="3619"></A></listitem>
1088
  <listitem>xlock package [1 command out of 1]: xlock. 
1089
  </listitem></itemizedlist>
1090
  <para><A NAME="4846"></A></para>
1091
  </sect2>
1092
  <sect2>
1093
  <title>Setting up the build environment</title>
1094
  <para><A NAME="4845">The environments for the NAT-NAT, DRA-NAT and DRA-DRA builds
1095
  have been setup using similar to those used during the Unixware port.</A></para>
1096
 
1097
 
1098
  <para><A NAME="2815"></A></para>
1099
  <itemizedlist>
1100
  <listitem>One single reference source tree, then a dedicated work tree per (build,
1101
  target platform). For the 1st target (Linux/i386), each work tree holds symbolic
1102
  links to the <I>source</I> tree, while binaries are built inside a <I>work</I>
1103
  tree as plain files. In addition, a procedure is used to replace a link to the
1104
  source tree by a link to a <I>patch</I> tree when a source file has to be
1105
  modified during the port to TenDRA. This is very similar to the environment we
1106
  had on Unixware. The major difference is that each package has its own set of
1107
  <I>source/work/patch</I> file trees. This is more modular but requires more
1108
  manipulations. 
1109
  <A NAME="8189"></A></listitem>
1110
  <listitem>For the 2nd target (Linux/Alpha): we usually created only a work tree for
1111
  the `DRA-DRA' build. It initially contained `source' files only, which are
1112
  symbolic links to their equivalent in the `DRA-DRA'/i386 work tree. By `source
1113
  files' we mean here the Makefiles and the <B>ANDF</B> - <B>.j</B> - files
1114
  having been generated from the original .c files by the TenDRA producer, during
1115
  the DRA-DRA build for Linux/i386. 
1116
  <A NAME="8208"></A></listitem>
1117
  <listitem>A shell script used as a pseudo cc (e.g. pseudo gcc) during the DRA-NAT and
1118
  DRA-DRA builds. This avoids the necessity to modify most of the original
1119
  makefiles when building the commands. The pseudo <I>cc</I> used during the
1120
  build for the 2nd platform substitutes the (usually unique) <I>input_file</I><B>.c</B>
1121
  by <I>input_file</I><B>.j</B>. 
1122
  </listitem></itemizedlist>
1123
  <para><A NAME="2809">One specific feature of the sources and build procedures of
1124
  the Linux commands is that they have often been designed to support a variety of
1125
  target platforms and UNIX variants at source level. Thus, when building a
1126
  command for the first time, there is usually a preliminary self-configuration
1127
  step which examines the system header files, and produces a local header file
1128
  (or a customized Makefile) which summarizes the target system peculiarities by
1129
  means of #define (or -D) statements. We ran such self-configuration scripts
1130
  before creating the NAT-NAT, DRA-NAT and DRA-DRA work trees: this assumes that
1131
  our second platform for porting (Linux/Alpha) is to provide similar APIs to the
1132
  1st one (Linux/i386). Eventually, we had to revise the settings chose by the
1133
  self-configuration.</A></para>
1134
  <para><A NAME="2801"></A></para>
1135
  </sect2>
1136
  <sect2>
1137
  <title>NAT-NAT/i386 and DRA-NAT/i386 build problems</title>
1138
  <para><A NAME="2827">These two builds of the commands were only performed on the
1139
  Linux/i386 platform, as a sanity check and cleanup of the source code.</A></para>
1140
  <para><A NAME="2917">We faced only one problem during the NAT-NAT/i386 build of a
1141
  few commands.</A></para>
1142
 
1143
 
1144
  <para><A NAME="2845"></A></para>
1145
  <itemizedlist>
1146
  <listitem>Some header files (e.g. <I>linux/autoconf.h</I>) were not found when
1147
  attempting to compile some administrative commands. To gain access to such
1148
  headers, the preliminary step of a kernel rebuild can be done; alternatively,
1149
  one could manually establish the proper symbolic links for <I>/usr/include/linux
1150
  </I>and
1151
  <I>/usr/include/asm</I>: they should point to their equivalent inside the<I>/usr/src/linux/include
1152
  </I>directory. 
1153
  </listitem></itemizedlist>
1154
  <para><A NAME="2849">We faced a limited number of problems during the
1155
  DRA-NAT/i386 builds of the commands. We list these problems below:</A></para>
1156
 
1157
 
1158
  <para><A NAME="2829"></A></para>
1159
  <itemizedlist>
1160
  <listitem>The link-edit of some commands failed because one symbol was undefined:
1161
  <I>_alloca</I>. In the native compiler (gcc), <I>_alloca</I> is implemented as
1162
  a built-in function. In the TenDRA compiler, this can also be the case, provided
1163
  that the header file <I>alloca.h</I> is explicitly included. So we modified the
1164
  relevant source files to include this header file. 
1165
  <A NAME="2842"></A></listitem>
1166
  <listitem>The source code for some commands appeared to use, through the inclusion of
1167
  a system header file or under <I>#ifdef i386</I> conditional instruction, some
1168
  assembly code. The related commands were thus excluded from our set of commands,
1169
  except for a few of them for which we found a C variant to the assembly code. 
1170
  <A NAME="2592"></A></listitem>
1171
  <listitem>Re-declaration of an array, for which the dimension was computed using
1172
  <I>sizeof</I>. The following code sums-up the problem: 
1173
  <A NAME="2593"></A>
1174
  <literallayout>	extern int lnum[sizeof(short)];
1175
  int lnum[sizeof(short)]; /* bis */
1176
  </literallayout>   
1177
  </listitem></itemizedlist>
1178
  <para><A NAME="2595">We sent a Change Request, <I>array_sizeof(262)</I>,
1179
  concerning this problem, which applied to the apr-95 and nov-95 TenDRA releases.
1180
  It has now been fixed.</A></para>
1181
 
1182
 
1183
  <para><A NAME="2597"></A></para>
1184
  <itemizedlist>
1185
  <listitem>Name conflict between a function and its arguments. The following code
1186
  sums-up the problem: 
1187
  <literallayout>	char *fields(fields)
1188
  	char *fields;
1189
  	{ return fields; }
1190
  </literallayout> 
1191
  </listitem></itemizedlist>
1192
  <para><A NAME="2901">We sent a Change Request, <I>func_var(262)</I>, concerning
1193
  this problem, which applies to the apr-95 and nov-95 TenDRA releases. It has now
1194
  been fixed.</A></para>
1195
 
1196
 
1197
  <para><A NAME="2603"></A></para>
1198
  <itemizedlist>
1199
  <listitem>Use of custom options of the native compiler (gcc), e.g.:
1200
  <literallayout>   -fpcc_struct_return</literallayout> This option was used in the Makefile for the
1201
  getty package. The gcc man page says that this option provides intercallability
1202
  with modules (e.g. library modules) compiled with a pcc compiler. We concluded
1203
  that this was not relevant when compiling for a Linux target platform, since gcc
1204
  is used to compile the libraries, and we ignored it. Similarly, we ignored, i.e.
1205
  filtered out in our pseudo-gcc for DRA-NAT/DRA-DRA builds, many other gcc
1206
  options such as:
1207
  <literallayout>   -fomit-frame-pointer, -pipe, -g</literallayout>while we adapted to TenDRA style
1208
  some others, such as:
1209
  <literallayout>   -static /* gcc */ --&gt; -Wl,-static /* tcc */ 
1210
  </literallayout>  </listitem></itemizedlist>
1211
  <para><A NAME="2743"></A></para>
1212
</sect2>
1213
  </sect1>
1214
  <sect1>
1215
  <title>5.4 Definition of the API for the commands</title>
1216
  <para><A NAME="5031">We started the experiment with an xpg3 API, and decided to
1217
  put all other symbols we needed in an extension API. However, after a few
1218
  compilations of Linux commands, it became clear that most of the symbols we were
1219
  adding to the extension API were in fact part of some other standard APIs, such
1220
  as svid3.</A></para>
1221
  <para><A NAME="3057">So, we redefined our base API to be a merge between the
1222
  xpg3, svid3, gcc and bsd_extn APIs delivered with TenDRA, limiting the extension
1223
  API to symbols specific to the Linux commands interface. In fact, some of the
1224
  symbols in the extension API are defined in the standard cose API, but since
1225
  this API is very partially supported by Linux, and sometimes conflicts with
1226
  definitions provided in other APIs, it was not worth including it in the base
1227
  API.</A></para>
1228
  <para><A NAME="3085">For the<I> level 2</I> set of commands, we downloaded some
1229
  packages using a BSD-like interface, and we tried to include the symbol
1230
  definitions for these commands in our extension API. However, this appeared to
1231
  be very difficult, since we found that the Linux implementation of some BSD
1232
  interfaces redefines symbols from the POSIX API, in an incompatible way. This is
1233
  reflected in the Linux header files by conditional definitions, selected with
1234
  the _BSD_SOURCE macro for example, or by replacement header files, such as
1235
  bsd/signal.h instead of signal.h. The incompatible definitions we found were for
1236
  the <I>jmp_buf</I> type, the <I>setjmp()</I>, <I>getpgrp()</I>, <I>wait()</I>,
1237
  <I>waitpid()</I>, <I>wait3()</I> and
1238
  <I>wait4()</I> functions, and finally the<I> signal()</I> function redefined
1239
  as <I>bsd_signal()</I>.</A></para>
1240
  <para><A NAME="3154">This problem could have been resolved by removing from our
1241
  base API the conflicting symbols, and creating a <I>conflict_posix</I> and a
1242
  <I>conflict_bsd</I> extension APIs with these symbols. The compilation of the
1243
  commands based on a BSD-like API would have used the <I>conflict_bsd</I> API,
1244
  in addition to the base and `regular extension' APIs, and would have been
1245
  link-edited with the
1246
  <I>libbsd</I> library provided by Linux. Since this would have taken a lot of
1247
  time, we preferred not to modify our API and we set aside these commands, unless
1248
  we found a simple work-around: selecting at build-time, or recoding to, a POSIX
1249
  adherence for them (refer to next section).</A></para>
1250
  <para><A NAME="3069">Finally, in order to compile some X11 commands, a separate
1251
  API including the <I>x5_lib</I>, <I>x5_t</I>, <I>x5_mu</I>,<I> x5_aw</I> and<I>x5_mit</I>
1252
  standard APIs, has been created. Since Linux is based on X11R6, an extension API
1253
  has also been created, which includes the few symbols we had to define for the
1254
  X11 commands we built.</A></para>
1255
  <para><A NAME="5289">We found one inconsistency between the Linux header files
1256
  and the standard API provided with TenDRA for the &lt;sys/socket.h&gt; header
1257
  file, defined in the bsd_ext API: we had to change almost every use of <I>caddr_t</I>
1258
  to <I>struct sockaddr *</I>. We also found a few inconsistencies between the
1259
  Linux/i386 and Linux/Alpha header files, which have been resolved by some
1260
  corrections to the Linux native header files, in the API definition, and in the
1261
  source code for one command (<I>more</I>).</A></para>
1262
  <para><A NAME="2745"></A></para>
1263
  </sect1>
1264
  <sect1>
1265
  <title>5.5 ANDFization of the commands</title>
1266
  <para><A NAME="5033">We encountered different kinds of problems when compiling
1267
  with TenDRA the set of commands on the Linux/i386 platform. Among these
1268
  problems, only one was related to a bug in the TenDRA technology, the others
1269
  were either related to ANDF constraints, or to more general portability issues.</A></para>
1270
  <para><A NAME="6085"></A></para>
1271
  <sect2>
1272
  <title>Dealing with ANDF constraints</title>
1273
  <para>We list below problems we encountered while ANDFizing Linux
1274
    commands, which are related to the use of the TenDRA technology as a 
1275
  replacement
1276
  to a classic compiler. We start with the only bug found in TenDRA during 
1277
  this
1278
  process, then we roughly follow the order in which the various issues were
1279
  encountered.</para>
1280
 
1281
  <itemizedlist>
1282
    <listitem>
1283
      <para>Redefinition of an API token as a macro</para>
1284
 
1285
      <para>In the code below, <I>alarm</I> is defined as a macro, but it is 
1286
        also a token in our API:</para>
1287
 
1288
      <literallayout>
1289
        #include &lt;unistd.h&gt; /* for alarm() */
1290
  	xtern int debug() ;
1291
  	#define D_RUN 1
1292
  	#define alarm(d) alarm(d); debug(D_RUN, ``alarm set: %s:%u'',\
1293
  			__FILE__, __LINE__)
1294
  	long xx() { return alarm((long)5); }
1295
      </literallayout>
1296
 
1297
      <para>This code is indeed illegal, but tdfc entered an infinite loop.
1298
        The problem was reported to DRA as <I>loop_tdfc_alarm(276)</I>, and
1299
        has now been fixed.</para>
1300
    </listitem>
1301
 
1302
    <listitem>
1303
      <para>Added missing startup macros<para></para>When the TenDRA
1304
        compiler (tcc) was used, a number of startup flags, defined with the
1305
        native compiler (gcc), were missing.  The <I>linux</I>,
1306
        <I>__linux__</I>, <I>unix</I> and _<I>_X11_P_HEADERS</I> flags, plus a
1307
        number of flags defined in the native <I>features.h</I> header file,
1308
        such as <I>_POSIX_SOURCE</I>, were added in a startup file for tcc.
1309
      </para>
1310
    </listitem>
1311
 
1312
  <listitem><para>Added missing function prototypes and fixed type
1313
    mismatches</para><para>We used a tcc option to warn about missing function
1314
    prototypes, and we fixed them by either including the appropriate header
1315
    files or adding their prototype for locally defined functions. We added
1316
    casting on some calls to library functions.  Then, every remaining
1317
    undeclared symbol was added to the extension API. <emphasis>Note than more
1318
    than half of the changes we made in the source code for Linux commands
1319
    consisted in adding such prototypes.</emphasis>
1320
    <A NAME="3799"></A></para></listitem>
1321
 
1322
<listitem>
1323
  <para>Resolved one conflict with an API symbol</para>
1324
 
1325
  <para>The function <I>mkdir()</I>, local to the file <I>mtools</I>, has been
1326
    renamed to avoid a conflict with the API symbol defined in
1327
    &lt;sys/stat.h&gt;.<A NAME="5412"></A></para></listitem>
1328
 
1329
  <listitem>Illegal use of target-dependent condition<BR/>In the code below,
1330
    INT_MAX is a target dependent token, which cannot be used to conditionally
1331
    define a preprocessor macro:<A NAME="5413"></A>
1332
  <literallayout>	#if (INT_MAX &lt;= 65535)
1333
  	#define longdiff(a, b) /* (definition 1 for the macro) */
1334
  	#else
1335
  	#define longdiff(a, b) /* (definition 2 for the macro) */
1336
  	#endif
1337
  </literallayout> 
1338
  <I>We fixed it by replacing the macro definition by a static functions:</I>
1339
  <literallayout>	static int longdiff(time_t a, time_t b) {
1340
  	#if (INT_MAX &lt;= 65535)
1341
  	/* ... (definition 1 for the function) */
1342
  	#else
1343
  	/* ... (definition 2 for the function) */
1344
  	#endif
1345
  	}
1346
      </literallayout>
1347
 
1348
      <para>This constraint arises from the way ANDF is used to achieve
1349
        portability between targets which may have different values for
1350
        INT_MAX. The constraint is that a target-dependent #if is permitted
1351
        only where a statement is permissible, and both alternatives must be
1352
        legal statement lists.</para>
1353
 
1354
      <para>This constraint unfortunately prevents target-dependent macro
1355
        definitions in the style shown above. DRA is currently considering
1356
        whether the constraint may be eased in a subsequent version of TenDRA
1357
        to permit certain well-formed cases such as this.</para>
1358
    </listitem>
1359
 
1360
    <listitem>
1361
      <para>POSIX.1 or SVID interfaces versus BSD interfaces</para>
1362
 
1363
      <para>Three functions of the <I>bin</I> package, <command>time</command>
1364
        and <command>crontab</command>, and <command>ash</command> (a simple
1365
        shell), were configured to use some BSD interfaces which had not been
1366
        included into our API, as discussed in
1367
        <link linkend="linux_re.htm#2743">&#167;  5.4</link>.</para>
1368
 
1369
      <para>For the <command>time</command> command, we found that the support
1370
        for POSIX interfaces was provided in the source code, so we used it.
1371
      </para>
1372
 
1373
      <para>Similarly, prior to building <command>ash</command>, we modified
1374
        the related configuration file and Makefile, in order to elect
1375
        svid3-like interfaces instead of the default bsd ones.</para>
1376
 
1377
  <para>For the <command>crontab</command> command, we fixed the problem by
1378
    removing in the source code some (simple) calls to the BSD
1379
    <function>wait4()</function> function, and by using the XPG3
1380
    <function>waitpid()</function> function instead.</para></listitem>
1381
 
1382
  <listitem>For a few commands which use the <I>curses</I> interface, e.g.
1383
    <I>bpe</I>, we chose the svid3 variant instead of the BSD one (they are
1384
    both supported by Linux). Makefiles for building these commands with
1385
    TenDRA have been changed to use the <I>libncurses</I> library instead of
1386
    the <I>libcurses</I> library at link-edit time. Note that the sources for
1387
    the <I>elvis</I> editor (from the <I>bin</I> package) embed a small custom
1388
    version of the <I>curses</I> interface.</listitem>
1389
 
1390
  <listitem>For some commands, the initial self-configuration step performed
1391
    prior to entering the actual build defines the path for another command,
1392
    because the latter is called by the first one by means of
1393
    <function>exec()</function> or <function>system()</function>.  While Linux
1394
    provides the &lt;paths.h&gt; header file for this purpose, we found some
1395
    files which do not include this header file, and others which need to call
1396
    a command for which there is no path definition in the regular header. An
1397
    example of such a situation is <command>elm</command>, which calls an
1398
    editor (e.g. <command>vi</command>).  When we detected such situations, we
1399
    either modified the source code to include and use &lt;paths.h&gt;, or we
1400
    added a definition inside the alternate &lt;paths.h&gt; specified in our
1401
    extension API.</listitem>
1402
 
1403
  <listitem>Pointer/Integer conversion<BR/>The TenDRA compiler can be
1404
    configured to issue a warning on every pointer/integer conversion. This is
1405
    done with the pragma instruction:<BR/><I>#pragma TenDRA conversion
1406
    analysis (int-pointer) warning</I><BR/>However, due to the very large
1407
    number of occurrences of these warnings, we had to cancel this mode, and
1408
    decided to postpone their analysis until after the validation
1409
    step.<BR/>For example, we encountered uses of `-1' (minus one) to give a
1410
    special meaning to a pointer value, while only `0' (NULL) is accepted for
1411
    this purpose. (Note: 64-bit issues are discussed later in this section.)
1412
    <A NAME="5432"></A></listitem>
1413
 
1414
  <listitem>Underspecified type in svid3 API<BR/>We found one command which
1415
  makes the assumption that the daddr_t type, defined in the svid3 API, is an
1416
  arithmetic type. The source code casts a daddr_t value into an int, while
1417
  daddr_t is defined in the API as: 
1418
 
1419
  <literallayout>
1420
    +TYPE daddr_t;
1421
  </literallayout>
1422
 
1423
  We fixed this problem by stating that daddr_t is indeed an arithmetic type,
1424
  which is correct for both Linux/i386 and Linux/Alpha. We initially modified
1425
  the reference svid3 API, but later we did it more cleanly, moving the
1426
  daddr_t definition to our extension API prior to changing it to:
1427
 
1428
  <literallayout>
1429
    +TYPE (int) daddr_t;
1430
  </literallayout>
1431
 
1432
  Also, prior to fixing this in the API, we found that casting an integer
1433
  value to a daddr_t type was not rejected by the TenDRA compiler, while it is
1434
  obviously illegal. A bug report has been sent to DRA, and this has now been
1435
  fixed.
1436
  </listitem>
1437
 
1438
  <listitem>Recoding of a source file dealing with target platform byte ordering
1439
  issues.<BR/>A source file used a local BYTEORDER macro, set-up during the
1440
  initial self-configuration step of the build of the command, to support
1441
  different byte ordering. However, Linux already provides for this purpose a
1442
  __BYTE_ODER macro, defined in the &lt;bytesex.h&gt; header file. So, we added
1443
  the __BYTE_ORDER symbol to our API, and replaced all the occurrences of the
1444
  BYTEORDER macro by references to the __BYTE_ODER API macro. We also had to
1445
  rewrite some code, because with TenDRA some instructions are illegal after a
1446
  target dependent condition.</listitem>
1447
 
1448
  <listitem>The termio and termios interfaces are both provided with Linux,
1449
  and share the same set of macros to define indexes in the<I> c_cc </I>array
1450
  from either the termio or termios structures. On Linux/i386, these indexes
1451
  are the same for the two structures, while on Linux/Alpha they differ.
1452
  TenDRA provides a way to support different variants of a same object, using
1453
  version numbers, and this should have solved our problem. However, since we
1454
  never used this feature before, we did not spend time to see how we could
1455
  use it in our API. Instead, we made a temporary fix, consisting in renaming
1456
  the constants in the termio interface. For two of the commands we ported,
1457
  <I>more</I> and <I>ispell</I>, which use the termio interface, we changed
1458
  their sources to reference the new macros. 
1459
  </listitem></itemizedlist>
1460
 
1461
  </sect2>
1462
 
1463
  <sect2>
1464
  <title>Undocumented dependencies to the OS / the underlying hardware</title>
1465
  <para>Some commands are platform dependent, and are not
1466
    easily (sometimes: not at all) portable from one platform to another.
1467
    However, the Linux/i386 and Linux/Alpha OS's are very similar;
1468
    furthermore, some hardware architectures built around the DEC Alpha chip
1469
    are not much different from the Intel-based PC: for example, our
1470
    Linux/Alpha platform includes ISA adapters for graphics and Ethernet. In
1471
    such a favorable situation, the Linux/i386 <I>ifconfig</I> command (from
1472
    the<I> tcpip/net-tools</I> subset), which displays hardware information on
1473
    the network interfaces such as their (ISA) ``Base address'', could
1474
    probably have been easily ported to Linux/Alpha (/AXP pci). Also, the perl
1475
    command, which includes optional support for undocumented system calls,
1476
    may or may not be portable between two Linux platforms, depending on the
1477
    system calls they implement.</para>
1478
 
1479
  <para>On the other hand, changing the format for binary
1480
  files, e.g. switching from a classic Linux <I>a.out</I> format to the
1481
  Digital Unix `Extended COFF', may require changes in some common commands
1482
  such as <I>strings</I> or <I>file</I>. When using a classic compiler, some
1483
  (or even all in a favorable case) of these changes may be hidden inside the
1484
  system header files, e.g. &lt;a.out.h&gt;, but the TenDRA compilation chain,
1485
  when used in DRA-DRA mode, is often more rigid.</para>
1486
 
1487
  </sect2>
1488
 
1489
  <sect2>
1490
  <title>Upgrade to TenDRA 4.0</title>
1491
  <para>When we had ANDFized the whole set of commands, we
1492
    upgraded to TenDRA 4.0 in order to work on the Linux/Alpha platform (see
1493
    <A HREF="linux_re.htm#2200">TenDRA installation on Dec/Alpha</A>).
1494
    However, we had to ANDFize again the set of commands with the new TenDRA
1495
    version, since it was not upward compatible with the previous one. In
1496
    fact, we only re-ANDFized the commands we tried to install on the
1497
    Dec/Alpha platform, at the time we needed them. We did not encounter any
1498
    problem when doing this.</para>
1499
 
1500
  </sect2>
1501
 
1502
  <sect2>
1503
  <title>Holes in source code portability (64-bit vs 32-bit issues)</title>
1504
  <para>During the installation and validation of these
1505
    commands on the second platform, we found a number of bugs related to
1506
    portability problems, which are out of the scope of TenDRA. All these bugs
1507
    were due to code assuming 32-bit platforms, which break on 64-bit
1508
    platforms. Some of the bugs we found were already fixed in early
1509
    Linux/Alpha releases, such as the Blade release, others were still there.
1510
    We fixed the source of the commands, re-andfized them, and installed and
1511
    validated these commands again on the two platforms. We give below the
1512
    portability issues we encountered:</para>
1513
 
1514
  <itemizedlist>
1515
    <listitem>Wrong <I>int &lt;-&gt; pointer</I> conversion<BR/>On Linux/Alpha
1516
      (and Digital Unix/Alpha), a pointer type is 8-bytes wide, so it cannot
1517
      fit in an <I>int</I> type, which is only 4-bytes wide. Fortunately, the
1518
      <I>long</I> type on Linux/Alpha is, as usual, as large as a pointer, and
1519
      thus can be used as a replacement for an <I>int</I>, each time an
1520
      explicit pointer&lt;-&gt;integer is used. This is a common type of the
1521
      portability fixes we had to make in the source code for Linux commands,
1522
      subsequent to encountering a `Linux/Alpha-only' problem at validation
1523
      time.</listitem>
1524
 
1525
  <listitem>Incorrect assumptions on sizes of <I>int</I>, <I>long</I> and
1526
  <I>size_t</I><BR/>Although in many cases int and long types are equivalent,
1527
  we give below three examples of code we found where it makes a difference:
1528
  <literallayout>
1529
/* #1 */ { int i; printf(``i value is: %ld\n'', i); }
1530
/* #2 */ extern char *malloc(int);
1531
/* #3 */ { long l ; printf(``%08lx'', l); }
1532
  </literallayout>
1533
      All three work perfectly on Linux/i386, while they cause, or could
1534
      cause, damage under Linux/Alpha.<BR/>In the first two lines the
1535
      function, printf or malloc, will read respectively a long on the stack,
1536
      which are 8 bytes wide, while only 4 bytes for an int would have been
1537
      pushed. Note that the correct prototype for malloc is char
1538
      *malloc(size_t), and that size_t is equivalent to long on Linux/Alpha.We
1539
      fixed the error on such printf statements with a cast to long for an
1540
      argument, and the error on malloc by replacing its local-and-wrong
1541
      declaration by the inclusion of the &lt;stdlib.h&gt; header
1542
      file.<BR/><BR/>In the third case, the instruction was used to print a
1543
      fixed number of digits.  However, a long, 8-bytes on an Alpha platform,
1544
      may hold a value that prints up to 16 digits, thus putting unexpected
1545
      digits in the output. In the code where we found the problem, the fix
1546
      was to truncate the value to a 4-byte value.  </listitem>
1547
  </itemizedlist>
1548
 
1549
  <para><A NAME="6139"></A></para>
1550
</sect2>
1551
  </sect1>
1552
 
1553
  <sect1>
1554
  <title>5.6 Installation of the API for the commands</title>
1555
  <sect2>
1556
  <title>Installation of the API on Linux/i386</title>
1557
  <para>The API is made of two parts, a base API, which is a
1558
    merge between xpg3, svid3, gcc and bsd_extn APIs, and an extension API,
1559
    which completes the interface required for the commands (see <A
1560
    HREF="linux_re.htm#2743">Definition of the API for the
1561
    commands</A>).</para>
1562
  <para><A NAME="4431">The base API was installed on the Linux/i386 platform,
1563
  without any problem. However, we left some tokens undefined when some parts of
1564
  the API were not part of the actual Linux API. Then, the extension API was
1565
  installed, as we extended it to cover more and more commands. These
1566
  installations required a few patches to the system header files, some of which
1567
  were already provided with the TenDRA snapshot. These installations went very
1568
  well, with only a few problems, listed in a following paragraph. Then, when we
1569
  moved to a new TenDRA snapshot to the Linux/Alpha platform, we re-installed the
1570
  API, without any problem.</A></para>
1571
  <para><A NAME="5724">We made a small number of modifications to the API during
1572
  the port of the commands on the Linux/Alpha platform. However, each modification
1573
  we made required re-installation of some parts of the API.</A></para>
1574
  <para><A NAME="4094"></A></para>
1575
  </sect2>
1576
  <sect2>
1577
  <title>Installation of the API on Linux/Alpha</title>
1578
  <para><A NAME="4163">As for the Linux/i386 platform, we had to apply some patches
1579
  to the system header files in order to install the API. A number of these
1580
  patches were actually identical to the patches we made on the Linux/i386 header
1581
  files. So, instead of copying and editing, by hand, these files again, we chose
1582
  to implement these patches by means of <I>sed</I> scripts, which could be
1583
  applied to both Linux/i386 and Linux/Alpha header files. Most of these scripts
1584
  are now common to the two platforms, although a few of them are specific to one.
1585
  These
1586
  <I>sed</I> scripts not only facilitate corrections to the system header files,
1587
  but would also be useful if we need to upgrade from one Linux version to
1588
  another.</A></para>
1589
  <para><A NAME="4448">The Linux/Alpha system header files do not differ much from
1590
  the Linux/i386 ones. However, since the Linux/Alpha port was derived from a more
1591
  recent Linux/i386 version (Linux 1.3) than the one we used (Linux 1.1), we could
1592
  not clearly distinguish between the changes which come from standard Linux
1593
  evolutions and those which have been introduced during the port of Linux to
1594
  Digital Alpha. One important modification was that some definitions found on
1595
  Linux/i386 in some &lt;linux/*&gt; or &lt;sys/*&gt; header files have now been
1596
  moved into &lt;asm/*&gt; header files. We had to take such changes into account
1597
  when adapting the Linux/i386 modifications to Linux/Alpha.</A></para>
1598
  <para><A NAME="4449">Finally, we did not port to Linux/Alpha the extension API to
1599
  the TenDRA x5/* APIs. This would have required installation of X11 on our
1600
  Linux/Alpha box, which consists of 28 additional floppy images! This part of the
1601
  API was only required for 9 commands from our set of commands, which we did not
1602
  install on Linux/Alpha.</A></para>
1603
  <para><A NAME="4199"></A></para>
1604
  </sect2>
1605
  <sect2>
1606
  <title>API installation problems</title>
1607
  <para><A NAME="4211">We list below the problems we found when building the API on
1608
  the Linux/i386 or the Linux/Alpha platforms, and the solution we adopted.</A></para>
1609
 
1610
 
1611
  <para><A NAME="11427"></A></para>
1612
  <itemizedlist>
1613
  <listitem>A macro, <I>makedev</I>, added to our extension API, was defined in the
1614
  Linux/i386<I>sys/sysmacros.h </I>header file. This file contains the lines:
1615
  <literallayout>    #define major(dev) ...
1616
      #define minor(dev) ...
1617
      #define makedev(major,minor) ...
1618
  </literallayout> The identifiers <I>major</I> and <I>minor</I> used to name the formal
1619
  parameters of the <I>makedev</I> macro are also the name of two macros defined
1620
  in this header file, which we included in our API. The clash on the names is
1621
  reported as an error by tdfc when building the API. We did not check whether
1622
  this was a TenDRA bug or not, but we bypassed the problem by using an alternate
1623
  version of <I>sys/sysmacros.h</I>, in which the formal parameters of the <I>makedev</I>
1624
  macro have been renamed. 
1625
  <A NAME="4269"></A></listitem>
1626
  <listitem>The &lt;bytesex.h&gt; header file contained the following lines:
1627
  <literallayout>   
1628
      #undef __BYTE_ORDER
1629
      #define __BYTE_ORDER 1234
1630
  </literallayout> The<I> #undef</I> line prevents tcc from finding the definition of the
1631
  __BYTE_ORDER constant. This is a constraint that applies only when building API
1632
  token libraries. It is a necessary consequence of using C macro definitions to
1633
  obtain ANDF token definitions. We bypassed this behaviour by commenting out the
1634
  #undef line in a replacement header file. 
1635
  <A NAME="4274"></A></listitem>
1636
  <listitem>The Linux/Alpha header files do not follow the standard APIs in some cases.
1637
  For example, the Linux/Alpha &lt;sys/stat.h&gt; header file defines the field
1638
  <I>st_dev</I> from the <I>stat</I> structure as `unsigned int' instead of
1639
  `dev_t' as defined in XPG/3. Since `dev_t' is equivalent to `unsigned int' on
1640
  Linux/Alpha, we were able to modify the system header file to use the correct
1641
  type. 
1642
  <A NAME="4318"></A></listitem>
1643
  <listitem>The Linux/Alpha header files sometimes use an `int' type, in places where a
1644
  `long' type is used on Linux/i386. In such cases, we decided to patch the
1645
  Linux/i386 header files to use an `int' type, since `long' and `int' are
1646
  equivalent on a 32-bit platform. 
1647
  <A NAME="4337"></A></listitem>
1648
  <listitem>The reverse situation, where Linux/i386 uses an `int' and Linux/Alpha uses
1649
  a `long', has also been found. In this case, we preferred to modify the API to
1650
  accept both types, using the tspec `+TYPE (int) ...' notation. 
1651
  <A NAME="4406"></A></listitem>
1652
  <listitem>On the Linux/i386 platform, we extended the API with some symbols from the &lt;termio.h&gt;
1653
  header file. The &lt;termio.h&gt; system header file has changed between
1654
  Linux/i386 and Linux/Alpha, and some definition were incompatible with the
1655
  extension API. We eventually found a solution, which involved a fix to the Linux
1656
  header files. 
1657
  <A NAME="4361"></A></listitem>
1658
  <listitem>The Linux system supports two variants of the <I>curses</I> library, one
1659
  defined by the &lt;curses.h&gt; header file for a BSD API, and the other defined
1660
  by the &lt;ncurses.h&gt; header file for a svid3 API. We used the latter to
1661
  build the API, since we do not support the BSD API. 
1662
  <A NAME="5348"></A></listitem>
1663
  <listitem>The TenDRA svid3 API defines the constant RLIM_INFINITY, from the
1664
  sys/resource.h header file, as follow:
1665
  <literallayout>    +CONST int RLIM_INFINITY;
1666
  </literallayout> However, this constant is used to assign variables of type <I>rlimit_t</I>,
1667
  which is, on Dec/Alpha, defined as a long, thus 8-bytes wide. So the problem
1668
  was: while this constant was defined with the value 0x7fffffffffffffffL, it was
1669
  actually truncated to fit within a (32-bit) int. We fixed this bug by replacing
1670
  the definition of RLIM_INFINITY by:
1671
  <literallayout>    +CONST rlimit_t RLIM_INFINITY;</literallayout> 
1672
  </listitem></itemizedlist>
1673
  <para><A NAME="1788"></A></para>
1674
</sect2>
1675
  </sect1>
1676
  <sect1>
1677
  <title>5.7 Installation and validation of the commands</title>
1678
  <para>On the Linux/i386 platform, we used the TenDRA compiler to
1679
  produce the ANDF files, and then translate them into binary executable files, in
1680
  the same invocation of the compiler. A tcc option was used to preserve the
1681
  intermediate ANDF files.</para>
1682
  <para><A NAME="4569">On the Linux/Alpha platform, we used the ANDF files produced
1683
  on the Linux/i386 platform, and translated them into binary executable files.
1684
  For this platform, we ran the TenDRA compiler on a Dec/Alpha platform as a
1685
  cross-compiler for the Linux/Alpha platform (see </A><A HREF="linux_re.htm#2200">TenDRA
1686
  installation on Dec/Alpha</A>).</para>
1687
  <para><A NAME="4627">In order to validate the commands we built, we used several
1688
  different methods, depending on the commands.</A></para>
1689
  <para><A NAME="6233">We found that a very limited number of commands were
1690
  packaged with some rather extensive self-validation tests, that we used to
1691
  validate such commands.</A></para>
1692
  <para><A NAME="6234">We tested some other commands interactively (e.g. <I>elvis</I>,
1693
  <I>bpe</I>, <I>ispell</I>, <I>elm</I>, ...). However, for most commands we
1694
  had to write small tests. Even a basic test requires several shell script lines:
1695
  it took us several weeks to write tests for &gt;200 commands then to run them.</A></para>
1696
  <para><A NAME="6235">Finally, a small number of commands, actually 10, was not
1697
  tested: <I>getty/uugetty</I>, <I>sudo.bin/visudo</I>, <I>readprofile</I>,
1698
  <I>swapon</I>, <I>mt-GNU</I>, <I>rmt</I>,
1699
  <I>plipconfig</I> and <I>slattach</I>. As none of these commands were actually
1700
  installed on the 2nd platform, there is no real penalty.</A></para>
1701
  <para><A NAME="4669">On the Linux/i386 platform, 236 commands were installed,
1702
  then validated. Conversely, on Linux/Alpha, we installed and validated only a
1703
  subset of these commands: about 150, as previously mentioned. While we found
1704
  only a few problems during the validation on Linux/i386, we faced a number of
1705
  validation failures on Linux/Alpha, thus requiring much more investigation. Some
1706
  of these problems were due to bugs in the TenDRA technology, and have all been
1707
  fixed by now. Most of the others have already been discussed in previous
1708
  sections.</A></para>
1709
  <para><A NAME="5957">We list below miscellaneous problems, encountered at
1710
  validation time on either the 1st or the 2nd platforms, which are not really
1711
  related to TenDRA, nor do they depend on portability issues in the original
1712
  source code.</A></para>
1713
  <para><A NAME="4579"></A></para>
1714
  <sect2>
1715
  <title>Miscellaneous problems encountered at validation</title>
1716
 
1717
  <para><A NAME="4671"></A></para>
1718
  <itemizedlist>
1719
  <listitem>For two commands, <I>sln</I> and <I>stty</I>, we found different
1720
  behaviour due to an undetected missing symbol in our API. For example, the <I>sln</I>
1721
  command is written such that, depending on weather the S_ISLINK symbol is
1722
  defined or not, it generates a symbolic link or a hard link. The missing symbol
1723
  was defined in our API to fix the problem. 
1724
  <A NAME="8290"></A></listitem>
1725
  <listitem>The <I>more</I> command on Linux/Alpha, of which the source code uses the
1726
  non-POSIX <I>termio</I> interface, waits for 4 input characters before
1727
  processing them. The reason is that in Linux/Alpha (as in Digital Unix) some of
1728
  the <I>termio.c_cc[]</I> control characters overlap with some others, depending
1729
  on the input mode being used (i.e. either the `canonical' mode or the
1730
  `half-cooked' mode). So such control characters, which are the ones at VMIN and
1731
  VTIME indexes, must always be updated when switching from one input mode to the
1732
  other: we changed the source code for the <I>more</I> command accordingly. 
1733
  <A NAME="5516"></A></listitem>
1734
  <listitem>We found two bugs in the Linux/Alpha libc library, in the <I>getegid</I>
1735
  and <I>times</I> functions. The 1st one was already known and fixed in a later
1736
  release, while the 2nd one was not (we received a fix for it a few days later,
1737
  from a member of the Linux/Alpha project). 
1738
  <A NAME="4522"></A></listitem>
1739
  <listitem>The <I>csplit</I> command, from the txtutils package, defines the <I>memchr()
1740
  </I>function, also defined in the libc library. The validation of this command
1741
  failed on Alpha, until we removed this local recoding for <I>memchr()</I> and
1742
  used the regular library entry point instead. 
1743
  <A NAME="13121"></A></listitem>
1744
  <listitem>The environment on Linux/Alpha for using the <I>zic</I> command was not
1745
  correct, since that command is not available in the Linux/Alpha BLADE_0.3
1746
  distribution. 
1747
  <A NAME="13122"></A></listitem>
1748
  <listitem>The environment on Linux/Alpha for running the <I>bpe</I> command was not
1749
  correct, since we had used the (available) <I>ncurses</I> library when
1750
  link-editing this command: at run-time the related <I>terminfo</I> `data base'
1751
  was lacking. We simply had to replicate on Linux/Alpha the Linux/i386 terminfo
1752
  files to cure this problem. 
1753
  </listitem></itemizedlist>
1754
  <para><A NAME="13123"></A></para>
1755
  </sect2>
1756
 
1757
  <sect2>
1758
  <title>Recent upgrades of our original source code for Linux commands</title>
1759
  <para><A NAME="6280">We initially found on the net a limited number of patches
1760
  for the commands in source form; such patches had been made during the port of
1761
  Linux to Digital Alpha. For example, the following patch for the source code for
1762
  the col command was found on <I>ftp.azstarnet.com</I>, but it is not a example
1763
  of interest since we had preventively fixed it, i.e. during the initial
1764
  ANDFization of the col command: </A></para>
1765
  <para>util-linux-2.5/text-utils/col.c:</para>
1766
  <literallayout>    + #include &lt;malloc.h&gt;</literallayout>
1767
 
1768
        <para>Conversely, neither the BLADE_0.3 nor the BLADE_0.2
1769
          distributions include source code for commands; we discovered very
1770
          recently that such code was available (on <I>ftp.digital.com</I>)
1771
          for the very first, 32-bit Linux/Alpha distribution. Nevertheless,
1772
          for three commands we used source code from the RedHat 2.1/beta
1773
          and 2.1 Linux/Alpha distributions. This allowed us to fix
1774
          incorrect behavior of the <I>zic</I> command; we also experimented
1775
          without success (due to lack of time) some partial upgrades of the
1776
          source code for <I>zdump</I> and <I>cpio</I>.</para>
1777
      </sect2>
1778
    </sect1>
1779
  </chapter>
1780
 
1781
  <chapter>
1782
    <title>6. Statistics</title>
1783
 
1784
    <sect1>
1785
      <title>6.1 Statistics for Linux APIs</title>
1786
 
1787
  <para>All the files required to create an API are located inside
1788
  a special sub-tree of the TenDRA [4.x] distribution named<I> src/apis/</I>.
1789
  First, the new API must be specified, in a dedicated language (the TenDRA <I>tspec</I>
1790
  tool is provided to translate such API specification into a target-independent
1791
  intermediate format). An API specification is split into files, each of which
1792
  usually corresponding to a system header file available on the target
1793
  platform(s); e.g.: <I>stdio.h, sys/types.h</I>, etc.</para>
1794
 
1795
  <para>Secondly, there is often the need for slight changes within
1796
  some of the system header files of a given target, in order to build (to
1797
  install) the new API on it; such changes are either hard-coded inside a
1798
  replacement version for the relevant headers, or automatically performed using
1799
  scripts of text processing commands; the <I>sed</I> tool, along with <I>sed</I>
1800
  scripts, are used to deal with common APIs (for UNIX-like systems) included in
1801
  current TenDRA distributions. We think that the second method is more flexible;
1802
  for example, the text processing commands to apply on the system header files in
1803
  order to build successfully our custom APIs for Linux were in most cases the
1804
  same among Linux/i386 and Linux/Alpha targets, so we have written a single set
1805
  of sed scripts suitable for both of these platforms.</para>
1806
 
1807
  <para><A HREF="linux_re.htm#TABLE1">Table 1</A> gives an
1808
  idea of the amount of work required to specify and to build the APIs used by the
1809
  ~230 Linux commands which were ported to ANDF. Two types of data are reported:
1810
  `number of files' and `number of lines'. The files are modules holding lines of
1811
  either API specification or of sed commands. We excluded from our statistics the
1812
  comment lines for both, because the ratio of comments versus actual <I>tspec/sed
1813
  </I>constructs was unusually high.</para>
1814
  <para>We recall that our `Base API' for Linux was derived from
1815
  existing ``standard'' APIs, i.e. mainly from XPG3 and SVID3, which themselves
1816
  use parts of POSIX. Consequently, the number of tspec <I>lines</I> for this API
1817
  which is shown below does not reflect the actual amount of lines of
1818
  specification having been used: most of the specifications we wrote are similar
1819
  to C language ``#include'' statements (<I>tspec</I> ``+IMPLEMENT'' or ``+USE''
1820
  constructs).</para>
1821
  <para><A NAME="8557">In our `Extension API 1', we have not uncommonly rewritten
1822
  specifications which had an equivalent (either identical or similar) within the
1823
  reference SVID3 API or SPEC1070 API.</A></para>
1824
  <para><A NAME="9300">We recall also that we did not start from scratch when
1825
  making the changes in Linux system headers in order to build our APIs, either
1826
  for Linux/i386 or Linux/Alpha targets: the TenDRA Snapshot we started from
1827
  (April 95) provided 11 <I>sed</I> scripts for this purpose, that were
1828
  sufficient to build most of the XPG3 API for the Linux/i386 target.</A></para>
1829
  <para><A NAME="14204">The number of <I>files</I> given for `Changes in system
1830
  headers' is the one for the 1st target, Linux/i386 (1.0): as already mentioned,
1831
  the build of APIs for the 2nd target, Linux/Alpha (1.3), uses the same set of
1832
  sed scripts. This means that the number of <I>lines</I> corresponds to the <I>sed</I>
1833
  commands which apply either to a Linux/Intel system header, to a Linux/Alpha
1834
  header or to both.</A></para>
1835
  <para><A NAME="TABLE1"></A>
1836
  </para>
1837
  <para><B>Table 1: APIs for Linux / ~230 commands</B></para>
1838
  <informaltable>
1839
  <row>
1840
  <entry></entry>
1841
  <entry><B>Base API, specs</B></entry>
1842
  <entry><B>Extension API1, specs</B></entry>
1843
  <entry><B>Extension API2 (X11), specs</B></entry>
1844
  <entry><B>Changes in system headers (build)</B></entry></row>
1845
  <row>
1846
  <entry>files</entry>
1847
  <entry>65 (.h)</entry>
1848
  <entry>66 (.h)</entry>
1849
  <entry>3 (.h)</entry>
1850
  <entry>48 (sed scripts)</entry></row>
1851
  <row>
1852
  <entry>lines (excl. comments)</entry>
1853
  <entry>1381</entry>
1854
  <entry>684</entry>
1855
  <entry>18</entry>
1856
  <entry>254</entry></row></informaltable>
1857
  <para><A NAME="14259"></A></para>
1858
  <para><A NAME="14261"></A></para>
1859
  <para><A NAME="14262"></A></para>
1860
  <para><A NAME="14260"></A></para>
1861
  </sect1>
1862
  <sect1>
1863
  <title>6.2 Statistics concerning changes in the original source code</title>
1864
 
1865
  <para><A NAME="8523"></A><A HREF="linux_re.htm#TABLE2">Table 2</A> lists the
1866
  packages we installed and validated on both platforms. The first column
1867
  gives the (Slackware Linux) name of the package, and the second gives the
1868
  number of source files we dealt with during the ANDFization. The following
1869
  column gives the number of files - actual source or Makefile - patched
1870
  during either the initial ANDFization (keeping the i386 as target), or the
1871
  port to the 2nd target (Alpha). The two last columns show the number of
1872
  files specifically (re)patched during the port to Alpha, and finally the
1873
  number of patched Makefiles (that for the overall project).</para>
1874
  <para><A NAME="TABLE2"></A>
1875
  </para>
1876
  <para><B>Table 2: Packages ported to Linux/i386 and Linux/Alpha</B></para>
1877
  <informaltable>
1878
  <row>
1879
  <entry><B>Packages</B></entry>
1880
  <entry><B>Nb source files</B></entry>
1881
  <entry><B>Nb patches <I>Total</I></B></entry>
1882
  <entry><B>Nb patches <I>Alpha port</I></B></entry>
1883
  <entry><B>Nb patches <I>Makefiles</I></B></entry></row>
1884
  <row>
1885
  <entry>bin</entry>
1886
  <entry>455 (1)</entry>
1887
  <entry>86</entry>
1888
  <entry>19</entry>
1889
  <entry>6</entry></row>
1890
  <row>
1891
  <entry>sh_util</entry>
1892
  <entry>72</entry>
1893
  <entry>14</entry>
1894
  <entry>3</entry>
1895
  <entry>0</entry></row>
1896
  <row>
1897
  <entry>txtutils</entry>
1898
  <entry>50</entry>
1899
  <entry>8</entry>
1900
  <entry>2</entry>
1901
  <entry>1</entry></row>
1902
  <row>
1903
  <entry>util</entry>
1904
  <entry>71(2)</entry>
1905
  <entry>51</entry>
1906
  <entry>22</entry>
1907
  <entry>3</entry></row>
1908
  <row>
1909
  <entry>diff</entry>
1910
  <entry>32</entry>
1911
  <entry>10</entry>
1912
  <entry>3</entry>
1913
  <entry>0</entry></row>
1914
  <row>
1915
  <entry>gzip</entry>
1916
  <entry>36</entry>
1917
  <entry>4</entry>
1918
  <entry>1</entry>
1919
  <entry>1</entry></row>
1920
  <row>
1921
  <entry>grep</entry>
1922
  <entry>16</entry>
1923
  <entry>7</entry>
1924
  <entry>4</entry>
1925
  <entry>1</entry></row>
1926
  <row>
1927
  <entry>find</entry>
1928
  <entry>57</entry>
1929
  <entry>12</entry>
1930
  <entry>2</entry>
1931
  <entry>0</entry></row>
1932
  <row>
1933
  <entry>bc</entry>
1934
  <entry>20</entry>
1935
  <entry>2</entry>
1936
  <entry>0</entry>
1937
  <entry>0</entry></row>
1938
  <row>
1939
  <entry>tar</entry>
1940
  <entry>37</entry>
1941
  <entry>10</entry>
1942
  <entry>2</entry>
1943
  <entry>1</entry></row>
1944
  <row>
1945
  <entry>rcs</entry>
1946
  <entry>28</entry>
1947
  <entry>6</entry>
1948
  <entry>0</entry>
1949
  <entry>0</entry></row>
1950
  <row>
1951
  <entry>byacc</entry>
1952
  <entry>20</entry>
1953
  <entry>8</entry>
1954
  <entry>0</entry>
1955
  <entry>0</entry></row>
1956
  <row>
1957
  <entry>m4</entry>
1958
  <entry>34</entry>
1959
  <entry>1</entry>
1960
  <entry>0</entry>
1961
  <entry>0</entry></row>
1962
  <row>
1963
  <entry>less</entry>
1964
  <entry>44</entry>
1965
  <entry>2</entry>
1966
  <entry>0</entry>
1967
  <entry>0</entry></row>
1968
  <row>
1969
  <entry>flex</entry>
1970
  <entry>46</entry>
1971
  <entry>3</entry>
1972
  <entry>0</entry>
1973
  <entry>0</entry></row>
1974
  <row>
1975
  <entry>ispell</entry>
1976
  <entry>40</entry>
1977
  <entry>21</entry>
1978
  <entry>15</entry>
1979
  <entry>1</entry></row>
1980
  <row>
1981
  <entry>elm</entry>
1982
  <entry>170</entry>
1983
  <entry>27</entry>
1984
  <entry>4</entry>
1985
  <entry>0</entry></row>
1986
  <row>
1987
  <entry>TOTAL</entry>
1988
  <entry>1233</entry>
1989
  <entry>272 (22%)</entry>
1990
  <entry>77</entry>
1991
  <entry>14</entry></row></informaltable>
1992
  <para>(1) Contents of the bin package were partially ANDFized: 48 commands out of
1993
  56. Also, a subset only of these ANDFized commands was actually ported to
1994
  Linux/Alpha: 37 (out of 48). So, the `number of source files' shown excludes
1995
  source code for non-ANDFized commands. Conversely, the `number of patches,
1996
  Alpha' would be greater if all the ANDFized commands had been ported to the
1997
  second target.</para>
1998
  <para>(2) Contents of the Slackware Linux util package were partially ANDFized: 35
1999
  commands out of 57. Among these, only 30 were actually ported to Linux/Alpha.</para>
2000
  <para><A NAME="7827"></A><A HREF="linux_re.htm#TABLE3">Table 3</A> lists the
2001
  packages we installed and validated on the Linux/i386 platform only. Similar
2002
  information, except for the number of patches for the Linux/Alpha platform, is
2003
  given.</para>
2004
  <para><A NAME="TABLE3"></A>
2005
  </para>
2006
  <para><B>Table 3: Packages ported to Linux/i386 only</B></para>
2007
  <informaltable>
2008
  <row>
2009
  <entry><B>Packages</B></entry>
2010
  <entry><B>Nb source files</B></entry>
2011
  <entry><B>Nb patches <I>(i386 only)</I></B></entry>
2012
  <entry><B>Nb patches <I>Makefiles</I></B></entry></row>
2013
  <row>
2014
  <entry>aaa_base</entry>
2015
  <entry>122</entry>
2016
  <entry>22</entry>
2017
  <entry>2</entry></row>
2018
  <row>
2019
  <entry>ash</entry>
2020
  <entry>49</entry>
2021
  <entry>15</entry>
2022
  <entry>1</entry></row>
2023
  <row>
2024
  <entry>bsdgames</entry>
2025
  <entry>47 (1)</entry>
2026
  <entry>35</entry>
2027
  <entry>11</entry></row>
2028
  <row>
2029
  <entry>cpio</entry>
2030
  <entry>44</entry>
2031
  <entry>22</entry>
2032
  <entry>1</entry></row>
2033
  <row>
2034
  <entry>getty</entry>
2035
  <entry>18</entry>
2036
  <entry>6</entry>
2037
  <entry>1</entry></row>
2038
  <row>
2039
  <entry>joe</entry>
2040
  <entry>87</entry>
2041
  <entry>26</entry>
2042
  <entry>0</entry></row>
2043
  <row>
2044
  <entry>perl</entry>
2045
  <entry>86</entry>
2046
  <entry>10</entry>
2047
  <entry>1</entry></row>
2048
  <row>
2049
  <entry>ps</entry>
2050
  <entry>35</entry>
2051
  <entry>6</entry>
2052
  <entry>1</entry></row>
2053
  <row>
2054
  <entry>sudo</entry>
2055
  <entry>9</entry>
2056
  <entry>6</entry>
2057
  <entry>0</entry></row>
2058
  <row>
2059
  <entry>tcpip/net-tools</entry>
2060
  <entry>26 (2)</entry>
2061
  <entry>12</entry>
2062
  <entry>0</entry></row>
2063
  <row>
2064
  <entry>xgames</entry>
2065
  <entry>105</entry>
2066
  <entry>28</entry>
2067
  <entry>3</entry></row>
2068
  <row>
2069
  <entry>xlock</entry>
2070
  <entry>37</entry>
2071
  <entry>4</entry>
2072
  <entry>1</entry></row>
2073
  <row>
2074
  <entry>TOTAL</entry>
2075
  <entry>665</entry>
2076
  <entry>175</entry>
2077
  <entry>22</entry></row></informaltable>
2078
  <para>(1) The bsdgames package was partially ported to ANDF</para>
2079
  <para>(2) In the tcpip package, only the Net-tools subset was ported.</para>
2080
  <para><A NAME="8168">From the data shown in </A><A HREF="linux_re.htm#TABLE2">Table
2081
  2</A>, we can say that about 80% of the original source files did not require
2082
  any change when ported to ANDF. We find also that we encountered, during the
2083
  initial ANDFization and the validation on the 1st platform, more than 70% of the
2084
  files requiring changes. In other words, we had missed approximately 30% of
2085
  required changes. Note that in our project both of the platforms were running
2086
  the same UNIX-like variant (Linux), so the last ratio could be greater in a less
2087
  favorable case. Finally, since the Intel/i386 and Digital/Alpha feature
2088
  different sizes for `pointer' type (and `long' type), while the byte ordering is
2089
  the same, there is probably still incorrect code lying inside our ANDF files for
2090
  Linux commands.</para>
2091
  <para><A NAME="6349"></A></para>
2092
</sect1>
2093
</chapter>
2094
  <chapter>
2095
    <title>7. Conclusion</title>
2096
 
2097
    <para>During this second part of the project, we greatly benefited from
2098
      the experience acquired during the first part
2099
      <A HREF="linux_re.htm#6567">[2]</A>. The build environment we used and
2100
      the way we integrated the TenDRA technology were directly derived from
2101
      the work on the Unixware platform. Also, the initial set of Linux
2102
      commands we could reasonably port was derived from the commands we had
2103
      already ANDFized for Unixware.</para>
2104
 
2105
    <para><A NAME="11487">We finally ported and validated about 230 commands
2106
      on the Linux/i386 platform, but we could port only about 150 of them to
2107
      the Linux/Alpha platform. The main reason for not porting the 80
2108
      remaining commands on Linux/Alpha was that we were short of time.
2109
      Although we are below the target of 300 commands to be ported to both
2110
      platforms, we believe that the experiment was a success. A significant
2111
      amount of sometimes complex code was ANDFized, and the portability of
2112
      this code was demonstrated. The main reasons that the initial objective
2113
      was not attained were:</A></para>
2114
 
2115
  <itemizedlist>
2116
    <listitem>The switch to the second platform was delayed.  Initially, we
2117
      had planned to use the microkernel based version of Linux on PowerPC,
2118
      but this was not available in time.  <A NAME="11560"></A></listitem>
2119
    <listitem>Setting up the Alpha/Linux system took a considerable amount of
2120
      time. This was mainly due to the fact that Linux has not been ported to
2121
      ``off-the-shelf'' hardware, and the system had to be assembled from
2122
      components (mother board, power supply, disks, etc.).  </listitem>
2123
    <listitem>In the Linux/Alpha distribution we installed, a number of
2124
      commands were missing, and others were still not fully validated. This
2125
      meant that, porting commands from Intel to Alpha, we found several
2126
      portability bugs which were not fixed, and sometimes not even known, in
2127
      the Alpha command sources. Finding fixes or asking for help on the
2128
      Linux/Alpha mailing list slowed down our work.
2129
  </listitem></itemizedlist>
2130
 
2131
  <para>In the course of the project, Linux has evolved from Linux 1.1 to 1.3,
2132
    and Linux commands were distributed on Alpha. However, we stuck to the
2133
    Linux 1.1 commands, and we only used the Linux/Alpha distribution to
2134
    install the system and to find fixes when we had problems with some
2135
    commands.</para>
2136
 
2137
  <para>Actually, many of the portability problems we found are now fixed on
2138
    Linux/Alpha, and it would be much easier to port these commands now than
2139
    it was a few months ago. However, the first source delivery of commands
2140
    for Linux/Alpha was only available in December 95, and using this new set
2141
    of commands would have required to re-do on the Intel platform the work
2142
    (ANDFization, installation and validation) which was already done.
2143
    Moreover, this first delivery was still not extensively validated and
2144
    contained a number of bugs.</para>
2145
  <para>This project demonstrated that it is possible to build an API for a
2146
    -rather large- set of commands. Moreover, this API is mostly based on
2147
    standard APIs, xpg3, svid3, with a relatively small number of additions
2148
    (e.g. a more complete bsd API than the TenDRA bsd_extn). However,
2149
    installation of the standard APIs (Posix, Xpg3,...) with TenDRA has shown
2150
    that Linux does not fully conform to these standards. In fact, the best
2151
    support is for the bsd API, since a large number of commands come from bsd
2152
    sources.</para>
2153
 
2154
  <para>We used a 3-step approach in porting to ANDF, first compiling with the
2155
  native compiler, second, using the TenDRA compiler with the native header
2156
  files, and finally using TenDRA with abstract headers files and token
2157
  libraries. Although we used the second step to find portability errors
2158
  detected by the TenDRA compiler, this could be done in the third step.
2159
  However, the third step which consists in making the source code compatible
2160
  with the abstract API, is not so easy, and thus we found it easier to
2161
  resolve portability checks in a separate step.</para>
2162
 
2163
  <para>Most of the modifications we made to the source code for
2164
  the commands came from missing function declarations and other trivial
2165
  unportable coding, e.g. wrong assumptions on int and pointer sizes.</para>
2166
 
2167
  <para>The TenDRA technology has proven capable of handling the differences
2168
  between the two platforms. Although the same operating system runs on both
2169
  platforms, these hardware platforms are sufficiently different to create
2170
  difficulties. Standard APIs were successfully installed on both platforms,
2171
  and the specific API developed for the commands could be designed to support
2172
  the two different implementations. However, defining and installing an API
2173
  is not an easy process and requires some -sometimes extended- knowledge of
2174
  the TenDRA technology. We also detected a very small number of bugs in the
2175
  TenDRA technology, in particular for the Dec/Alpha installer which has only
2176
  been recently distributed by DRA.</para>
2177
  </chapter>
2178
  <chapter>
2179
    <title>8. Appendix: list of problems submitted to DRA</title>
2180
 
2181
    <para>The problems are classified according to their status
2182
      at the end of March 1996. They were encountered on the April 95 or
2183
      November 95 releases of TenDra, and have all been fixed now.</para>
2184
 
2185
  <sect1>
2186
    <title>Errors in the TenDRA compiler</title>
2187
        <itemizedlist>
2188
        <listitem>CR95_359.FB::shift_to_sign<BR/>Error on an arithmetic shift left.<BR/>Fixed
2189
        in November 95. 
2190
        </listitem>
2191
        <listitem>261 - array_sizeof<BR/>Error when declaring twice an array with sizeof(int)
2192
        as dimension.<BR/>Fixed in tdfc:4.58 
2193
        <A NAME="5642"></A></listitem>
2194
        <listitem>262 - func_var<BR/>Name conflict between a function and its arguments.<BR/>Fixed
2195
        in TenDRA February 96. 
2196
        <A NAME="5546"></A></listitem>
2197
        <listitem>276 - loop_tdfc_alarm<BR/>Tdfc loops when attempting to redefine as macro a
2198
        tokenized function.<BR/>Fixed in tdfc 4:58 
2199
        <A NAME="5547"></A></listitem>
2200
        <listitem>220 - fstp_esi<BR/>invalid assembler instruction ``fstp %esi''<BR/>Fixed in
2201
        TenDRA November 95. 
2202
        <A NAME="5548"></A></listitem>
2203
        <listitem>225 - func_return_struct<BR/>Intercallability with a gcc-compiled library
2204
        function which returns an 8-bytes structure. Bypassed with thw tcc option
2205
        -Wt,-G1.<BR/>Fixed in TenDRA November 95. 
2206
        <A NAME="5552"></A></listitem>
2207
        <listitem>335 - alpha_long_too_big<BR/>Use of a literal integer constant larger than
2208
        232.<BR/>Bypassed. Added a `L' suffix to such a value. 
2209
        <A NAME="5556"></A></listitem>
2210
        <listitem>337 - Error in Alpha installer<BR/>Error message ``internal error:
2211
        Change_variety out of range''.<BR/>Fixed in TenDRA February 96. 
2212
        <A NAME="5566"></A></listitem>
2213
        <listitem>338 - Error in SVID3 API (RLIM_INFINITY)<BR/>Illegal type for the API
2214
        definition ``+CONST int RLIM_INFINITY ;''<BR/>Fixed in the next major TenDRA
2215
        release. 
2216
        <A NAME="5567"></A></listitem>
2217
        <listitem>343 - Error in Linux installer (/tmp full)<BR/>The translation on
2218
        Linux/Alpha of a file required more than 80MB in /tmp<BR/>Fixed in the TenDRA
2219
        February 96. 
2220
        <A NAME="5570"></A></listitem>
2221
        <listitem>344 - SVID3 API (daddr_t)<BR/>Casting an integer value to an unspecified
2222
        type was not rejected.<BR/>Fixed in tdfc:4.98 
2223
        </listitem></itemizedlist>
2224
    </sect1>
2225
  </chapter>
2226
 
2227
  <bibliography>
2228
    <title>Bibliography</title>
2229
 
2230
    <biblioentry xreflabel="Ferri&egrave;re95-1">
2231
      <authorgroup>
2232
        <author>
2233
          <firstname>Fran&ccedil;ois</firstname>
2234
          <surname>de Ferri&egrave;re</surname>
2235
        </author>
2236
        <author>
2237
          <firstname>Jacques</firstname>
2238
          <surname>Febvre</surname>
2239
        </author>
2240
      </authorgroup>
2241
      <copyright>
2242
        <year>1995</year>
2243
        <holder>Open Systems Research Institute</holder>
2244
      </copyright>
2245
      <title>Revised Plan for Validation of TenDRA Capability to Implement a
2246
      Unix-like Operating System</title>
2247
  June 1995
2248
    </biblioentry>
2249
 
2250
    <biblioentry xreflabel="Ferri&egrave;re95-2">
2251
      <authorgroup>
2252
        <author>
2253
          <firstname>Fran&ccedil;ois</firstname>
2254
          <surname>de Ferri&egrave;re</surname>
2255
        </author>
2256
 
2257
        <author>
2258
          <firstname>Fred</firstname>
2259
          <surname>Roy</surname>
2260
        </author>
2261
      </authorgroup>
2262
      <copyright>
2263
        <year>1995</year>
2264
        <holder>Open Systems Research Institute</holder>
2265
      </copyright>
2266
  <para><A NAME="6567"></A> 
2267
      <title>Validation of TenDRA Capability to Implement a UNIX-like
2268
        Operating System</title>June 1995</para>
2269
    </biblioentry>
2270
  </bibliography>
2271
    <para>Last Modified: 04:46pm , July 30, 1996</para>
2272
</book>