Using fake target name forces make to rebuild all targets that depend on
it. Properly specify version.h as a target name and use double-colon to
let make know that it's a special build target.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
In some environments where git isn't present (e.g. in Debian pbuilder),
building qdl fails due. Fix the order such that we check if VERSION is
provided first & use that, only if VERSION is not provided then call
git directly to get the version.
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
The variable name VERSION is more descriptive of the code than GITREF.
Use VERSION instead.
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
If for any reasons git describe does not work (git not installed, or
not running from a git workspace), set VERSION to unknown-version.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
In order to implement a proper versioning scheme, let's generate a
version.h file that defines VERSION variable built from git
workspace. The version format will be
v<MAJOR>.<MINOR>-<COMMIT##>-<SHA1>
Where:
* MAJOR and MINOR are from the most recent tag
* COMMIT## is the number of commits since last tag, to ensure
incremental numbering
* SHA1 is an abbreviated representation of the actual commit SHA.
This requires building from a git workspace, with we are effectively
calling 'git describe' during the build.
We then define print_version() utility function to be used by all
programs.
Ensure that util.c depends on version.h and that we only update
version.h timestamps when the version actually changes to avoid
unnecessary rebuilds.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
On some platforms, we support Boot LUN redundancy, with the boot
partitions duplicated on more than 1 LUN. Only 1 LUN can be boot
active at any time, but the platform can switch on reboot in case of
corruption. As such, when flashing a full system, we end up flashing
boot partition on several LUN, and the "first" LUN with SBL or XBL
will be used as the initial/primary boot device for the
setbootablestoragedrive command.
Up until this commit we displayed an error message in this situation,
but let's turn that into an ux_info() log instead, since it's not an
error.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
It is a valid use case to flash a single partition (such as CDT) with
QDL. In such a case when we are not flashing the entire image, we
effectively are not flashing any 'boot' partition (SBL, XBL, ...), and
we don't need to send the setbootablestoragedrive command to the
programmer. Currently we display the 'no boot partition found' message
which is confusing for users, as it looks like an error message even
though it's not. Let's turn this message into a debug log message
instead.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
Not providing any user feedback during flashing is not very user
friendly, in particular when, in some situations, it can take minutes to
flash very large files.
Introduce a progress bar for the flashing and patching steps to provide
such feedback to the user, when stdout is determined to be a terminal of
sufficient size (i.e. tools programmatically invoking qdl should see no
difference).
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
QDL uses a few different styles when printing logs for the user,
with some inconsistencies, some errors, and some room for improvement.
Revisit all the ux_xyz() invocations to clean up the output from the
tool.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Rather than sprinkling the user experience decisions across the
implementation with prints to stdout, stderr, conditional checks for
qdl_debug etc, consolidate these into a single set of ux wrappers.
Transition all callers of printf() and fprintf() to these new wrappers,
without changing the level of content of the printouts.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Builds with multiple copies of the primary bootloader does not make
sense, but after successfully flashing all the partitions of such build
it makes more sense to make one of them bootable, at least more than
skipping the step and saying that none was found.
Pick the first found primary bootloader and warn the user about the
situation.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
In a few places in firehose.c the memory returned from xmlGetProp() is
leaked. Avoid this by freeing it.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
In the event that no ramdump_path is provided to sahara_run() the
ramdump_dir will remain -1. For good hygiene avoid calling close() on
this invalid file descriptor.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Valgrind correctly reports that the write of 0x30 bytes accesses
uninitialized stack space. Pad the Sahara HELLO request and response
with the expected "reserved" entries to reach the defined 0x30 bytes to
avoid sending random stack content to the device.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The XML parsing helpers turns libxml strings into standard C-types and
leaks the libxml memory. Fix this by freeing the libxml strings once
they are accessed.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
For each <program/> entry int he list, a scratch buffer of "max payload
size" is allocated, and lost. Free this memory instead.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Continuing the journey to make QDL not leak any memory on a successful
run, introduce operations to free the program and patch objects on
exit.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>