All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: Jonas Karlman <jonas@kwiboo.se>, Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Kever Yang <kever.yang@rock-chips.com>,
	Joseph Chen <chenjh@rock-chips.com>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>
Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com>,
	Jagan Teki <jagan@edgeble.ai>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	u-boot@lists.denx.de
Subject: Re: [PATCH v3 4/5] rockchip: mkimage: Update init size limit
Date: Sat, 18 Feb 2023 05:43:32 +0100	[thread overview]
Message-ID: <68feadb7-5446-9f0d-0dd7-96b49a98cdc1@gmail.com> (raw)
In-Reply-To: <20230217205247.3402473-5-jonas@kwiboo.se>

Hi Jonas,

On 2/17/23 21:52, Jonas Karlman wrote:
> Sync init size limit from vendor u-boot:

This sync might not be correct.
Please recheck with each SoC or limit your change to the rk3328 SoC if prove fails.
Could Kever disclose SoC details here?

Johan 

> 
>  px30: 12KiB (+2KiB)

>  rk3066: 32KiB (+2KiB)


On the rk3066 the limitation depends on the bootrom logic and the tpl location it is loaded in memory:

//SPL
	flash_boot_size = idb_buf[0].flash_boot_size;
	size = flash_boot_size - 5;
	if ( size >= 32763 )
		flash_boot_size = 10;
//TPL
	flash_data_size = idb_buf[0].flash_data_size;
	if (flash_data_size - 4 >= 61 ||
	    flash_boot_size < flash_data_size ||
	    flash_data_size & 3) {
		flash_data_size = 4;
	}

	offset = idb_buf[0].boot_code1_offset + start;

===

CONFIG_TPL_TEXT_BASE=0x10080C00
TPL/SPL truncated to 2048 = 4 sectors of 512bytes per NAND page.
Header size = 4 x 512bytes

limit1: flash_data_size - 4 >= 61
limit2: flash_boot_size < flash_data_size

===

	usFlashDataSec = (ALIGN(dwLoaderDataSize, 2048)) / SECTOR_SIZE;
	usFlashBootSec = (ALIGN(dwLoaderSize, 2048)) / SECTOR_SIZE;

	dwSectorNum = 4 + usFlashDataSec + usFlashBootSec;

	pSec0->usBootDataSize = usFlashDataSec;
	pSec0->usBootCodeSize = usFlashDataSec + usFlashBootSec;

>  rk3328: 30KiB (+2KiB)
>  rk3568: 60KiB (-16KiB)
> 
> This makes it possible to use latest vendor TPL with RK3328 without
> getting a size limit error running the mkimage command.
> 
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> ---
> v3:
> - Sync with vendor u-boot as-is
> - Update commit message to include size changes
> 
> v2:
> - New patch
> 
>  tools/rkcommon.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/rkcommon.c b/tools/rkcommon.c
> index 1f1eaa16752b..630e54b1a54d 100644
> --- a/tools/rkcommon.c
> +++ b/tools/rkcommon.c
> @@ -121,20 +121,20 @@ struct spl_info {
>  };
>  
>  static struct spl_info spl_infos[] = {
> -	{ "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
> +	{ "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
>  	{ "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },

> -	{ "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },

This is OK.

> -	{ "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },

> +	{ "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },

This wrong.

printf "%d\n" $(((0x8000 - 0x800 ) / 512))
60 sectors of size 512


> +	{ "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
>  	{ "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
>  	{ "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>  	{ "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
>  	{ "rk3308", "RK33", 0x40000 - 0x1000, false, RK_HEADER_V1 },
> -	{ "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
> +	{ "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
>  	{ "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>  	{ "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 },
>  	{ "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
>  	{ "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
> -	{ "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
> +	{ "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
>  };
>  
>  /**

  reply	other threads:[~2023-02-18  4:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 2/5] rockchip: Use an external TPL binary on RK3568 Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 1/5] binman: Add support for a rockchip-tpl entry Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 5/5] rockchip: evb-rk3568: Update defconfig Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 4/5] rockchip: mkimage: Update init size limit Jonas Karlman
2023-02-18  4:43   ` Johan Jonker [this message]
2023-02-18 11:48     ` Johan Jonker
2023-02-18 13:00       ` Jonas Karlman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68feadb7-5446-9f0d-0dd7-96b49a98cdc1@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=alpernebiyasak@gmail.com \
    --cc=chenjh@rock-chips.com \
    --cc=jagan@edgeble.ai \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=quentin.schulz@theobroma-systems.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.