summaryrefslogtreecommitdiffstats
path: root/src/build/tools/hb
blob: 0ea3cdad7925da417ba294d32a4bc379c97facb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
#!/bin/sh
#  IBM_PROLOG_BEGIN_TAG
#  This is an automatically generated prolog.
#
#  $Source: src/build/tools/hb $
#
#  IBM CONFIDENTIAL
#
#  COPYRIGHT International Business Machines Corp. 2011
#
#  p1
#
#  Object Code Only (OCO) source materials
#  Licensed Internal Code Source Materials
#  IBM HostBoot Licensed Internal Code
#
#  The source code for this program is not published or other-
#  wise divested of its trade secrets, irrespective of what has
#  been deposited with the U.S. Copyright Office.
#
#  Origin: 30
#
#  IBM_PROLOG_END

execute_in_sandbox()
{
    [ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
    [ -z "${SANDBOXROOT}" ] && echo "Missing SANDBOXROOT." && exit -1
    [ -z "${SANDBOXNAME}" ] && echo "Missing SANDBOXNAME." && exit -1

    if [ ! -d "${SANDBOXBASE}" ]; then
        echo "Sandbox does not exist.  Create with 'hb simsetup."
        exit -1
    fi

    SANDBOXRC="${SANDBOXROOT}/hbsandboxrc"
    WORKON_CMD="workon -rc ${SANDBOXRC} -sb ${SANDBOXNAME} -m $2 "

    echo $1 > ${SANDBOXBASE}/src/sandbox_execute_cmd
    chmod 700 ${SANDBOXBASE}/src/sandbox_execute_cmd

    ${WORKON_CMD} -c ./sandbox_execute_cmd

    rm ${SANDBOXBASE}/src/sandbox_execute_cmd
}

needs_machine_variable()
{
    MACHINE=${MACHINE:-$DEFAULT_MACHINE}
    export MACHINE
    echo "Setting up for Machine = $MACHINE"
}

hb_helptext()
{
    echo "Hostboot Utility Script"

    case $1 in
    workon)
        echo "  Topic 'workon'"
        echo
        echo "  Usage:"
        echo "      hb workon"
        echo
        echo "  Sources necessary environment files for building hostboot"
        echo "  and begins a new shell.  The workon may be left via 'exit'."
        echo
        echo "  Environment Variables:"
        echo "      SHELL: The shell program to launch."
        echo
        echo "  See also:"
        echo "      customrc"
        ;;
    simsetup)
        echo "  Topic 'simsetup'"
        echo
        echo "  Usage:"
        echo "      hb simsetup"
        echo
        echo "  Creates a simics workspace (FSP sandbox) in the directed"
        echo "  location and initializes simics as well as executing any"
        echo "  hostboot specific workarounds."
        echo
        echo "  FSP backing build and workarounds are chosen as directed"
        echo "  by the CI test files (src/build/citest/etc)."
        echo
        echo "  Environment Variables:"
        echo "      SANDBOXROOT: Root directory of where the sandboxes"
        echo "                   should go."
        echo "      SANDBOXNAME: Desired name of the hostboot sandbox."
        ;;
    prime)
        echo "  Topic 'prime'"
        echo
        echo "  Usage:"
        echo "      hb prime"
        echo "      hb prime --test"
        echo
        echo "  Copies hostboot images and simics scripts into the"
        echo "  simics workspace."
        echo
        echo "  Options:"
        echo "      --test : Copy test images (as opposed to non-test)."
        echo
        echo "  See also:"
        echo "      simsetup"
        ;;
    startsimics)
        echo "  Topic 'startsimics'"
        echo
        echo "  Usage:"
        echo "      hb startsimics <opts>"
        echo
        echo "  Enters the simics workspace and starts simics using the"
        echo "  start_simics utility.  Any options are passed directly to"
        echo "  the start_simics script."
        echo
        echo "  Requires the hostboot image to be 'prime'd into the workspace."
        echo
        echo "  Environment Variables:"
        echo "      MACHINE: Alternate simics machine type (default SALERNO)"
        echo "      SIMICSOPTIONS: Additional options to always pass to the"
        echo "                     start simics script, such as '-nre'."
        echo
        echo "  See also:"
        echo "      simsetup, prime"
        ;;
    rsync)
        echo "  Topic 'rsync'"
        echo
        echo "  Usage:"
        echo "      hb rsync"
        echo
        echo "  Synchronizes an entire Hostboot repository with another"
        echo "  directory.  This can be useful for creating a backup of"
        echo "  the repository or for pushing it to a remote host, such"
        echo "  as a pool machine where simics is executed."
        echo
        echo "  Environment Variables:"
        echo "      RSYNCHOST: (optional) remote host to rsync to."
        echo "      RSYNCDIR: Destination directory of the rsync."
        echo
        echo "  The trailing slash on RSYNCDIR, or lack thereof, has"
        echo "  meaning to rsync.  Specifically /.../foo will create a new"
        echo "  directory called 'foo' with the contents of your repository"
        echo "  in it, while /.../foo/ will create a subdirectory within foo"
        echo "  by the name of your repository's directory name."
        ;;
    objsizes)
        echo "  Topic 'objsizes'"
        echo
        echo "  Usage:"
        echo "      hb objsizes"
        echo
        echo "  Reads the ELF header information from all of the hostboot"
        echo "  modules and generates a CSV output of the sizes of the text"
        echo "  and data sections of the modules."
        ;;
    copyright_check)
        echo "  Topic 'copyright_check'"
        echo
        echo "  Usage:"
        echo "      hb copyright_check"
        echo
        echo "  Executes addCopyright.pl in validate mode against the most"
        echo "  recent commit in your repository to ensure the prologs are"
        echo "  all added properly."
        ;;
    errlparser)
        echo "  Topic 'errlparser'"
        echo
        echo "  Usage:"
        echo "      hb errlparser"
        echo
        echo "  Prepares a copy of FipS errl tool that is hostboot aware,"
        echo "  places it in simics directory."
        ;;
    cachesync)
        echo "  Topic 'cachesync'"
        echo
        echo "  Usage:"
        echo "     hb cachesync"
        echo
        echo "  Synchronizes the repository's binary file cache with the"
        echo "  project repository."
        ;;
    cacheadd)
        echo "  Topic 'cacheadd'"
        echo
        echo "  Usage:"
        echo "     hb cacheadd [--local] <file> \"<msg>\""
        echo
        echo "  Inserts a file into the project binary file cache."
        echo
        echo "  Options:"
        echo "     --local: Indicates file should be put only in local cache."
        ;;
    customrc)
        echo "  Topic 'customrc'"
        echo
        echo "  Setting up this file in the root of your repository gives a"
        echo "  convienient way to create default environment variables for"
        echo "  the 'hb' script and your hostboot workon environment.  Some"
        echo "  of the hb sub-commands require environment variables assigned"
        echo "  and they should be done through this 'customrc' file.  You"
        echo "  may also use this as a place to source other files you need"
        echo "  for your environment, such as setting up 'git'."
        echo
        echo "  The 'customrc' file is in the .gitignore file and should"
        echo "  NEVER be committed to git.  These are your own custom "
        echo "  settings."
        echo
        echo "  The minimal example 'customrc' file is as follows:"
        echo "      #!/bin/sh"
        echo "      export SANDBOXROOT=~/sandboxes"
        echo "      export SANDBOXNAME=hostboot"
        echo
        echo "  See also:"
        echo "      All other sub-commands."
        ;;
    *)
        echo "  Usage:"
        echo "      hb <cmd>"
        echo "      hb help [<cmd>|<topic>]"
        echo
        echo "  Available Commands:"
        echo "      workon, simsetup, prime, startsimics, rsync, objsizes,"
        echo "      copyright_check, errlparser, cachesync, cacheadd"
        echo
        echo "  Additional Help Topics:"
        echo "      customrc"
        echo
        echo "  For initial setup:"
        echo "      1) Create customrc file."
        echo "      2) hb workon"
        echo "      3) hb simsetup"
        echo "      4) Create images (edit code, make, etc.)."
        echo "      5) hb prime [--test]"
        echo "      6) hb startsimics"
        echo "      7) Return to step 4 until satisfied."
        ;;
    esac
}

hb_workon()
{
    if [ -n "${HOSTBOOT_INSIDE_WORKON}" ]; then
        echo "Already in a workon."
        exit -1
    else
        export HOSTBOOT_INSIDE_WORKON=1
        echo "Setting environment variables..."
        source ./env.bash

        echo "Spawning new shell (${SHELL})..."
        ${SHELL} && exit 0
    fi
}

hb_prime()
{
    if [ -n "${SANDBOXBASE}" ]; then
        if [ ! -d "${SANDBOXBASE}" ]; then
            echo "Sandbox does not exist.  Create with 'hb simsetup."
            exit -1
        fi
        needs_machine_variable
        cpfiles.pl $*
    else
        echo "SANDBOXBASE not set."
        exit -1
    fi
}

hb_simsetup()
{
    [ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
    [ -z "${SANDBOXROOT}" ] && echo "Missing SANDBOXROOT." && exit -1
    [ -z "${SANDBOXNAME}" ] && echo "Missing SANDBOXNAME." && exit -1
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1

    SANDBOXRC="${SANDBOXROOT}/hbsandboxrc"
    DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`

    if [ -d "${SANDBOXBASE}" ]; then
        echo "Removing old sandbox."
        mksb -rc ${SANDBOXRC} -dir ${SANDBOXROOT} -undo $SANDBOXNAME
    fi

    if [ ! -d "${SANDBOXROOT}" ]; then
        echo "Creating sandbox root directory."
        mkdir -p ${SANDBOXROOT}
    fi

    echo "Creating new sandbox."
    mksb -rc ${SANDBOXRC} -dir ${SANDBOXROOT} -back $DRIVER \
         -sb ${SANDBOXNAME} -m ppc

    echo "Running workarounds (presimsetup)."
    cp ${HOSTBOOTROOT}/src/build/citest/etc/workarounds.presimsetup ${SANDBOXBASE}/src
    execute_in_sandbox "export BACKING_BUILD=\$bb && ./workarounds.presimsetup"  "ppc"
    rm ${SANDBOXBASE}/src/workarounds.presimsetup

    needs_machine_variable
    execute_in_sandbox "start_simics -no_start -machine ${MACHINE}"  "ppc"

    echo "Running workarounds (postsimsetup)."
    cp ${HOSTBOOTROOT}/src/build/citest/etc/workarounds.postsimsetup ${SANDBOXBASE}/src
    execute_in_sandbox "export BACKING_BUILD=\$bb && ./workarounds.postsimsetup"  "ppc"
    rm ${SANDBOXBASE}/src/workarounds.postsimsetup

    mkdir ${SANDBOXBASE}/img

    # Put a starter copy of errl to simics directory; refresh w/ "hb errlparser"
    cd ${SANDBOXBASE}/simics
    ln -sf  ${DRIVER}/obj/x86.nfp/errl/nfp/tool/errl

}

hb_startsimics()
{
    [ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1

    if [ ! -d "${SANDBOXBASE}" ]; then
        echo "Sandbox does not exist.  Create with 'hb simsetup."
        exit -1
    fi

    SBDRIVER=`cat ${SANDBOXBASE}/rc_files/sb.conf | \
              grep "backing_build" | awk '{ print $3 }'`
    DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`

    if [ ${SBDRIVER} != ${DRIVER} ]; then
        echo "Driver mismatch between sandbox and src/build/citest/etc/bbuild."
        echo "Sandbox at ${SBDRIVER}"
        echo "Update sandbox with 'hb simsetup'."
        exit -1
    fi

    needs_machine_variable
    execute_in_sandbox \
        "start_simics -machine ${MACHINE} ${SIMICSOPTIONS} $*"  "ppc"
}

hb_rsync()
{
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
    [ -z "${RSYNCDIR}" ] && echo "Missing RSYNCDIR." && exit -1

    if [ -z "${RSYNCHOST}" ]; then
        rsync -av --delete ${HOSTBOOTROOT}/ ${RSYNCDIR}
    else
        rsync -zav --delete ${HOSTBOOTROOT}/ ${RSYNCHOST}:${RSYNCDIR}
    fi
}

hb_objsizes()
{
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1

    echo "Object,Text Size,Data Size"

    objdump -h ${HOSTBOOTROOT}/img/*.elf ${HOSTBOOTROOT}/img/*.so | \
    grep -e ".elf" -e ".so:" -e ".text " -e ".data " | \
    sed "s/.so:.*/.so/" | \
    sed "s/.elf:.*/.elf/" | \
    sed 's/.*\.text *\([0-9a-f]*\).*/,0x\1/' | \
    sed "s/.*\.data *\([0-9a-f]*\).*/,0x\1/" | \
    sed "N ; N ; s/\n//g" | \
    xargs -n1 perl -e 'printf "%s,%d,%d\n", map { 0 == hex $_ ? $_ : hex $_ } split /\,/,shift;' | \
    sed "s/.*\///"
}

hb_copyright_check()
{
    git diff HEAD~1 --name-only | xargs addCopyright.pl validate
}


hb_errlparser()
{
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
    [ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
    [ -z "${SANDBOXNAME}" ] && echo "Missing SANDBOXNAME." && exit -1
    [ -z "${SANDBOXROOT}" ] && echo "Missing SANDBOXROOT." && exit -1

    DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`

    # sanity checks 
    if [ ! -f ${DRIVER}/src/makefile ]; then
        echo "Cannot reach backing build: $DRIVER. You may need tokens."
        exit -1
    fi

    if [ !  -f  ${HOSTBOOTROOT}/src/include/usr/hbotcompid.H ]; then 
        echo "Missing \$HOSTBOOTROOT/src/include/usr/hbotcompid.H"
        exit -1
    fi

    if [ !  -f  ${HOSTBOOTROOT}/src/include/usr/errl/hberrltypes.H ]; then 
        echo "Missing \$HOSTBOOTROOT/src/include/usr/errl/hberrltypes.H"
        exit -1
    fi

    if [ !  -f  ${HOSTBOOTROOT}/obj/genfiles/hostBootSrcParse.H ]; then 
        echo "Missing \$HOSTBOOTROOT/obj/genfiles/hostBootSrcParse.H"
        echo "This is a generated file produced during a Hostboot build."
        exit -1
    fi

    # Copy hbotcompid.H to $sb/src/fstp/fsp
    mkdir -p ${SANDBOXBASE}/src/fstp/fsp
    cp ${HOSTBOOTROOT}/src/include/usr/hbotcompid.H  ${SANDBOXBASE}/src/fstp/fsp

    # Symlink hbotcompid.H into the export trees. 
    # TODO: Eventually, this will be done by src/fstp/nfp/makefile, and when 
    # that's ready, it will require a mk of fstp instead of this.
    mkdir -p  ${SANDBOXBASE}/export/x86.nfp/fips/include 
    cd  ${SANDBOXBASE}/export/x86.nfp/fips/include 
    ln -sf ../../../../src/fstp/fsp/hbotcompid.H

    mkdir -p  ${SANDBOXBASE}/export/ppc/fips/include 
    cd  ${SANDBOXBASE}/export/ppc/fips/include 
    ln -sf ../../../../src/fstp/fsp/hbotcompid.H

    # One-time preparation and x86.nfp full build of epub and errl. 
    if [ !  -f  ${SANDBOXBASE}/src/errl/makefile  ]; then 
        # First time running 'hb errlparser' 
        echo "Preparing sandbox ..."
        rm -fr  ${SANDBOXBASE}/src/epub ;  mkdir -p ${SANDBOXBASE}/src/epub
        rm -fr  ${SANDBOXBASE}/src/errl ;  mkdir -p ${SANDBOXBASE}/src/errl

        # TODO When the backing build has Hostboot awareness, remove this
        # copying from Monte's public directory. Requirement SW105241.
        if [ -d /gsa/ausgsa/home/c/o/copelanm/public/mamatha/errl ]; then
            # Copy patch version of epub_service_codes.H 
            cp -a ${DRIVER}/src/epub/*   ${SANDBOXBASE}/src/epub
            cp  /gsa/ausgsa/home/c/o/copelanm/public/mamatha/epub/fsp/epub_service_codes.H   ${SANDBOXBASE}/src/epub/fsp

            # Copy errl patch.
            cp -a /gsa/ausgsa/home/c/o/copelanm/public/mamatha/errl/* ${SANDBOXBASE}/src/errl
        else
            # Populate with stuff from backing build.
            cp -a ${DRIVER}/src/epub/*   ${SANDBOXBASE}/src/epub
            cp -a ${DRIVER}/src/errl/*   ${SANDBOXBASE}/src/errl
        fi    

        # Trigger a full local build this one time.  
        # Next time can be a partial build.
        execute_in_sandbox "cd ${SANDBOXBASE}/src/epub && mk -a"  "x86.nfp"
        execute_in_sandbox "cd ${SANDBOXBASE}/src/errl && mk -a"  "x86.nfp"
    fi

    # (Re-)Copy Hostboot plugins sources so they are up to date. 
    rm -fr ${SANDBOXBASE}/src/plugins
    mkdir -p ${SANDBOXBASE}/src/plugins

    # Locate and copy plugins directories for Hostboot components.
    PLUGDIRS=`find  ${HOSTBOOTROOT}/src/usr -name plugins -type d`
    ALLCOMPS=""

    for D in $PLUGDIRS; do 
        COMP=`echo $D | sed 's/^.*\/src\/usr\///' | awk '-F/' '{print $1}' `
        mkdir  ${SANDBOXBASE}/src/plugins/$COMP
        cp -a  ${HOSTBOOTROOT}/src/usr/$COMP/plugins/*   ${SANDBOXBASE}/src/plugins/$COMP
        ALLCOMPS="$ALLCOMPS $COMP"
    done

    # Build a src/plugins/makefile with the component names found above.
    echo "# This file auto-generated from  ${HOSTBOOTROOT}/src/usr/errl/plugins/makefile.fips" >${SANDBOXBASE}/src/plugins/makefile
    echo "HBCOMPS=$ALLCOMPS"  >>${SANDBOXBASE}/src/plugins/makefile
    grep -v "^ *#"  ${HOSTBOOTROOT}/src/usr/errl/plugins/fips.mk >>${SANDBOXBASE}/src/plugins/makefile

    # Copy common plugins.mk included by all plugins makefiles.
    cp  ${HOSTBOOTROOT}/src/usr/errl/plugins/plugins.mk ${SANDBOXBASE}/src/plugins

    # Clean any libB* symlinks in the export tree.
    find  ${SANDBOXBASE}/export/x86.nfp/fips/lib -name "libB*" -exec rm {} \;  2>/dev/null

    # Build all libB* plugins from scratch every time. This should not take long.
    execute_in_sandbox "cd ${SANDBOXBASE}/src/plugins && mk -a" "x86.nfp"
    
    # Ensure the errl binary is gone in order to trigger 
    # a relink to pick up changed libB*.a files 
    mkdir -p ${SANDBOXBASE}/src/errl
    mkdir -p ${SANDBOXBASE}/obj/x86.nfp/errl/nfp/tool
    rm -f ${SANDBOXBASE}/obj/x86.nfp/errl/nfp/tool/errl
    execute_in_sandbox "cd ${SANDBOXBASE}/src/errl && mk"  "x86.nfp"
   
    # Get the x86 errl tool to simics directory 
    # cp  $SANDBOXBASE/obj/x86.nfp/errl/nfp/tool/errl   $SANDBOXBASE/simics
    cd ${SANDBOXBASE}/simics
    ln -sf ../obj/x86.nfp/errl/nfp/tool/errl
}

hb_cachesync()
{
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1

    rsync -av /gsa/ausgsa/projects/h/hostboot/.binary_cache/ \
              ${HOSTBOOTROOT}/.git/hb_cache

    failure=0
    for files in ${HOSTBOOTROOT}/.git/hb_cache/data/*; do
        echo "`basename $files`  $files" | sha1sum --check >> /dev/null
        if [ $? -ne 0 ]; then
            echo "Failed SHA1 verification! $files"
            failure=-1
        fi
    done

    exit $failure
}

hb_cacheadd()
{
    [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1    

    CACHE_PATH=/gsa/ausgsa/projects/h/hostboot/.binary_cache/
    FILE=$1
    shift

    if [ $FILE == "--local" ]; then
        echo "Adding as local copy."
        CACHE_PATH=${HOSTBOOTROOT}/.git/hb_cache/

        FILE=$1
        shift
    fi

    MESSAGE=$*

    [ ! -e "${FILE}" ] && echo "File $FILE does not exist." && exit -1
    [ -z "${MESSAGE}" ] && echo "No message given." && exit -1

    FILE_BASE=`basename $FILE`
    SHA1SUM=`sha1sum -b $FILE | sed 's/ .*//'`

    echo $FILE $SHA1SUM

    cp $FILE $CACHE_PATH/data/$SHA1SUM
    echo $SHA1SUM : `whoami` : `date` : $MESSAGE \
            >> $CACHE_PATH/files/$FILE_BASE

    echo "Added $FILE_BASE as $SHA1SUM"

}



if [ 0 == $# ]; then
    hb_helptext
    exit -1
fi

FIRST_PARAM=$1
shift

case ${FIRST_PARAM} in
workon)
    hb_workon $*
    ;;
prime)
    hb_prime $*
    ;;
simsetup)
    hb_simsetup $*
    ;;
startsimics)
    hb_startsimics $*
    ;;
rsync)
    hb_rsync $*
    ;;
objsizes)
    hb_objsizes $*
    ;;
copyright_check)
    hb_copyright_check $*
    ;;
errlparser)
    hb_errlparser $*
    ;;
cachesync)
    hb_cachesync $*
    ;;
cacheadd)
    hb_cacheadd $*
    ;;
*)
    hb_helptext $*
    exit -1
    ;;
esac
OpenPOWER on IntegriCloud