[comp.sys.amiga.tech] Unix device drivers

darin@nova.laic.uucp (Darin Johnson) (12/02/88)

This brings up an apropos point.  I have been trying to think of a way
(but haven't actually gotten much coding done) of booting a non-AmigaDos
OS.  What I would like to do, is be able to use the trackdisk driver,
rather than talk directly to the drive (ick).  However, since I don't
want to use Exec, I am unsure if trackdisk will work (is it
multitasking, or just a routine?).  Another alternative would be to
keep everything running under Exec until I get enough stuff loaded
into memory, and then take over.  It might even be possible to do an
OpenLibrary and use that to load the new OS, but would this work before
DOS is initialized?

Does anyone have any interesting ideas about how Amiga UNIX does/will
do this (since they have to bootstrap also...)?

Other wierd problems...  The RKM manual is vague about what state
the machine is in during/after the bootstrap code.  When I return from
the bootblock code, is the Amiga non-multitasking, or do I have to
disable Exec?  Also, since I would like to create executables from
Manx (or Asm68K) object files, should I just be compatable with
the standard executable format and use 'ln' or 'blink'?  If not, how
does one actually link something (this isn't discussed in any of my
compiler design books)?

Of course, now I plan on getting mail from people wondering why I'm not
satisfied with AmigaDOS, why kick out Exec, etc.  Just because I want
to, thats why!  And when that gets boring, I'll write a compiler, so
there...

Darin Johnson (leadsv!laic!darin@pyramid.pyramid.com)
	"It's true, the world's not perfect...  But we've submitted an SPR"

anderson@broadway.UUCP (Stuart Anderson) (12/07/88)

In article <379@laic.UUCP>, darin@nova.laic.uucp (Darin Johnson) writes:
> This brings up an apropos point.  I have been trying to think of a way
> (but haven't actually gotten much coding done) of booting a non-AmigaDos
> OS.

Hmm.... I had those thoughts once too. I was trying to figure a way to 
boot Xinu instead of AmigaDOS.

> What I would like to do, is be able to use the trackdisk driver,
> rather than talk directly to the drive (ick).  However, since I don't
> want to use Exec, I am unsure if trackdisk will work (is it
> multitasking, or just a routine?).

My inpression is that the device exists as three entities: 1) the device library
that exist in the same context as what ever task is accessing the device (may
be a file system task), 2) another task that queues up request and sets up a
list of blocks to read/write to/from the disk ( Some devices may not have this
other task ) , and 3) one or more interrupt handlers that get executed when
the hardware singals the completion of the previous operation ( Some devices
may not require the part either ).

Because of 2 & 3, the device driver depends on Exec being healthy. Since Exec
is the central executive of the operating system, leaving it alive would
put some limits on how different another operating system could be.

> Another alternative would be to
> keep everything running under Exec until I get enough stuff loaded
> into memory, and then take over.

This was the approach I took. It seemed to be the best way for early
developement. Taking over this way requires that you either shut down
AmigaDos and the rest of the system in an orderly manner, or that you just 
replace all of the interrupt vectors very quickly and take control immediately.
Doing it the second way means that your new executive has to be ready to go
immediatly, and must be prepared for any surprises (interrupts) that may occur
that were left over from the previous OS. Also comes the problem of reclaiming
all of the memory that was used by the old OS. Probably not hard, just one
more thing to have to do.

> It might even be possible to do an
> OpenLibrary and use that to load the new OS, but would this work before
> DOS is initialized?

I don't think so since OpenLibrary will need to use Dos to load the library.
 
> Does anyone have any interesting ideas about how Amiga UNIX does/will
> do this (since they have to bootstrap also...)?

My guess is that it will load a different "kickstart" (kernel) and then
use that to boot the rest of the system ( there, simple huh? 8-) )
 
> Other wierd problems...  The RKM manual is vague about what state
> the machine is in during/after the bootstrap code.  When I return from
> the bootblock code, is the Amiga non-multitasking, or do I have to
> disable Exec?

The 'Install2' program posted a few weeks ago suggested to me that a whole new 
bootstrap could be written that loaded a new kernel from the disk ( sounds
like a virus kind of thing to do ). Sort of a mini disk driver that loaded
a few sectors into the kickstart RAM ( or elsewhere for ROM based systems ).

> Also, since I would like to create executables from
> Manx (or Asm68K) object files, should I just be compatable with
> the standard executable format and use 'ln' or 'blink'?  If not, how
> does one actually link something (this isn't discussed in any of my
> compiler design books)?

If you let Dos load the new system, the just use the regular format. If not,
then you need a utility to convert a regular format ( maybe with some addresses
already resolved ) into a binary image that can then be written to the new boot
disk along with the new bootstrap.
 
> Of course, now I plan on getting mail from people wondering why I'm not
> satisfied with AmigaDOS, why kick out Exec, etc.  Just because I want
> to, thats why!  And when that gets boring, I'll write a compiler, so
> there...
 
I bought my Amiga because it had a 68000 in it, which I was familiar with, and
because it's open architecture will let me explore with new stuff (like OS's).
AmigaDos is fine for most everything I do, but to learn/experiment with 
perating systems, theres probably no better way than to write one on your
own machine.


So many details, and so little time to organize them!!!!


------------------------------------------------------------------------------
                    anderson@ece.scarolina.edu
           uunet!ncrlnk!ncrcae.........!broadway!anderson
                              \!secola/
-- 
------------------------------------------------------------------------------
                    anderson@ece.scarolina.edu
           uunet!ncrlnk!ncrcae.........!broadway!anderson
                              \!secola/