rkimage.c 1.1 KB

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