mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 08:07:59 +00:00
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>
This commit is contained in:
parent
3d2a47f11c
commit
5d3248a688
4 changed files with 46 additions and 37 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include <fpga.h>
|
#include <fpga.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <mapmem.h>
|
#include <mapmem.h>
|
||||||
|
#include <rtc.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
@ -925,3 +926,19 @@ int image_setup_linux(bootm_headers_t *images)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_LMB */
|
#endif /* CONFIG_LMB */
|
||||||
|
|
||||||
|
void genimg_print_size(uint32_t size)
|
||||||
|
{
|
||||||
|
printf("%d Bytes = ", size);
|
||||||
|
print_size(size, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void genimg_print_time(time_t timestamp)
|
||||||
|
{
|
||||||
|
struct rtc_time tm;
|
||||||
|
|
||||||
|
rtc_to_tm(timestamp, &tm);
|
||||||
|
printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
|
||||||
|
tm.tm_year, tm.tm_mon, tm.tm_mday,
|
||||||
|
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||||
|
}
|
||||||
|
|
27
common/image-host.c
Normal file
27
common/image-host.c
Normal file
|
@ -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(×tamp));
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
#include <status_led.h>
|
#include <status_led.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <rtc.h>
|
|
||||||
|
|
||||||
#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT
|
#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
#include <fdt_support.h>
|
#include <fdt_support.h>
|
||||||
|
@ -60,6 +58,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#include <abuf.h>
|
#include <abuf.h>
|
||||||
#include <bzlib.h>
|
#include <bzlib.h>
|
||||||
|
#include <display_options.h>
|
||||||
#include <gzip.h>
|
#include <gzip.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <lz4.h>
|
#include <lz4.h>
|
||||||
|
@ -528,41 +527,6 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_HOSTCC
|
|
||||||
void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
|
|
||||||
{
|
|
||||||
memmove(to, from, len);
|
|
||||||
}
|
|
||||||
#endif /* !USE_HOSTCC */
|
|
||||||
|
|
||||||
void genimg_print_size(uint32_t size)
|
|
||||||
{
|
|
||||||
#ifndef USE_HOSTCC
|
|
||||||
printf("%d Bytes = ", size);
|
|
||||||
print_size(size, "\n");
|
|
||||||
#else
|
|
||||||
printf("%d Bytes = %.2f KiB = %.2f MiB\n",
|
|
||||||
size, (double)size / 1.024e3,
|
|
||||||
(double)size / 1.048576e6);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if IMAGE_ENABLE_TIMESTAMP
|
|
||||||
void genimg_print_time(time_t timestamp)
|
|
||||||
{
|
|
||||||
#ifndef USE_HOSTCC
|
|
||||||
struct rtc_time tm;
|
|
||||||
|
|
||||||
rtc_to_tm(timestamp, &tm);
|
|
||||||
printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
|
|
||||||
tm.tm_year, tm.tm_mon, tm.tm_mday,
|
|
||||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
||||||
#else
|
|
||||||
printf("%s", ctime(×tamp));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const table_entry_t *get_table_entry(const table_entry_t *table, int id)
|
const table_entry_t *get_table_entry(const table_entry_t *table, int id)
|
||||||
{
|
{
|
||||||
for (; table->id >= 0; ++table) {
|
for (; table->id >= 0; ++table) {
|
||||||
|
|
|
@ -113,6 +113,7 @@ dumpimage-mkimage-objs := aisimage.o \
|
||||||
lib/fdtdec_common.o \
|
lib/fdtdec_common.o \
|
||||||
lib/fdtdec.o \
|
lib/fdtdec.o \
|
||||||
common/image.o \
|
common/image.o \
|
||||||
|
common/image-host.o \
|
||||||
imagetool.o \
|
imagetool.o \
|
||||||
imximage.o \
|
imximage.o \
|
||||||
imx8image.o \
|
imx8image.o \
|
||||||
|
|
Loading…
Add table
Reference in a new issue