From patchwork Sun Aug 16 12:01:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 507841 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6E2851402A0 for ; Mon, 17 Aug 2015 17:15:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C8C114B8E4; Mon, 17 Aug 2015 09:11:21 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7dlvAqFD07o7; Mon, 17 Aug 2015 09:11:21 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B9DC64BA48; Mon, 17 Aug 2015 09:10:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 768324B61D for ; Sun, 16 Aug 2015 14:02:05 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YyoQuyPqPnxJ for ; Sun, 16 Aug 2015 14:02:05 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by theia.denx.de (Postfix) with ESMTPS id 042244B615 for ; Sun, 16 Aug 2015 14:02:04 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 59EF32188184 Received: by dusk.luon.net (Postfix, from userid 1000) id 4744E2504F; Sun, 16 Aug 2015 14:01:57 +0200 (CEST) From: Sjoerd Simons To: u-boot@lists.denx.de, Simon Glass Date: Sun, 16 Aug 2015 14:01:55 +0200 Message-Id: <1439726516-5461-8-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439726516-5461-1-git-send-email-sjoerd.simons@collabora.co.uk> References: <1439726516-5461-1-git-send-email-sjoerd.simons@collabora.co.uk> Cc: Tom Rini Subject: [U-Boot] [PATCH 7/8] rockchip: Drop first 32kb of zeros from the rksd image type X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Acked-by: Simon Glass --- doc/README.rockchip | 2 +- tools/rksd.c | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) 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",