diff mbox

[U-Boot,08/11] Allow compiling common/bootm.c on with HOSTCC

Message ID 1401770392-11459-9-git-send-email-sjg@chromium.org
State Deferred
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass June 3, 2014, 4:39 a.m. UTC
We want to use some of the functionality in this file, so make it
build on the host.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/bootm.c | 18 ++++++++++++++----
 tools/Makefile |  1 +
 tools/bootm.c  |  1 +
 3 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 tools/bootm.c
diff mbox

Patch

diff --git a/common/bootm.c b/common/bootm.c
index a19a9de..7613e49 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -5,10 +5,10 @@ 
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#ifndef USE_HOSTCC
 #include <common.h>
-#include <bootm.h>
+#include <bootstage.h>
 #include <bzlib.h>
-#include <image.h>
 #include <fdt_support.h>
 #include <lmb.h>
 #include <malloc.h>
@@ -17,12 +17,16 @@ 
 #include <lzma/LzmaTypes.h>
 #include <lzma/LzmaDec.h>
 #include <lzma/LzmaTools.h>
-
 #if defined(CONFIG_CMD_USB)
 #include <usb.h>
 #endif
+#else
+#include "mkimage.h"
+#endif
 
-DECLARE_GLOBAL_DATA_PTR;
+#include <command.h>
+#include <bootm.h>
+#include <image.h>
 
 #ifndef CONFIG_SYS_BOOTM_LEN
 /* use 8MByte as default max gunzip size */
@@ -31,6 +35,10 @@  DECLARE_GLOBAL_DATA_PTR;
 
 #define IH_INITRD_ARCH IH_ARCH_DEFAULT
 
+#ifndef USE_HOSTCC
+
+DECLARE_GLOBAL_DATA_PTR;
+
 static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 				   char * const argv[], bootm_headers_t *images,
 				   ulong *os_data, ulong *os_len);
@@ -801,3 +809,5 @@  static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 
 	return buf;
 }
+
+#endif /* ndef USE_HOSTCC */
diff --git a/tools/Makefile b/tools/Makefile
index 7610557..6348030 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -73,6 +73,7 @@  RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := rsa-sign.o rsa-verify.o rsa-checksum.o
 dumpimage-mkimage-objs := aisimage.o \
 			atmelimage.o \
 			$(FIT_SIG_OBJS-y) \
+			bootm.o \
 			crc32.o \
 			default_image.o \
 			fdtdec.o \
diff --git a/tools/bootm.c b/tools/bootm.c
new file mode 100644
index 0000000..63d5eb8
--- /dev/null
+++ b/tools/bootm.c
@@ -0,0 +1 @@ 
+#include "../common/bootm.c"