Changing from DOS to XENIX and from XENIX to DOS 
Author Message
 Changing from DOS to XENIX and from XENIX to DOS

I have been asked to show how to set up files to switch automatically
between DOS and XENIX on the same machine.  Would those of you
who try this method, E-Mail me a note.  I have been using this method
for a long time now.

In general, a hard disk that contains both DOS and XENIX will be paritioned
into 4 partitions.
     1) XENIX bad track table (very short)
     2) XENIX root file system
     3) XENIX usr [sic] file system
     4) DOS
This happens when you install XENIX.

At any time, one of these partitions is "active".  If parition 2 is active,
Xenix will boot when you turn on the computer.  If partition 4 is active, DOS
will boot when you turn on the computer.

You use the FDISK utility (comes with DOS and XENIX) to change the active
partition.  For example, if XENIX boots automatically, you can have DOS boot
automatically by activating partition 4.  This automatically deactivates
partition 2.

(Note: Some XENIX's, eg.IBM 2.0, will let you type "DOS" and start DOS whenever
XENIX is ready to boot.  This will start DOS, but it will not change the
active partition.)

The ideal system would be to easily activate one or the other
partition whenever you want; that is, to be able to change from DOS to XENIX to
DOS easily.

Of course, you could do it by hand, using FDISK, but this is a bad idea.  
First, this is not easy enough.  Second, you do not want to be messing with
FDISK!  One false move could wipe out (re-partition) everything beyond recall.

The solution is to call FDISK using a carefully designed script.  Assuming
that the paritions on your disk are as I described above, here is how you do
it.

1) Changing from XENIX to DOS:

Use the following shell script.  This script feeds the correct responses to
the fdisk program to activate the DOS partition.  (By the way, the Xenix fdisk
program is much safer than the DOS FDISK.  The Xenix program will not let you
cause damage.)

     echo
     echo '** Changing to DOS **'
     echo
     fdisk /dev/rhd00 <<- eof >/dev/null 2>/dev/null
         a
         4
         w
         q
     eof

Note1: the line with "eof" must start at column 1.
Note2: this script assumes that your hard disk is C: ("rhd00")

Create this script as userid root and give it 755 permission.
Say that you call it "dos" and put it in
the root directory.  Then, root can switch to DOS by entering:
     /dos
A useful idea is to create the following short script:
     su - root -c /dos
and call it "dos" and put it where everyone can get at it with permissions
of 755.  Then, any userid can change to DOS, iff the user knows the root
password.  If you set this up and you are logged in under your own userid
(not root) and you enter:
     dos
you will be asked:
     Password:
After entering the root password, your system will automatically change to
DOS.

2) Changing from DOS to XENIX:

Here is a batch file to change from DOS TO XENIX (the file "fdisk.xen"
is explained below):

     :* Batch file to change to Xenix
          echo off

     :* Activate Xenix FDISK partition
          fdisk < fdisk.xen

     :* Tell user to reboot
          echo XENIX partition activated
          echo To change to XENIX, reboot system

If you have a program such as "warmboot" that automatically reboots from DOS,
you can reboot automatically from the batch file.

Name the batch file XENIX.BAT.  Then, you can change to Xenix anytime by
entering:
     xenix

The batch file works by assuming that the file FDISK.XEN contains the correct
commands for FDISK.  Thus, you must build such a file and make sure that it
can be found by XENIX.BAT.  For example, if you are keeping FDISK.XEN in the
\SYSTEM\UTILITY directory, change the fourth line in the batch file to:

          fdisk < \system\utility\fdisk.xen

To build FDISK.XEN you need to know what responses FDISK expects to change the
active partition from #4 to #2. These responses are (check it yourself on your
own system):

     2 <enter>
     2 <enter>
     <escape> <escape>

Note that there are no <return>'s after the <escape>'s.

Unfortunately, it may not be easy to
create FDISK.XEN.  Bear in mind, you need to generate a 8 byte file that
contains the 8 bytes shown above (<enter> takes 2 bytes).
EDLIN cannot do it for you as it will not
let you put in <escape> characters.  Perhaps you have an editor that can do
the job.  If not try:
     1) Do it with vi under Xenix (use Ctrl-v escape) and pass it to DOS.
     2) Write a BASIC program to create the file.
     3) Create a dummy file:
       copy con: fdisk.xen
       2
       2
       xx<F6>
     then use the Norton Utilities or something to change the "xx" to
     two <escape> characters (hex 1B, decimal 27).
This works fine.

Note: When you execute XENIX.BAT and FDISK works automatically, you will hear
two beeps.  Don't worry, it's okay.

Final Note: Usually, I suggest that people remove the FIDSK program from their
hard disks.  This prevents anyone else from accidentally causing catastrophic
damage.  However, in this case, you need FDISK.  I suggest that you rename it
to something else and change XENIX.BAT accordingly.  



Mon, 19 Apr 1993 01:36:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. porting an MS-DOS Forth to a 386 Unix/Xenix

2. LMI Forth (was: porting an MS-DOS Forth to a 386 Unix/Xenix)

3. Porting an 8088/MS-DOS FORTH to 386 Xenix

4. APL for UNIX or XENIX wanted

5. Xenix

6. XENIX TO DBF

7. Wanted, fourth compiler or shell for Unix/Xenix...

8. Forth for Xenix 286

9. Forth for Xenix

10. forth for sco xenix 386

11. GRaphicLibrary/PDM2 on Xenix

12. Modula-2 for XENIX ?

 

 
Powered by phpBB® Forum Software