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.sim...@collabora.co.uk>

---

Changes in v2:
- Move into sandbox/lib/bootm.c
- convert to u-boot coding style
- Remove unneeded cast

 arch/sandbox/lib/bootm.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index 8ddf4ef..25c5aa4 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -8,6 +8,25 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int bootz_setup(ulong image, ulong *start, ulong *end)
+{
+       uint8_t *zimage = 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)) {
-- 
2.1.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to