recovery-utils: add preprocessor flag to change recovery tool usage help
This commit adds a compiler flag to remove certain options from the recovery-utils, because some features rely on functionality that is not supported by the CCMP1 platforms. https://onedigi.atlassian.net/browse/DEL-9116 Signed-off-by: Mike Engel <Mike.Engel@digi.com>
This commit is contained in:
parent
11426fcb5b
commit
269d80105d
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2017, Digi International Inc.
|
# Copyright (C) 2017-2024, Digi International Inc.
|
||||||
|
|
||||||
SUMMARY = "Recovery reboot utilities"
|
SUMMARY = "Recovery reboot utilities"
|
||||||
LICENSE = "MPL-2.0"
|
LICENSE = "MPL-2.0"
|
||||||
|
|
@ -12,6 +12,9 @@ SRC_URI = "file://${BPN}"
|
||||||
|
|
||||||
S = "${WORKDIR}/${BPN}"
|
S = "${WORKDIR}/${BPN}"
|
||||||
|
|
||||||
|
# Set compilation flag to disable some recovery features that are not supported
|
||||||
|
CFLAGS = "${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', ' -DSUPPORTS_FS_ENCRYPTION', '', d)}"
|
||||||
|
|
||||||
do_install() {
|
do_install() {
|
||||||
oe_runmake DESTDIR=${D} install
|
oe_runmake DESTDIR=${D} install
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2021, Digi International Inc.
|
* Copyright (c) 2017-2024, Digi International Inc.
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <recovery.h>
|
#include <recovery.h>
|
||||||
|
|
||||||
#define VERSION "0.3" GIT_REVISION
|
#define VERSION "0.4" GIT_REVISION
|
||||||
|
|
||||||
#define REBOOT_TIMEOUT 10
|
#define REBOOT_TIMEOUT 10
|
||||||
|
|
||||||
|
|
@ -34,6 +34,17 @@
|
||||||
#define CMD_UPDATEFW "update-firmware"
|
#define CMD_UPDATEFW "update-firmware"
|
||||||
#define CMD_ENCRYPT "encrypt-partitions"
|
#define CMD_ENCRYPT "encrypt-partitions"
|
||||||
|
|
||||||
|
#ifdef SUPPORTS_FS_ENCRYPTION
|
||||||
|
#define HELP_ENCRYPT " -e <partitions> --encrypt=<partitions> Encrypt the list of provided partitions.\n"
|
||||||
|
#define HELP_UNENCRYPT " -d <partitions> --unencrypt=<partitions> Un-encrypt the list of provided partitions.\n"
|
||||||
|
#define HELP_KEY " -k [<key>] --encryption-key[=<key>] Set <key> as file system encryption key.\n" \
|
||||||
|
" Empty to generate a random key.\n"
|
||||||
|
#else
|
||||||
|
#define HELP_ENCRYPT ""
|
||||||
|
#define HELP_UNENCRYPT ""
|
||||||
|
#define HELP_KEY ""
|
||||||
|
#endif /* CCMP_RECOVERY_SUPPORT */
|
||||||
|
|
||||||
#define RECOVERY_USAGE \
|
#define RECOVERY_USAGE \
|
||||||
"Reboot into recovery mode setting recovery commands.\n" \
|
"Reboot into recovery mode setting recovery commands.\n" \
|
||||||
"Copyright(c) Digi International Inc.\n" \
|
"Copyright(c) Digi International Inc.\n" \
|
||||||
|
|
@ -43,10 +54,9 @@
|
||||||
"Usage: %s [options] [<SWU-package-path>]\n\n" \
|
"Usage: %s [options] [<SWU-package-path>]\n\n" \
|
||||||
" -u --update-firmware Perform firmware update\n" \
|
" -u --update-firmware Perform firmware update\n" \
|
||||||
" -i <image> --image-set=<image> Use the specified image-set from sw-description (only together with -u).\n" \
|
" -i <image> --image-set=<image> Use the specified image-set from sw-description (only together with -u).\n" \
|
||||||
" -e <partitions> --encrypt=<partitions> Encrypt the list of provided partitions.\n" \
|
HELP_ENCRYPT \
|
||||||
" -d <partitions> --unencrypt=<partitions> Un-encrypt the list of provided partitions.\n" \
|
HELP_UNENCRYPT \
|
||||||
" -k [<key>] --encryption-key[=<key>] Set <key> as file system encryption key.\n" \
|
HELP_KEY \
|
||||||
" Empty to generate a random key.\n" \
|
|
||||||
" -w --wipe-update-partition Wipe 'update' partition\n" \
|
" -w --wipe-update-partition Wipe 'update' partition\n" \
|
||||||
" -T <N> --reboot-timeout=<N> Reboot after N seconds (default %d)\n" \
|
" -T <N> --reboot-timeout=<N> Reboot after N seconds (default %d)\n" \
|
||||||
" -f --force Force (un)encryption and key change operations.\n" \
|
" -f --force Force (un)encryption and key change operations.\n" \
|
||||||
|
|
@ -63,8 +73,7 @@
|
||||||
"\n" \
|
"\n" \
|
||||||
"Usage: %s [options] <SWU-package-path>\n\n" \
|
"Usage: %s [options] <SWU-package-path>\n\n" \
|
||||||
" -i <image> --image-set=<image> Use the specified image-set from sw-description.\n" \
|
" -i <image> --image-set=<image> Use the specified image-set from sw-description.\n" \
|
||||||
" -k [<key>] --encryption-key[=<key>] Set <key> as file system encryption key.\n" \
|
HELP_KEY \
|
||||||
" Empty to generate a random key.\n" \
|
|
||||||
" -T <N> --reboot-timeout=<N> Reboot after N seconds (default %d)\n" \
|
" -T <N> --reboot-timeout=<N> Reboot after N seconds (default %d)\n" \
|
||||||
" -f --force Force (un)encryption and key change operations.\n" \
|
" -f --force Force (un)encryption and key change operations.\n" \
|
||||||
" --help Print help and exit\n" \
|
" --help Print help and exit\n" \
|
||||||
|
|
@ -79,10 +88,9 @@
|
||||||
"Version: %s\n" \
|
"Version: %s\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
"Usage: %s [-e <partitions>] [-d <partitions>] [options]\n\n" \
|
"Usage: %s [-e <partitions>] [-d <partitions>] [options]\n\n" \
|
||||||
" -e <partitions> --encrypt=<partitions> Encrypt the list of provided partitions.\n" \
|
HELP_ENCRYPT \
|
||||||
" -d <partitions> --unencrypt=<partitions> Un-encrypt the list of provided partitions.\n" \
|
HELP_UNENCRYPT \
|
||||||
" -k [<key>] --encryption-key[=<key>] Set <key> as file system encryption key.\n" \
|
HELP_KEY \
|
||||||
" Empty to generate a random key.\n" \
|
|
||||||
" -T <N> --reboot-timeout=<N> Reboot after N seconds (default %d)\n" \
|
" -T <N> --reboot-timeout=<N> Reboot after N seconds (default %d)\n" \
|
||||||
" -f --force Force (un)encryption and key change operations.\n" \
|
" -f --force Force (un)encryption and key change operations.\n" \
|
||||||
" --help Print help and exit\n" \
|
" --help Print help and exit\n" \
|
||||||
|
|
@ -133,6 +141,7 @@ static void usage_and_exit(int exitval)
|
||||||
static void parse_options(int argc, char *argv[])
|
static void parse_options(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
static int opt_index, opt;
|
static int opt_index, opt;
|
||||||
|
#ifdef SUPPORTS_FS_ENCRYPTION
|
||||||
static const char *short_options = "ui:k::wT:e:d:f";
|
static const char *short_options = "ui:k::wT:e:d:f";
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"update-firmware", no_argument, NULL, 'u'},
|
{"update-firmware", no_argument, NULL, 'u'},
|
||||||
|
|
@ -146,6 +155,18 @@ static void parse_options(int argc, char *argv[])
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
static const char *short_options = "ui:wT:f";
|
||||||
|
static const struct option long_options[] = {
|
||||||
|
{"update-firmware", no_argument, NULL, 'u'},
|
||||||
|
{"image_set", required_argument, NULL, 'i'},
|
||||||
|
{"wipe-update-partition", no_argument, NULL, 'w'},
|
||||||
|
{"reboot-timeout", required_argument, NULL, 'T'},
|
||||||
|
{"force", no_argument, NULL, 'f'},
|
||||||
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{NULL, 0, NULL, 0}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue