rkimage.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_check_params(struct image_tool_params *params)
  14. {
  15. return 0;
  16. }
  17. static int rkimage_verify_header(unsigned char *buf, int size,
  18. struct image_tool_params *params)
  19. {
  20. return 0;
  21. }
  22. static void rkimage_print_header(const void *buf)
  23. {
  24. }
  25. static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
  26. struct image_tool_params *params)
  27. {
  28. memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
  29. RK_SPL_HDR_SIZE);
  30. }
  31. static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
  32. {
  33. return 0;
  34. }
  35. static int rkimage_check_image_type(uint8_t type)
  36. {
  37. if (type == IH_TYPE_RKIMAGE)
  38. return EXIT_SUCCESS;
  39. else
  40. return EXIT_FAILURE;
  41. }
  42. /*
  43. * rk_image parameters
  44. */
  45. U_BOOT_IMAGE_TYPE(
  46. rkimage,
  47. "Rockchip Boot Image support",
  48. 4,
  49. &header,
  50. rkimage_check_params,
  51. rkimage_verify_header,
  52. rkimage_print_header,
  53. rkimage_set_header,
  54. rkimage_extract_subimage,
  55. rkimage_check_image_type,
  56. NULL,
  57. NULL
  58. );