From patchwork Sun Aug 30 22:55:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 52879 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id B34D02127E for ; Sun, 30 Aug 2015 23:06:44 +0000 (UTC) Received: by labip2 with SMTP id ip2sf34474336lab.1 for ; Sun, 30 Aug 2015 16:06:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=MNT8b1T/YcCxnvOlWB/D7/YBRTUHS55KZZpqgDDEGw8=; b=JdgViLyOObLH0queen8pcqr9rgbz2ZYaXlk13vYxh7sP/WmFGotPJSgIk8ChDAidXE OkOgA/VzjvzUTVzAeOzXbHC7nhJ7DYCtdDngIg5K6+dWmjJgVYckAglNw69yBdsGJ7s/ oLP4WBWCVryCl/pLvGpx0Rv9EegiZb7+vyo8WeBQhYU6HT9cBr5VktXCpksK4amb3ORP jBQbBlc7s031GYQ9hugzhL8ZOdObIyc8KNt+AGPiBXNEnSufktAa9AKQEa7zWh9OfmLn 2j6DMjr7NEHMNFW0i9kxkwjU+a6d+s6EpEm3R71RKqVZYnqqY2oW0MMZ3Et5JwOK2WrB pstA== X-Gm-Message-State: ALoCoQlblFVGLjD8jXGX1lqSCP4j9xj3xm1DVZyseKQ73WJ4dfO1Dc3L37GeM/RN3G7raNcEZVDw X-Received: by 10.180.82.101 with SMTP id h5mr3935024wiy.1.1440976003698; Sun, 30 Aug 2015 16:06:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.227 with SMTP id n3ls442484lan.0.gmail; Sun, 30 Aug 2015 16:06:43 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr247238lbb.60.1440976003408; Sun, 30 Aug 2015 16:06:43 -0700 (PDT) Received: from mail-lb0-x22d.google.com (mail-lb0-x22d.google.com. [2a00:1450:4010:c04::22d]) by mx.google.com with ESMTPS id pf2si11798058lbc.2.2015.08.30.16.06.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 16:06:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22d as permitted sender) client-ip=2a00:1450:4010:c04::22d; Received: by lbvd4 with SMTP id d4so15601622lbv.3 for ; Sun, 30 Aug 2015 16:06:43 -0700 (PDT) X-Received: by 10.112.16.135 with SMTP id g7mr8918182lbd.19.1440976003311; Sun, 30 Aug 2015 16:06:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.151.194 with SMTP id us2csp1273566lbb; Sun, 30 Aug 2015 16:06:42 -0700 (PDT) X-Received: by 10.180.211.82 with SMTP id na18mr16614765wic.76.1440976002713; Sun, 30 Aug 2015 16:06:42 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id f8si17971910wik.80.2015.08.30.16.06.42; Sun, 30 Aug 2015 16:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B506C4B7E0; Mon, 31 Aug 2015 01:06:39 +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 SrZWLyRgylM5; Mon, 31 Aug 2015 01:06:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 545934B7EF; Mon, 31 Aug 2015 01:06:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A74144B7A9 for ; Mon, 31 Aug 2015 01:06:17 +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 GCUGEr8k94vl for ; Mon, 31 Aug 2015 01:06:17 +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 mail-io0-f173.google.com (mail-io0-f173.google.com [209.85.223.173]) by theia.denx.de (Postfix) with ESMTPS id 2EBE64B792 for ; Mon, 31 Aug 2015 01:06:13 +0200 (CEST) Received: by iog7 with SMTP id 7so17603493iog.2 for ; Sun, 30 Aug 2015 16:06:12 -0700 (PDT) X-Received: by 10.107.154.13 with SMTP id c13mr22377994ioe.104.1440975972614; Sun, 30 Aug 2015 16:06:12 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id bd7sm9295503igb.19.2015.08.30.16.06.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 16:06:11 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 1B7AD221811; Sun, 30 Aug 2015 16:56:12 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 30 Aug 2015 16:55:50 -0600 Message-Id: <1440975352-28528-40-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.5.0.457.gab17608 In-Reply-To: <1440975352-28528-1-git-send-email-sjg@chromium.org> References: <1440975352-28528-1-git-send-email-sjg@chromium.org> Cc: huangtao , Andre Przywara , cwx Subject: [U-Boot] [PATCH v5 39/41] 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: 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" X-Original-Sender: sjg@chromium.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22d as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@google.com; dmarc=fail (p=NONE dis=NONE) header.from=chromium.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Sjoerd Simons 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 Signed-off-by: Simon Glass --- 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(-) 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",