aboutsummaryrefslogtreecommitdiff
path: root/common/image-host.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-09-25 07:03:17 -0600
committerTom Rini <trini@konsulko.com>2021-10-08 15:53:26 -0400
commit5d3248a688c2368be54aaa9407be30adfa994abc (patch)
tree5f91893da368e86ff51ec69efdf42f849e2b01eb /common/image-host.c
parent3d2a47f11c1e77e79aa4f04dc787b25054822267 (diff)
image: Split host code out into its own file
To avoid having #ifdefs in a few functions which are completely different in the board and host code, create a new image-host.c file. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/image-host.c')
-rw-r--r--common/image-host.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/common/image-host.c b/common/image-host.c
new file mode 100644
index 0000000000..20a9521948
--- /dev/null
+++ b/common/image-host.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Image code used by host tools (and not boards)
+ *
+ * (C) Copyright 2008 Semihalf
+ *
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#include <time.h>
+
+void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
+{
+ memmove(to, from, len);
+}
+
+void genimg_print_size(uint32_t size)
+{
+ printf("%d Bytes = %.2f KiB = %.2f MiB\n", size, (double)size / 1.024e3,
+ (double)size / 1.048576e6);
+}
+
+void genimg_print_time(time_t timestamp)
+{
+ printf("%s", ctime(&timestamp));
+}