From 75d9e5ad5292c9e53102d54b36cfa3e9d42e1fe0 Mon Sep 17 00:00:00 2001 From: "tim.newsham" Date: Sun, 4 May 2008 18:52:38 +0000 Subject: [PATCH] - cleaned up the build process some - use patches instead of sed hacks. - comments for all patches, and each one separated. - apply patches as part of "rebuild" instead of in assemv7. --- patches/cold.patch | 11 +++++++++ patches/fixV7div.patch | 12 ++++++++++ patches/notes.txt | 23 +++++++++++++++++++ patches/vec0407.patch | 16 +++++++++++++ tools/assemv7 | 28 ++++------------------- tools/rebuild | 52 ++++++++++++++++++++++++++++++------------ 6 files changed, 104 insertions(+), 38 deletions(-) create mode 100644 patches/cold.patch create mode 100644 patches/fixV7div.patch create mode 100644 patches/notes.txt create mode 100644 patches/vec0407.patch diff --git a/patches/cold.patch b/patches/cold.patch new file mode 100644 index 0000000..f7f1e0e --- /dev/null +++ b/patches/cold.patch @@ -0,0 +1,11 @@ +diff -ru rebuilt/u0.s build/u0.s +--- rebuilt/u0.s 2008-05-03 08:27:03.000000000 -1000 ++++ build/u0.s 2008-05-04 08:29:31.000000000 -1000 +@@ -1,6 +1,6 @@ + / u0 -- unix + +-cold = 0 ++cold = 1 + orig = 0 . / orig = 0. relocatable + + rkda = 177412 / disk address reg rk03/rk11 diff --git a/patches/fixV7div.patch b/patches/fixV7div.patch new file mode 100644 index 0000000..69c373d --- /dev/null +++ b/patches/fixV7div.patch @@ -0,0 +1,12 @@ +diff -ru rebuilt/u0.s build/u0.s +--- rebuilt/u0.s 2008-05-03 08:27:03.000000000 -1000 ++++ build/u0.s 2008-05-04 08:28:00.000000000 -1000 +@@ -122,7 +122,7 @@ + mov $sb0,(r1)+ / I/O queue entry drum + mov $sb1,(r1)+ / I/O queue entry disk (mounted device) + mov $swp,(r1)+ / I/O queue entry core image being swapped +- mov $[systm-inode]\/2,sb0+4 / sets up initial buffers per ++ mov $-109.,sb0+4 / sets up initial buffers per + / format given in + mov $systm,sb0+6 / memory map + mov $-512.,sb1+4 diff --git a/patches/notes.txt b/patches/notes.txt new file mode 100644 index 0000000..1f384a5 --- /dev/null +++ b/patches/notes.txt @@ -0,0 +1,23 @@ +cold.patch - + Sets the "cold" flag to one to build a kernel that bootstraps the + root filesystem. + +fixV7div.patch + The instruction + mov $[systm-inode]\/2,sb0+4 / sets up initial buffers per + assembles incorrectly with the v7 assembler we are using because + it does an unsigned divide by two on a negative number. We patch + the correct value "-109." in for the expression. This is fragile + and will break if systm or inode move around due to code changes. + +vec0407.patch + The v7 assembler builds an 0407 a.out file. The original sources + used an 0405 a.out file in which the a.out header occupied the first + six words of the text segment. The sources accomodate this in two + ways 1) they comment out the first 3 vectors. 2) they have code + which patches those first six vectors back to their proper values. + When building with the v7 assembler the first work around will + result in the other vectors having an incorrect offset. This patch + just uncomments the first three vectors. This would not be necessary + if we had a proper 0405 assembler. + diff --git a/patches/vec0407.patch b/patches/vec0407.patch new file mode 100644 index 0000000..06d3151 --- /dev/null +++ b/patches/vec0407.patch @@ -0,0 +1,16 @@ +diff -r -u rebuilt/u0.s build/u0.s +--- rebuilt/u0.s 2008-05-03 08:27:03.000000000 -1000 ++++ build/u0.s 2008-05-04 08:25:41.000000000 -1000 +@@ -45,9 +45,9 @@ + core = orig+40000 / specifies beginning of user's core + ecore = core+20000 / specifies end of user's core (4096 words) + +-/ 4;4 init by copy +-/ unkni;0 " error +-/ fpsym;0 " illg in tr ++ 4;4 / init by copy ++ unkni;0 / " error ++ fpsym;0 / " illg in tr + unkni;0 / trace and trap (see Sec. B.1 page ) + unkni;0 / trap + panic;0 / pwr diff --git a/tools/assemv7 b/tools/assemv7 index ede6708..df83d93 100755 --- a/tools/assemv7 +++ b/tools/assemv7 @@ -9,31 +9,13 @@ . tools/assemv7.cfg export APOUT_ROOT -COLD=0 -if [ "$1" = "cold" ] ; then - COLD=1 -fi -echo "COLD: $COLD" -tools/rebuild - -# fix "mount" issue which 1ed as cant deal with -# and also fix up the vector table in u0.s since -# the result is a slightly different format a.out that doesnt -# include the header in the text segment -test -d build || mkdir build -for f in rebuilt/u?.s ; do - b=`basename $f` - if [ $COLD = 1 ] ; then - sed -e 's/.*init by copy.*/4;4;unkni;0;fpsym;0/' \ - -e 's/\[systm-inode\]\\\//-109./' \ - -e 's/cold = 0/cold = 1/' < $f > build/$b - else - sed -e 's/.*init by copy.*/4;4;unkni;0;fpsym;0/' \ - -e 's/\[systm-inode\]\\\//-109./' < $f > build/$b - fi -done +# build sources from pages and generate patched sources in "build" +# if "cold" is passed in, the "cold" option will be patched on. +tools/rebuild "$@" +# assemble the kernel from patched sources and generate symbols +# and build a simh loadable file. cd build $APOUT $APOUT_ROOT/bin/as ../sys1.s u?.s $APOUT $APOUT_ROOT/bin/nm a.out |sort > a.out.syms diff --git a/tools/rebuild b/tools/rebuild index cd41d6d..268f46a 100755 --- a/tools/rebuild +++ b/tools/rebuild @@ -1,19 +1,41 @@ #!/bin/sh -m() { cat pages/$2 > rebuilt/$1.s; } +r() { cat pages/$2-* > rebuilt/$1.s; } -test -d rebuilt || mkdir rebuilt +rebuild() { + test -d rebuilt || mkdir rebuilt -m u0 e00-* -m u1 e01-* -m u2 e02-* -m u3 e03-* -m u4 e04-* -m u5 e05-* -m u6 e06-* -m u7 e07-* -m u8 e08-* -m u9 e09-* -m ux e10-* -#m sh e11-* -#m ini e12-* + echo rebuilding... + r u0 e00 + r u1 e01 + r u2 e02 + r u3 e03 + r u4 e04 + r u5 e05 + r u6 e06 + r u7 e07 + r u8 e08 + r u9 e09 + r ux e10 + #r sh e11 + #r ini e12 +} + +p() { echo ' ' $1; patch -s -p1 <../patches/$1; } + +patches() { + test -d build || mkdir build + + echo patching... + cp rebuilt/* build + cd build + p vec0407.patch + p fixV7div.patch + if [ "$1" = "cold" ] ; then + p cold.patch + fi +} + + +rebuild +patches "$@"