Project import
diff --git a/u-boot-2012.10/Makefile b/u-boot-2012.10/Makefile
new file mode 100644
index 0000000..23fad93
--- /dev/null
+++ b/u-boot-2012.10/Makefile
@@ -0,0 +1,286 @@
+#
+#    Copyright (c) 2010-2011 Nest, Inc.
+#    All rights reserved.
+#
+#    This document is the property of Nest Labs. It is considered
+#    confidential and proprietary information.
+#
+#    This document may not be reproduced or transmitted in any form,
+#    in whole or in part, without the express written permission of
+#    Nest Labs.
+#
+#    Description:
+#      This file is the makefile for the Universal Bootloader, u-boot.
+#
+
+.NOTPARALLEL:
+
+include pre.mak
+
+PackageRoot		:= .
+
+PackageSeparator	:= 
+
+PackageVersion		:= 
+PackageSourceDir	:= $(PackageRoot)/$(UBootPackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,include/config.mk)
+
+CleanPaths		+= $(PackageLicenseFile)
+
+CP			= cp
+DD			= dd
+LN			= ln
+TAR			= tar
+MKDIR			= mkdir
+CHMOD			= chmod
+PRINTF			= printf
+PUSHD			= pushd
+POPD			= popd
+FSL_HAB_SIGN		= $(BuildRoot)/build/scripts/fsl_hab_sign.sh
+FSL_CST			= $(BuildRoot)/build/tools/host/i686-pc-linux-gnu/bin/freescale-cst
+
+GeneratedBuildExtra	:= $(shell bash $(BuildExtraScriptSourcePath) --build-version $(BuildVersion))
+
+LocalBuildExtra		= $(if $(call IsVariable,BuildExtra,undefined),$(call UseIfNotEmpty,$(GeneratedBuildExtra)),$(call UseIfNotEmpty,$(BuildExtra)))
+
+#
+# Build and result paths for staging targets
+#
+
+UBootResultBinDir	:= $(call GenerateResultPaths,,bin)
+UBootResultSbinDir	:= $(call GenerateResultPaths,,sbin)
+
+UBootPrintEnvBuildPath	:= $(call GenerateBuildPaths,tools/env/fw_printenv)
+UBootPrintEnvResultPath	:= $(call GenerateResultPaths,,sbin/fw_printenv)
+
+UBootSetEnvResultPath	:= $(call GenerateResultPaths,,sbin/fw_setenv)
+
+UBootMkimageBuildPath	:= $(call GenerateBuildPaths,tools/mkimage)
+UBootMkimageResultPath	:= $(call GenerateResultPaths,,bin/mkimage)
+
+UnsignedUBootBuildPath	:= $(call GenerateBuildPaths,$(UBootImageFile))
+
+#
+# If UBootSignedImageFile AND UBootSignedSDPImageFile are defined, we need to do
+# an extra step and sign UBootImageFile to produce signed binaries.
+#
+# There are three different ways we can generate this signed binary:
+# 1) Copy a signed image from within the Git repo*    [ Default behavior if the appropriate signed image folder is present ]
+# 2) Copy an unsigned image from the build folder*    [ Fallback behavior if the appropriate signed image folder is not present (deleted or not yet present) ]
+# 3) Sign it locally using the private keys           [ Force this by passing 'SIGN_BOOTLOADER=true' on make cmdline ]
+#
+# *Also generates a signing .tgz archive in the u-boot results folder that can be unpacked on an offline
+#  signing workstation that has the necessary signing keys and used to sign the image. It contains:
+#  1) The code signing binary: freescale-cst
+#  2) The code signing helper script: fsl_hab_sign.sh
+#  3) The unsigned u-boot image
+#  4) A top-level signing script that defines the input and output filenames, for documentation purposes, and so that we are consistent.
+#
+ifneq "$(and $(UBootSignedImageFile),$(UBootSignedSDPImageFile))" ""
+SignedUBootResultPath	= $(call GenerateResultPaths,,$(UBootSignedImageFile))
+SignedSDPUBootResultPath= $(call GenerateResultPaths,,$(UBootSignedSDPImageFile))
+BuildResults		= $(SignedUBootResultPath) $(SignedSDPUBootResultPath)
+
+# Generate a signing .tgz archive
+UBootSigningArchiveResultPath	= $(call GenerateResultPaths,,u-boot-unsigned-$(BuildVersion)-$(BuildProduct)-$(BuildConfig)$(LocalBuildExtra).tgz)
+define SIGNING_SCRIPT
+#!/bin/bash
+set -e
+./$(notdir $(FSL_HAB_SIGN)) $(basename $(UBootImageFile))-$(BuildVersion)$(LocalBuildExtra)$(suffix $(UBootImageFile)) $(basename $(UBootSignedImageFile))-$(BuildVersion)$(LocalBuildExtra)$(suffix $(UBootSignedImageFile))
+./$(notdir $(FSL_HAB_SIGN)) --sdp $(basename $(UBootImageFile))-$(BuildVersion)$(LocalBuildExtra)$(suffix $(UBootImageFile)) $(basename $(UBootSignedImageFile))-sdp-$(BuildVersion)$(LocalBuildExtra)$(suffix $(UBootSignedImageFile))
+echo "Done, no errors"
+
+endef
+export SIGNING_SCRIPT
+GenerateUBootSigningArchive	= $(eval TMPDIR := $(shell mktemp -d)) \
+				  $(MKDIR) -p $(TMPDIR)/$(BuildProduct)/$(BuildConfig) && \
+				  $(CP) $(FSL_HAB_SIGN) $(TMPDIR)/$(BuildProduct)/$(BuildConfig) && \
+				  $(CP) $(FSL_CST) $(TMPDIR)/$(BuildProduct)/$(BuildConfig) && \
+				  $(CP) $(1) $(TMPDIR)/$(BuildProduct)/$(BuildConfig)/$(basename $(UBootImageFile))-$(BuildVersion)$(LocalBuildExtra)$(suffix $(UBootImageFile)) && \
+				  $(PRINTF) "$$SIGNING_SCRIPT" > $(TMPDIR)/$(BuildProduct)/$(BuildConfig)/sign.sh && \
+				  $(CHMOD) u+x $(TMPDIR)/$(BuildProduct)/$(BuildConfig)/sign.sh && \
+				  $(PUSHD) $(TMPDIR) && sha256sum $(BuildProduct)/$(BuildConfig)/* > $(BuildProduct)/$(BuildConfig)/SHA256SUMS && $(POPD) && \
+				  $(TAR) -czf $(UBootSigningArchiveResultPath) --directory $(TMPDIR) $(BuildProduct) && \
+				  $(RM) -rf $(TMPDIR)
+
+ifdef SIGN_BOOTLOADER
+# This is option (3) above
+# This option also copies the signed result, places it into the signed u-boot images folder with a name that reflects the
+# BuildExtra (tag, last commit hash, etc) and updates the symlinks to it so that it is ready to commit into the repo.
+GenerateSignedResult	= $(Echo) "Signing result \"$(call GenerateBuildRootEllipsedPath,$2)\" locally" && \
+			  $(FSL_HAB_SIGN) $(3) $(1) $(2) $(LocalBuildExtra) && \
+			  $(CP) $(2) $(UBootSignedImagesFolder)/$(basename $(notdir $(2)))$(LocalBuildExtra)$(suffix $(2)) && \
+			  $(LN) -fs $(basename $(notdir $(2)))$(LocalBuildExtra)$(suffix $(2)) $(UBootSignedImagesFolder)/$(notdir $(2))
+else ifneq ($(wildcard $(UBootSignedImagesFolder)),)
+# This is option (1) above
+GenerateSignedResult	= $(Echo) "Copying signed result \"$(call GenerateBuildRootEllipsedPath,$2)\" from repo ($(UBootSignedImagesFolder)/$(notdir $(2)))" && \
+			  $(call GenerateUBootSigningArchive,$(1)) && \
+			  $(CP) $(UBootSignedImagesFolder)/$(notdir $(2)) $(2)
+else
+# This is option (2) above
+#
+# Note that setting CONFIG_SECURE_BOOT in the U-boot config causes a 'CSF 0x2000' command to be
+# added to the mkimage config, which causes the CSF field in the the IVT header to be nonzero,
+# and increases the length of the image given in the header by 0x2000 Bytes. If cases such as this,
+# where we don't actually do the signing and append the CSF data, we need to zero the field and
+# append 0x2000 Bytes of zeros, so that the boot ROM won't die trying to read it.
+GenerateSignedResult	= $(Echo) "Copying result \"$(call GenerateBuildRootEllipsedPath,$2)\" without signing" && \
+			  $(call GenerateUBootSigningArchive,$(1)) && \
+			  $(CP) $(1) $(2) && \
+			  $(DD) if=/dev/zero of=$(2) seek=24 bs=1 count=4 conv=notrunc > /dev/null 2>&1 && \
+			  $(DD) if=/dev/zero of=$(2) bs=$$((0x2000)) count=1 conv=notrunc oflag=append > /dev/null 2>&1
+endif
+
+else
+UnsignedUBootResultPath	= $(call GenerateResultPaths,,$(UBootImageFile))
+BuildResults		= $(UnsignedUBootResultPath)
+endif
+
+NestBuildDefines	:= NEST_BUILD_CONFIG_$(call ToUpper,$(BuildConfig)) NEST_BUILD_CONFIG=\\\"$(BuildConfig)\\\"
+NestBuildDefineFlags	:= $(call ToolGenerateDefineArgument,$(NestBuildDefines))
+
+
+# The diamond1 and j49 u-boot builds require the HOSTCC and HOSTSTRIP flags to point to the cross-toolchain so that
+# fw_printenv/fw_setenv will be built for the target arch. Doing this with the newer (2014.04) diamond3 and flintstone
+# builds causes the host tools to be cross-compiled, and is unnecessary, which is more in line with what seems logical.
+ifeq ($(UBootPackageName),u-boot)
+toolHostCCFlags		= HOSTCC="$(CC)" HOSTSTRIP=$(STRIP)
+else
+toolHostCCFlags		=
+endif
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/COPYING: source
+
+$(PackageLicenseFile): $(PackageSourceDir)/COPYING
+	$(copy-result)
+
+# We are building this package from version-controller source, so
+# there is nothing to do for this target goal.
+
+$(PackageSourceDir):
+
+# Prepare the sources.
+
+.PHONY: source
+source: | $(PackageSourceDir)
+
+# Patch the sources, if necessary.
+
+.PHONY: patch
+patch: source
+
+# U-Boot has no way of explicitly setting CC, LD, OBJCOPY, et al and
+# instead relies on the value of CROSS_COMPILE. Consequently, we have
+# to ensure that 'ToolBinDir' is in 'PATH' so that the kernel build
+# infrastructure can find $(CROSS_COMPILE)gcc, $(CROSS_COMPILE)ld, et
+# al.
+
+configure build stage: PATH := $(PATH):$(ToolBinDir)
+configure build stage: CROSS_COMPILE := $(CCACHE) $(CROSS_COMPILE)
+
+# Generate the package build makefile.
+
+$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(PackageSourceDir) \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	O=$(CURDIR)/$(BuildDirectory) \
+	$(UBootDefaultConfig)
+
+# Configure the source for building.
+
+.PHONY: configure
+configure: source $(PackageBuildMakefile)
+
+# Build the source.
+
+.PHONY: build
+build: $(UnsignedUBootBuildPath)
+
+$(UnsignedUBootBuildPath): configure
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(PackageSourceDir) \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	O=$(CURDIR)/$(BuildDirectory) \
+	NestBuildDefineFlags="$(NestBuildDefineFlags)" \
+	all
+
+$(UBootPrintEnvBuildPath): configure $(UnsignedUBootBuildPath)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(PackageSourceDir) \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	O=$(CURDIR)/$(BuildDirectory) \
+	$(toolHostCCFlags) \
+	TOOLSUBDIRS=env \
+	NestBuildDefineFlags="$(NestBuildDefineFlags)" \
+	env tools
+
+$(UnsignedUBootBuildPath): build
+
+# Stage the build to a temporary installation area.
+#
+# U-Boot does not support a notion of installing, so we have to
+# cherry-pick the components we want from the build directory and
+# copy/install them to the results directory.
+
+.PHONY: stage stage-target stage-target-tools stage-host-tools
+stage: stage-target stage-target-tools stage-host-tools
+
+stage-target: $(BuildResults)
+	$(Verbose)$(CP) -f $(call GenerateBuildPaths,System.map) $(ResultDirectory)
+
+#
+# Targets and commands for signing compiled images.
+# Generates a regular signed image for NAND boot AND a special SDP one for USB DFU boot
+#
+
+$(UnsignedUBootResultPath): $(UnsignedUBootBuildPath) | $(ResultDirectory)
+	$(Verbose)$(CP) -f $< $@
+
+$(SignedUBootResultPath): $(UnsignedUBootBuildPath) | $(ResultDirectory)
+	$(Verbose)$(call GenerateSignedResult,$<,$@,)
+
+$(SignedSDPUBootResultPath): $(UnsignedUBootBuildPath) | $(ResultDirectory)
+	$(Verbose)$(call GenerateSignedResult,$<,$@,--sdp)
+
+#
+# Targets and commands for staging target (i.e cross-compiled) tools.
+#
+
+$(UBootResultSbinDir):
+	$(create-directory)
+
+$(UBootPrintEnvResultPath): $(UBootPrintEnvBuildPath) | $(UBootResultSbinDir)
+	$(copy-result)
+
+$(UBootSetEnvResultPath): $(UBootPrintEnvBuildPath) | $(UBootResultSbinDir)
+	$(Echo) "Creating \"$(call GenerateBuildRootEllipsedPath,$@)\""
+	$(Verbose)ln -sf fw_printenv "$(@)"
+
+stage-target-tools: $(UBootPrintEnvResultPath) $(UBootSetEnvResultPath)
+
+#
+# Targets and commands for staging host (i.e. natively-compiled) tools
+# that may be used elsewhere in the build.
+#
+
+$(UBootResultBinDir):
+	$(create-directory)
+
+$(UBootMkimageBuildPath): build
+
+$(UBootMkimageResultPath): $(UBootMkimageBuildPath) | $(UBootResultBinDir)
+	$(copy-result)
+
+stage-host-tools: $(UBootMkimageResultPath)
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/u-boot-2012.10/u-boot.tar.gz b/u-boot-2012.10/u-boot.tar.gz
new file mode 100644
index 0000000..004c5c9
--- /dev/null
+++ b/u-boot-2012.10/u-boot.tar.gz
Binary files differ
diff --git a/u-boot-2012.10/u-boot.url b/u-boot-2012.10/u-boot.url
new file mode 100644
index 0000000..5a57eee
--- /dev/null
+++ b/u-boot-2012.10/u-boot.url
@@ -0,0 +1 @@
+git://git.denx.de/u-boot.git
diff --git a/u-boot-2012.10/u-boot.version b/u-boot-2012.10/u-boot.version
new file mode 100644
index 0000000..d80bf5b
--- /dev/null
+++ b/u-boot-2012.10/u-boot.version
@@ -0,0 +1 @@
+2012.10