zimage.c 813 B

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