From patchwork Fri Mar 9 19:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Spreckels X-Patchwork-Id: 883953 X-Patchwork-Delegate: openwrt@kresin.me Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=Informatik.Uni-Oldenburg.DE Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MsvxilGy"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zycZ953Mfz9scC for ; Sat, 10 Mar 2018 06:16:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hMlv2k0wkxreCvXkPQj8OkKWTU/0DNfOygyeNPQO/j4=; b=MsvxilGyzGAMYOjC9UxkapECJ1 frPJPfwJZ38MZe6/WrELh0z8RDMLYJOhGiGLPFKlUmXfU/u2dmnHEY5ySJITAsbLtiyEKydFVgmdu oDwKquZe40vuxfwjwpkfX1E9rMMw4PXn+mItfA3N9ws1m2ZsYprnruHtYY6uiZ/x4yODpfwDLTJ3o tXQ0J9DGtL77WL7kzenWKy9X5DKFcVgm/7mLux/7zuRZTfCJZteC90I1oYaQiIFqE9sdwUcdnA2kV tRuAjjZh7C6JyIrvoNEg8IsjMFgDqqWTdJVeW3Oh9vi0ODgX5CIwLDykKS7TVgpyl+MdR1g7vUmy1 3nEWomtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euNVI-00012N-KL; Fri, 09 Mar 2018 19:16:32 +0000 Received: from arbi.informatik.uni-oldenburg.de ([134.106.1.7]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euNVD-00010U-4f for lede-dev@lists.infradead.org; Fri, 09 Mar 2018 19:16:29 +0000 Received: from weser.Informatik.Uni-Oldenburg.DE ([134.106.11.83]) by arbi.Informatik.Uni-Oldenburg.DE (Exim 4.72) id 1euNV5-000520-Pr; Fri, 09 Mar 2018 20:16:19 +0100 Received: from ahi.Informatik.Uni-Oldenburg.DE. ([134.106.9.61]) by weser.Informatik.Uni-Oldenburg.DE (Exim 4.80.1) id 1euNUx-000JWv-IJ; Fri, 09 Mar 2018 20:16:11 +0100 From: "Valentin Spreckels" To: lede-dev@lists.infradead.org Date: Fri, 9 Mar 2018 20:17:16 +0100 Message-Id: <20180309191717.19545-2-Valentin.Spreckels@Informatik.Uni-Oldenburg.DE> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180309191717.19545-1-Valentin.Spreckels@Informatik.Uni-Oldenburg.DE> References: <20180309191717.19545-1-Valentin.Spreckels@Informatik.Uni-Oldenburg.DE> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_111627_570866_9299E0AD X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [134.106.1.7 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 2/3] scripts: add EVA ramboot script X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The bootloader on the FRITZ!Box 7412 crashes when flashing images. Thus the AVM recovery tool uses another approach: It uses the bootloader to load a small linux system into the ram and boot it from there. This system will then flash the image. This script mimics the behavior: It loads an openwrt initramfs image. After this a sysupgrade can be done to persistently install openwrt. Signed-off-by: Valentin Spreckels Acked-by: John Crispin --- scripts/flashing/eva_ramboot.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 scripts/flashing/eva_ramboot.py diff --git a/scripts/flashing/eva_ramboot.py b/scripts/flashing/eva_ramboot.py new file mode 100755 index 0000000000..b825d2768b --- /dev/null +++ b/scripts/flashing/eva_ramboot.py @@ -0,0 +1,37 @@ +#!/usr/bin/python + +from ftplib import FTP +from sys import argv +from os import stat + +assert len(argv) == 3 +ip = argv[1] +image = argv[2] + +size = stat(image).st_size +# arbitrary size limit, to prevent the address calculations from overflows etc. +assert size < 0x2000000 + +# We need to align the address. A page boundary seems to be sufficient on 7362sl +# and 7412 +addr = ((0x8000000 - size) & ~0xfff) +haddr = 0x80000000 + addr +img = open(image, "rb") + +ftp = FTP(ip, 'adam2', 'adam2') + +def adam(cmd): + print("> %s"%(cmd)) + resp = ftp.sendcmd(cmd) + print("< %s"%(resp)) + assert resp[0:3] == "200" + +ftp.set_pasv(True) +# The following parameters allow booting the avm recovery system with this +# script. +adam('SETENV memsize 0x%08x'%(addr)) +adam('SETENV kernel_args_tmp mtdram1=0x%08x,0x88000000'%(haddr)) +adam('MEDIA SDRAM') +ftp.storbinary('STOR 0x%08x 0x88000000'%(haddr), img) +img.close() +ftp.close()