mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 21:19:35 +00:00
tools: acrn-crashlog: version control patch for binaries
This patch is the version control patch for the binaries of acrn-crashlog. Signed-off-by: CHEN Gang <gang.c.chen@intel.com> Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com> Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Acked-by: Eddie Dong <Eddie.dong@intel.com>
This commit is contained in:
parent
047ffc3f92
commit
d4b4c03cde
@ -1,3 +1,6 @@
|
|||||||
|
MAJOR_VERSION=1
|
||||||
|
MINOR_VERSION=0
|
||||||
|
|
||||||
BASEDIR := $(shell pwd)
|
BASEDIR := $(shell pwd)
|
||||||
|
|
||||||
LIBS = -lpthread -lxml2 -lcrypto -lrt -lsystemd -ltelemetry
|
LIBS = -lpthread -lxml2 -lcrypto -lrt -lsystemd -ltelemetry
|
||||||
@ -10,7 +13,7 @@ LDFLAGS += $(LIBS) -Wl,--gc-sections
|
|||||||
|
|
||||||
TARGET = $(BUILDDIR)/acrnprobe/bin/acrnprobe
|
TARGET = $(BUILDDIR)/acrnprobe/bin/acrnprobe
|
||||||
|
|
||||||
all: check_dirs $(TARGET)
|
all: include/version.h check_dirs $(TARGET)
|
||||||
|
|
||||||
$(BUILDDIR)/acrnprobe/obj/%.o:%.c
|
$(BUILDDIR)/acrnprobe/obj/%.o:%.c
|
||||||
$(CC) -c $(CFLAGS) $< -o $@
|
$(CC) -c $(CFLAGS) $< -o $@
|
||||||
@ -35,6 +38,9 @@ $(BUILDDIR)/acrnprobe/bin/acrnprobe: $(BUILDDIR)/acrnprobe/obj/main.o \
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Clean objects and binaries"
|
@echo "Clean objects and binaries"
|
||||||
|
@if [ -e include/version.h ]; then \
|
||||||
|
$(RM) -f include/version.h; \
|
||||||
|
fi
|
||||||
@if [ -d $(BUILDDIR)/acrnprobe/obj ]; then \
|
@if [ -d $(BUILDDIR)/acrnprobe/obj ]; then \
|
||||||
find $(BUILDDIR)/acrnprobe/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
|
find $(BUILDDIR)/acrnprobe/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
|
||||||
fi
|
fi
|
||||||
@ -45,6 +51,19 @@ clean:
|
|||||||
$(RM) -r $(BUILDDIR)/acrnprobe/obj ; \
|
$(RM) -r $(BUILDDIR)/acrnprobe/obj ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
include/version.h:
|
||||||
|
touch include/version.h
|
||||||
|
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
|
||||||
|
DIRTY=`git diff --name-only $(BASEDIR)`;\
|
||||||
|
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
|
||||||
|
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
|
||||||
|
cat $(BASEDIR)/../license_header > include/version.h;\
|
||||||
|
echo "#define AP_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\
|
||||||
|
echo "#define AP_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\
|
||||||
|
echo "#define AP_BUILD_VERSION "\""$$PATCH"\""" >> include/version.h;\
|
||||||
|
echo "#define AP_BUILD_TIME "\""$$TIME"\""" >> include/version.h;\
|
||||||
|
echo "#define AP_BUILD_USER "\""$(USER)"\""" >> include/version.h
|
||||||
|
|
||||||
check_dirs:
|
check_dirs:
|
||||||
@if [ ! -d $(BUILDDIR)/acrnprobe/bin ]; then \
|
@if [ ! -d $(BUILDDIR)/acrnprobe/bin ]; then \
|
||||||
mkdir -p $(BUILDDIR)/acrnprobe/bin ; \
|
mkdir -p $(BUILDDIR)/acrnprobe/bin ; \
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include "event_handler.h"
|
#include "event_handler.h"
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "log_sys.h"
|
#include "log_sys.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define CONFIG_INSTALL "/usr/share/defaults/telemetrics/acrnprobe.xml"
|
#define CONFIG_INSTALL "/usr/share/defaults/telemetrics/acrnprobe.xml"
|
||||||
#define CONFIG_CUSTOMIZE "/etc/acrnprobe.xml"
|
#define CONFIG_CUSTOMIZE "/etc/acrnprobe.xml"
|
||||||
#define VERSION "1.0"
|
|
||||||
|
|
||||||
void usage(void)
|
void usage(void)
|
||||||
{
|
{
|
||||||
@ -79,7 +79,10 @@ int main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
case 'V':
|
case 'V':
|
||||||
printf(VERSION "\n");
|
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||||
|
AP_MAJOR_VERSION, AP_MINOR_VERSION,
|
||||||
|
AP_BUILD_VERSION, AP_BUILD_USER,
|
||||||
|
AP_BUILD_TIME);
|
||||||
return 0;
|
return 0;
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
|
5
tools/acrn-crashlog/license_header
Normal file
5
tools/acrn-crashlog/license_header
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) <2018> Intel Corporation
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
@ -1,4 +1,7 @@
|
|||||||
all: check_obj usercrash_s usercrash_c debugger
|
MAJOR_VERSION=1
|
||||||
|
MINOR_VERSION=0
|
||||||
|
|
||||||
|
all: include/version.h check_obj usercrash_s usercrash_c debugger
|
||||||
|
|
||||||
CURRDIR := $(shell pwd)
|
CURRDIR := $(shell pwd)
|
||||||
INCLUDE += -I $(CURRDIR)/include/
|
INCLUDE += -I $(CURRDIR)/include/
|
||||||
@ -30,6 +33,19 @@ debugger: $(BUILDDIR)/usercrash/obj/debugger.o \
|
|||||||
$(BUILDDIR)/usercrash/obj/%.o:%.c
|
$(BUILDDIR)/usercrash/obj/%.o:%.c
|
||||||
$(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
|
$(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
|
||||||
|
|
||||||
|
include/version.h:
|
||||||
|
touch include/version.h
|
||||||
|
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
|
||||||
|
DIRTY=`git diff --name-only $(CURRDIR)`;\
|
||||||
|
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
|
||||||
|
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
|
||||||
|
cat $(CURRDIR)/../license_header > include/version.h;\
|
||||||
|
echo "#define UC_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\
|
||||||
|
echo "#define UC_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\
|
||||||
|
echo "#define UC_BUILD_VERSION "\""$$PATCH"\""" >> include/version.h;\
|
||||||
|
echo "#define UC_BUILD_TIME "\""$$TIME"\""" >> include/version.h;\
|
||||||
|
echo "#define UC_BUILD_USER "\""$(USER)"\""" >> include/version.h
|
||||||
|
|
||||||
check_obj:
|
check_obj:
|
||||||
@if [ ! -d $(BUILDDIR)/usercrash/bin ]; then \
|
@if [ ! -d $(BUILDDIR)/usercrash/bin ]; then \
|
||||||
mkdir -p $(BUILDDIR)/usercrash/bin ; \
|
mkdir -p $(BUILDDIR)/usercrash/bin ; \
|
||||||
@ -41,6 +57,9 @@ check_obj:
|
|||||||
.PHONY:clean
|
.PHONY:clean
|
||||||
clean:
|
clean:
|
||||||
@echo "Clean objects and binaries"
|
@echo "Clean objects and binaries"
|
||||||
|
@if [ -e include/version.h ]; then \
|
||||||
|
$(RM) -f include/version.h; \
|
||||||
|
fi
|
||||||
@if [ -d $(BUILDDIR)/usercrash/obj ]; then \
|
@if [ -d $(BUILDDIR)/usercrash/obj ]; then \
|
||||||
find $(BUILDDIR)/usercrash/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
|
find $(BUILDDIR)/usercrash/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
|
||||||
fi
|
fi
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "log_sys.h"
|
#include "log_sys.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usercrash works as C/S model: usercrash_c works as usercrash client to
|
* Usercrash works as C/S model: usercrash_c works as usercrash client to
|
||||||
@ -185,7 +186,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (strcmp(argv[1], "-v") == 0) {
|
if (strcmp(argv[1], "-v") == 0) {
|
||||||
printf("usercrash_c version is 1.0\n");
|
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||||
|
UC_MAJOR_VERSION, UC_MINOR_VERSION,
|
||||||
|
UC_BUILD_VERSION, UC_BUILD_USER,
|
||||||
|
UC_BUILD_TIME);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strcmp(argv[1], "-h") == 0) {
|
if (strcmp(argv[1], "-h") == 0) {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "crash_dump.h"
|
#include "crash_dump.h"
|
||||||
#include "log_sys.h"
|
#include "log_sys.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debugger can work without server when uses "debugger pid" commands to
|
* Debugger can work without server when uses "debugger pid" commands to
|
||||||
@ -33,7 +34,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (strcmp(argv[1], "-v") == 0) {
|
if (strcmp(argv[1], "-v") == 0) {
|
||||||
printf("debugger version is 1.0\n");
|
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||||
|
UC_MAJOR_VERSION, UC_MINOR_VERSION,
|
||||||
|
UC_BUILD_VERSION, UC_BUILD_USER,
|
||||||
|
UC_BUILD_TIME);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strcmp(argv[1], "-h") == 0) {
|
if (strcmp(argv[1], "-h") == 0) {
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "log_sys.h"
|
#include "log_sys.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define FILE_PATH_LEN_MAX 256
|
#define FILE_PATH_LEN_MAX 256
|
||||||
|
|
||||||
@ -389,7 +390,10 @@ int main(int argc, char *argv[])
|
|||||||
while ((opt = getopt(argc, argv, "vh")) != -1) {
|
while ((opt = getopt(argc, argv, "vh")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("usercrash_s version is 1.0\n");
|
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||||
|
UC_MAJOR_VERSION, UC_MINOR_VERSION,
|
||||||
|
UC_BUILD_VERSION, UC_BUILD_USER,
|
||||||
|
UC_BUILD_TIME);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
print_usage();
|
print_usage();
|
||||||
|
Loading…
Reference in New Issue
Block a user