summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2023-05-24 09:54:48 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-05-24 09:54:48 +0200
commit89c8cbea752a31f18da169a90210b296a9c31e0e (patch)
tree07c6eaa2e5879af6f8720dd21c0c11c0c5bf9a5e /scripts
parentda9b325a9ca70de3a872d4bc3db64da3c2511419 (diff)
parentf0d275c2054ee795454598af59344be0aa1eef09 (diff)
downloadbarebox-89c8cbea752a31f18da169a90210b296a9c31e0e.tar.gz
barebox-89c8cbea752a31f18da169a90210b296a9c31e0e.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'scripts')
-rw-r--r--scripts/imx/Makefile2
-rw-r--r--scripts/imx/imx-usb-loader.c30
-rwxr-xr-xscripts/socfpga_import_preloader2
3 files changed, 27 insertions, 7 deletions
diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
index dbfa82910a..b3be3886d8 100644
--- a/scripts/imx/Makefile
+++ b/scripts/imx/Makefile
@@ -3,7 +3,7 @@
hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE) += imx-image
hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER) += imx-usb-loader
-HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0`
+HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
HOSTLDLIBS_imx-usb-loader = `pkg-config --libs libusb-1.0`
imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index fdf9e74bd8..676f077c25 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -46,6 +46,10 @@
#define FT_DCD 0xee
#define FT_LOAD_ONLY 0x00
+#ifndef UTS_RELEASE
+#define UTS_RELEASE "unknown"
+#endif
+
/*
* comment from libusb:
* As per the USB 3.0 specs, the current maximum limit for the depth is 7.
@@ -1526,8 +1530,13 @@ static void usage(const char *prgname)
"-p <devpath> Specify device path: <bus>-<port>[.<port>]...\n"
"-s skip DCD included in image\n"
"-v verbose (give multiple times to increase)\n"
+ "--version display version number\n"
"-h this help\n", prgname);
- exit(1);
+}
+
+static void version(const char *prgname)
+{
+ fprintf(stderr, "%s %s\n", prgname, UTS_RELEASE);
}
int main(int argc, char *argv[])
@@ -1545,10 +1554,20 @@ int main(int argc, char *argv[])
char *initfile = NULL;
char *devpath = NULL;
char *devtype = NULL;
+ int opt_version = 0;
+ struct option long_options[] = {
+ {"version", no_argument, &opt_version, 1},
+ { }
+ };
w.do_dcd_once = 1;
- while ((opt = getopt(argc, argv, "cvhd:i:p:s")) != -1) {
+ while ((opt = getopt_long(argc, argv, "cvhd:i:p:s", long_options, NULL)) != -1) {
+ if (opt_version) {
+ version(argv[0]);
+ exit(EXIT_SUCCESS);
+ }
+
switch (opt) {
case 'c':
verify = 1;
@@ -1558,6 +1577,7 @@ int main(int argc, char *argv[])
break;
case 'h':
usage(argv[0]);
+ exit(EXIT_SUCCESS);
case 'd':
devtype = optarg;
break;
@@ -1571,13 +1591,13 @@ int main(int argc, char *argv[])
w.do_dcd_once = 0;
break;
default:
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if (devtype && strcmp(devtype, "list") == 0) {
list_imx_device_types();
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (devtype && !devpath) {
@@ -1587,7 +1607,7 @@ int main(int argc, char *argv[])
if (optind == argc) {
fprintf(stderr, "no filename given\n");
usage(argv[0]);
- exit(1);
+ exit(EXIT_FAILURE);
}
w.plug = 1;
diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader
index 2bec9f2d21..bd54e1b913 100755
--- a/scripts/socfpga_import_preloader
+++ b/scripts/socfpga_import_preloader
@@ -8,7 +8,7 @@ usage() {
-b|--board <BOARD_DIRECTORY>
optional:
-e|--embedded-sdk <ALTERA_EMBEDDED_SDK>"
- echo "EXAMPLE: $0 -i ~/cv_soc_devkit_ghrd/hps_isw_handoff/soc_system_hps_0/ -b arch/arm/boards/altera-socdk -e ~/altera-embedded-sdk/"
+ echo "EXAMPLE: $0 -i ~/cv_soc_devkit_ghrd/hps_isw_handoff/soc_system_hps_0/ -b arch/arm/boards/altera-socdk -e ~/altera-embedded-sdk/"
exit 1
}