From patchwork Mon Jan 21 07:49:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 156163 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6086472jaa; Sun, 20 Jan 2019 23:49:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ooWzczr0vfRDjPSQxFFocPe/q+Hi5uRj/+/s4WM4vKGeMgUmWyS6uVYlCMh7OgmeHpAL8 X-Received: by 2002:a50:9724:: with SMTP id c33mr25963750edb.288.1548056961023; Sun, 20 Jan 2019 23:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548056961; cv=none; d=google.com; s=arc-20160816; b=ksirFcVQjGBRa3Q17uHQP9nV657k+906ye4m9bMbrjoDiO79t2RFVLfaYunOZlTNIL 5TfuAdYHBJUuc5pzr8YRPdBQsiRYMcKvlsOdaE5HmV/1i8WMZRD5Mtg6DI2B82Q5OyK5 eORYkGtB9bvk6LEM3SKjkXUT1VAYUEikQse0mwz35Yrz0cOBnVk+YFankk35c/q5Iwfy lmmf3vS528aOTXB3Zn8gwGDX0nYnXJHGMog5Rvr973XOUhvvZKBWpNqzy6d3H+2pjSsL h/nmRqRtelesvOfsTjnLpZ68YS+bNuIH1QOoLjrGG2+3NHhRtH2wOYLAsse5DOf8SGBs 7Rgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:dkim-signature; bh=vSjZNk3o9k/n5JTueFpUeiAKaPgrab+Id5us7pAVLKE=; b=nyJbqoqseu6qgVZ4MP/cD9eLh4uYbIBF5WQWTNAEhacHtKZfqQiWNZPkJ7aFyh6zff HQUsu0mplQ/dD+2YRbR9ORrwxHmXq/r+DKYMmsyOnopeD88Xxif6qnk8yaIMUQ1pxBJY mYydHtyxtSZTuIizKoGX2eRoGXybve1gzSi/K2zpYAAL45KmgW2vItRYqgFmwJF2LBf9 oRvu8QPaUMn0EO0xaSqFr1OiMtbGZ1v+bN+NUNvQ3KlUzeyNU3mNpMumHVNEAdyA4YP1 2lzfDiFdNsx/3oBkRmWCQ99dSptHHcLVkR1v2iVvBhh8cuJBdLXd4YQgVyoP6u3sULs0 AJrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RpfhL0cE; 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 r17si1721923edq.40.2019.01.20.23.49.20; Sun, 20 Jan 2019 23:49:21 -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=RpfhL0cE; 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 9D757C21DAF; Mon, 21 Jan 2019 07:49:20 +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_DNSWL_BLOCKED, 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 610DFC21C38; Mon, 21 Jan 2019 07:49:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E9609C21C38; Mon, 21 Jan 2019 07:49:15 +0000 (UTC) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) by lists.denx.de (Postfix) with ESMTPS id 61625C21C29 for ; Mon, 21 Jan 2019 07:49:15 +0000 (UTC) Received: by mail-yw1-f65.google.com with SMTP id g75so7720992ywb.1 for ; Sun, 20 Jan 2019 23:49:15 -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:mime-version :content-transfer-encoding; bh=iYkOqJZuZTlB9X4vir0Vooi/qDLZhBjcygQwSxAlJ+0=; b=RpfhL0cEZnYQKZ0Qs0qjEDQgZ6HhvOwBbJLRDM6yEs3mkH9Z0DgMEfmoPW3tQq1iLG bdaJwYhwmBXY60ORQsuk6/orgmm1uq5VOR14qmyPTf7x0c27v+VWHuFhA+VEaRFlCFiT 7kCLOg/cRbCQhuIIxHKVhlmDxOPBFGkVH/YEw= 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:mime-version :content-transfer-encoding; bh=iYkOqJZuZTlB9X4vir0Vooi/qDLZhBjcygQwSxAlJ+0=; b=CnhU02LKhPkOlZ52NOx619OjeWrxfy1WDtQoCcrS4oM3GxtJaaU+jbSUYNWNP5gWNB yx8ZkaqJJIPqrPclzU9lZTAIC9rPmXyXqefILVve3HoEaNNEZkFxiCGPYHoN5g+e+4hB 1WlJJDY1UoE5t1Jl/4gCTSMR1brn4klUPObFUCS1SDDdQlZ0QpXx7YYALDvbuTpflBvg G2cYD7d9H60AAfK9w/Hung97GHXvwyBFw1MpVcVVKlpRc7CzLMliDdP0/KqpNnsp/aSj GkSCanDBSPrcOXyhjnOGoeDaVZkfYZIUkBlQy6vszxZe90KDeTYjM3gbC27Y6po4W/IA 9e5Q== X-Gm-Message-State: AJcUukeAeqb0Mb7rSL13Qs2Qe+6P6t7tO96LrvlF5xhV67+vtRW+MdP6 1zPghNpMO6utWFsxozdiBqsA3A== X-Received: by 2002:a0d:d7ca:: with SMTP id z193mr27552846ywd.282.1548056954015; Sun, 20 Jan 2019 23:49:14 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id z37sm6265251ywj.3.2019.01.20.23.49.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Jan 2019 23:49:13 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de, xypron.glpk@gmx.de Date: Mon, 21 Jan 2019 16:49:16 +0900 Message-Id: <20190121074923.29959-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v5 0/7] cmd: add efidebug for efi environment 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch set is a collection of patches to enhance efi user interfaces /commands. It will help improve user experience on efi boot and make it more usable *without* edk2's shell utility. Let's see how it works: => efidebug boot add 1 SHELL mmc 0:1 /Shell.efi "" => efidebug boot add 2 HELLO mmc 0:1 /hello.efi "" => efidebug boot dump Boot0001: attributes: A-- (0x00000001) label: SHELL file_path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,MBR,0x086246ba,0x800,0x40000)/\\Shell.efi data: Boot0002: attributes: A-- (0x00000001) label: HELLO file_path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,MBR,0x086246ba,0x800,0x40000)/\\hello.efi data: => efidebug boot order 1 2 => efidebug boot order 1: Boot0001: SHELL 2: Boot0002: HELLO => run -e Boot0002 (or bootefi bootmgr - 2) ; '-' means no dtb specified WARNING: booting without device tree Booting: HELLO ## Starting EFI application at 000000007db8b040 ... Hello, world! ## Application terminated, r = 0 => env set -e PlatformLang en ; important! (or you can do "efidebug setvar PlatformLang en") => env print -e Boot0001: {boot,run}(blob) 00000000: 01 00 00 00 68 00 53 00 ....h.S. 00000010: 48 00 45 00 4c 00 4c 00 H.E.L.L. 00000020: 00 00 01 04 14 00 b9 73 .......s 00000030: 1d e6 84 a3 cc 4a ae ab .....J.. 00000040: 82 e8 28 f3 62 8b 03 1a ..(.b... 00000050: 05 00 00 03 1a 05 00 00 ........ 00000060: 04 01 2a 00 01 00 00 00 ..*..... 00000070: 00 08 00 00 00 00 00 00 ........ 00000080: 00 00 04 00 00 00 00 00 ........ 00000090: ba 46 62 08 00 00 00 00 .Fb..... 000000a0: 00 00 00 00 00 00 00 00 ........ 000000b0: 01 01 04 04 1c 00 5c 00 ......\. 000000c0: 5c 00 53 00 68 00 65 00 \.S.h.e. 000000d0: 6c 00 6c 00 2e 00 65 00 l.l...e. 000000e0: 66 00 69 00 00 00 7f ff f.i.... 000000f0: 04 00 00 ... Boot0002: {boot,run}(blob) 00000000: 01 00 00 00 68 00 48 00 ....h.H. 00000010: 45 00 4c 00 4c 00 4f 00 E.L.L.O. 00000020: 00 00 01 04 14 00 b9 73 .......s 00000030: 1d e6 84 a3 cc 4a ae ab .....J.. 00000040: 82 e8 28 f3 62 8b 03 1a ..(.b... 00000050: 05 00 00 03 1a 05 00 00 ........ 00000060: 04 01 2a 00 01 00 00 00 ..*..... 00000070: 00 08 00 00 00 00 00 00 ........ 00000080: 00 00 04 00 00 00 00 00 ........ 00000090: ba 46 62 08 00 00 00 00 .Fb..... 000000a0: 00 00 00 00 00 00 00 00 ........ 000000b0: 01 01 04 04 1c 00 5c 00 ......\. 000000c0: 5c 00 68 00 65 00 6c 00 \.h.e.l. 000000d0: 6c 00 6f 00 2e 00 65 00 l.o...e. 000000e0: 66 00 69 00 00 00 7f ff f.i.... 000000f0: 04 00 00 ... BootOrder: {boot,run}(blob) 00000000: 01 00 02 00 .... OsIndicationsSupported: {ro,boot}(blob) 00000000: 00 00 00 00 00 00 00 00 ........ PlatformLang: {boot,run}(blob) 00000000: 65 6e en => run -e Boot0001 or bootefi bootmgr (UEFI shell ...) "setvar" command now supports efi shell-like syntax: => env set -e foo =S\"akashi\" =0x012345 =Habcdef => env print -e foo foo: {boot,run}(blob) 00000000: 61 6b 61 73 68 69 45 23 akashiE# 00000010: 01 00 ab cd ef ..... Other useful sub commands are: => efidebug devices ; print uefi devices => efidebug drivers ; print uefi drivers => efidebug dh ; print uefi handles => efidebug images ; print loaded images => efidebug memmap ; dump uefi memory map Enjoy! -Takahiro Akashi Changes in v5 (Jan 21, 2019) * rename the command name from efitool to efidebug again * add it to MAINTAINERS * follow a standard way of adding sub commands * allow "env -e" syntax without enabling CONFIG_CMD_EFIDEBUG (merging v4's patch#8 into patch#1) * change "_"-prefixed function names * change some internal variables' names * not print an efi driver's name at "efidebug drivers", yet showing a device path * change protocol name strings from char to u16 at "efidebug dh" * add a helper function to print efi memory attributes at "efidebug memmap" Changes in v4 (Jan 15, 2019) * rename the command name from efishell to efitool * use efi_uintn_t for "size" if appropriate * correct a help text for "boot add" sub-command * "boot" sub-command always takes a hexadecimal number * use systab.boottime directly instead of a local variable, bs * fix a bug in "setvar" sub-command * fix a bug in "devices" and "dh" sub-command * fix a bug in "memmap" sub-command * add "boot next" sub-command to set BootNext variable * "drivers" sub-command prints more useful info, including a driver's name which originates from a corresponding u-boot efi driver * "dh" sub-commands prints more useful info, including a list of protocols which are bound to a given handle Changes in v3 (Dec 18, 2018) * split v2 into two separate patch series * add CONFIG_CMD_EFISHELL to enable/disable efishell command * add missing free() at several places in efishell command Changes in v2 (Nov 5, 2018) * modify efi_dp_from_name() for use in efishell * rename efi_marshal_load_option() to efi_serialize_load_option(), taking a "struct efi_load_option" as an argument * improve a format in dumping uefi variables * enhance a setvar syntax as efi's shell does * change a syntax from "bootefi bootmgr -2" to "bootefi bootmgr - 2" * add -e option to run command * add -e option to env command * add more sub-commands AKASHI Takahiro (7): cmd: add efidebug command cmd: efidebug: add devices command cmd: efidebug: add drivers command cmd: efidebug: add dh command cmd: efidebug: add images command cmd: efidebug: add memmap command cmd: env: add "-e" option for handling UEFI variables MAINTAINERS | 1 + cmd/Kconfig | 10 + cmd/Makefile | 1 + cmd/efidebug.c | 1155 +++++++++++++++++++++++++++++++++++++++++++++ cmd/nvedit.c | 59 ++- include/command.h | 6 + 6 files changed, 1231 insertions(+), 1 deletion(-) create mode 100644 cmd/efidebug.c