Ejemplo n.º 1
0
static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd,
			     struct image_tool_params *params)
{
	int sector;
	unsigned int size;
	int ret;

	size = params->orig_file_size;
	ret = rkcommon_set_header(buf, size);
	debug("size %x\n", size);
	if (ret) {
		/* TODO([email protected]): This method should return an error */
		printf("Warning: SPL image is too large (size %#x) and will not boot\n",
		       size);
	}

	memcpy(buf + RKSPI_SPL_HDR_START, CONFIG_ROCKCHIP_SPL_HDR, 4);

	/*
	 * Spread the image out so we only use the first 2KB of each 4KB
	 * region. This is a feature of the SPI format required by the Rockchip
	 * boot ROM. Its rationale is unknown.
	 */
	for (sector = size / RKSPI_SECT_LEN - 1; sector >= 0; sector--) {
		printf("sector %u\n", sector);
		memmove(buf + sector * RKSPI_SECT_LEN * 2,
			buf + sector * RKSPI_SECT_LEN,
			RKSPI_SECT_LEN);
		memset(buf + sector * RKSPI_SECT_LEN * 2 + RKSPI_SECT_LEN,
		       '\0', RKSPI_SECT_LEN);
	}
}
Ejemplo n.º 2
0
static void rksd_set_header(void *buf,  struct stat *sbuf,  int ifd,
			       struct image_tool_params *params)
{
	unsigned int size;
	int ret;

	size = params->file_size - RKSD_SPL_HDR_START;
	ret = rkcommon_set_header(buf, size);
	if (ret) {
		/* TODO([email protected]): This method should return an error */
		printf("Warning: SPL image is too large (size %#x) and will not boot\n",
		       size);
	}

	memcpy(buf + RKSD_SPL_HDR_START, CONFIG_ROCKCHIP_SPL_HDR, 4);
}
Ejemplo n.º 3
0
static void rksd_set_header(void *buf,  struct stat *sbuf,  int ifd,
			    struct image_tool_params *params)
{
	unsigned int size;
	int ret;

	/*
	 * We need to calculate this using 'RK_SPL_HDR_START' and not using
	 * 'tparams->header_size', as the additional byte inserted when
	 * 'is_boot0' is true counts towards the payload (and not towards the
	 * header).
	 */
	size = params->file_size - RK_SPL_HDR_START;
	ret = rkcommon_set_header(buf, size, params);
	if (ret) {
		/* TODO([email protected]): This method should return an error */
		printf("Warning: SPL image is too large (size %#x) and will "
		       "not boot\n", size);
	}
}