From patchwork Mon Nov 26 11:20:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 151998 Delivered-To: patch@linaro.org Received: by 2002:aa7:da0f:0:0:0:0:0 with SMTP id r15csp3114866eds; Mon, 26 Nov 2018 03:21:34 -0800 (PST) X-Google-Smtp-Source: AJdET5dI+wCK+C6n5+lUSE+9iA2TbXj2h9hCmrHUIQTFnPH4sVI+ZJCm7O3B2j+aChYiNNMhtjxn X-Received: by 2002:a17:906:c44a:: with SMTP id ck10-v6mr20302491ejb.25.1543231294732; Mon, 26 Nov 2018 03:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543231294; cv=none; d=google.com; s=arc-20160816; b=EWLOUhAF4sOBQq/oeAdBm8fXVv0HiVLPJVa+RUAe0YAKTHr5NMTR2/ow0KZQPyULQ8 nayhnqqMtcA4YCZvNAuXaVh536+MhEkZ1Cg5iNnjkEIJ2feeLRSC++b9eu75XamDK9B8 RKE0Rq+Mj5DxOcioERnAw8j2zBGkjg+2TWbOMczX4yROxocYLRj0vpOb6Y3mggo6nby/ JYu5/Nu2hqGcjEa2WUgyUtCZ6YuJgGndESR516PHbjySTokbWmJoaeRKG6bZ0LAB99HG w4ZcibXFG4B3nWGSCiZ1+0GGTBbVxwXtP+Xn9IQTh6pbNw+jtFGiKfxbsWKUOOXv++h6 aOPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature; bh=0BtHrCAlsstDcDXFuwKEgfeXZlK67/sdMyB8h6L5BV8=; b=Oped+lUFi7QOwrnq6Eft/sxv4/f3vsbLCTX2TSOMqz/fNlJ9zbglO4bVfsRZD+Y4Gj /WJ/UtFH/4XjfDH7vc/D8GvYFyfumvK9i+xj4H6+rzWMGEOkfXnKNePuq90rCM3FXU/o RrYJPPbskesmiP2hhQpy1zaxtaZ1XarLbiakT0/RG8M4ym68XT+2LWmr4VglFLWHJNot iO1g7fyjOSYY+xeO8Du3S983KBNJ4hxUXbjgEwCt7eDLd6SAqEBjXH5NgdBtzCRTvbiq FoVOvS3ENs2hV8g0A3DsQFiIM6MmHCY9AXtw8T9aKTe13kQvo2T0nSbl5QPI90lfqH0W 45mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Z+/VsVlh"; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id s24si203111edx.207.2018.11.26.03.21.33; Mon, 26 Nov 2018 03:21:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Z+/VsVlh"; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id C1C89C21ECC; Mon, 26 Nov 2018 11:21:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id EA831C21ECC; Mon, 26 Nov 2018 11:21:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F1C8CC21ECC; Mon, 26 Nov 2018 11:21:24 +0000 (UTC) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by lists.denx.de (Postfix) with ESMTPS id 527E6C21DF9 for ; Mon, 26 Nov 2018 11:21:24 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id c123so5727281pfb.0 for ; Mon, 26 Nov 2018 03:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=R8DhKltJipSU7a/XwmiNGJk7Zf0PLdhSxCKAdU3chrQ=; b=Z+/VsVlhx0wX/ymSbJAS/+aKpPAwlmB9XzFRbi4JIvDMd3K/ZpS+zdYaETutAhagJd W6ASzWBjTySsWAxBsje0Ic/y0EAH5W6mqSA3MwXcQ7Puzmm143qNJ6jT9lcvXsn6fSMT edpIUAnnFemWPzV1fBRlur7G2wrCDwoocASL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=R8DhKltJipSU7a/XwmiNGJk7Zf0PLdhSxCKAdU3chrQ=; b=CK5lNt+KMCQEL66nQsC8ObE2KVz86isu7lqpO68GwoBkXNbHu1YcvL7D1KZVOI5Ru/ KO+unhHO8NwjL1ouD6zz/nlWsNcW1iMb76goEmkT+V4FC9tvTK77s1UVim+LOh2tia7T tFXHW19oukzerpoTBmrQhCQCAYifSqBgPEe74mC7e0NmLt5S6zdIzGIvZKZZ/GtsSSMA ssciNHOQDXuLnaNUTJ4nUwhfMBghieUpkDrsA5JnU8XdewzlhCQZhoNkNjlPUdeOzyqR 00S79B5hPln35QZ3L7sDx5AzIm5VRsIDOZHbhXk7KfzHuT3doD8WwgwbwNbOkHcztIg2 P89g== X-Gm-Message-State: AA+aEWYdomzR21vXa/tNvWt30bcBJu5iH0TWTKl0Kol7HlcY2TnhSLs8 C87RWR6lUKPQDN3clrlWoiKut2mcIsk= X-Received: by 2002:a63:344e:: with SMTP id b75mr23572878pga.184.1543231282333; Mon, 26 Nov 2018 03:21:22 -0800 (PST) Received: from localhost.localdomain ([117.196.235.131]) by smtp.gmail.com with ESMTPSA id z191sm85640075pgd.74.2018.11.26.03.21.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Nov 2018 03:21:21 -0800 (PST) From: Sumit Garg To: u-boot@lists.denx.de Date: Mon, 26 Nov 2018 16:50:17 +0530 Message-Id: <1543231217-18799-1-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: daniel.thompson@linaro.org, agraf@suse.de Subject: [U-Boot] [PATCH] qemu-arm: Add persistent environment support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Currently on qemu-arm platforms environment is kept in RAM. Instead use pflash device 1 to provide persistent environment support across device reset. Also (optionally) provide support for persistent environment across qemu machine OFF/ON using following instructions: - Create envstore.img using qemu-img: qemu-img create -f raw envstore.img 64M - Add a pflash drive parameter to the command line: -drive if=pflash,format=raw,index=1,file=envstore.img Signed-off-by: Sumit Garg --- configs/qemu_arm64_defconfig | 7 +++++++ configs/qemu_arm_defconfig | 7 +++++++ doc/README.qemu-arm | 6 ++++++ include/configs/qemu-arm.h | 8 +++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig index f4502c9..0f13716 100644 --- a/configs/qemu_arm64_defconfig +++ b/configs/qemu_arm64_defconfig @@ -29,3 +29,10 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y +CONFIG_ENV_IS_IN_FLASH=y +CONFIG_MTD=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig index acebdc5..b75363e 100644 --- a/configs/qemu_arm_defconfig +++ b/configs/qemu_arm_defconfig @@ -29,3 +29,10 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y +CONFIG_ENV_IS_IN_FLASH=y +CONFIG_MTD=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y diff --git a/doc/README.qemu-arm b/doc/README.qemu-arm index 2601656..e67bc13 100644 --- a/doc/README.qemu-arm +++ b/doc/README.qemu-arm @@ -47,6 +47,12 @@ The minimal QEMU command line to get U-Boot up and running is: Note that for some odd reason qemu-system-aarch64 needs to be explicitly told to use a 64-bit CPU or it will boot in 32-bit mode. +Additional persistent U-boot environment support can be added as follows: +- Create envstore.img using qemu-img: + qemu-img create -f raw envstore.img 64M +- Add a pflash drive parameter to the command line: + -drive if=pflash,format=raw,index=1,file=envstore.img + Additional peripherals that have been tested to work in both U-Boot and Linux can be enabled with the following command line parameters: diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h index fedc466..83a930b 100644 --- a/include/configs/qemu-arm.h +++ b/include/configs/qemu-arm.h @@ -21,7 +21,8 @@ #define CONFIG_SYS_HZ 1000 /* Environment options */ -#define CONFIG_ENV_SIZE SZ_64K +#define CONFIG_ENV_ADDR 0x4000000 +#define CONFIG_ENV_SIZE SZ_256K #define BOOT_TARGET_DEVICES(func) \ func(SCSI, scsi, 0) \ @@ -42,4 +43,9 @@ #define CONFIG_SYS_CBSIZE 512 +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_SYS_FLASH_BASE 0x0 +#define CONFIG_SYS_MAX_FLASH_BANKS 2 +#define CONFIG_SYS_MAX_FLASH_SECT 256 /* Sector: 256K, Bank: 64M */ + #endif /* __CONFIG_H */