Commit 74d22ad6 authored by NiteHawk's avatar NiteHawk Committed by GitHub
Browse files

Merge pull request #62 from n1tehawk/20161021_autoversion

Add support for version information 
parents f0a15f42 99942a6e
sunxi-fexc
bin2fex
fex2bin
sunxi-bootinfo
sunxi-fel
sunxi-pio
sunxi-fexc
sunxi-nand-part
sunxi-pio
version.h
*.o
*.swp
......@@ -61,7 +61,7 @@ all: tools target-tools
tools: $(TOOLS) $(FEXC_LINKS)
target-tools: $(TARGET_TOOLS)
misc: $(MISC_TOOLS)
misc: version.h $(MISC_TOOLS)
binfiles: $(BINFILES)
......@@ -85,9 +85,9 @@ install-target-tools: $(TARGET_TOOLS)
clean:
@rm -vf $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) $(MISC_TOOLS)
@rm -vf *.o *.elf *.sunxi *.bin *.nm *.orig
@rm -vf version.h *.o *.elf *.sunxi *.bin *.nm *.orig
$(TOOLS) $(TARGET_TOOLS): Makefile common.h
$(TOOLS) $(TARGET_TOOLS): Makefile common.h version.h
fex2bin bin2fex: sunxi-fexc
ln -nsf $< $@
......@@ -158,7 +158,10 @@ sunxi-meminfo: meminfo.c
sunxi-script_extractor: script_extractor.c
$(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^
version.h:
@./autoversion.sh > $@
.gitignore: Makefile
@for x in $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) '*.o' '*.swp'; do \
@for x in $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) version.h '*.o' '*.swp'; do \
echo "$$x"; \
done > $@
done | sort -V > $@
# sunxi-tools
[![License](http://img.shields.io/badge/License-GPL-green.svg)](LICENSE.md)
[![Build Status](https://travis-ci.org/linux-sunxi/sunxi-tools.svg?branch=master)](https://travis-ci.org/linux-sunxi/sunxi-tools)
[![Releases](https://img.shields.io/github/release/linux-sunxi/sunxi-tools.svg)](https://github.com/linux-sunxi/sunxi-tools/releases)
Copyright (C) 2012 Alejandro Mery <amery@geeks.cl>
<br>For a full list of contributors, see
......
#
# This script auto-updates a VERSION string definition.
# It outputs informational messages to stderr, while the actual
# output (on stdout) can easily be redirected to a file.
#
LATEST_RELEASE="v1.3"
if VER=`git describe --tags --dirty --always`; then
echo "Setting version information: ${VER}" >&2
else
VER=${LATEST_RELEASE}
echo "Unable to determine current version (using \"${VER}\" as fallback)" >&2
fi
echo >&2
echo "/* Auto-generated information. DO NOT EDIT */"
echo "#define VERSION \"${VER}\""
......@@ -336,6 +336,13 @@ void print_boot1_file_head(boot1_file_head_t *hdr, loader_type type)
printf("Unknown boot0 header version\n");
}
static void usage(const char *cmd)
{
puts("sunxi-bootinfo " VERSION "\n");
printf("Usage: %s [<filename>]\n", cmd);
printf(" With no <filename> given, will read from stdin instead\n");
}
int main(int argc, char * argv[])
{
FILE *in = stdin;
......@@ -352,8 +359,11 @@ int main(int argc, char * argv[])
}
if (argc > 1) {
in = fopen(argv[1], "rb");
if (!in)
fail("open input: ");
if (!in) {
if (*argv[1] == '-')
usage(argv[0]);
fail("open input");
}
}
int len;
......
......@@ -19,6 +19,8 @@
#include <stddef.h> /* offsetof */
#include "version.h" /* auto-generated VERSION string */
/** flag function argument as unused */
#ifdef UNUSED
#elif defined(__GNUC__)
......
......@@ -28,6 +28,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include "common.h"
#include "portable_endian.h"
#include "progress.h"
......@@ -1582,6 +1583,7 @@ int main(int argc, char **argv)
#endif
if (argc <= 1) {
puts("sunxi-fel " VERSION "\n");
printf("Usage: %s [options] command arguments... [command...]\n"
" -v, --verbose Verbose logging\n"
" -p, --progress \"write\" transfers show a progress bar\n"
......
......@@ -215,6 +215,7 @@ done:
*/
static inline void app_usage(const char *arg0, int mode)
{
fputs("sunxi-fexc " VERSION "\n\n", stderr);
errf("Usage: %s [-vq]%s[<input> [<output>]]\n", arg0,
mode ? " " : " [-I <infmt>] [-O <outfmt>] ");
......
......@@ -39,6 +39,7 @@
#include <errno.h>
#include <getopt.h>
#include "common.h"
#include "portable_endian.h"
#if defined(CONFIG_BCH_CONST_PARAMS)
......@@ -62,7 +63,6 @@
#define cpu_to_be32 htobe32
#define kfree free
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define BCH_PRIMITIVE_POLY 0x5803
......@@ -916,7 +916,9 @@ static int create_image(const struct image_info *info)
static void display_help(int status)
{
fprintf(status == EXIT_SUCCESS ? stdout : stderr,
"Usage: sunxi-nand-image-builder [OPTIONS] source-image output-image\n"
"sunxi-nand-image-builder %s\n"
"\n"
"Usage: sunxi-nand-image-builder [OPTIONS] source-image output-image\n"
"\n"
"Creates a raw NAND image that can be read by the sunxi NAND controller.\n"
"\n"
......@@ -960,8 +962,8 @@ static void display_help(int status)
" A normal image can be generated with\n"
" sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s -c 40/1024\n"
" A boot0 image can be generated with\n"
" sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s -b -u 4096 -c 64/1024\n"
);
" sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s -b -u 4096 -c 64/1024\n",
VERSION);
exit(status);
}
......
......@@ -24,9 +24,11 @@
#include <strings.h>
#include <fcntl.h>
#include "nand-common.h"
#include "common.h"
void usage(const char *cmd)
{
puts("sunxi-nand-part " VERSION "\n");
printf("usage: %s [-f a10|a20] nand-device\n", cmd);
printf(" %s nand-device 'name2 len2 [usertype2]' ['name3 len3 [usertype3]'] ...\n", cmd);
printf(" %s [-f a10|a20] nand-device start1 'name1 len1 [usertype1]' ['name2 len2 [usertype2]'] ...\n", cmd);
......
......@@ -20,6 +20,7 @@
#include <string.h>
#include <unistd.h>
#include "common.h"
#include "portable_endian.h"
struct phoenix_ptable {
......@@ -76,6 +77,7 @@ err:
static void usage(char **argv)
{
puts("phoenix-info " VERSION "\n");
printf("Usage: %s [options] [phoenix_image]\n"
" -v verbose\n"
" -q quiet\n"
......
......@@ -165,7 +165,7 @@ static const char *argv0;
static void usage(int rc )
{
fputs("sunxi-pio " VERSION "\n\n", stderr);
fprintf(stderr, "usage: %s -m|-i input [-o output] pin..\n", argv0);
fprintf(stderr," -m mmap - read pin state from system\n");
fprintf(stderr," -i read pin state from file\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment