mirror of
https://github.com/DoctorWkt/unix-jun72.git
synced 2026-03-10 20:54:10 +00:00
- trying out a new build style.
This commit is contained in:
166
newbuild/Makefile
Normal file
166
newbuild/Makefile
Normal file
@@ -0,0 +1,166 @@
|
||||
#
|
||||
# Makefile for building the unix kernel and disk images.
|
||||
#
|
||||
# important targets:
|
||||
# all - make kernel and disk images
|
||||
# images - make disk images
|
||||
# tape - make a tape image for a "cold" kernel
|
||||
# loadfile - make a simh loadfile containing the kernel
|
||||
# unix - make the kernel
|
||||
# clean - delete intermediate files
|
||||
# clobber - delete all generated files
|
||||
#
|
||||
# settings:
|
||||
# EXTRAPATCHES - list of extra patches to apply
|
||||
# USECOREPATCHES - "yes" or "no", use the core set of patches
|
||||
#
|
||||
# Examples:
|
||||
# make run
|
||||
# build disk images and unix and run unix in simh
|
||||
# make unix tape EXTRAPATCHES=cold
|
||||
# build a "cold" kernel and a tape to boot it with.
|
||||
|
||||
|
||||
USECOREPATCHES = yes
|
||||
EXTRAPATCHES =
|
||||
|
||||
ALL = loadfile rf0.dsk rk0.dsk
|
||||
ML= ../tools/ml
|
||||
MKFS = ../tools/mkfs
|
||||
MKTAPE = ../tools/mktape.py
|
||||
APOUT_ROOT = ../fs/root
|
||||
APOUT = APOUT_ROOT=$(APOUT_ROOT) ../tools/apout/apout
|
||||
AS = $(APOUT) $(APOUT_ROOT)/bin/as
|
||||
NM = $(APOUT) $(APOUT_ROOT)/bin/nm
|
||||
TREECOPY = rsync -a --exclude .svn
|
||||
KSRCS = u0.s u1.s u2.s u3.s u4.s u5.s u6.s u7.s u8.s u9.s ux.s
|
||||
ALLSRCS = $(KSRCS) init.s sh.s
|
||||
CLEANSRCS = $(ALLSRCS:.s=.clean)
|
||||
PAGES = ../pages/e00-01 ../pages/e00-02 ../pages/e00-03 ../pages/e00-04 \
|
||||
../pages/e00-05 ../pages/e00-06 ../pages/e00-07 ../pages/e00-08 \
|
||||
../pages/e00-09 ../pages/e00-10 ../pages/e01-01 ../pages/e01-02 \
|
||||
../pages/e01-03 ../pages/e01-04 ../pages/e01-05 ../pages/e01-06 \
|
||||
../pages/e01-07 ../pages/e01-08 ../pages/e01-09 ../pages/e01-10 \
|
||||
../pages/e02-01 ../pages/e02-02 ../pages/e02-03 ../pages/e02-04 \
|
||||
../pages/e02-05 ../pages/e02-06 ../pages/e02-07 ../pages/e02-08 \
|
||||
../pages/e02-09 ../pages/e02-10 ../pages/e03-01 ../pages/e03-02 \
|
||||
../pages/e03-03 ../pages/e03-04 ../pages/e04-01 ../pages/e04-02 \
|
||||
../pages/e04-03 ../pages/e04-04 ../pages/e04-05 ../pages/e04-06 \
|
||||
../pages/e04-07 ../pages/e05-01 ../pages/e05-02 ../pages/e05-03 \
|
||||
../pages/e05-04 ../pages/e05-05 ../pages/e05-06 ../pages/e06-01 \
|
||||
../pages/e06-02 ../pages/e06-03 ../pages/e06-04 ../pages/e06-05 \
|
||||
../pages/e06-06 ../pages/e07-01 ../pages/e07-02 ../pages/e07-03 \
|
||||
../pages/e07-04 ../pages/e07-05 ../pages/e07-06 ../pages/e07-07 \
|
||||
../pages/e07-08 ../pages/e08-01 ../pages/e08-02 ../pages/e08-03 \
|
||||
../pages/e08-04 ../pages/e08-05 ../pages/e08-06 ../pages/e08-07 \
|
||||
../pages/e08-08 ../pages/e08-09 ../pages/e09-01 ../pages/e09-02 \
|
||||
../pages/e09-03 ../pages/e09-04 ../pages/e09-05 ../pages/e09-06 \
|
||||
../pages/e09-07 ../pages/e09-08 ../pages/e10-01 ../pages/e10-02 \
|
||||
../pages/e11-01 ../pages/e11-02 ../pages/e11-03 ../pages/e11-04 \
|
||||
../pages/e11-05 ../pages/e11-06 ../pages/e11-07 ../pages/e12-01 \
|
||||
../pages/e12-02 ../pages/e12-03 ../pages/e12-04
|
||||
|
||||
# make the important stuff
|
||||
all : $(ALL)
|
||||
|
||||
# make the important stuff and run the emulator
|
||||
run : $(ALL)
|
||||
@../tools/pdp11 simh.cfg
|
||||
|
||||
# reconstitute sources from ocr'd pages
|
||||
$(CLEANSRCS) cleansrc : $(PAGES)
|
||||
@echo Building clean source...
|
||||
@r() { cat ../pages/$$1-* >$$2.clean ; } ; \
|
||||
r e00 u0; \
|
||||
r e01 u1; \
|
||||
r e02 u2; \
|
||||
r e03 u3; \
|
||||
r e04 u4; \
|
||||
r e05 u5; \
|
||||
r e06 u6; \
|
||||
r e07 u7; \
|
||||
r e08 u8; \
|
||||
r e09 u9; \
|
||||
r e10 ux; \
|
||||
r e11 sh; \
|
||||
r e12 init
|
||||
@touch cleansrc
|
||||
|
||||
# patch the clean sources
|
||||
# XXX what if we do USECOREPATCHES=no and we want to apply
|
||||
# one of the cores as an EXTRAPATCH?
|
||||
$(ALLSRCS) patched : $(CLEANSRCS)
|
||||
@echo Patching...
|
||||
@for src in $(CLEANSRCS) ; do \
|
||||
cp $$src `basename $$src .clean`.s; \
|
||||
done
|
||||
@if [ $(USECOREPATCHES) = "yes" ] ; then \
|
||||
for p in ../patches/core/*.patch ; do \
|
||||
echo ' ' `basename $$p .patch`; \
|
||||
patch -s -p1 < $$p; \
|
||||
done; \
|
||||
fi
|
||||
@for p in $(EXTRAPATCHES) ; do \
|
||||
echo ' ' $$p; \
|
||||
patch -s -p1 < ../patches/$$p.patch; \
|
||||
done
|
||||
@touch patched
|
||||
|
||||
# build the unix kernel from the KSRCS using the v2 assembler.
|
||||
# XXX make ml take cmd line args for input and output file.
|
||||
unix loadfile usyms : $(KSRCS)
|
||||
@echo Building kernel...
|
||||
@$(AS) u?.s
|
||||
@$(NM) a.out | sort > usyms
|
||||
@$(ML)
|
||||
@mv a.out unix
|
||||
|
||||
# build init from sources
|
||||
# XXX make fixaout.py overwrite a.out instead of write b.out
|
||||
init : init.s
|
||||
@echo Building init...
|
||||
@$(AS) init.s
|
||||
@../tools/fixaout.py
|
||||
@rm a.out
|
||||
@mv b.out init
|
||||
|
||||
# build sh from sources XXX notyet
|
||||
# sh : sh.s
|
||||
|
||||
# build a prototype filesystems
|
||||
root usr protofs : init
|
||||
@echo Building filesystems...
|
||||
@$(TREECOPY) ../fs/root .
|
||||
@$(TREECOPY) ../fs/new/etc root
|
||||
@$(TREECOPY) ../fs/usr .
|
||||
@#cp init root/etc/init
|
||||
@#cp sh root/etc/sh XXX notyet
|
||||
@touch protofs
|
||||
|
||||
# build filesystem images
|
||||
rf0.dsk rk0.dsk images : protofs
|
||||
@echo Building disk images...
|
||||
@$(MKFS) -p ../fs/Readme root rf0.dsk rf
|
||||
@$(MKFS) -p ../fs/Readme root rk0.dsk rk
|
||||
@touch images
|
||||
|
||||
# build a tape image
|
||||
tape : protofs
|
||||
@echo Building tape image...
|
||||
@$(MKTAPE) root root/bin/* root/etc/*
|
||||
|
||||
# clean intermediate files
|
||||
clean :
|
||||
rm -f $(CLEANSRCS) cleansrc
|
||||
rm -f $(ALLSRCS) patched *.orig
|
||||
rm -f unix usyms
|
||||
rm -rf usr root protofs
|
||||
rm -f init
|
||||
rm -f images
|
||||
|
||||
# clean intermediate and target files
|
||||
clobber : clean
|
||||
rm -f tape
|
||||
rm -f loadfile
|
||||
rm -f rf0.dsk rk0.dsk
|
||||
|
||||
21
newbuild/simh.cfg
Executable file
21
newbuild/simh.cfg
Executable file
@@ -0,0 +1,21 @@
|
||||
#!../tools/pdp11
|
||||
set cpu 11/20
|
||||
set cpu 32K
|
||||
set rk0 enabled
|
||||
att rk0 rk0.dsk
|
||||
set rf 2p
|
||||
set rf enabled
|
||||
attach rf rf0.dsk
|
||||
set tc enabled
|
||||
att tc tape
|
||||
set hk disabled
|
||||
set rha disabled
|
||||
set tm disabled
|
||||
set rx disabled
|
||||
set rl disabled
|
||||
set tq disabled
|
||||
set tc enabled
|
||||
set rf enabled
|
||||
set ke enabled
|
||||
load loadfile
|
||||
go 400
|
||||
@@ -158,7 +158,7 @@ def wrFile(out, fn, d, mode, uid) :
|
||||
def wrEof(out) :
|
||||
wrFile(out, "", "", 0, 0)
|
||||
|
||||
def copyFile(out, fn) :
|
||||
def copyFile(root, out, fn) :
|
||||
"copy file from local filesystem to tape."
|
||||
f = file(fn, 'rb')
|
||||
d = f.read()
|
||||
@@ -172,12 +172,17 @@ def copyFile(out, fn) :
|
||||
if not fn in perms : print "making up mode"
|
||||
wrFile(out, fn, d, mode, uid)
|
||||
|
||||
root = "/tmp/s2"
|
||||
def main() :
|
||||
if len(sys.argv) < 2 :
|
||||
print "usage: %s root files" % sys.argv[0]
|
||||
raise SystemExit(1)
|
||||
root = sys.argv[1]
|
||||
files = sys.argv[2:]
|
||||
|
||||
f = file("tape", "wb")
|
||||
f.write("\0" * (512 * 65)) # start at block 65
|
||||
for fn in sys.argv[1:] :
|
||||
copyFile(f, fn)
|
||||
for fn in files :
|
||||
copyFile(root, f, fn)
|
||||
wrEof(f)
|
||||
f.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user