summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-05-30 22:51:33 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-06-08 14:25:44 -0500
commitad6cf41f0adc544fb8dacae893fa25b57ba2cf82 (patch)
treed4cb851443c4fcc25e647af6876b1ff8e70dda44 /src
parentf9df2e083971910e20fe47bfe3c117b7df9db6da (diff)
downloadblackbird-hostboot-ad6cf41f0adc544fb8dacae893fa25b57ba2cf82.tar.gz
blackbird-hostboot-ad6cf41f0adc544fb8dacae893fa25b57ba2cf82.zip
Improve distribution mechanism for FSP delivery.
Replaced 'cpfiles' with a set of makefiles that does all of the old function and also allows more complex behaviors such as creating a TAR file of all our common code. Moved the delivery location of our content into a simics sandbox to match the locations in an FSP build. Updated debug tools to handle living in a different location. Removed 'post_model_hook.simics' and replaced with the {startup,standalone,combined}.simics files. Updated various scripts that were calling 'cpfiles' to instead call 'hbDistribute' (which in turn calls the makefiles). RTC: 41640 Change-Id: I10d1782ae89a397725e880c44ba44d01b0e4b011 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1173 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/citest/autocitest9
-rwxr-xr-xsrc/build/debug/Hostboot/_DebugFramework.pm18
-rwxr-xr-xsrc/build/debug/simics-debug-framework.pl23
-rwxr-xr-xsrc/build/debug/simics-debug-framework.py22
-rw-r--r--src/build/mkrules/dist_rules.mk446
-rw-r--r--src/build/mkrules/dist_targets.mk182
-rwxr-xr-xsrc/build/mkrules/hbfw/fsp/makefile44
-rwxr-xr-xsrc/build/mkrules/hbfw/img/makefile57
-rwxr-xr-xsrc/build/mkrules/hbfw/makefile66
-rwxr-xr-xsrc/build/mkrules/hbfw/simics/makefile53
-rwxr-xr-xsrc/build/simics/combined.simics0
-rwxr-xr-xsrc/build/simics/hb-pnor-mvpd-preload.pl16
-rwxr-xr-xsrc/build/simics/hb-pnor-mvpd-preload.py8
-rwxr-xr-xsrc/build/simics/post_model_hook.simics52
-rwxr-xr-xsrc/build/simics/standalone.simics1
-rwxr-xr-xsrc/build/simics/startup.simics44
-rwxr-xr-xsrc/build/tools/cpfiles.pl452
-rwxr-xr-xsrc/build/tools/hb10
-rwxr-xr-xsrc/build/tools/hbDistribute115
19 files changed, 1075 insertions, 543 deletions
diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest
index 5b755e0b8..e7a4167df 100755
--- a/src/build/citest/autocitest
+++ b/src/build/citest/autocitest
@@ -124,7 +124,7 @@ SBXHOME=$WORKSPACE_DIR
## autosim, mksb, workon, etc should look in $SANDBOXRC for the location of the sandbox.
## this is more effective than using -rc option (autosim has no option for this anyway)
-SANDBOXRC="$SBXHOME/my.sandboxrc"
+SANDBOXRC="$SBXHOME/hbsandboxrc"
if [ "$DRIVER" = "" ] ; then
@@ -150,7 +150,7 @@ HBICORE_TEST_SYMS="${HBICORE_TEST%%.*}.syms"
HBICORE_TEST_EXTENDED="${HBICORE_TEST%%.*}_extended.bin"
-CPFILES="${SBXHOME}/src/build/tools/cpfiles.pl"
+CPFILES="${SBXHOME}/src/build/tools/hbDistribute"
## let's get set up
@@ -192,6 +192,9 @@ fi
## set $SANDBOXRC to the local one, this should cause this to make and run
## in a new sandbox at the base workspace dir.
export SANDBOXRC
+export SANDBOXROOT=$SBXHOME
+export SANDBOXNAME=$TEST_SANDBOX
+export SANDBOXBASE=$SANDBOXROOT/$SANDBOXNAME
if [ ! -d "$SBXHOME/$TEST_SANDBOX" ] ; then
echo "run mksb to create the sandbox "
@@ -258,7 +261,7 @@ waitkb
echo "Copy .syms, bin, hbotStringfile, etc to base sandbox dir."
echo "$sb"
-$CPFILES $sb --test
+$CPFILES --test
if [ $? -ne 0 ] ; then
echo "ERROR: $CPFILES failed: $?"
exit 1
diff --git a/src/build/debug/Hostboot/_DebugFramework.pm b/src/build/debug/Hostboot/_DebugFramework.pm
index 6b7ee622a..e5a811867 100755
--- a/src/build/debug/Hostboot/_DebugFramework.pm
+++ b/src/build/debug/Hostboot/_DebugFramework.pm
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011 - 2012
+# COPYRIGHT International Business Machines Corp. 2011-2012
#
# p1
#
@@ -85,7 +85,13 @@ sub callToolModule
my $tool = shift;
my $package = "Hostboot::$tool";
- eval("use lib '.'; use $package; return 1;") or
+ my $tool_loc = ".";
+ if (exists &::getToolOverride)
+ {
+ $tool_loc = ::getToolOverride();
+ }
+
+ eval("use lib '$tool_loc'; use $package; return 1;") or
die "Couldn't load tool \"$tool\":\n\t$@";
eval("$package->main(\\%toolOpts);");
die $@ if $@;
@@ -146,7 +152,13 @@ sub callToolModuleHelpInfo
my $tool = shift;
my $package = "Hostboot::$tool";
- eval("use lib '.'; use $package; return 1;") or
+ my $tool_loc = ".";
+ if (exists &::getToolOverride)
+ {
+ $tool_loc = ::getToolOverride();
+ }
+
+ eval("use lib '$tool_loc'; use $package; return 1;") or
die "Couldn't load tool \"$tool\":\n\t$@";
my %info = eval("$package->helpInfo(\\%toolOpts);");
die $@ if $@;
diff --git a/src/build/debug/simics-debug-framework.pl b/src/build/debug/simics-debug-framework.pl
index 6c23b1efd..f78f34284 100755
--- a/src/build/debug/simics-debug-framework.pl
+++ b/src/build/debug/simics-debug-framework.pl
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011 - 2012
+# COPYRIGHT International Business Machines Corp. 2011-2012
#
# p1
#
@@ -31,6 +31,7 @@
# side.
use strict;
+use lib $ENV{HB_TOOLPATH};
use Hostboot::_DebugFramework;
$| = 1; # Disable buffering on STDIN/STDOUT.
@@ -149,6 +150,12 @@ sub getImgPath
return $imgPath;
}
+# Tool location override.
+sub getToolOverride
+{
+ return $ENV{'HB_TOOLPATH'}
+}
+
# Simics always uses the non-test named files.
sub getIsTest
{
@@ -200,7 +207,7 @@ sub translateAddr
my $mSComAddrHi = ( $addr >> 4 );
my $mSComAddrLo = ( $addr & 0x000000000000000f ) ;
- $simicsaddr = ( 0x0000300000000000 ## Base addr
+ $simicsaddr = ( 0x0003FC0000000000 ## Base addr
| (($mSComAddrHi & 0x0000000007ffffff) << 8 ) ## 27 bits, shift 8
| (($mSComAddrLo & 0x000000000000000f) << 3 ) ## 4 bits, shift 3
);
@@ -285,6 +292,11 @@ sub checkContTrace()
sendIPCMsg("get-tool","");
my ($unused, $tool) = recvIPCMsg();
+# Get image path.
+sendIPCMsg("get-img-path");
+($unused, $imgPath) = recvIPCMsg();
+$imgPath = determineImagePath($imgPath);
+
# If we were called with --usage, send tool help instead of executing.
if ((-1 != $#ARGV) && ("--usage" eq $ARGV[0]))
{
@@ -292,14 +304,9 @@ if ((-1 != $#ARGV) && ("--usage" eq $ARGV[0]))
exit;
}
-# Get tool options, image path.
+# Get tool options.
sendIPCMsg("get-tool-options","");
my ($unused, $toolOpts) = recvIPCMsg();
-sendIPCMsg("get-img-path");
-($unused, $imgPath) = recvIPCMsg();
-
-# Update image path, parse options.
-$imgPath = determineImagePath();
parseToolOpts($toolOpts);
# Execute module.
diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py
index 33fcee913..27f074fe2 100755
--- a/src/build/debug/simics-debug-framework.py
+++ b/src/build/debug/simics-debug-framework.py
@@ -89,15 +89,19 @@ class DebugFrameworkProcess:
tool = ""; # string - tool module name.
toolOptions = ""; # string - tool options
outputToString = None; # mode - String output instead of STDOUT.
- imgPath = "./"; # Image dir path override.
+ imgPath = None; # Image dir path override.
result = ""; # Result string for Usage-mode.
outputFile = None; # Output file for results in addition to STDOUT
def __init__(self, tool = "Printk", toolOptions = "",
outputToString = None, usage = None,
- imgPath = "./",outputFile = None):
+ imgPath = None,
+ outputFile = None):
+ # Assign instance 'imgPath' variable.
+ self.imgPath = imgPath if imgPath else (os.environ['HB_TOOLPATH']+"/");
+
# Determine sub-process arguments.
- process_args = ["./simics-debug-framework.pl"];
+ process_args = [self.imgPath+"simics-debug-framework.pl"];
if (usage): # Pass --usage if Usage mode selected.
process_args = process_args + [ "--usage" ];
outputToString = True;
@@ -109,7 +113,6 @@ class DebugFrameworkProcess:
self.tool = tool;
self.toolOptions = toolOptions;
self.outputToString = outputToString;
- self.imgPath = imgPath;
self.outputFile = open(outputFile, 'w') if outputFile else None;
# Read a message from the process pipe.
@@ -229,7 +232,7 @@ class DebugFrameworkProcess:
# @param imgPath - Image path override.
def run_hb_debug_framework(tool = "Printk", toolOpts = "",
outputToString = None, usage = None,
- imgPath = "./", outputFile = None):
+ imgPath = None, outputFile = None):
# Create debug sub-process.
fp = DebugFrameworkProcess(tool,toolOpts,outputToString,
usage,imgPath,outputFile)
@@ -262,7 +265,7 @@ def run_hb_debug_framework(tool = "Printk", toolOpts = "",
# @brief Create a simics command wrapper for each debug tool module.
def register_hb_debug_framework_tools():
# Find all modules from within Hostboot subdirectory.
- files = os.listdir("./Hostboot")
+ files = os.listdir(os.environ['HB_TOOLPATH']+"/Hostboot")
# Filter out any prefixed with '_' (utility module) or a '.' (hidden file).
pattern = re.compile("[^\._]");
@@ -402,21 +405,22 @@ def magic_instruction_callback(user_arg, cpu, arg):
saveCommand = "(system_cmp0.phys_mem)->map[0][1]->image.save tracBINARY 0x%x %d"%(pTracBinaryBuffer,cbUsed)
SIM_run_alone(run_command, saveCommand )
# Run fsp-trace on tracBINARY file (implied), append output to tracMERG
- os.system( "fsp-trace ./ -s hbotStringFile >>tracMERG 2>/dev/null" )
+ os.system( "fsp-trace ./ -s "+os.environ['HB_TOOLPATH']+
+ "/hbotStringFile >>tracMERG 2>/dev/null" )
# Continuous trace: Open the symbols and find the address for
# "g_tracBinaryInfo" Convert to a number and save in tracBinaryInfoAddr
# The layout of g_tracBinaryInfo is a 64-bit pointer to the mixed buffer
# followed by a 64-bit count of bytes used in the buffer. See
# src/usr/trace/trace.C and mixed_trace_info_t.
-for line in open('hbicore.syms'):
+for line in open(os.environ['HB_TOOLPATH']+'/hbicore.syms'):
if "g_tracBinaryInfo" in line:
words=line.split(",")
tracBinaryInfoAddr=int(words[1],16)
break
# Find the address of the g_cont_trace_trigger_info and save it in
# contTraceTrigInfo
-for line in open('hbicore.syms'):
+for line in open(os.environ['HB_TOOLPATH']+'/hbicore.syms'):
if "g_cont_trace_trigger_info" in line:
words=line.split(",")
contTraceTrigInfo=int(words[1],16)
diff --git a/src/build/mkrules/dist_rules.mk b/src/build/mkrules/dist_rules.mk
new file mode 100644
index 000000000..c197fb630
--- /dev/null
+++ b/src/build/mkrules/dist_rules.mk
@@ -0,0 +1,446 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/mkrules/dist_rules.mk $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+
+#
+# Makefile rules defining all the actions for the Hostboot content delivery.
+#
+# Note: White-space is important for make. An attempt to make these readable
+# and within the 80-character guidelines was done but in a few cases
+# this was not possible.
+#
+
+
+# Default target to 'ALL' which is equivalent to a release. ALL will
+# build all of the targets as subdirectories within the TARGET_DIR.
+.DEFAULT_GOAL := ALL
+.PHONY: ALL
+ALL: $(addsuffix _TARGET_AS_SUBDIR, $(VALID_TARGETS))
+
+# Dummy target to force building of some ODE mk directives.
+.PHONY: FORCE_ALWAYS
+FORCE_ALWAYS:
+
+# Comma has special meaning to make function-calls, so need it defined as a
+# variable for when you want to concatenate or search against a comma.
+COMMA = ,
+
+# ------------- '--test' target directives ---------------------
+#
+# UNDERSCORE_TEST is set to _test when hbDistribute is called with --test
+# and set to the empty string otherwise.
+#
+# TESTVAR_CHANGED_FILE is a file (.hostboot_testvar_changed) which will hold
+# 0 or 1 indicating the --test status for the last execution. This allows
+# us to rebuild a lot of targets when someone switches between test and not.
+#
+# TESTVAR_CHANGED is a 'function' that will return "changed" or "no-changed"
+# depending on the value of the .hostboot_testvar_changed file. This is used
+# to force the TESTVAR_CHANGED_FILE to get rebuilt, which causes anything
+# depending on it to also get rebuilt, if the --test parameter has changed.
+# The forcing is done via the .PHONY directive.
+#
+UNDERSCORE_TEST = $(if $(TARGET_TEST),_test)
+TESTVAR_CHANGED_FILE = $(TARGET_DIR)/.hostboot_testvar_changed
+TESTVAR_CHANGED = $(if $(wildcard $(TESTVAR_CHANGED_FILE)),\
+ $(if $(findstring $(if $(TARGET_TEST),1,0),\
+ $(shell cat $(TESTVAR_CHANGED_FILE))),\
+ no-change,changed),\
+ changed)
+ifeq (changed,$(findstring changed,$(TESTVAR_CHANGED)))
+ .PHONY: $(TESTVAR_CHANGED_FILE)
+endif
+$(TESTVAR_CHANGED_FILE):
+ @echo $(if $(TARGET_TEST),1,0) > $@
+
+# ------------- File searching directives ----------------------
+# ROOTPATH_WILDCARD and ROOTPATH_WILDCARD_RECURSIVE are useful functions
+# for defining targets (in dist_targets.mk) where a .../path/* is wanted.
+#
+# ROOTPATH_WILDCARD takes a file-path-pattern relative to the ROOTPATH and
+# returns all the files matching it. (Ex. src/build/debug/Hostboot/*.pm).
+#
+# ROOTPATH_WILDCARD_RECURSIVE takes a file-path relative to the ROOTPATH and
+# returns all the files beneith it. (Ex. src/usr/targeting/common)
+#
+#
+# The utility functions _RECURSIVE_WILDCARD and RECURSIVE_WILDCARD are used
+# to perform the searching. _RECURSIVE_WILDCARD finds all files inside a
+# specific directory. RECURSIVE_WILDCARD finds all non-directory entities
+# inside a specific directory.
+#
+_RECURSIVE_WILDCARD = $(wildcard $(addsuffix /*,$(1)))
+RECURSIVE_WILDCARD = $(if $(call _RECURSIVE_WILDCARD, $(1)),\
+ $(foreach path,$(call _RECURSIVE_WILDCARD, $(1)), \
+ $(call RECURSIVE_WILDCARD, $(path))), \
+ $(1))
+
+ROOTPATH_WILDCARD = $(subst $(ROOTPATH)/,,$(wildcard $(ROOTPATH)/$(1)))
+ROOTPATH_WILDCARD_RECURSIVE = $(subst $(ROOTPATH)/,,\
+ $(call RECURSIVE_WILDCARD, $(ROOTPATH)/$(1)))
+
+# ------------- ODE sandbox directives ----------------------
+# If we are trying to build the FSP target and SANDBOXROOT/SANDBOXNAME
+# is part of the destination directory then we are trying to populate an
+# ODE sandbox. Therefore, we need to define some variables to allow
+# running commands in the sandbox. Otherwise, we'll define a simple echo
+# that tells the user what we would have done.
+#
+# EXECUTE_IN_SANDBOX is the define command for running something in a
+# sandbox. We have to create a small shell script containing what we
+# want to run in the sandbox and then point 'workon' at it.
+#
+ifeq ($(MAKECMDGOALS),fsp_TARGET)
+ifdef SANDBOXROOT
+ifdef SANDBOXNAME
+HB_SANDBOX = $(SANDBOXROOT)/$(SANDBOXNAME)
+HB_SANDBOXRC = $(SANDBOXROOT)/hbsandboxrc
+HB_SANDBOX_CMD = $(HB_SANDBOX)/src/.sandbox_execute_cmd
+ifneq (,$(findstring $(HB_SANDBOX), $(TARGET_DIR)))
+HB_FOUND_A_SANDBOX = yes
+EXECUTE_IN_SANDBOX = echo "$(strip $(1))" > $(HB_SANDBOX_CMD) && \
+ chmod 700 $(HB_SANDBOX_CMD) && \
+ workon -rc $(HB_SANDBOXRC) -m $(2) -sb $(SANDBOXNAME) \
+ -c $(HB_SANDBOX_CMD) && \
+ rm $(HB_SANDBOX_CMD)
+endif
+endif
+endif
+endif
+
+ifndef HB_FOUND_A_SANDBOX
+HB_FOUND_A_SANDBOX = no
+EXECUTE_IN_SANDBOX = echo " [CONTEXT=$(strip $(2))] $(1)"
+endif
+
+#
+# __SOURCE_FOR_TARGET utility function takes a three-tuple of
+# [ 1=target, 2=source, 3=comma-separated-targets ].
+#
+# If the current target (1) is in the list (3) then the source is returned.
+# If the list (3) contains 'all' then the source is returned, unless the
+# current target (1) is 'tools'.
+#
+# Ex:
+# __SOURCE_FOR_TARGET("fsp", "foobar", "vpo,tools") => ""
+# __SOURCE_FOR_TARGET("fsp", "foobar", "fsp,vpo") => "foobar"
+# __SOURCE_FOR_TARGET("fsp", "foobar", "all") => "foobar"
+# __SOURCE_FOR_TARGET("tools", "foobar", "all") => ""
+#
+__SOURCE_FOR_TARGET = $(if $(findstring tools,$(1)), \
+ $(if $(findstring $(1),$(3)),$(2)),\
+ $(if $(or $(findstring $(1),$(3)),\
+ $(findstring all,$(3))\
+ ),\
+ $(2)) \
+ )
+# ------------- COPY_FILE directives ----------------------
+# COPY_FILES format is <source file>:<comma separated targets>
+#
+# For each file in COPY_FILES and target, we need to create a recipe of:
+# $(TARGET_DIR)$(TARGET)/$(FILE) depends on $(ROOTPATH)/$(FILE)
+#
+# Since we don't have a $(TARGET) sub-directory when building a single
+# target, there is also a recipe for the root $(TARGET_DIR)/$(FILE).
+#
+# __COPY_TARGET_RULE is a function that creates a single recipe from
+# parameters (1=filepath, 2=target).
+#
+# COPY_TARGET_RULE is a function that creates a recipe for each target
+# from parameter (1=filepath).
+#
+# Finally, a for-loop is done over every file in COPY_FILES to
+# instantiate their recipes.
+#
+define __COPY_TARGET_RULE
+$(TARGET_DIR)$(2)/$(notdir $(1)): $(ROOTPATH)/$(1) $(TESTVAR_CHANGED_FILE)
+ @mkdir -p $$(dir $$@)
+ @echo " CP $$(notdir $$@)" && cp -r $$< $$@
+endef
+define COPY_TARGET_RULE
+$(call __COPY_TARGET_RULE,$(1))
+$(foreach targ,$(VALID_TARGETS), \
+ $(eval $(call __COPY_TARGET_RULE,$(1),/$(targ))))
+endef
+$(foreach targ,$(COPY_FILES), \
+ $(eval $(call COPY_TARGET_RULE,$(firstword $(subst :, ,$(targ))))))
+
+# ------------- COPY_RENAME_FILE directives ----------------------
+# COPY_RENAME_FILES format is:
+# <dest file>:<source file>:<comma separated targets>
+#
+# For each file in COPY_RENAME_FILES and target, we need to create a recipe:
+# $(TARGET_DIR)$(TARGET)/$(DEST) depends on $(ROOTPATH)/$(SOURCE)
+#
+# Since we don't have a $(TARGET) sub-directory when building a single
+# target, there is also a recipe for the root $(TARGET_DIR)/$(DEST).
+#
+# __COPY_RENAME_TARGET_RULE is a function that creates a single recipe from
+# parameters (1=dest, 2=source, 3=target).
+#
+# COPY_RENAME_TARGET_RULE is a function that creates a recipe for each target
+# from parameter (1=dest, 2=source).
+#
+# Finally, a for-loop is done over every file in COPY_RENAME_FILES to
+# instantiate their recipes.
+#
+define __COPY_RENAME_TARGET_RULE
+$(TARGET_DIR)$(3)/$(1): $(ROOTPATH)/$(2) $(TESTVAR_CHANGED_FILE)
+ @mkdir -p $$(dir $$@)
+ @echo " CP-RENAME $$(notdir $$<) $$(notdir $$@)" && cp -r $$< $$@
+endef
+define COPY_RENAME_TARGET_RULE
+$(call __COPY_RENAME_TARGET_RULE,$(1),$(2))
+$(foreach targ,$(VALID_TARGETS), \
+ $(eval $(call __COPY_RENAME_TARGET_RULE,$(1),$(2),/$(targ))))
+endef
+$(foreach targ,$(COPY_RENAME_FILES), \
+ $(eval $(call COPY_RENAME_TARGET_RULE,$(firstword $(subst :, ,$(targ))),$(word 2,$(subst :, ,$(targ))))))
+
+# ------------- LINK_FILE directives ----------------------
+# LINK_FILES format is:
+# <dest link>:<source file>:<comma separated targets>
+#
+# For each file in LINK_FILES and target, we need to create a recipe:
+# $(TARGET_DIR)$(TARGET)/$(DEST) depends on $(TARGET_DIR)$(TARGET)/$(SOURCE)
+#
+# Since we don't have a $(TARGET) sub-directory when building a single
+# target, there is also a recipe for the root $(TARGET_DIR)/$(DEST).
+#
+# __LINK_TARGET_RULE is a function that creates a single recipe from
+# parameters (1=dest, 2=source, 3=target).
+#
+# LINK_TARGET_RULE is a function that creates a recipe for each target
+# from parameter (1=dest, 2=source).
+#
+# Finally, a for-loop is done over every file in LINK_FILES to
+# instantiate their recipes.
+#
+define __LINK_TARGET_RULE
+$(TARGET_DIR)$(3)/$(1): $(TARGET_DIR)$(3)/$(2) $(TESTVAR_CHANGED_FILE)
+ @mkdir -p $$(dir $$@)
+ @echo " LINK $$(notdir $$<) $$(notdir $$@)" && \
+ ln -sf $$(notdir $$<) $$@
+endef
+define LINK_TARGET_RULE
+$(call __LINK_TARGET_RULE,$(1),$(2))
+$(foreach targ,$(VALID_TARGETS), \
+ $(eval $(call __LINK_TARGET_RULE,$(1),$(2),/$(targ))))
+endef
+$(foreach targ,$(LINK_FILES), \
+ $(eval $(call LINK_TARGET_RULE,$(firstword $(subst :, ,$(targ))),$(word 2,$(subst :, ,$(targ))))))
+
+# ------------- TAR file directives ----------------------
+# <TARFILE>_CONTENTS format is:
+# <file>[:<kept root of path>]
+#
+# For each file in TAR_FILES and target, we need to create a recipe:
+# $(TARGET_DIR)$(TARGET)/$(TARFILE) depends on [a bunch of content].
+#
+# The content is determined by iterating through all of the files listed
+# in <TARFILE>_CONTENTS and calling TAR_CONTENT_SOURCEFILE.
+#
+# Since there is potential renaming going on as part of the TAR creation
+# process, the recipe template for creating a TAR is longer than the others.
+# We need to create a temporary directory, populate it with the content,
+# create the TAR file, and then remove the temporary directory.
+#
+# Since we don't have a $(TARGET) sub-directory when building a single
+# target, there is also a recipe for the root $(TARGET_DIR)/$(DEST).
+#
+# TAR_CONTENT_SOURCEFILE / DESTFILE are functions for extrapolating the
+# source / dest names from a line in the <TARFILE>_CONTENTS. The source
+# is simply $(ROOTPATH)/$(FILE). The dest is relative to the root of the
+# TAR file. When the file in _CONTENTS doesn't have the optional parameter
+# then the destination is just the filename, otherwise we have to strip
+# everything before the optional parameter from the source path.
+#
+# __TAR_TARGET_RULE is a function that creates a single recipe from
+# parameters (1=tar file, 2=target).
+#
+# TAR_TARGET_RULE is a function that creates a recipe for each target
+# from parameter (1=tar file).
+#
+# Finally, a for-loop is done over every file in TAR_FILES to
+# instantiate their recipes.
+#
+TAR_CONTENT_SOURCEFILE = \
+ $(addprefix $(ROOTPATH)/,$(firstword $(subst :, ,$(1))))
+TAR_CONTENT_DESTFILE = \
+ $(addprefix $(word 2, $(subst :, ,$(1))), \
+ $(if $(word 2, $(subst :, ,$(1))),\
+ $(lastword $(subst $(word 2, $(subst :, ,$(1))), , \
+ $(firstword $(subst :, ,$(1))))), \
+ $(notdir $(1))\
+ )\
+ )
+
+define __TAR_TARGET_RULE
+$(TARGET_DIR)$(2)/$(1): TAR_TEMP_DIR:=$$(shell mktemp -du)
+$(TARGET_DIR)$(2)/$(1): $$(foreach file, $$($(1)_CONTENTS), \
+ $$(call TAR_CONTENT_SOURCEFILE, $$(file))) \
+ $(TESTVAR_CHANGED_FILE)
+ @echo " TAR $$(notdir $$@)"
+ @mkdir $$(TAR_TEMP_DIR)
+ @$$(foreach file, $$($(1)_CONTENTS), \
+ echo " ADD-FILE" $$(call TAR_CONTENT_DESTFILE,$$(file)) ; \
+ mkdir -p $$(TAR_TEMP_DIR)/$$(dir \
+ $$(call TAR_CONTENT_DESTFILE, $$(file))) ;\
+ cp $$(call TAR_CONTENT_SOURCEFILE, $$(file)) \
+ $$(addprefix $$(TAR_TEMP_DIR)/, \
+ $$(subst $$(UNDERSCORE_TEST),,\
+ $$(call TAR_CONTENT_DESTFILE, $$(file)))) ;\
+ )
+ @tar --create --file $$@ -C $$(TAR_TEMP_DIR)/ .
+ @touch $$@
+ @rm -rf $$(TAR_TEMP_DIR)
+endef
+define TAR_TARGET_RULE
+$(call __TAR_TARGET_RULE,$(1))
+$(foreach targ,$(VALID_TARGETS), \
+ $(eval $(call __TAR_TARGET_RULE,$(1),/$(targ))))
+endef
+$(foreach targ,$(TAR_FILES), \
+ $(eval $(call TAR_TARGET_RULE,$(firstword $(subst :, ,$(targ))))))
+
+# ------------- ODE_REMAKE directives ----------------------
+# <TARGET>_ODE_REMAKES format is:
+# <fsp dir>:<mk target>:<context>:<dependency>.
+#
+# For each directive in <TARGET>_ODE_REMAKES, we need to create a recipe
+# that calls into the ODE sandbox and performs a 'mk' operation. In
+# order to reduce the number of 'mk' calls done we allow the ODE_REMAKE
+# directives to be dependent upon something created for the target (such
+# as a tarfile). __ODE_REMAKE_TARGET is a function that creates a
+# filename to touch based on the sandbox subdirectory and context where the
+# 'mk' operation is being performed.
+#
+# The recipes override the environment variable MAKEFLAGS because ODE 'mk'
+# interprets this in bad ways. (Error about not knowing how to build target
+# "rR".)
+#
+# The recipes are defined as ".NOTPARALLEL" as a safe-guard to ensure we only
+# call into the sandbox one at a time even if someone were to call this
+# makefile with '-j'.
+#
+# ODE_REMAKE_RULE is a function called when instantiating a target
+# (see _ODE_REMAKE_DEPS below) to instantiate the ODE remake receipe and
+# return the __ODE_REMAKE_TARGET filename for the ODE directive.
+#
+__ODE_REMAKE_TARGET = .ode_built_$(subst /,_,$(firstword $(subst :, ,$(1)))__$(word 2,$(subst :, ,$(1))))
+define __ODE_REMAKE_RULE
+.NOTPARALLEL : $(TARGET_DIR)/$(1)$(call __ODE_REMAKE_TARGET,$(2))
+$(TARGET_DIR)/$(1)$(call __ODE_REMAKE_TARGET, $(2)) : MAKEFLAGS=
+$(TARGET_DIR)/$(1)$(call __ODE_REMAKE_TARGET, $(2)) : \
+ $(lastword $(subst :, ,$(2)))
+ @echo ODE_MK $(firstword $(subst :, ,$(2)))
+ @$$(call EXECUTE_IN_SANDBOX,\
+ mkdir -p $(firstword $(subst :, ,$(2))) && \
+ cd $(firstword $(subst :, ,$(2))) && \
+ mk -a $(subst NOTARGET,,$(word 2, $(subst :, ,$(2)))),\
+ $(word 3, $(subst :, ,$(2))))
+ @touch $$@
+endef
+ODE_REMAKE_RULE = $(eval $(call __ODE_REMAKE_RULE,,$(2)))\
+ $(call __ODE_REMAKE_TARGET,$(2))
+
+# ------------- Global target directives ----------------------
+# The INSTANTIATE_TARGET function is where all of the top-level
+# directives (called directly by 'make' or 'make fsp_TARGET') are
+# created.
+#
+# For each possible target, we need to instantiate a recipe for how
+# to create target when we are only making the target and one for when
+# we are building all targets (a release). This is the _TARGET and
+# _TARGET_AS_SUBDIR recipe templates.
+#
+# Within a template we need to determine what to build, which is
+# determined by the global actions like COPY_FILES, TAR_FILES, etc.
+# The variables <TARGET>_<ACTION> are determined here by filtering the
+# global <ACTION> variable for matches against the <TARGET> name.
+# (__SOURCE_FOR_TARGET from above is used as the filtering mechanism).
+#
+# Building a target is 3 simple stages:
+# 1) Print a "Starting <TARGET>" message.
+# 2) Build all of the target dependencies
+# (based on the <TARGET>_<ACTION> variables).
+# 3) Print a "Completed <TARGET>" message.
+#
+# At the end we loop over all VALID_TARGETS to call INSTANTIATE_TARGET
+# against them.
+#
+define INSTANTIATE_TARGET
+$(1)_COPY_FILE += $$(foreach file, $$(COPY_FILES), \
+ $$(call __SOURCE_FOR_TARGET,$(1), \
+ $$(firstword $$(subst :, ,$$(file))), \
+ $$(lastword $$(subst :, ,$$(file))) \
+ ) \
+ )
+
+$(1)_COPY_RENAME_FILE += $$(foreach file, $$(COPY_RENAME_FILES), \
+ $$(call __SOURCE_FOR_TARGET,$(1), \
+ $$(firstword $$(subst :, ,$$(file))), \
+ $$(lastword $$(subst :, ,$$(file))) \
+ ) \
+ )
+
+$(1)_LINK_FILE += $$(foreach file, $$(LINK_FILES), \
+ $$(call __SOURCE_FOR_TARGET,$(1), \
+ $$(firstword $$(subst :, ,$$(file))), \
+ $$(lastword $$(subst :, ,$$(file))) \
+ ) \
+ )
+
+$(1)_TAR_FILE += $$(foreach file, $$(TAR_FILES), \
+ $$(call __SOURCE_FOR_TARGET,$(1), \
+ $$(firstword $$(subst :, ,$$(file))), \
+ $$(lastword $$(subst :, ,$$(file))) \
+ ) \
+ )
+
+$(1)_ODE_REMAKE_DEPS += $$(foreach file, $$($(1)_ODE_REMAKES), \
+ $$(call ODE_REMAKE_RULE,$(1),$$(file)))
+
+.PHONY: $(1)_TARGET $(1)_TARGET_AS_SUBDIR
+$(1)_TARGET: \
+ $(1)_TARGET_ECHO_START \
+ $$(addprefix $$(TARGET_DIR)/,$$(notdir $$($(1)_COPY_FILE))) \
+ $$(addprefix $$(TARGET_DIR)/,$$($(1)_COPY_RENAME_FILE)) \
+ $$(addprefix $$(TARGET_DIR)/,$$($(1)_LINK_FILE)) \
+ $$(addprefix $$(TARGET_DIR)/,$$($(1)_TAR_FILE)) \
+ $$(addprefix $$(TARGET_DIR)/,$$($(1)_ODE_REMAKE_DEPS))
+ @echo TARGET $(1) complete.
+
+$(1)_TARGET_AS_SUBDIR: \
+ $(1)_TARGET_ECHO_START \
+ $$(addprefix $$(TARGET_DIR)/$(1)/,$$(notdir $$($(1)_COPY_FILE))) \
+ $$(addprefix $$(TARGET_DIR)/$(1)/,$$($(1)_COPY_RENAME_FILE)) \
+ $$(addprefix $$(TARGET_DIR)/$(1)/,$$($(1)_LINK_FILE)) \
+ $$(addprefix $$(TARGET_DIR)/$(1)/,$$($(1)_TAR_FILE))
+ @echo TARGET $(1) complete.
+
+$(1)_TARGET_ECHO_START:
+ @echo TARGET $(1) start...
+
+endef
+$(foreach targ,$(VALID_TARGETS),$(eval $(call INSTANTIATE_TARGET,$(targ))))
+
diff --git a/src/build/mkrules/dist_targets.mk b/src/build/mkrules/dist_targets.mk
new file mode 100644
index 000000000..441ceb54e
--- /dev/null
+++ b/src/build/mkrules/dist_targets.mk
@@ -0,0 +1,182 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/mkrules/dist_targets.mk $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+
+ROOTPATH = ../../..
+
+#
+# Makefile rules defining the Hostboot content delivery to various external
+# entities. Typically we release to 'fsp', 'vpo' and a full release.
+#
+# The fsp target is used for Simics testing and for delivering code and tools.
+# The vpo target is used for VPO testing.
+# The tools target is for offline debug (ex. hb-dump-debug) and misc tools.
+#
+# The release is created by generating all targets into their subdirectory:
+# ...release/fsp/...
+# ...release/vpo/...
+# ...reelase/tools/...
+#
+
+# Content targets.
+VALID_TARGETS = fsp vpo tools
+
+#
+# Files which are to be directly copied into content targets.
+#
+# Format is <source file>:<comma separated targets>
+#
+COPY_FILES = \
+ src/build/tools/hb-parsedump.pl:tools,vpo \
+ src/build/debug/hb-dump-debug:tools,vpo \
+ src/build/debug/vpo-debug-framework.pl:vpo \
+ src/build/vpo/hb-dump:vpo \
+ src/build/vpo/hb-istep:vpo \
+ src/build/vpo/hb-virtdebug.pl:vpo \
+ src/build/vpo/VBU_Cacheline.pm:vpo \
+ img/errlparser:tools,vpo \
+ img/hbotStringFile:tools,vpo \
+ img/isteplist.csv:tools,vpo \
+ img/dimmspd.dat:vpo \
+ img/procmvpd.dat:vpo \
+ src/build/hwpf/prcd_compile.tcl:tools \
+ src/usr/hwpf/hwp/initfiles/sample.initfile:tools \
+ $(foreach file, $(call ROOTPATH_WILDCARD,releaseNotes.html), $(file):fsp)\
+
+#
+# Files which are copied and renamed for targets.
+#
+# Format is <dest file>:<source file>:<comma separated targets>
+#
+COPY_RENAME_FILES = \
+ makefile:src/build/mkrules/hbfw/makefile:fsp \
+ img/makefile:src/build/mkrules/hbfw/img/makefile:fsp \
+ hbicore.bin:img/hbicore$(UNDERSCORE_TEST).bin:vpo \
+ img/hostboot.bin:img/hbicore$(UNDERSCORE_TEST).bin:fsp \
+ img/murano.pnor:img/simics_MURANO$(UNDERSCORE_TEST).pnor:fsp \
+ img/venice.pnor:img/simics_VENICE$(UNDERSCORE_TEST).pnor:fsp \
+ img/tuleta.pnor:img/TULETA$(UNDERSCORE_TEST).pnor:fsp \
+ vbu.pnor:img/vbu$(UNDERSCORE_TEST).pnor:vpo \
+ hbicore.syms:img/hbicore$(UNDERSCORE_TEST).syms:tools,vpo \
+ hbicore.list:img/hbicore$(UNDERSCORE_TEST).list:tools,vpo \
+ hbicore.bin.modinfo:img/hbicore$(UNDERSCORE_TEST).bin.modinfo:tools,vpo \
+ $(foreach file, $(call ROOTPATH_WILDCARD,src/build/debug/Hostboot/*.pm), \
+ Hostboot/$(notdir $(file)):$(file):tools,vpo)
+
+#
+# Symbolic links created in the target.
+#
+# Format is <dest link>:<source file>:<comma separated targets>
+#
+# Example:
+# Each debug framework module is symbolically linked against the
+# vpo-debug-framework.pl executable in the VPO target as 'hb-Tool'
+#
+# hb-Printk:vpo-debug-framework.pl:vpo
+#
+LINK_FILES = \
+ $(foreach file,\
+ $(call ROOTPATH_WILDCARD,src/build/debug/Hostboot/[^_]*.pm), \
+ hb-$(basename $(notdir $(file))):vpo-debug-framework.pl:vpo)
+
+#
+# TAR files to create for each target.
+#
+# Format is <tar file>:<comma separated targets>
+#
+# The content for each tar file is in <tarfile>_CONTENTS.
+#
+# The format in the <tarfile>_CONTENTS variables is:
+# <file>[:<kept root of path>]
+#
+# Examples:
+# src/hbfw/simics/makefile on FSP is created from
+# src/build/mkrules/hbfw/simics/makefile on Hostboot and is added to the
+# root of the simics.tar file.
+# simics.tar_CONTENTS += src/build/mkrules/hbfw/simics/makefile
+#
+# src/hbfw/fsp/targeting/common/target.C on FSP is created from
+# src/usr/targeting/common/target.C on Hostboot and is added to the
+# fsp.tar at targeting/common.
+# fsp.tar_CONTENTS += src/usr/targeting/common/target.C:targeting/
+#
+TAR_FILES = \
+ simics.tar:fsp \
+ fsp.tar:fsp
+
+#
+# Contents for the simics.tar.
+#
+# Tools for booting and debugging simics.
+#
+simics.tar_CONTENTS = \
+ src/build/mkrules/hbfw/simics/makefile \
+ src/build/simics/startup.simics \
+ src/build/simics/standalone.simics \
+ src/build/simics/combined.simics \
+ src/build/simics/hb-simdebug.py \
+ src/build/debug/simics-debug-framework.py \
+ src/build/debug/simics-debug-framework.pl \
+ $(addsuffix :Hostboot/, \
+ $(call ROOTPATH_WILDCARD,src/build/debug/Hostboot/*.pm)) \
+ img/hbicore$(UNDERSCORE_TEST).syms \
+ img/hbicore$(UNDERSCORE_TEST).list \
+ img/hbicore$(UNDERSCORE_TEST).bin.modinfo \
+ img/errlparser \
+ img/isteplist.csv \
+ img/hbotStringFile \
+ src/build/simics/hb-pnor-mvpd-preload.py \
+ src/build/simics/hb-pnor-mvpd-preload.pl \
+ img/dimmspd.dat \
+ img/procmvpd.dat \
+
+#
+# Contents for the fsp.tar.
+#
+# Common code delivered to FSP builds.
+#
+fsp.tar_CONTENTS = \
+ src/build/mkrules/hbfw/fsp/makefile \
+ $(addsuffix :targeting/,\
+ $(call ROOTPATH_WILDCARD_RECURSIVE,src/usr/targeting/common))\
+ $(addsuffix :targeting/,\
+ $(call ROOTPATH_WILDCARD_RECURSIVE,src/include/usr/targeting/common))
+
+#
+# Portions of the FSP sandbox which must be rebuilt based on file changes.
+#
+# Format is <fsp dir>:<mk target>:<context>:<dependency>.
+#
+# NOTARGET is a special target which indicates to just run 'mk'.
+# FORCE_ALWAYS is a special dependency that causes the 'mk' to always be
+# executed.
+#
+# Example:
+# hbfw:expand_tars:ppc:FORCE_ALWAYS indicates that the src/hbfw
+# directory should have 'mk expand_tars' executed in the ppc context.
+#
+fsp_ODE_REMAKES = \
+ hbfw:expand_tars:ppc:FORCE_ALWAYS \
+ hbfw/img:update_images_for_sandbox:ppc:FORCE_ALWAYS \
+ hbfw/simics:NOTARGET:ppc:$(TARGET_DIR)/simics.tar
+
+include dist_rules.mk
diff --git a/src/build/mkrules/hbfw/fsp/makefile b/src/build/mkrules/hbfw/fsp/makefile
new file mode 100755
index 000000000..2bba0d394
--- /dev/null
+++ b/src/build/mkrules/hbfw/fsp/makefile
@@ -0,0 +1,44 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/mkrules/hbfw/fsp/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+
+#
+# FSP Destination: src/hbfw/fsp/makefile
+#
+# NOTE: Do NOT modify this file in CMVC directly! It comes from the Hostboot
+# repository and will be overwritten.
+
+
+# Process the targeting subtree
+
+.if(${CONTEXT:R} == "ppc")
+
+EXPINC_SUBDIRS += targeting
+OBJECTS_SUBDIRS +=
+EXPLIB_SUBDIRS +=
+EXPSHLIB_SUBDIRS += targeting
+STANDARD_SUBDIRS += targeting
+RUNBVT_SUBDIRS +=
+
+.endif
+
+.include <${RULES_MK}>
diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile
new file mode 100755
index 000000000..d2e08cdfc
--- /dev/null
+++ b/src/build/mkrules/hbfw/img/makefile
@@ -0,0 +1,57 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/mkrules/hbfw/img/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+
+#
+# FSP Destination: src/hbfw/img/makefile
+#
+# NOTE: Do NOT modify this file in CMVC directly! It comes from the Hostboot
+# repository and will be overwritten.
+
+.include <${RULES_MK}>
+
+.if($(CONTEXT:R) == "ppc")
+
+PNOR_IMAGES = tuleta.pnor murano.pnor venice.pnor
+OTHER_IMAGES = hostboot.bin
+
+ALL_IMAGES = ${PNOR_IMAGES} ${OTHER_IMAGES}
+
+DEFAULT_PATH = ${.PATH}
+SRCPATH = ${DEFAULT_PATH:M*src*}
+
+OTHERS = cp_hbfiles
+
+cp_hbfiles:
+ ${ALL_IMAGES:@image@cp -f ${SRCPATH:F${image}} ${image};@}
+
+clobber_cp_hbfiles:
+ rm ${ALL_IMAGES}
+
+FLASH_DEST = $(MAKETOP)$(OBJECTDIRTOP)../images/$(CONTEXT)/lab/flash
+
+update_images_for_sandbox:
+ mkdir -p ${FLASH_DEST}
+ ${ALL_IMAGES:@image@${hbimg:!cd ${FLASH_DEST}; cp -f ${.PATH:F${image}} ${image};!e}@}
+
+.endif
+
diff --git a/src/build/mkrules/hbfw/makefile b/src/build/mkrules/hbfw/makefile
new file mode 100755
index 000000000..31ba42fad
--- /dev/null
+++ b/src/build/mkrules/hbfw/makefile
@@ -0,0 +1,66 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/mkrules/hbfw/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+
+#
+# FSP Destination: src/hbfw/makefile
+#
+# NOTE: Do NOT modify this file in CMVC directly! It comes from the Hostboot
+# repository and will be overwritten.
+
+STANDARD_SUBDIRS += \
+ img \
+ simics
+
+# Process the fsp subtree
+
+.if(${CONTEXT:R} == "ppc")
+
+EXPINC_SUBDIRS += fsp
+OBJECTS_SUBDIRS +=
+EXPLIB_SUBDIRS +=
+EXPSHLIB_SUBDIRS += fsp
+STANDARD_SUBDIRS += fsp
+RUNBVT_SUBDIRS +=
+
+.endif
+
+# Directives to expand tar files and ensure expansion before
+# subdirectory traversal.
+#
+# If you add a new tarfile and subdirectory, you must add the
+# corresponding _SUBDIR/BUILD/EXPINC/subdir dependency.
+
+TARFILES = fsp.tar simics.tar
+
+_SUBDIR/BUILD/EXPINC/fsp: expand_tars_fsp.tar
+_SUBDIR/BUILD/EXPINC/simics: expand_tars_simics.tar
+
+EXPINC_TARGETS += expand_tars
+
+expand_tars: ${TARFILES:S/^/expand_tars_/g}
+expand_tars_%: $${@:S/expand_tars_//}
+ @echo Extracting $> to ${*:S/expand_tars_//}
+ mkdir -p ${*:S/expand_tars_//}
+ ${TAR} -x --file $> -C ${*:S/expand_tars_//}
+
+.include <${RULES_MK}>
diff --git a/src/build/mkrules/hbfw/simics/makefile b/src/build/mkrules/hbfw/simics/makefile
new file mode 100755
index 000000000..ac5c91399
--- /dev/null
+++ b/src/build/mkrules/hbfw/simics/makefile
@@ -0,0 +1,53 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/mkrules/hbfw/simics/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+
+#
+# FSP Destination: src/hbfw/simics/makefile
+#
+# NOTE: Do NOT modify this file in CMVC directly! It comes from the Hostboot
+# repository and will be overwritten.
+
+.include <${RULES_MK}>
+
+OTHERS = copy_scripts
+
+HBFW_SIMICS_PATH = ${MAKETOP}simu/scripts/hbfw/
+
+HBFW_SRC_PATHS = ${.PATH:M*src*hbfw*} ${.PATH:M*obj*hbfw*}
+HBFW_SRC_DIRS = ${HBFW_SRC_PATHS:XD}
+HBFW_SRC_FILES = ${:!${HBFW_SRC_DIRS:@path@ls ${path};@}!}
+
+HBFW_SCRIPTS_TO_COPY = ${HBFW_SRC_FILES:Nmakefile}
+HBFW_SCRIPTS_PATHS = ${HBFW_SCRIPTS_TO_COPY:p}
+
+HBFW_COPY_COMMAND = \
+ ${HBFW_SCRIPTS_PATHS:@file@cp -r ${file} ${HBFW_SIMICS_PATH}; @}
+HBFW_REMOVE_COMMAND = \
+ ${HBFW_SCRIPTS_TO_COPY:@file@rm -rf ${HBFW_SIMICS_PATH}${file}; @}
+
+copy_scripts:
+ mkdir -p ${HBFW_SIMICS_PATH}
+ ${HBFW_COPY_COMMAND}
+
+clobber_copy_scripts:
+ ${HBFW_REMOVE_COMMAND}
diff --git a/src/build/simics/combined.simics b/src/build/simics/combined.simics
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/src/build/simics/combined.simics
diff --git a/src/build/simics/hb-pnor-mvpd-preload.pl b/src/build/simics/hb-pnor-mvpd-preload.pl
index 39c7d0998..503064e1b 100755
--- a/src/build/simics/hb-pnor-mvpd-preload.pl
+++ b/src/build/simics/hb-pnor-mvpd-preload.pl
@@ -20,8 +20,7 @@
#
# Origin: 30
#
-# IBM_PROLOG_END
-
+# IBM_PROLOG_END_TAG
use strict;
use File::Temp qw/ tempfile tempdir /;
@@ -30,6 +29,7 @@ my $DEBUG = 0;
my $numProcs;
my $numCentPerProc;
my $dataPath = ".";
+my $outputPath = ".";
# Create temp file for MVPD
my $emptyMVPDfh;
@@ -68,6 +68,11 @@ while( $ARGV = shift )
{
$dataPath = shift;
}
+ elsif( $ARGV =~ m/--outputPath/ ||
+ $ARGV =~ m/-op/ )
+ {
+ $outputPath = shift;
+ }
else
{
usage();
@@ -99,6 +104,7 @@ sub usage
print " -np --numProcs Number of Processors in the drawer.\n";
print " -ncpp --numCentPerProc Number of Centaurs per Processor.\n";
print " -dp --dataPath Path to where VPD data files are located.\n";
+ print " -op --outputPath Path where VPD files should end up.\n";
print " Default: ./\n";
print " -h --help Help/Usage.\n";
print "\n\n";
@@ -137,14 +143,14 @@ sub createMVPDData
my $cmd;
my $result;
my $sourceFile;
- my $sysMVPDFile = "$dataPath/$sysMVPD";
+ my $sysMVPDFile = "$outputPath/$sysMVPD";
if( -e $sysMVPDFile )
{
# Cleanup any existing files
system( "rm -rf $sysMVPDFile" );
}
-
+
# Create empty processor MVPD chunk.
$cmd = "echo \"00FFFF: 00\" \| xxd -r \> $emptyMVPD";
system( $cmd ) == 0 or die "Creating $emptyMVPD failed!";
@@ -187,7 +193,7 @@ sub createSPDData
my $cmd;
my $result;
my $sourceFile;
- my $sysSPDFile = "$dataPath/$sysSPD";
+ my $sysSPDFile = "$outputPath/$sysSPD";
if( -e $sysSPDFile )
{
diff --git a/src/build/simics/hb-pnor-mvpd-preload.py b/src/build/simics/hb-pnor-mvpd-preload.py
index e7756380f..4e5c0c0c7 100755
--- a/src/build/simics/hb-pnor-mvpd-preload.py
+++ b/src/build/simics/hb-pnor-mvpd-preload.py
@@ -19,8 +19,7 @@
#
# Origin: 30
#
-# IBM_PROLOG_END
-
+# IBM_PROLOG_END_TAG
import os,sys
import subprocess
import shlex
@@ -28,10 +27,11 @@ import shlex
#------------------------------------------------------------------------------
# Call a perl script to build up the VPD data for PNOR.
#------------------------------------------------------------------------------
-thisSys = os.environ.get( "MACHINE" );
+toolLoc = os.environ.get("HB_TOOLPATH");
+thisSys = os.environ.get("HB_MACHINE").upper();
numProcs = os.environ.get( "GFW_P8_%s_NUM_PROCS" % thisSys );
numCentaurPerProc = os.environ.get( "GFW_P8_%s_CENTAURS_PER_PROC" % thisSys );
-cmd = "./hb-pnor-mvpd-preload.pl --numProcs " + numProcs + " --numCentPerProc " + numCentaurPerProc
+cmd = toolLoc + "/hb-pnor-mvpd-preload.pl --numProcs " + numProcs + " --numCentPerProc " + numCentaurPerProc + " --dataPath " + toolLoc
print "Generate PNOR VPD for " + numProcs + " processor(s), and " + numCentaurPerProc + " Centaur(s) per Processor.";
args = shlex.split( cmd );
subprocess.call( args );
diff --git a/src/build/simics/post_model_hook.simics b/src/build/simics/post_model_hook.simics
deleted file mode 100755
index fb5480c26..000000000
--- a/src/build/simics/post_model_hook.simics
+++ /dev/null
@@ -1,52 +0,0 @@
-################################################################################
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: firmsim firmsim_vob/firmsim_comp/simics/post_model_hook.simics 1$
-#
-# IBM CONFIDENTIAL
-#
-# OBJECT CODE ONLY SOURCE MATERIALS
-#
-# COPYRIGHT International Business Machines Corp. 2011,2011
-# All Rights Reserved
-#
-# The source code for this program is not published or otherwise
-# divested of its trade secrets, irrespective of what has been
-# deposited with the U.S. Copyright Office.
-#
-# IBM_PROLOG_END_TAG
-# post_model_hook.simics
-# This file is used to run a set of commands on the simics console after
-# modules have loaded.
-################################################################################
-# Example for Hostboot group:
-#@os.environ["HOSTBOOT_SYMS"]="./hbicore.syms"
-#@os.environ["HOSTBOOT_OFILE"]="./hbotStringFile"
-#add-directory path="/esw/fips740/Builds/built/hostboot"
-#run-python-file traceHB.py
-#@del os.environ["HOSTBOOT_SYMS"]
-################################################################################
-
-# Preload VPD in PNOR
-run-python-file hb-pnor-mvpd-preload.py
-
-#setup traces
-run-python-file simics-debug-framework.py
-run-python-file hb-simdebug.py
-
-#Load PNOR image into phys_mem
-phys_mem.load-file ../images/ppc/lab/flash/simics.pnor 0x400000
-phys-mem.load-file ./sysmvpd.dat 0x681000
-phys-mem.load-file ./sysspd.dat 0x701000
-
-#Setup the mailbox
-venice_cec_chip_cmp0.psi_hb->psihb_psihbcr=0x5f00000000000000
-# for mbox on core 0 use:
-# venice_cec_chip_cmp0.psi_hb->psihb_xivr_fsi=0x0140000000 #02010917
-# for mbox on core 5 use:
-venice_cec_chip_cmp0.psi_hb->psihb_xivr_fsi=0x0000A00140000000 #02010917
-
-venice_cec_chip_cmp0.psi_hb->psihb_irsn=0x00030000FFFF0000 #0201091b
-p8Proc0.proc_fsi2host_mbox->responder_enable=1
-
diff --git a/src/build/simics/standalone.simics b/src/build/simics/standalone.simics
new file mode 100755
index 000000000..8ea2bdcee
--- /dev/null
+++ b/src/build/simics/standalone.simics
@@ -0,0 +1 @@
+p8Proc0.proc_fsi2host_mbox->responder_enable=1
diff --git a/src/build/simics/startup.simics b/src/build/simics/startup.simics
new file mode 100755
index 000000000..ad178ef91
--- /dev/null
+++ b/src/build/simics/startup.simics
@@ -0,0 +1,44 @@
+# Initialize HB search paths.
+$hb_startup_path = (lookup-file hbfw/startup.simics)
+$hb_script_location = (python "''.join(map('/'.__add__,\""+$hb_startup_path+"\"[1:].split('/')[0:-1]))")
+python "os.environ['HB_TOOLPATH'] = \""+$hb_script_location+"\""
+
+$hb_machine = (shell "env | grep 'GFW_P8_.*_PROC_CCIN' | sed 's/GFW_P8_\\(.*\\)_PROC_CCIN.*/\\1/'")
+$hb_machine = (python "\""+$hb_machine+"\".lower()")
+python "os.environ['HB_MACHINE'] = \""+$hb_machine+"\""
+
+# Load fake PNOR.
+try {
+ $hb_pnor_image_name = $hb_machine + ".pnor"
+ $hb_pnor_image = (lookup-file $hb_pnor_image_name)
+ if ($hb_pnor_image) {
+ (system_cmp0.phys_mem).load-file $hb_pnor_image 0x400000
+ } else {
+ echo "ERROR: Cannot find Hostboot PNOR image."
+ }
+} except { echo "ERROR: Failed to load fake PNOR." }
+
+# Preload VPD in PNOR
+try {
+ run-python-file (lookup-file hbfw/hb-pnor-mvpd-preload.py)
+ (system_cmp0.phys_mem).load-file ./sysmvpd.dat 0x681000
+ (system_cmp0.phys_mem).load-file ./sysspd.dat 0x701000
+} except { echo "ERROR: Failed to preload VPD into PNOR." }
+
+# Load HB debug tools.
+try {
+ run-python-file (lookup-file hbfw/simics-debug-framework.py)
+ run-python-file (lookup-file hbfw/hb-simdebug.py)
+} except { echo "ERROR: Failed to load Hostboot debug tools." }
+
+
+
+
+########################### WORKAROUNDS ####################################
+# Setup the mailbox.
+venice_cec_chip_cmp0.psi_hb->psihb_psihbcr=0x5f00000000000000
+# for mbox on core 0 use:
+# venice_cec_chip_cmp0.psi_hb->psihb_xivr_fsi=0x0140000000 #02010917
+# for mbox on core 5 use:
+venice_cec_chip_cmp0.psi_hb->psihb_xivr_fsi=0x0000A00140000000 #02010917
+venice_cec_chip_cmp0.psi_hb->psihb_irsn=0x00030003FFFF0000 #0201091b
diff --git a/src/build/tools/cpfiles.pl b/src/build/tools/cpfiles.pl
deleted file mode 100755
index cd907aa77..000000000
--- a/src/build/tools/cpfiles.pl
+++ /dev/null
@@ -1,452 +0,0 @@
-#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/build/tools/cpfiles.pl $
-#
-# 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
-
-#
-# Purpose: This perl script needs to be executed from the
-# git repository. It will copy all relevant files, including
-# scripts, hbotStringFile, .list, .syms and .bin files needed for debug
-# or to release Hostboot code to the user specified directory.
-#
-# Author: CamVan Nguyen 07/07/2011
-#
-
-#
-# Usage:
-# cpfiles.pl <path> [--test] [--release | --vpo | --simics]
-
-
-#------------------------------------------------------------------------------
-# Specify perl modules to use
-#------------------------------------------------------------------------------
-use strict;
-use warnings;
-use Cwd;
-use File::Basename;
-use File::Spec;
-use File::Path;
-
-#------------------------------------------------------------------------------
-# Forward Declaration
-#------------------------------------------------------------------------------
-sub printUsage;
-
-#------------------------------------------------------------------------------
-# Global arrays
-#------------------------------------------------------------------------------
-
-#List of files to copy. Path is relative to git repository.
-# r = copy to Hostboot release dir
-# s = copy to simics sandbox
-# v = copy to vpo/vbu dir
-my %files = ("src/build/tools/hb-parsedump.pl" => "rsv",
- "src/build/simics/hb-simdebug.py" => "s",
- "src/build/simics/post_model_hook.simics" => "s",
- "src/build/debug/Hostboot" => "rsv",
- "src/build/debug/simics-debug-framework.pl" => "s",
- "src/build/debug/simics-debug-framework.py" => "s",
- "src/build/debug/vpo-debug-framework.pl" => "rv",
- "src/build/debug/hb-dump-debug" => "rsv",
- "src/build/vpo/hb-dump" => "rv",
- "src/build/vpo/hb-istep" => "rv",
- "src/build/vpo/hb-virtdebug.pl" => "rv",
- "src/build/vpo/VBU_Cacheline.pm" => "rv",
- "src/build/hwpf/prcd_compile.tcl" => "r",
- "img/errlparser" => "rsv",
- "img/hbotStringFile" => "rsv",
- "img/hbicore.syms" => "rsv",
- "img/hbicore_test.syms" => "rsv",
- "img/hbicore.bin" => "rsv",
- "img/hbicore_test.bin" => "rsv",
- "img/hbicore.list" => "rsv",
- "img/hbicore_test.list" => "rsv",
- "img/hbicore.bin.modinfo" => "rsv",
- "img/hbicore_test.bin.modinfo" => "rsv",
- "img/simics_MURANO.pnor" => "rs",
- "img/simics_MURANO_test.pnor" => "rs",
- "img/simics_VENICE.pnor" => "rs",
- "img/simics_VENICE_test.pnor" => "rs",
- "img/TULETA.pnor" => "r",
- "img/TULETA_test.pnor" => "r",
- "img/vbu.pnor" => "rv",
- "img/vbu_test.pnor" => "rv",
- "img/isteplist.csv" => "rsv",
- "img/dimmspd.dat" => "sv",
- "img/procmvpd.dat" => "sv",
- "src/build/simics/hb-pnor-mvpd-preload.py" => "sv",
- "src/build/simics/hb-pnor-mvpd-preload.pl" => "sv",
- "src/usr/hwpf/hwp/fapiTestHwp.C" => "r",
- "src/include/usr/hwpf/hwp/fapiTestHwp.H" => "r",
- "src/usr/hwpf/hwp/initfiles/sample.initfile" => "r",
- );
-
-#Directories in base git repository
-my @gitRepoDirs = ("img",
- "obj",
- "src");
-
-
-#==============================================================================
-# MAIN
-#==============================================================================
-
-#------------------------------------------------------------------------------
-# Parse optional input argument
-#------------------------------------------------------------------------------
-my $numArgs = $#ARGV + 1;
-#print "num args = $numArgs\n";
-
-my $test = 0; #Flag to overwrite hbicore.<syms|bin|list> with the test versions
-my $inDir = ""; #User specified directory to copy files to
-my $env = "s"; #Flag to indicate which environment; simics by default
-
-if ($numArgs > 3)
-{
- #Print command line help
- print ("ERROR: Too many arguments entered.\n");
- printUsage();
- exit (1);
-}
-else
-{
- foreach (@ARGV)
- {
- if (($_ eq "--help") || ($_ eq "-h"))
- {
- #Print command line help
- printUsage();
- exit (0);
- }
- elsif ($_ eq "--test")
- {
- #Set flag to copy hbicore_test.<syms|bin> to hbcore_test.<syms|bin>
- $test = 1;
- }
- elsif ($_ eq "--release")
- {
- #Set flag to indicate environment
- $env = "r";
- }
- elsif ($_ eq "--vpo")
- {
- #Set flag to indicate environment
- $env = "v";
- }
- elsif ($_ eq "--simics")
- {
- #Set flag to indicate environment
- $env = "s";
- }
- else
- {
- #Save user specified directory
- $inDir = $_;
- }
- }
-}
-
-#------------------------------------------------------------------------------
-# Initialize the paths to copy files to
-#------------------------------------------------------------------------------
-my $simicsDir = "";
-my $imgDir = "";
-
-my $sandbox = $ENV{'SANDBOXBASE'};
-my $machine = $ENV{'MACHINE'};
-#print "machine = $machine\n";
-
-if ($inDir ne "")
-{
- $simicsDir = $inDir;
- $imgDir = $inDir;
- print "input dir = $inDir\n";
-
-
- #If at src dir in sandbox
- if (basename($inDir) eq "src")
- {
- #Check if img dir exists else will copy .bin files to simics dir
- $imgDir = File::Spec->catdir($inDir, "../images/ppc/lab/flash");
- $simicsDir = File::Spec->catdir($inDir, "../simics");
- unless (-d ($imgDir))
- {
- print "Creating path to image/ppc/lab/flash directory in sandbox.\n";
- mkpath($imgDir);
- }
- }
-}
-elsif (defined ($sandbox))
-{
- unless ($sandbox ne "")
- {
- die ('ERROR: No path specified and env $SANDBOXBASE = NULL'."\n");
- }
-
- print "sandbox = $sandbox\n";
-
- #Check if simics and img dirs exist, else exit
- $simicsDir = File::Spec->catdir($sandbox, "simics");
- $imgDir = File::Spec->catdir($sandbox, "images/ppc/lab/flash");
- print "simics dir = $simicsDir\n img dir = $imgDir\n";
-
- unless ((-d $simicsDir) && (-d $imgDir))
- {
- die ("ERROR: simics and/or img directories not found in sandbox\n");
- }
-}
-else
-{
- print 'ERROR: No path specified and env $SANDBBOXBASE not set.'."\n";
- printUsage();
- exit(1);
-}
-
-#------------------------------------------------------------------------------
-# Get the base dir of the git repository
-#------------------------------------------------------------------------------
-my $cwd = getcwd();
-my @paths = File::Spec->splitdir($cwd);
-#print "@paths\n";
-
-my @list;
-my $data;
-foreach $data (@paths)
-{
- last if grep { $_ eq $data } @gitRepoDirs;
- push @list, $data;
-}
-#print "@list\n";
-
-my $gitRepo = File::Spec->catdir(@list);
-#print "$gitRepo\n";
-
-#------------------------------------------------------------------------------
-# Copy files to user specified directory or to sandbox
-# Use unix command vs perl's File::Copy to preserve file attributes
-#------------------------------------------------------------------------------
-my $command = "";
-my $copyDir = "";
-
-chdir $gitRepo;
-#print "cwd: ", getcwd()."\n";
-
-# There is no guarantee of the order of the elements of a hash (%files), so
-# delete the files first so we don't accidentally delete them after copying when
-# the --test option is used.
-while ( my ($key, $value) = each(%files) )
-{
- #Skip file if not correct env
- next if (!($value =~ m/$env/));
-
- my($filename, $directories, $suffix) = fileparse($key, qr{\..*});
- my $recursive = (-d $key) ? "-r" : "";
-
- #Is file in img dir?
- if (($suffix eq ".bin") ||
- ($suffix eq ".toc") ||
- ($suffix eq ".pnor"))
- {
- $copyDir = $imgDir;
- }
- else
- {
- $copyDir = $simicsDir;
- }
-
- #Delete the old file first (handles copying over symlinks)
- $command = sprintf("rm -f %s %s/%s%s", $recursive,
- $copyDir, $filename, $suffix);
- print "$command\n";
- die if (system("$command") != 0);
-}
-
-# Now copy files
-while ( my ($key, $value) = each(%files) )
-{
- #Skip file if not correct env
- next if (!($value =~ m/$env/));
-
- $command = "";
-
- my($filename, $directories, $suffix) = fileparse($key, qr{\..*});
- #print "$filename, $directories, $suffix\n";
-
- my $recursive = (-d $key) ? "-r" : "";
-
- #Copy .bin to the img dir
- if (($suffix eq ".bin") ||
- ($suffix eq ".toc") ||
- ($suffix eq ".pnor"))
- {
- $copyDir = $imgDir;
- }
- else
- {
- $copyDir = $simicsDir;
- }
-
- #Check if user wants to copy test versions to hbicore.<syms|bin|list>
- if (($test == 1) && ("r" ne $env))
- {
- #Copy test versions to hbicore.<syms|bin|list>
- if ($filename eq "hbicore_test")
- {
- $command = sprintf("cp %s %s %s", $recursive,
- $key, $copyDir."/hbicore".$suffix);
- }
- elsif ($filename eq "simics_MURANO_test")
- {
- $command = sprintf("cp %s %s %s", $recursive,
- $key, $copyDir."/simics_MURANO".$suffix);
- }
- elsif ($filename eq "simics_VENICE_test")
- {
- $command = sprintf("cp %s %s %s", $recursive,
- $key, $copyDir."/simics_VENICE".$suffix);
- }
- elsif ($filename eq "vbu_test")
- {
- $command = sprintf("cp %s %s %s", $recursive,
- $key, $copyDir."/vbu".$suffix);
- }
- elsif ($filename ne "hbicore" and $filename ne "simics_MURANO" and $filename ne "simics_VENICE" and $filename ne "vbu")
- {
- $command = sprintf("cp %s %s %s", $recursive,
- $key, $copyDir);
- }
- }
- else
- {
- $command = sprintf("cp %s %s %s", $recursive, $key, $copyDir);
- }
-
- # Copy the file
- if ($command ne "")
- {
- print "$command\n";
- `$command`;
- if( $? != 0 )
- {
- print "ERROR : exiting\n";
- exit(-1);
- }
- }
-}
-
-if ("s" eq $env) #simics
-{
- # create a sim-link from hostboot name for PNOR to name simics uses.
- print "Linking in simics_".$machine.".pnor to name used by simics\n";
- $command = sprintf("ln -sf %s/simics_%s.pnor %s/%s.pnor", $imgDir, $machine, $imgDir, lc($machine) );
- print "$command\n";
- `$command`;
- if( $? != 0 )
- {
- print "ERROR : exiting\n";
- exit(-1);
- }
-
- # create a sym-link to hostboot.bin for simics
- print "Linking hbicore.bin to hostboot.bin\n";
- $command = sprintf("ln -sf %s/hbicore.bin %s/hostboot.bin", $imgDir, $imgDir );
- print "$command\n";
- `$command`;
- if( $? != 0 )
- {
- print "ERROR : exiting\n";
- exit(-1);
- }
-
- # create a sym-link to the appropriate pnor binary for simics post script loading PNOR to fake pnor
- print "Linking in simics_".$machine.".pnor\n";
- $command = sprintf("ln -sf %s/simics_%s.pnor %s/simics.pnor", $imgDir, $machine, $imgDir );
- print "$command\n";
- `$command`;
- if( $? != 0 )
- {
- print "ERROR : exiting\n";
- exit(-1);
- }
-
-}
-else #release or vpo
-{
- # create sym-links for vpo-debug-framework.pl for each perl module
- # in the debug framework
- my $debugFrameworkDir = "src/build/debug/Hostboot";
- opendir (my $dh, $debugFrameworkDir) or
- die "Can't open dir '$debugFrameworkDir': $!";
- my @files = readdir $dh;
- closedir $dh;
-
- #need to create symlinks for old tool names as well
- push(@files, "errl");
- push(@files, "printk");
- push(@files, "trace");
-
- chdir $inDir;
- foreach (@files)
- {
- # filter out Example.pm & any file prefixed with '_' or '.'
- next if ( ($_ =~ m/^[._]/) || ($_ =~ m/Example/) );
-
- my($filename, $directories, $suffix) = fileparse($_, qr{\..*});
-
- # create sym-link
- $filename = "hb-$filename";
- $command = "ln -sf vpo-debug-framework.pl $filename";
- print "$command\n";
- die if (system("$command") != 0);
- }
-}
-
-chdir $cwd;
-#print "cwd: ", getcwd()."\n";
-
-
-#==============================================================================
-# SUBROUTINES
-#==============================================================================
-
-#------------------------------------------------------------------------------
-# Print command line help
-#------------------------------------------------------------------------------
-sub printUsage()
-{
- print ("\nUsage: cpfiles.pl [--help] | [<path>] [--test]\n");
- print (" [--release| --vpo| --simics]\n\n");
- print (" This program needs to be executed from the git repository.\n");
- print (" It will copy all relevant files, scripts, hbotStringFile,\n");
- print (" .list, .syms and .bin files needed for debug or release of\n");
- print (" Hostboot code to one of two locations:\n");
- print (" 1. <path> if one is specified by the user\n");
- print (" 2. if <path> is not specified, then the files will be\n");
- print (' copied to the path specified by env variable $SANDBOXBASE'."\n");
- print (" if it is defined.\n\n");
- print (" --help: prints usage information\n");
- print (" --test: Copy hbicore_test.<syms|bin|list> to hbicore.<syms|bin|list>\n");
- print (" --release: Copy files needed to release Hostboot code\n");
- print (" --vpo: Copy files needed to debug in vpo\n");
- print (" --simics: <default> Copy files needed to debug in simics\n");
-}
-
diff --git a/src/build/tools/hb b/src/build/tools/hb
index 5714bfb5a..f605f5c9e 100755
--- a/src/build/tools/hb
+++ b/src/build/tools/hb
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011
+# COPYRIGHT International Business Machines Corp. 2011-2012
#
# p1
#
@@ -20,8 +20,7 @@
#
# Origin: 30
#
-# IBM_PROLOG_END
-
+# IBM_PROLOG_END_TAG
execute_in_sandbox()
{
[ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
@@ -264,8 +263,7 @@ hb_prime()
echo "Sandbox does not exist. Create with 'hb simsetup."
exit -1
fi
- needs_machine_variable
- cpfiles.pl $*
+ hbDistribute $*
else
echo "SANDBOXBASE not set."
exit -1
@@ -309,8 +307,6 @@ hb_simsetup()
execute_in_sandbox "export BACKING_BUILD=\$bb && ./workarounds.postsimsetup" "ppc"
rm ${SANDBOXBASE}/src/workarounds.postsimsetup
- mkdir -p ${SANDBOXBASE}/images/ppc/lab/flash
-
# 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
diff --git a/src/build/tools/hbDistribute b/src/build/tools/hbDistribute
new file mode 100755
index 000000000..2c67a1c3f
--- /dev/null
+++ b/src/build/tools/hbDistribute
@@ -0,0 +1,115 @@
+#!/bin/bash
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/tools/hbDistribute $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# 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_TAG
+TARGET_DIR="invalid directory"
+TARGET="fsp_TARGET"
+TEST_TEST=0
+
+print_usage()
+{
+ echo "Usage: $0 [--help] | "
+ echo " [<path>] [--test] [--release | --vpo | --simics | --fsp]"
+ echo
+ echo " This script will deliver the defined content for a distribition"
+ echo " target. Typically this is used to populate an ODE sandbox with"
+ echo " images and debug tools or for the generation of a build release"
+ echo " directory."
+ echo
+ echo " Target content is defined in src/build/mkrules/dist_targets.mk"
+ echo
+ echo " Options:"
+ echo " --help: Prints usage information"
+ echo
+ echo " --test: Includes test images and content instead of non-test."
+ echo
+ echo " --release: Create a full release distribution (all targets)."
+ echo " --vpo: Generate just 'vpo' content."
+ echo " --simics/--fsp: *default* Generate just 'fsp' content"
+}
+
+# Parse arguments
+for ARG in $*
+do
+ case $ARG in
+ "--help")
+ print_usage
+ exit
+ ;;
+
+ "--test")
+ TARGET_TEST=1
+ ;;
+
+ "--vpo")
+ TARGET="vpo_TARGET"
+ ;;
+
+ "--simics" | "--fsp")
+ TARGET="fsp_TARGET"
+ ;;
+
+ "--release")
+ TARGET="ALL"
+ ;;
+
+ "--debug")
+ DEBUG="-d"
+ ;;
+
+ --*)
+ echo "ERROR: Unknown option: $ARG"
+ exit
+ ;;
+
+ *)
+ TARGET_DIR=$ARG
+ ;;
+
+ esac
+done
+
+# Verify target directory or default to sandbox.
+if [ "${TARGET_DIR}" == "invalid directory" ]; then
+ if [ -z "${SANDBOXROOT}" -o -z "${SANDBOXNAME}" ]; then
+ echo "ERROR: No path specified and \$SANDBOXBASE undefined."
+ print_usage
+ exit
+ else
+ TARGET_DIR=${SANDBOXROOT}/${SANDBOXNAME}/src/hbfw
+ fi
+fi
+
+# Find root of repository.
+REPO_ROOT=`git rev-parse --show-toplevel`
+if [ -z $REPO_ROOT ]; then
+ echo "ERROR: Not in a git repo."
+ exit
+fi
+
+# Execute makefile for distribution.
+mkdir -p $TARGET_DIR
+export TARGET_TEST
+export TARGET_DIR
+cd $REPO_ROOT/src/build/mkrules
+make -rR ${DEBUG:=} -f dist_targets.mk $TARGET
+
OpenPOWER on IntegriCloud