When a set of optional patches has been tested by Peter Ford on the
engineering unit and MIT has certified the corresponding ECO, this
document describes the process by which the patches may be converted
into a set of addPatch
commands
for use on orbit.
The set of all such commands to upload a complete desired set of
patches onto ACIS, including the final addPatch
command which establishes the software version number, is called a
"patchload".
The inputs to the flight patch build process are
addPatch
command packets, starting with those for the standard
patches, continuing (for all but the standard-only patchload) with
each of the optional patches in a certified combination, and ending
with an addPatch
command which sets the flight software version
number (FSVN.)
There will be just one of these certified combinations that we intend to place on orbit and incorporate right away in an SOP. The other patchloads will be constructed and minimally tested, then held in reserve so that we can expeditiously develop an SOP for them should the need arise. Which is the correct flight patchload should be obvious from ECO review and ACIS Ops Working Group meetings; if not, just ask around.
The primary outputs areSACGS uses identity pools to keep track of unique identifiers. When you build a new parameter block or power command, you checkout new identifiers from the ID pools to prevent subsequent reuse. There are six ID pools; four of which are in common use (te, cc, win, cmdseqno) and two of which are only used for flight software patches (fsver, pnode). If a previous user created new FSW patch packets and neglected to "make idcheckin", the fsver and pnode pools could remain incorrect until the next patch is required. Don't skip steps! The most obvious symptom that this has happened is in step 10, when building the patchloads. Each patchload includes a final packet with the flight software version number which should not be the same as the previous set of flight software patches. The fsver and pnode ID pools can be repaired in the same way as the rest -- consult the SACGS maintainer for help.
Although one may always obtain a full flight software release
from the MIT ACIS team at /nfs/acis/h3/acisfs/configcntl/,
there's no way to obtain the bcmd files for the addPatch
commands
without building pretty much everything from scratch - which requires
a particular environment with the necessary cross-compilers.
We have therefore always skipped all that, and proceeded to just steal outright the bcmds which MIT used for its ECO certifications.
The certifications are documented in a certification directory/nfs/acis/h3/acisfs/patchbld/cert-X-Z
In that directory, you will find files and subdirectories named after
certified patch combinations, such as:
cc3x3+eventhist+compressall+txings/
Each .notes file indicates a certified combination, for which we must
build a corresponding patchload. To learn
which optional patches are included in the certification,
always look in the notes, because the patches explicit in the
subdirectory name may not be the entire list. The notes will also
indicate a list of "Test Support Patches". Also known as "engineering
patches", these are used to support diagnostics during testing on
the engineering unit, but are never intended to be loaded on orbit.
cc3x3+eventhist+compressall+txings.notes
cc3x3+eventhist+compressall+untricklebias+txings/
cc3x3+eventhist+compressall+untricklebias+txings.notes
Patch order. At this point, you will also want to determine the order in which you will load the optional patches. As of this writing, the one real order dependency is that smtimedlookup must precede eventhist and cc3x3. But additional dependencies may arise. Peter Ford has undertaken to state the load order of the patches within the first page of the corresponding .notes file in the future, so look there.
******************************
HOPEFULLY SUPERFLUOUS NOTEShould the patch order not be listed, contact Peter. Or you can follow the old instructions which follow.
The one way to be sure of patch order is to open an MIT test script (
runtest.tcl
) under each certification, and examine the order in which the script invoked its optional patches. (There's one test script for each patch, but within a certification they will list the patches in the same order.)These tcl scripts, typically named runtest.tcl, are found in the MIT patchbld area under cert-X-Z/
END HOPEFULLY SUPERFLOUS NOTE/
*****************************
Let's suppose you are ready to build the flight patches for a particular certification. Continuing with the above example, you will have found that the included patches are
smtimedlookupThe bcmd for the standard patches is the file
cc3x3
eventhist
compressall
txings
standard.bcmd
inpatchbld/release-X-opt-Y/release/dist/standard-release-X-opt-Y
The bcmd for the optional patches is in
patchbld/release-X-opt-Y/release/dist/options-release-X-opt-Y
Each patch sits in its own file, with an "opt_" prefix. For example,
opt_smtimedlookup.bcmd
contains the patch for smtimedlookup.
The engineering patches are considered optional patches, and have been
stable since launch. They're loaded into high patch memory, to
minimize the chance that their addresses will have to change as flight
patches are added. There are four of them, deaeng
,
dearepl
, printswhouse
, and tlmio
.
There will be additional optional patches in the directory that will not be included in the certification release and will not be loaded onto the flight instrument.
You'll do most of your real work on the Harvard side. You'll peek into the MIT net only to grab the ECO version of the bcmds, do a sanity check on the engineering unit with the commands you've built, and obtain the patch dump comparison file.
You should be in the SACGS environment. Whether interactively or
via .login or .cshrc, you should have
sourced the latest DS release, as well as sg_env_source.
The superior HEAD directory for all the patch building is
/data/acis/cmdgen/patching/acisfs_patchbld
. We shall refer
to this as $PTCHBLD
.
% cd /home/ascds(Your usual $SGDAT should work fine, but if you choose to dedicate a separate one to this task, be sure to run
% source /home/ascds/.ascrc
% newgrp acisops
% source data/acis/cmdgen/sacgs/bin/sg_env_source
% setenv PTCHBLD "/data/acis/cmdgen/patching/acisfs_patchbld"
% make setupthere.)
There hasn't been a solid convention on how to name either the .cmd files containing the patchloads, or the names of the packets themselves. However, you can look at previous patchloads and previous .cmb files for models, and this much has been constant:
Note that even when the source code for a given optional patch is unchanged from the previous release, the load addresses are likely to be different, so patch packet contents will change.
Finally, the patches for the flight software version number have names of the form "WUFSVhhhhh", where hhhhh is the hex version number.
From Peter Ford's patchbld directory on the MIT net
(/nfs/acis/h3/acisfs/patchbld
),
recursively copy the subdirectory
release-X-opt-Y/release/dist
onto the HEAD directory
$PTCHBLD/release-X-opt-Y
.
% mkdir -p $PTCHBLD/release-X-opt-Y/release
% scp -r maaxnew.mit.edu:/nfs/acis/h3/acisfs/patchbld/release-X-opt-Y/release/dist $PTCHBLD/release-X-opt-Y/release
Remember to include your username if it's different between MIT and HEAD. Also note that the copy needs to go through knockknock.mit.edu, either in two steps, or by setting up keypairs and ssh configuration.
Example results for standard E optional F certification G:You'll find the bcmd for the standard patches on the subdirectory% ls $PTCHBLD/release-E-opt-F/release/dist/ options-release-E-opt-F/ standard-release-E-opt-F/ options-release-E-opt-F.notes standard-release-E-opt-F.notes
standard-release-X-opt-Y
and bcmds for the various optional patches on the subdirectory
options-release-X-opt-Y
$PTCHBLD/patchloads
.eng-X-opt-Y
.singlets
.wustandxwhere X (or x) and Y (or y) are the standard and optional patch release, z is the certification release, and L is a lowercase letter, unique within the release, identifying a particular certified set of optional patches. (If there are no new or updated standard patches, you will re-use the wustandx that already exists.)
wuxyz_Lcom
% mkdir $PTCHBLD/patchloads/eng-X-opt-YTo determine L, look at the first page of the Engineering Change Order Certification. This will list the combinations of optional patches that are certified. You want to use these letters for L and you want to build ALL patch combinations that have been certified. (If only one combination has been certified, L will be "a".)
% mkdir $PTCHBLD/patchloads/wustandx
% mkdir $PTCHBLD/patchloads/wuxyz_Lcom (where L can be a,b,c or more)
The singlets directory may contain intermediate products from the last patch building exercise. Copy the contents to a parallel directory with a name indicating its vintage (i.e. singlets_xyz), then clear the singlets directory out.
% rm $PTCHBLD/patchloads/singlets/*
Copy $SGPROD/bin/sacgs_ops_make to Makefile on each of the subdirectories you created in the previous step, and on the singlets directory.
%cp $SGPROD/bin/sacgs_ops_make $PTCHBLD/patchloads/singlets/Makefile(where the the copy to wustandx may be unnecessary if there are no new standard patches, and the last command will be repeated for each value of L.)
%cp $SGPROD/bin/sacgs_ops_make $PTCHBLD/patchloads/eng-X-opt-Y/Makefile
%cp $SGPROD/bin/sacgs_ops_make $PTCHBLD/patchloads/wustandx/Makefile
%cp $SGPROD/bin/sacgs_ops_make $PTCHBLD/patchloads/wuxyz_Lcom/Makefile
A component file is a tab separated file
with records of the form:
<bcmd file><tab> <patchnm> <tab>
<ccccccc> <tab> {'N' | 'Y'}
Each line represents an input bcmd file that will be used in at
least one of the certified combination loads. (Optional patches that
are not included in the certification release do not need to appear
in the component files.)
Component files will serve as inputs to
id4pkts.pl
in steps 8 and 10, in which the
script will generate or assign identifiers and FSW version
numbers and output cmd files suitable for eventual insertion into
the ACIS tables. id4pkts.pl
will be run once in the
singlets directory, where it will assign new command sequence
numbers and patch nodes, as appropriate, to all the standard and
optional patch packets. It will then be run again for each patch
combination to create the full cmd patchload file, re-using the IDs
assigned in the singlets run, and adding the FSW version number.
In a component file, each input bcmd (component) is described by one line, consisting of four fields:
Look at the .cmb files from a previous release to see models for
the construction of these files. Note that the final letter in each
packet id field should be the release letter. For standard X opt Y,
the the standard packet id will end in 'x'; and each optional packet id will end in
'y'. If either X or Y is a vowel, take special care to choose short
names, since id4pkts.pl
's truncation algorithm
eliminates trailing vowels first.
In the working directory singlets
, create the component
file for the first id4pkts.pl run (step 8 below). It should include
all standard and optional components that will be included in any
of the certified combinations for this patch release; all entries (except perhaps the standard patch line, see
note below) will have a 'Y' in the selection field. This first
component file will not necessarily correspond to any particular certified
combination load. Call it all_patches.cmb
As in Section 3, use the first page of the Engineering Change Order
Certification to determine which optional patches are certified in
this release. The release-X-opt-Y directory will contain more
patches than what has been certified. You only need to place the
certified patches in the all_patches.cmb
file.
Enter them in the order in which they were loaded for testing
in their certification. The Certification ECO notes or the release
email from Peter should indicate
the valid order.
NOTE: If the standard patches have not changed (i.e., they remain at the same release letter), you don't want to assign new ids for the standard patch packets, you want to re-use the existing ids. Write 'N' for the standard patches in the selection field of the component file for the first id4pkts.pl run in the singlets directory. Copy the existing standard patches file, standard.bcmd, from the previous release into the singlets directory. It will get picked up as input to the subsequent id4pkts.pl runs. Also, copy the existing standard patches, wustandx.cmd, from the previous singlets directory (singlets_xyz) into singlets for the record.
Create the patchload component files. On each wustandx and wuxyz_Lcom directory, create a component file. The component file for the wustandx directory, needed only if there are new standard patches, will select only the standard component (by entering a 'Y' in the selection field). The load for each optional patch combination will select the standard component plus all the optional components in that certified combination. These component files have the same format as the master component file in the previous step, and will be used in step 10 below.
% cd $PTCHBLD/patchloads/eng-X-opt-Y
opt_deaeng.bcmd
opt_dearepl.bcmd
opt_printswhouse.bcmd
opt_tlmio.bcmd
% renumber_eng.pl opt_tlmio.bcmd opt_printswhouse.bcmd opt_deaeng.bcmd opt_dearepl.bcmdFor neatness and historical consistency, the files should be listed in just that order. The purpose of this exercise is to insert patch node numbers into the commands. The script doesn't have to reference the idpools, because it assigns the node numbers working down from high values, so as to avoid any possible conflict with flight patch ids.
There will be four output files, with "_renumbered" inserted into
their names just before the file extension, e.g.
opt_tlmio_renumbered.bcmd
. The only difference between
these and the inputs is that their packets will have patch ids
assigned to them.
Peter typically includes a packet in each engineering patch that
sets the flight software number to high values. Since the engineering
unit loads engineering patches last, these packets would overwrite
the real flight software patch version number. So the
renumber_eng.pl
script drops those packets from its output.
% bcmd -r opt_tlmio_renumbered.bcmd > opt_tlmio_renumbered.ipkts(The "i" in the "ipkts" suffix denotes that identifiers have been added.)
% cd /nfs/acis/h5/buehler/cypress/engpatch
% mkdir X-opt-Y
% scp *renumbered* maaxnew.mit.edu:/nfs/acis/h5/buehler/cypress/engpatch/X-opt-Y/.
% cp *renumbered* ..That places the engineering patch binaries on the parent directory, where the napcat2bcmd Makefile can look for them.
% cd $PTCHBLD/patchloads/singlets
% make idstart
This places a working copy of the idpools on $SGDAT/data/idp and another on $SGDAT/ckpoint. (There is no "make clean" step; the "make lidcheckin" essentially does the cleanup.)
Perform the first id4pkts run:
% id4pkts.pl -f all_patches.cmb -i $SGDAT/idp -a -r XYZwhere X, Y, and Z are the release letters for standard patches, optional patches, and certification, respectively.
The script expects to find MIT input .bcmd files on the directories
$PTCHBLD/release-X-opt-Y/release/dist/standard-release-X-opt-Y
and
$PTCHBLD/release-X-opt-Y/release/dist/options-release-X-opt-Y
.
It will fill in command sequence numbers, patchnode numbers,
and (as comments) 10-character packet ids. Later eatdat
will
read these comments to learn what packet ids to use as keys into
the ACIS Tables.
Note: the id4pkts.pl code is re-entrant. The first thing the
script does is to copy the id pools originally obtained by
"make idstart" from $SGDAT/ckpoint to $SGDAT/idp. So repeated
runs of the script will assign the same ids, until you issue the
"make lidcheckin" command.
Note 2: At this stage, there should be no packets in the cmd files of the form
# Patch id 1You can check this with a grep on "Patch Id". If there are, delete them. They won't do serious harm: the flight software version number packets added in step 10 will override them, turning them essentially into no-ops. But they are extraneous, and finding them on board may cause confusion to humans later on. (Peter has one of these, which sets the flight software version number to 0, in each of his individual patch .bcmds; it makes it clear when a run is being performed on patches in development, rather than on the current flight load.)
add 0xefff patch 1 0x8001dfd0 {
0x0000ffff
}
Still in the singlets directory, compare the output files for the standard or individual optional patch cmds to the MIT input bcmds. You'll do one check for each optional patch and one for the standard patches.
Historical note. In the past, the .cmd files created in this procedure wrote out their patch packets with four hex words to a line, while many of Peter's utilities put out one hex word to a line. For ease of comparison, you may want to process bcmds through a dumb little script I've put onto $SGPROD/bin. E.g.:
% cat $PTCHBLD/release-X-opt-Y/release/dist/options-release-X-opt-Y/opt_compressall.bcmd | four2aline_bcmd.pl opt_compressall.bcmdbefore comparing. End historical note.
% cp $PTCHBLD/release-X-opt-Y/release/dist/options-release-X-opt-Y/opt_compressall.bcmd .Then check for differences between the MIT version of each patch and your own, e.g.:
% diff opt_compressall.bcmd wucmprsy.cmdThe expected differences will consist only of lines like this:
< add 0xccdd patch 2 0x800e3654 {The first and second numeric fields (command sequence and patch id) show an expected difference, the hex field (patch load address) should be identical; and the comment with the packet id has been added.
---
> add 11228 patch 1050 0x800e3654 { ## WUCMPRSF02
Once you are satisfied there are no other differences, you can synchronize your local copies of the id pools. (All of the make commands for id pools will run correctly from any directory with a Makefile.)
% make lidcheckinThis copies the idpools from $SGDAT/idp to the $SGDAT/ckpoint directory.
If you are certain no one else has run SACGS and obtained IDs from the global ID pools since you started step 8, run
% make idcheckin
Otherwise, return to run step 8.
In step 8, you used id4pkts.pl
to assign
identifiers for command packets within each individual patch. Now, you will
use it to combine those individual patches into patchloads
For each patchload directory where you created a component file in step 6 (wustandx and wuxyz_Lcom):
% cat ../singlets/standard.bcmd ../singlets/opt_smtimedlookup.bcmd ... > wuxyz_Lcom_mit.bcmd
id4pkts.pl
there. It will
concatenate all the patches in the load, and add the final patch
packet which installs the flight software version number.
% id4pkts.pl -f <component file> -l <loadname> -r XYZHere "loadname" is the desired output file name minus the file extension, wustandx or wuxyz_Lcom. These outputs are the files which, once verified, you will place under source control on the Harvard LAN, in step 17.
% make lidcheckinDo a separate lidcheckin for each patchload directory, otherwise the flight version number will be multiply assigned.
At this point, confirm that the FSW version numbers are unique and do not overlap with the FSW version numbers assigned to the previous patch level. If they do, you will need to repair the ID pools and do the ID assignment again.
If this is a new standard patchload:
% cd $PTCHBLD/patchloads/wustandxand for each L combination
% bcmd -r wustandx.cmd > wustandx.ipkts
% cd $PTCHBLD/patchloads/wuxyz_Lcom
% bcmd -r wuxyz_Lcom.cmd > wuxyz_Lcom.ipkts
% cd $PTCHBLD/patchloads(Again remembering username if different and navigating through knockknock.mit.edu with keypairs and ssh configuration.) Both the cmds and the ipkts will now have permanent MIT side copies. (They won't override the existing copies, which sit on subdirectories specific to their own X-opt-Y.)
% scp wustandx/wustandx.* maaxnew.mit.edu:/nfs/acis/h5/buehler/cypress/engpatch/X-opt-Y
% scp wuxyz_*com/wuxyz*com.* maaxnew.mit.edu:/nfs/acis/h5/buehler/cypress/engpatch/X-opt-Y
% cd /nfs/acis/h5/buehler/cypress/napcat2bcmd/
Save the old Makefile somewhere convenient, just in case. Use the current patch release PATCH= definitions, above the "Historical-only section" line, as a model to create the new patchload definitions. The new definitions should go above the current patch.
For sanity testing of the certified loads that we aren't planning to place on orbit, add only one PATCH= definition, modeled on "Flight imitation with image loader", but call it something like "wuxyz_Lcom with image loader".
Later, when we actually put the new patches on orbit, we'll move the "Historical-only" line above the first PATCH= line for the old release.Run a few TE and CC SI modes with the current production patches and then new patches in place. (You select the patchload you want to run in the Makefile, leaving only one "PATCH=" line uncommented out.) The runs should complete without errors and with the expected output files. This testing takes time -- confirm that no one else needs the EU and that your network connection can stay open.
Specifically, to perform the sanity check for the new patches we are planning to upload to Chandra, you will follow the instructions for standard SI mode testing here and as described below. Make sure the right flight software version number comes up in pmon for each test.
% cd /nfs/acis/h5/buehler/cypress/cmdver/or/guest(In case some anomaly arises - not just a mistake in the patch generation process, but a difficulty with the engineering unit, or with the patches themselves - we'll want to preserve the contents of this directory, and redo this step in a parallel subdirectory when the anomaly is resolved.)
% mkdir fswv48
% cd fswv48
% mkdir telem
% cp /nfs/acis/h1/www/bin/current.* .
rptchk_rundat $rootnamewhich will report its results to stdout.
% run-dat3.pl -I -c current.cfg -d current.dat TE_00B26B TE_00B26 TE_007ACB TE_007AC TE_007AEB TE_007AE > & fswv48_cti.rpt
% mv current.5rpt fswv48_cti.5rpt
% rptchk_rundat fswv48_cti
% run-dat3.pl -I -c current.cfg -d current.dat TE_004A4B TE_004A4 TE_00458B TE_00458 TE_00714B TE_00714 TE_004F2B TE_004F2 >& fswv48_te.rpt
% mv current.5rpt fswv48_te.5rpt
% rptchk_rundat fswv48_te
% run-dat3.pl -I -c current.cfg -d current.dat CC_00044B CC_00044 CC_0004AB CC_0004A CC_000DAB CC_000DA CC_00046B CC_00046>& fswv48_cc.rpt
% mv current.5rpt fswv48_cc.5rpt
% rptchk_rundat fswv48_cc
% run-dat3.pl -I -c current.cfg -d current.dat TE_007E8B TE_007E8 TE_0095CB TE_0095C >& fswv48_spc.rpt(TE_007E8 uses multiple spatial windows, and TE_0095C exercises subarrays.)
% mv current.5rpt fswv48_spc.5rpt
% rptchk_rundat fswv48_spc
% run-dat3.pl -I -c current.cfg -d current.dat TE_009F4B TE_00946B TE_00946 >& fswv48_evhst.rpt
% mv current.5rpt fswv48_evhst.5rpt
% rptchk_rundat fswv48_evhst
All EU runs should complete without errors and the resulting rpt files should look very similar between the two FSW versions (except for times, etc.)
If there are additional certified combinations, set the PATCH= line in the Makefile accordingly, and perform a single run-dat3.pl run, with one or two of the CCs, and one or two of the TEs that you used above. Follow the same steps to check the rpt file.
"make start" will load the patches. Start a filter client in the monitor window:
% filterClient -h cypress | psci -T -B -m -v -l wuxyz_Lcom_compare &Back in your cypress napcat2bcmd window, issue the command:
% echo dump 0 patchlist | bcmd | sendCmds | cclient cypress 7000In the Monitor window you will see lines reporting a series of 'dumpedPatches' packets, and in particular one which indicates total "bytes written to `wuxyz_Lcom_compare_dumpedPtaches.1.dat". Wait for one more swHousekeeping packet, and you know your patch comparison dump is complete.
The filterClient will produce (possibly among other things you can ignore) the binary file wuxyz_Lcom_compare.dumpedPatches.1.dat. Copy this to the following places:
Finally, set the PATCH= line back to the "flight imitation with image loader" for the release that's currently on orbit, and run a quick CC mode through run-dat3.pl:
% run-dat3.pl -Z -I -c current.cfg -d current.dat CC_00044B CC_00044 >& backto_fswvn44.rptYou're doing this just to make sure the flight software version number is restored in pmon, for the next production run on the engineering unit. (The additional "-Z" flag powers down FEPs and video boards when run-dat3 finishes.)
Finish up as directed in the standard EU instructions.
Back on the Harvard net,
Concatenate all the .cmd files creatd in step 10, and copy that
concatenated file to your $SGDAT directory (or whatever subdirectory
of $SGDAT you choose to work in.) Suppose the concatenated file is
called patches_xyz.cmd. There will be a lot of repetition in this cmd
file, but that's all right. The cmd2dat
script
doesn't care if it gets multiple copies of a packet; it will add in the
first one, and ignore the others.
% cd $SGDATAt this point, follow steps 7.2 to the end of the SACGS short form, which does some book-keeping and distributes the new ACIS tables to the FOT and to the EGSE.
% cp patches_xyz.cmd obsreqs.cmd
% make clean
% make start
% cmd2dat patches_xyz >& patches_xyz.session1
(Check the results)
% log2cfg patches_xyz >& patches_xyz.session2
(This is essentially a NO-OP, since you are not adding any new configurations, but make products wants the file there.)
% make ROOT=patches_xyz ODBTAG=yy_mm_dd_XYZL products
cksum
on the
patch comparison file.
Some use is made of regular sacgs operations. Otherwise, we have:
Executables: id4pkts.pl, renumber_eng.pl, patchid_rpt.pl. Checked into CVS under
/cmdgen/util. The util directory is highly nonvolatile, but ought
to be copied to /data/acis-bak now
and then. Being on /data/acis, it does get backed up to tape.
There are three significant outputs:
A. patches_xyz.cmd - stored on $SGPROD/data/atbls/cmds by 'make products'.
B. The engineering .cmd and .ipkts.
On the Harvard side, these are stored on
$PTCHBLD/patchloads
in the eng-X-opt-Y directory. On the MIT side they're in
/nfs/acis/h5/buehler/cypress/engpatch
There's a CVS module "onorbit_patch" under the SACGS CVSROOT, where the
.cmb, .cmd and .ipkts files are stored under release-X-opt-Y
subdirectories.
C. The packets themselves, ensconced in the ACIS Tables.
Same backup and version control as all ACIS tables:
Separate files for each version, kept in perpetuity on /data/acis,
with hot backup to /data/acis-bak.
Separate version control of ACIS Tables within OCC, from which
we can recover them via lucky.