@@ -7,6 +7,7 @@
# not drop the handler if it is not called.
# Handler can be called dynamically based
# on the received image type.
+obj-y += dummy_handler.o
obj-$(CONFIG_ARCHIVE) += archive_handler.o
obj-$(CONFIG_CFI) += flash_handler.o
obj-$(CONFIG_CFIHAMMING1)+= flash_hamming1_handler.o
new file mode 100644
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2013
+ * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * on behalf of ifm electronic GmbH
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "swupdate.h"
+#include "handler.h"
+#include "util.h"
+
+void dummy_handler(void);
+
+static int install_nothing(struct img_type *img,
+ void __attribute__ ((__unused__)) *data)
+{
+ int ret;
+ int fdout;
+
+ if (img->is_partitioner | img->is_script)
+ return 0;
+
+ fdout = open("/dev/null", O_WRONLY);
+ if (fdout < 0) {
+ TRACE("Device %s cannot be opened: %s",
+ "/dev/null", strerror(errno));
+ return -1;
+ }
+
+ ret = copyimage(&fdout, img, NULL);
+
+ close(fdout);
+ return ret;
+}
+
+__attribute__((constructor))
+void dummy_handler(void)
+{
+ register_handler("dummy", install_nothing,
+ IMAGE_HANDLER |
+ FILE_HANDLER |
+ SCRIPT_HANDLER |
+ PARTITION_HANDLER,
+ NULL);
+}
This handler skip an installation and it is thought to provide a dry-to-run. Signed-off-by: Stefano Babic <sbabic@denx.de> --- handlers/Makefile | 1 + handlers/dummy_handler.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 handlers/dummy_handler.c