rkimage.c 896 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2015 Google, Inc
  4. * Written by Simon Glass <sjg@chromium.org>
  5. *
  6. * See README.rockchip for details of the rkimage format
  7. */
  8. #include "imagetool.h"
  9. #include <image.h>
  10. #include "rkcommon.h"
  11. static uint32_t header;
  12. static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
  13. struct image_tool_params *params)
  14. {
  15. memcpy(buf, rkcommon_get_spl_hdr(params), RK_SPL_HDR_SIZE);
  16. if (rkcommon_need_rc4_spl(params))
  17. rkcommon_rc4_encode_spl(buf, 0, params->file_size);
  18. }
  19. static int rkimage_check_image_type(uint8_t type)
  20. {
  21. if (type == IH_TYPE_RKIMAGE)
  22. return EXIT_SUCCESS;
  23. else
  24. return EXIT_FAILURE;
  25. }
  26. /*
  27. * rk_image parameters
  28. */
  29. U_BOOT_IMAGE_TYPE(
  30. rkimage,
  31. "Rockchip Boot Image support",
  32. 0,
  33. &header,
  34. rkcommon_check_params,
  35. NULL,
  36. NULL,
  37. rkimage_set_header,
  38. NULL,
  39. rkimage_check_image_type,
  40. NULL,
  41. NULL
  42. );