The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [Unix-jun72] UNIX V1 bootstrap
@ 2008-05-11 14:13 James A. Markevitch
  2008-05-17 18:06 ` Tim Newsham
  0 siblings, 1 reply; 7+ messages in thread
From: James A. Markevitch @ 2008-05-11 14:13 UTC (permalink / raw)


I've ported the bootstrap stuff over the whole UNIX V1 build process.
(Note: it would be nice to have a V1 as, so that all of these hacks
we've been doing can go away).

I'll send out the .tar.gz under a separate e-mail, but it's small enough (10K)
and I don't know who's in which timezone, so somebody should be able
to commit it.

There are two versions included: one that copies the bootstrap into
the rf0.dsk image before running the simulator, and one that runs
native under V1.  Given that, if someone builds the kernel using
as under V1, they can use the usr/boot/msys command to install it
without leaving the simulation.

The good news is that you can use that to copy your test kernel into
the cold boot area and if it fails, can re-start the simulator from
the warm boot area and not lose any of your filesystem (assuming your
bad kernel didn't trash it, of course).

I also have a boot command, but haven't tested it yet.  It could be
used to reboot without leaving the simulation.  That's fine if your
kernel works, of course.

James Markevitch



^ permalink raw reply	[flat|nested] 7+ messages in thread
* [Unix-jun72] UNIX V1 bootstrap
@ 2008-05-18  1:04 James A. Markevitch
  2008-05-18  1:24 ` Warren Toomey
  0 siblings, 1 reply; 7+ messages in thread
From: James A. Markevitch @ 2008-05-18  1:04 UTC (permalink / raw)


> > I've ported the bootstrap stuff over the whole UNIX V1 build process.
> > (Note: it would be nice to have a V1 as, so that all of these hacks
> > we've been doing can go away).
> 
> Did you write bos.s and msys.s from scratch?   I noticed your
> wunix contains no header, just the binary bits.  Was this standard
> procedure in other versions of unix or is it possible that
> the msys program took in an 0405 or 0407 and stripped the header
> off before writing it?  Is there an easy way to strip the header
> from within the unix system with standard commands?

I wrote bos.s and msys.s from scratch.  I am not aware of any binaries
or source for these.

bos is written in an entirely position-independent manner so that it can be
compiled with a v1 assembler, v2 assembler, etc. and still run when loaded
at location 54000 in core.  Other than the option to load a paper tape, I
believe this to be as true to V1 as possible.

msys was implemented to be as true to V1 as I believed possible.  It copies
images directly from disk without modifying them, as I believe the original
V1 msys did.  There is no header kludging, since a V1 a.out UNIX kernel
should be bootable without modification.

For wunix (warm unix), I took the build/loadfile, stripped off the
first 6 bytes, then copied the next 16K bytes, just as the boot/installboot
script does.

For building under UNIX itself, there are a variety of strategies.  Here
is my list, in order of preference:

1. Use the V1 assembler.  This will produce a 12-byte header that is
exactly compatible with the kernel source as it appears in the listing.  As
many people on this are aware, the first 12 bytes get manually patched
by the UNIX code when it starts up.  But, I don't think the V1 assembler
exists anywhere, or at least not that has been found.  That kind of makes
this option moot.

2. Modify the V2 assembler to produce V1 binaries.  If the V2 assembler
can be built from sources, then it should be straighforward to edit it
to produce V1 binaries (i.e. 405 instead of 407).  This would allow a
kernel in the true spirit of V1 to be created, then copied into the
boot area by msys.  It would also allow other programs to all be created
as V1 binaries, which has a lot of attraction to me.

3. Modify msys.s to be msys2.s to strip the 407 header and also truncate
the copy to not overrun the size of the area being copied into (1K, 6K,
6K, 3K).  I just tested a modified version of this and attached it below,
since that should help to get things going; but I really think that
option #2 would be nice to have eventually.

Note to use msys2, you need to copy build/a.out to fs/usr/boot/unix.out,
and to put msys2.s into fs/usr/boot/msys2.s.  Then after you boot, do:
	chdir /usr/boot
	as msys2.s
	mv a.out msys2
	msys2 u unix.out
I'll clean up the source and send a complete fs/usr/boot out later
tonight.

James Markevitch

--------------------------- fs/usr/boot/msys2.s -------------------------
/ msys2 -- copy file to RF read only slot
/
/ re-creation, based on description in UNIX_ProgammersManual_Nov71.pdf,
/ page 7-06, BOOT PROCEDURES (VII)
/ 5/9/08 jam at magic.com
/ 5/17/08 jam at magic.com -- hacked to copy 407-format a.out files

/ b bos		1700
/ u warm unix	1704
/ 1 cold unix	1734
/ 2 unassigned	1764

	mov	sp,r5
	mov	(r5)+,r3	/ argc
	cmp	$3,r3		/ must be 3
	bne	badcmd		/ else error
	tst	(r5)+
	mov	(r5)+,r4	/ get first arg

	cmpb	(r4),$'b
	bne	1f
	mov	$1700,r3
	mov	$4,r4
	br	2f
1:
	cmpb	(r4),$'u
	bne	1f
	mov	$1704,r3
	mov	$30,r4
	br	2f
1:
	cmpb	(r4),$'1
	bne	1f
	mov	$1734,r3
	mov	$30,r4
	br	2f
1:
	cmpb	(r4),$'2
	bne	badcmd
	mov	$1764,r3
	mov	$14,r4
2:

	/ open file
	mov	(r5),r5
	mov	r5,0f
	sys	open; 0:..; 0
	bes	error
	mov	r0,r1
	sys	seek; 20; 0
	bes	error

	/ open rf0 and seek to correct block
	sys	open; disk; 1
	bes	error
	mov	r0,r2
	mov	r3,0f
	sys	seek; 0:..; 0
	bes	error

	/ copy file from file to disk one block at a time
1:
	mov	r1,r0
	sys	read; buf; 512.
	mov	r0,r5
	mov	r2,r0
	sys	write; buf; 512.
	bes	error
	dec	r4
	beq	3f
	tst	r5
	bne	1b

3:
	sys	exit

error:
	mov	$1,r0
	sys	write; 1f; 2
	4
	sys	exit
1:
	<?\n>

badcmd:
	mov	$1,r0
	sys	write; 1f; 2
	4
	sys	exit
1:
	<?\n>

disk:
	</dev/rf0\0>
	.even

buf:	.=.+512.



^ permalink raw reply	[flat|nested] 7+ messages in thread
* [Unix-jun72] UNIX V1 bootstrap
@ 2008-05-18  6:18 James A. Markevitch
  2008-05-18  6:28 ` Warren Toomey
  0 siblings, 1 reply; 7+ messages in thread
From: James A. Markevitch @ 2008-05-18  6:18 UTC (permalink / raw)


> > For building under UNIX itself, there are a variety of strategies.  Here
> > is my list, in order of preference:
> > 
> > 2. Modify the V2 assembler to produce V1 binaries.
> 
> I'm going to take a "devil's advocate" stance here, and argue to keep the
> existing "as" binary untouched.

In any event, the msys2.s will work to install a V2-assembled kernel
into the boot area.

I've sent a new copy of the boot directory and fs/usr/boot to Warren and
Tim to install.  msys2.s is now the program to use to install the bootstrap
and the fs/usr/boot/unix.out file is a copy of build/a.out.

This means that if the kernel is assembled using the V2 assembler under
UNIX V1 itself, then the a.out from that assembly can be used directly
by msys2 to install into the boot area.

James Markevitch



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-05-18  6:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-11 14:13 [Unix-jun72] UNIX V1 bootstrap James A. Markevitch
2008-05-17 18:06 ` Tim Newsham
2008-05-18  1:04 James A. Markevitch
2008-05-18  1:24 ` Warren Toomey
2008-05-18  3:23   ` Doug Merritt
2008-05-18  6:18 James A. Markevitch
2008-05-18  6:28 ` Warren Toomey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).