From patchwork Mon Apr 24 23:08:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1773157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bM7fgM1G; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q51lj4thZz23v2 for ; Tue, 25 Apr 2023 09:38:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5FEB086188; Tue, 25 Apr 2023 01:38:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bM7fgM1G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CF09C85E7C; Tue, 25 Apr 2023 01:08:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB586861E4 for ; Tue, 25 Apr 2023 01:08:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-760ed95b9e6so112096239f.1 for ; Mon, 24 Apr 2023 16:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682377728; x=1684969728; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B9SrC8wL+eM9/euR9w9iIXG2XGi6axzQzxF+9xlgYfw=; b=bM7fgM1G+vaUuhWR2CiMOdWB7lNS7T269i/A/q+gtRCz3H41qqX5VqiVlWTJA75C/O zcaAHVhhs5tDv9U9xwT9MhsEm64Lvc7gS0Rb2q6p1VSNxRgt++kyv9gpLCOAZRwT5DAr SX8LZTSP3mEBHAeCnbFmWTtgUeoNNLRDm9N60= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682377728; x=1684969728; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B9SrC8wL+eM9/euR9w9iIXG2XGi6axzQzxF+9xlgYfw=; b=gPin29dqptHLHYh0Cc2JAztNGTeYREaz1DALLXY58ndcJUrkK5e6D9maEpFHfopouZ qjhYjHxqclxFqzJDI6n2U0oAOeFeVHuLZu/CGlvHUczlsP/PlsyW3IaoXeMu696hSWE0 qJ9Vib4MXRZgJ6+8PyHP34Gi1ymiRLNv90nciuvmpi4083b7ztuZVQgkfbs0x50AENmH ot9kOte2Lf8/HEUqTxV39Iwo0SI4qZyI4GhQ7k+eGfgzYOuqWxYeFrNSL0EWmJyBp8/z eVDd8dL5mzxPG05QhZIuIcJ2In4mjm1Sdtq/XkkCwIETBzBJ0UzB9uaN4uEr8PHosP8A ikIw== X-Gm-Message-State: AAQBX9cW70Zp0tqnqtyuWC5h5np8ZRU6TGXc/qAAxo+NECe9QXIeiE5p W3NJAhaj0qpRDsIHbdldtbdutpqDBOx98/x+hpI= X-Google-Smtp-Source: AKy350Z6vgCI9eh2y08/beJ4+cITCZ19giZb+10ueG3LCNS1D8EteA+dRlIwJVUx5kxFgIIMaqc4Jg== X-Received: by 2002:a05:6e02:6c5:b0:32b:751b:6f9b with SMTP id p5-20020a056e0206c500b0032b751b6f9bmr6487934ils.13.1682377728206; Mon, 24 Apr 2023 16:08:48 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id j128-20020a026386000000b0040908cbbc5asm3746643jac.68.2023.04.24.16.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 16:08:47 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Alper Nebi Yasak , Anastasiia Lukianenko , Andre Przywara , Andrew Scull , Ashok Reddy Soma , Fabio Estevam , Hai Pham , Harald Seiler , Heiko Thiery , Heinrich Schuchardt , Ilias Apalodimas , Jagan Teki , Joe Hershberger , Kever Yang , =?utf-8?q?Marek_Beh=C3=BAn?= , Marek Vasut , Marek Vasut , Mark Kettenis , Masahiro Yamada , Max Krummenacher , Michael Walle , Michal Simek , Michal Suchanek , Neha Malcom Francis , Nick Desaulniers , Oleksandr Andrushchenko , Ovidiu Panait , =?utf-8?q?Pali_Roh=C3=A1r?= , Patrice Chotard , Patrick Delaunay , Peng Fan , Philippe Reynes , =?utf-8?q?Pierre-Cl=C3=A9?= =?utf-8?q?ment_Tosi?= , Quentin Schulz , Ramon Fried , Rasmus Villemoes , Rick Chen , Roman Kopytin , Sean Anderson , Sean Anderson , Sjoerd Simons , Stefan Herbrechtsmeier , Stefan Roese , Stefano Babic , Steven Lawrance , Sughosh Ganu , Weijie Gao , Wolfgang Denk Subject: [PATCH 00/31] Allow building sandbox with MSYS2 Date: Mon, 24 Apr 2023 17:08:05 -0600 Message-ID: <20230424230836.630907-1-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 25 Apr 2023 01:38:05 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This expands the existing work to allow sandbox to build and run on Windows using MSYS2. It also fixes a few issues so that binman can be used. There are various limitations and some features do not work fully yet. In particular, weak functions are not well supported on Windows so these are disabled. Various minor compiler-flag and filename adjustments are also needed. This does not support SDL, so U-Boot has no display. This is potentially possible, but requires using minggw instead of the base toolchain [1] so needs to be dealt with separately. [1] https://gist.github.com/thales17/fb2e4cff60890a51d9dddd4c6e832ad2 Simon Glass (31): patman: Declare the future Series memory u_boot_pylib: Correct name of readme u_boot_pylib: Make pty optional binman: Avoid using a symlink binman: Don't require a HOME directory pylibfdt: Allow building on Windows Fix Makefile warning about parallel targets mkimage: Correct checking of configuration node Kbuild: Detect including an MSYS2 path sandbox: Provide a linker script for MSYS2 sandbox: Provide an EFI link script for PE sandbox: Drop dead code from Makefile sandbox: Disable raw Ethernet on MSYS2 sandbox: Drop signal handling for MSYS2 sandbox: Correct SDL.h header inclusion sandbox: Include errno.h in the test header sandbox: Allow weak symbols to be dropped sections: Drop use of linux/types.h sandbox: Drop incorrect inclusion of linux/types.h sandbox: Drop inclusion of os.h in sscanf.c test: Avoid strange symbols in the assembler file sandbox: Fix up setting of monitor_len on MSYS2 ctype: Avoid using a symlink build: Disable weak symbols for MSYS2 Makefile: Disable unsupported compiler options with PE Makefile: Correct the ans1_compiler rule for MSYS2 Makefile: Disable LTO when building with MSYS2 doc: Update the MSYS2 packages and versions doc: Show how to build sandbox for MSYS2 Makefile: Drop unwind tables CI: Enable sandbox build for Windows .azure-pipelines.yml | 27 ++ Kconfig | 15 + Makefile | 27 +- arch/sandbox/Makefile | 7 - arch/sandbox/config.mk | 8 +- arch/sandbox/cpu/Makefile | 2 + arch/sandbox/cpu/os.c | 3 +- arch/sandbox/cpu/sdl.c | 2 +- arch/sandbox/cpu/u-boot-pe.lds | 447 ++++++++++++++++++++++++++ arch/sandbox/include/asm/test.h | 1 + arch/x86/lib/crt0_x86_64_efi.S | 2 + arch/x86/lib/pe_x86_64_efi.lds | 83 +++++ cmd/bootefi.c | 3 +- cmd/bootz.c | 3 + common/board_f.c | 2 +- common/usb.c | 3 + doc/build/gcc.rst | 35 ++ doc/build/tools.rst | 20 +- drivers/core/root.c | 3 + drivers/net/Makefile | 2 + drivers/spi/sandbox_spi.c | 3 + env/env.c | 6 + include/asm-generic/sections.h | 16 +- include/ctype.h | 7 +- include/linux/compiler_attributes.h | 4 + include/os.h | 2 - include/test/test.h | 4 +- lib/efi_loader/Makefile | 8 + lib/efi_loader/efi_image_loader.c | 3 + lib/efi_loader/efi_runtime.c | 4 + lib/lmb.c | 4 +- lib/sscanf.c | 1 - lib/time.c | 3 + scripts/Kbuild.include | 3 +- scripts/Makefile.build | 2 +- scripts/Makefile.lib | 9 +- scripts/dtc/pylibfdt/Makefile | 16 +- scripts/make_pip.sh | 9 +- tools/Makefile | 14 +- tools/binman/binman | 11 +- tools/binman/cmdline.py | 2 +- tools/image-host.c | 4 +- tools/patman/commit.py | 3 + tools/u_boot_pylib/README.rst | 2 +- tools/u_boot_pylib/cros_subprocess.py | 28 +- tools/u_boot_pylib/pyproject.toml | 2 +- 46 files changed, 803 insertions(+), 62 deletions(-) create mode 100644 arch/sandbox/cpu/u-boot-pe.lds create mode 100644 arch/x86/lib/pe_x86_64_efi.lds mode change 120000 => 100644 include/ctype.h mode change 120000 => 100755 tools/binman/binman