diff mbox

[v5,39/41] rockchip: Drop first 32kb of zeros from the rkSD image type

Message ID 1440975352-28528-40-git-send-email-sjg@chromium.org
State Accepted
Commit dd39bcaffbc886e5948d5b6dc0a4156a8b0ba053
Headers show

Commit Message

Simon Glass Aug. 30, 2015, 10:55 p.m. UTC
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

Instead of creating a rockchip SPL SD card image with 32KB of zeros
which can be written to the start of an SD card, create the images with
only the useful data that should be written to an offset of 32KB on the
SD card.

The first 32 kilobytes aren't needed for bootup and only serve as
convenient way of accidentally obliterating your partition table.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 doc/README.rockchip | 2 +-
 tools/rksd.c        | 9 ++-------
 2 files changed, 3 insertions(+), 8 deletions(-)

Comments

Simon Glass Sept. 3, 2015, 6 p.m. UTC | #1
On 30 August 2015 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>
> Instead of creating a rockchip SPL SD card image with 32KB of zeros
> which can be written to the start of an SD card, create the images with
> only the useful data that should be written to an offset of 32KB on the
> SD card.
>
> The first 32 kilobytes aren't needed for bootup and only serve as
> convenient way of accidentally obliterating your partition table.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Acked-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  doc/README.rockchip | 2 +-
>  tools/rksd.c        | 9 ++-------
>  2 files changed, 3 insertions(+), 8 deletions(-)

Applied to u-boot-rockchip, thanks!
diff mbox

Patch

diff --git a/doc/README.rockchip b/doc/README.rockchip
index ce8ce77..347fc05 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -90,7 +90,7 @@  Booting from an SD card
 To write an image that boots from an SD card (assumed to be /dev/sdc):
 
    ./firefly-rk3288/tools/mkimage -T rksd -d firefly-rk3288/spl/u-boot-spl-dtb.bin out
-   sudo dd if=out of=/dev/sdc
+   sudo dd if=out of=/dev/sdc seek=64
    sudo dd if=firefly-rk3288/u-boot-dtb.img of=/dev/sdc seek=256
 
 This puts the Rockchip header and SPL image first and then places the U-Boot
diff --git a/tools/rksd.c b/tools/rksd.c
index 2efcd68..a8dbe98 100644
--- a/tools/rksd.c
+++ b/tools/rksd.c
@@ -14,9 +14,7 @@ 
 #include "rkcommon.h"
 
 enum {
-	RKSD_HEADER0_START	= 64 * RK_BLK_SIZE,
-	RKSD_SPL_HDR_START	= RKSD_HEADER0_START +
-					RK_CODE1_OFFSET * RK_BLK_SIZE,
+	RKSD_SPL_HDR_START	= RK_CODE1_OFFSET * RK_BLK_SIZE,
 	RKSD_SPL_START		= RKSD_SPL_HDR_START + 4,
 	RKSD_HEADER_LEN		= RKSD_SPL_START,
 };
@@ -44,11 +42,8 @@  static void rksd_set_header(void *buf,  struct stat *sbuf,  int ifd,
 	unsigned int size;
 	int ret;
 
-	/* Zero the whole header. The first 32KB is empty */
-	memset(buf,  '\0',  RKSD_HEADER0_START);
-
 	size = params->file_size - RKSD_SPL_HDR_START;
-	ret = rkcommon_set_header(buf + RKSD_HEADER0_START, size);
+	ret = rkcommon_set_header(buf, size);
 	if (ret) {
 		/* TODO(sjg@chromium.org): This method should return an error */
 		printf("Warning: SPL image is too large (size %#x) and will not boot\n",