+static struct spl_info *rkcommon_get_spl_info(char *imagename)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(spl_infos); i++)
+ if (!strncmp(imagename, spl_infos[i].imagename, 6))
+ return spl_infos + i;
+
+ return NULL;
+}
+
+int rkcommon_check_params(struct image_tool_params *params)
+{
+ int i;
+
+ if (rkcommon_get_spl_info(params->imagename) != NULL)
+ return 0;
+
+ fprintf(stderr, "ERROR: imagename (%s) is not supported!\n",
+ strlen(params->imagename) > 0 ? params->imagename : "NULL");
+
+ fprintf(stderr, "Available imagename:");
+ for (i = 0; i < ARRAY_SIZE(spl_infos); i++)
+ fprintf(stderr, "\t%s", spl_infos[i].imagename);
+ fprintf(stderr, "\n");
+
+ return -1;
+}
+
+const char *rkcommon_get_spl_hdr(struct image_tool_params *params)
+{
+ struct spl_info *info = rkcommon_get_spl_info(params->imagename);
+
+ /*
+ * info would not be NULL, because of we checked params before.
+ */
+ return info->spl_hdr;
+}
+
+int rkcommon_get_spl_size(struct image_tool_params *params)
+{
+ struct spl_info *info = rkcommon_get_spl_info(params->imagename);
+
+ /*
+ * info would not be NULL, because of we checked params before.
+ */
+ return info->spl_size;
+}
+
+int rkcommon_set_header(void *buf, uint file_size,
+ struct image_tool_params *params)