From patchwork Mon Nov 5 09:06:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 150152 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2351970ljp; Mon, 5 Nov 2018 01:04:36 -0800 (PST) X-Google-Smtp-Source: AJdET5dVNAxwV6A4gD+BOFO/r/C9awZZ+h0rxAB3P4wqZrou0V3zmG3YyyRI9T9SEST3dIHVvU3z X-Received: by 2002:a17:906:860a:: with SMTP id o10-v6mr13376236ejx.1.1541408676471; Mon, 05 Nov 2018 01:04:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541408676; cv=none; d=google.com; s=arc-20160816; b=dDQLeuHUeLzXH94UOdBE42XEBLdUvWfJ8KkPXqjQhp8WFclZZ25rP8z0mRyfE4Du5V RmHfCh9UPJs5zPy7lkcyEJ4VLINMr7qsWBu2MK5vDu8Eczv2UVC2GfZEtmlV0q6aaqej 9OQhS3ENEmG0nB0ulu4QFFn3b96hJ/Jftaq6fyni1sf/P2yIftkXN5edX5jBvQgGu1iu fup4thVBhsJjL44fuEaGmEuQZAlM+6V7PrIsvLKpYanaHGe8KXJm38tU8n6e+U34vvgj 1o//kdgDmR6Re56P3dQH/0LkI3DIZweWvrIb8nYlFwaMQHSHs1IktG52G5Xb2aNFGykU XRjA== 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=JO0+yCQEOukBD7eVG8wV5giya1Leb2U/T+UDmAMgkPM=; b=xW70kesP3QsNZ2MxB9OMqdJIbM0iNlB8T1D0KsILlJVfkiMcfv+R3VFugZV9XYTxFh RB6RcNsqX1uMoOiPlkZ7Me/sQT33p6alHBYUOH6COJ4m4UB6zZbbSCtnoid996Mf3yvY w15FNpueou/2G1au8/4SCmqzq5X6peC48dc2RUsAjWxXd7zPCU/a1FQcxArvQSPTxtqy 2rWHFJmWXEdRv++vdX1WQy4FKrypemadMNWSWyz0dlm2AHw9kyrJm1IID5aK1/QFN2KM lBreiRm+VhoXym280VLDpgZDAnHr5pAVZLeFNvl/93b6/gWmIjhXuu8ZRjCLl7gcEPBm EugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=h8Jrwgkp; 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 l17-v6si5976832edc.108.2018.11.05.01.04.36; Mon, 05 Nov 2018 01:04:36 -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=h8Jrwgkp; 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 EDC24C2220A; Mon, 5 Nov 2018 09:04:34 +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 4848BC221BC; Mon, 5 Nov 2018 09:04:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 51AE0C221BC; Mon, 5 Nov 2018 09:04:32 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) by lists.denx.de (Postfix) with ESMTPS id 6683CC2213B for ; Mon, 5 Nov 2018 09:04:29 +0000 (UTC) Received: by mail-yw1-f67.google.com with SMTP id v199-v6so3356412ywg.1 for ; Mon, 05 Nov 2018 01:04:29 -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=CHoShlEMInfEUzV9IJIJiF59TLcf78R3FdjafdIHsds=; b=h8Jrwgkpj0f1zZIuVh/0FkQwJo0Oq1CZieb6pHbY3bEVIcI8yAGQ4Y8QEoS2/QHKVF zvXsPN9dZNVbXWy7xvb/4sc1vWF/IsJlpqKgEQcqEF8idd0LlvlTmrhlU/KKR4GKipSb K1B1eIKu3iBqfiRKtnV/sgIMFE25Er96SetiY= 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=CHoShlEMInfEUzV9IJIJiF59TLcf78R3FdjafdIHsds=; b=aMfPhFsgWygpSgJ/m+uKAtPr33cMgzAPNqA4B4ih5RqGZY/I715PFNDFpZsj843TOT s1L1vbEyU8Iqx4Vj+8rbK/E5KuUTJdDHix3EqEj7ZSrf5NycRBLIZXuzn5JhCHof/yvJ /wYWzIcWhjXOhalx/ghOWPF/uNUXQ3Cax23LuYxS+DblqCJpdPk74gdobaLicHGgh/YM fRELcTk4IhLeYqEz9TR4QD/u6RVJRjRc0ktjHiNY8TnpRgQd9ftdb3SXrCSFQTkr6cjw 8nrRQEwx+IcSLr9oA2ZcYc+w+K0s9Yhm5k5A7XwcNhF9TJspZCnGMB2v/oQq0TyQ5OwM CJZw== X-Gm-Message-State: AGRZ1gLxEccNwniBM9bEk8z9HlkwQWNaLpBynmEo+KOISmlgr2PsQIxY UEohqMD1edmxezmpVhlUsUa2MA== X-Received: by 2002:a81:108b:: with SMTP id 133-v6mr20246246ywq.450.1541408667922; Mon, 05 Nov 2018 01:04:27 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id f203-v6sm7059054ywa.45.2018.11.05.01.04.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 01:04:27 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Mon, 5 Nov 2018 18:06:39 +0900 Message-Id: <20181105090653.7409-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 00/14] efi: make efi and bootmgr more usable 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: => efishell boot add 1 SHELL mmc 0:1 /Shell.efi "" => efishell boot add 2 HELLO mmc 0:1 /hello.efi "" => efishell 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: => efishell boot order 1 2 => efishell 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 "efishell 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 (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: => efishell devices ; print uefi devices => efishell drivers ; print uefi drivers => efishell images ; print loaded images => efishell dh ; print uefi handles => efishell memmap ; dump uefi memory map # I admit there is some room to improve the output from those commands. Enjoy! -Takahiro Akashi 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 (14): efi_loader: allow device == NULL in efi_dp_from_name() efi_loader: bootmgr: add load option helper functions efi_loader: bootmgr: allow for running a given load option cmd: add efishell command cmd: efishell: add devices command cmd: efishell: add drivers command cmd: efishell: add images command cmd: efishell: add memmap command cmd: efishell: add dh command cmd: bootefi: carve out fdt parameter handling cmd: bootefi: run an EFI application of a specific load option cmd: run: add "-e" option to run an EFI application cmd: efishell: export uefi variable helper functions cmd: env: add "-e" option for handling UEFI variables cmd/Makefile | 2 +- cmd/bootefi.c | 71 ++- cmd/efishell.c | 970 +++++++++++++++++++++++++++++++ cmd/efishell.h | 6 + cmd/nvedit.c | 63 +- common/cli.c | 30 + include/command.h | 5 + include/efi_loader.h | 26 +- lib/efi_loader/efi_bootmgr.c | 101 ++-- lib/efi_loader/efi_device_path.c | 11 +- 10 files changed, 1223 insertions(+), 62 deletions(-) create mode 100644 cmd/efishell.c create mode 100644 cmd/efishell.h