From patchwork Mon Aug 8 18:39:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 656936 X-Patchwork-Delegate: sr@denx.de 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 3s7R6y3rptz9s4n for ; Tue, 9 Aug 2016 04:40:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nZWCLPfO; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E98654BE6F; Mon, 8 Aug 2016 20:40:23 +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 XP2Ao8sE4COa; Mon, 8 Aug 2016 20:40:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6887D4B98B; Mon, 8 Aug 2016 20:40:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 583154B98B for ; Mon, 8 Aug 2016 20:40:20 +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 W7Vdyl_y4pkx for ; Mon, 8 Aug 2016 20:40:20 +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-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by theia.denx.de (Postfix) with ESMTPS id 1713D4B656 for ; Mon, 8 Aug 2016 20:40:15 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id x83so17134224wma.3 for ; Mon, 08 Aug 2016 11:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tiJBka5RqsX5rofQZQ9QUxUEm0MilNzZz1fKOerv9bM=; b=nZWCLPfOMSdxPd3CvRw/QWuGd816ZzcCliFIKnpacfPx0jfR6c932Yfb3IefkUELhV 3s0H+jAdhF3JLRyR4s8emi5cYvPLVDKWqlogOgONDTYSuAhO4wgV7UDyDNfqCEblkylJ WPNDrNa4BIAkZ8PLJ2aT08Mg8rOBcp9hpriD8c/JA5HUd7lk4bjZaXNVocB2cg+B4UII e0AVJHBsPpkAFXBpE7OHDuENYocx92p8xKmIWFhbU0SVXKXyxjPRfw7QczlEpjJfcpQN sFHIZW6ETMOf9N3/5Ny8czj5zezuwcYdyJNLGgRhDKE1hrT3BWRydpvnJpAD7/4clt0O lUZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tiJBka5RqsX5rofQZQ9QUxUEm0MilNzZz1fKOerv9bM=; b=N/FwOatXpu+Hvd/1A5b4yosywdfR9urieFzbGADq6lJAlLbJIrxMWNbzOtOoiR4F2S dCxOYfjfDJwnzqgH6IFsdxg7ZUzSNe7K/LAUoLreBmLAkXYuWbYtkd0j38JDkSJVf0QL IHh0ljMe84zEBL5wezm9ic9rjiwGVanozlOWSG2NYKHm3qGrJ6/a9XFSH26oNy3vrmqC A++NRmL1/02lFrKvy16k0IwFLYtEQYk3/DKlKMPaZWnj15yuiCVTwAHXWOg/Me+h2X4q BbjpK+UjVlV2XToMj/IjXoKJp4Ojx9gPzi76emYWm2oj+etATpOLsCV+r+id0ypt1ll1 sjpQ== X-Gm-Message-State: AEkoouubRYklLDUFFapGXmtirFsr+Qo3di+28oUNg8TsuBBgSscSfQ+22bsPHRSEtqC1Ug== X-Received: by 10.194.118.132 with SMTP id km4mr8666329wjb.158.1470681615118; Mon, 08 Aug 2016 11:40:15 -0700 (PDT) Received: from gandalf.schnuecks.de (p5DE8EA41.dip0.t-ipconnect.de. [93.232.234.65]) by smtp.gmail.com with ESMTPSA id qe2sm34196335wjc.28.2016.08.08.11.40.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 11:40:14 -0700 (PDT) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id 2E78FF0EF2; Mon, 8 Aug 2016 20:40:13 +0200 (CEST) From: Simon Baatz To: u-boot@lists.denx.de Date: Mon, 8 Aug 2016 20:39:45 +0200 Message-Id: <1470681585-24848-1-git-send-email-gmbnomis@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: Stefan Roese , Luka Perkov Subject: [U-Boot] [PATCH] tools: kwboot: patch destaddr only for SoCs with header version 1 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" Commit f4db6c976cf ("arm: mvebu: Add runtime detection of UART (xmodem) boot-mode") added a change to hdr->destaddr when dynamically patching an image for UART boot mode. With this change, kwboot ceases to work on Kirkwood. Thus, let's change hdr->destaddr only when we are patching an image with header version 1 (Orion and Kirkwood use header version 0). Signed-off-by: Simon Baatz Fixes: f4db6c976cf ("arm: mvebu: Add runtime detection of UART (xmodem) boot-mode") Cc: Stefan Roese Cc: Luka Perkov Cc: Kevin Smith --- Hi, this patch makes kwboot work again on Kirkwood for me. However, I could not verify whether Armada XP / 38x still works, since I don't have such hardware. - Simon tools/kwboot.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index e00958a..4160e5b 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -655,14 +655,6 @@ kwboot_img_patch_hdr(void *img, size_t size) hdr->blockid = IBR_HDR_UART_ID; - /* - * Subtract mkimage header size from destination address - * as this header is not expected by the Marvell BootROM. - * This way, the execution address is identical to the - * one the image is compiled for (TEXT_BASE). - */ - hdr->destaddr = hdr->destaddr - sizeof(struct image_header); - if (image_ver == 0) { struct main_hdr_v0 *hdr_v0 = img; @@ -672,6 +664,14 @@ kwboot_img_patch_hdr(void *img, size_t size) hdr_v0->srcaddr = hdr_v0->ext ? sizeof(struct kwb_header) : sizeof(*hdr_v0); + } else { + /* + * Subtract mkimage header size from destination address + * as this header is not expected by the Marvell BootROM. + * This way, the execution address is identical to the + * one the image is compiled for (TEXT_BASE). + */ + hdr->destaddr = hdr->destaddr - sizeof(struct image_header); } hdr->checksum = kwboot_img_csum8(hdr, hdrsz) - csum;