rkimage.c 1.1 KB

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