zimage.c 816 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (C) 2016
  3. * Ladislav Michl <ladis@linux-mips.org>
  4. *
  5. * bootz code:
  6. * Copyright (C) 2012 Marek Vasut <marek.vasut@gmail.com>
  7. *
  8. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #include <common.h>
  11. #define LINUX_ARM_ZIMAGE_MAGIC 0x016f2818
  12. struct arm_z_header {
  13. uint32_t code[9];
  14. uint32_t zi_magic;
  15. uint32_t zi_start;
  16. uint32_t zi_end;
  17. } __attribute__ ((__packed__));
  18. int bootz_setup(ulong image, ulong *start, ulong *end)
  19. {
  20. struct arm_z_header *zi = (struct arm_z_header *)image;
  21. if (zi->zi_magic != LINUX_ARM_ZIMAGE_MAGIC) {
  22. #ifndef CONFIG_SPL_FRAMEWORK
  23. puts("Bad Linux ARM zImage magic!\n");
  24. #endif
  25. return 1;
  26. }
  27. *start = zi->zi_start;
  28. *end = zi->zi_end;
  29. #ifndef CONFIG_SPL_FRAMEWORK
  30. printf("Kernel image @ %#08lx [ %#08lx - %#08lx ]\n",
  31. image, *start, *end);
  32. #endif
  33. return 0;
  34. }