
Add dummy bootz_setup implementation allowing the u-boot sandbox to run bootz. This recognizes both ARM and x86 zImages to validate a valid zImage was loaded.
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk --- arch/sandbox/cpu/cpu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 1aa397c..c71fb86 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -7,6 +7,7 @@ #include <dm/root.h> #include <os.h> #include <asm/state.h> +#include <asm/io.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -40,6 +41,25 @@ unsigned long __attribute__((no_instrument_function)) timer_get_us(void) return os_get_nsec() / 1000; }
+int bootz_setup(ulong image, ulong *start, ulong *end) +{ + uint8_t *zimage = (uint8_t *)map_sysmem(image, 0); + uint8_t arm_magic[] = { 0x18, 0x28, 0x6f, 0x01 }; + + if (memcmp(zimage + 0x202, "HdrS", 4) == 0) { + printf ("setting up x86 zImage\n"); + } else if (memcmp (zimage + 0x24, arm_magic, 4) == 0) { + printf ("setting up ARM zImage\n"); + } else { + printf ("Unrecognized zImage\n"); + return 1; + } + + *start = 0xdead; + *end = 0xbeef; + return 0; +} + int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {