From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D9A1C433F5 for ; Fri, 17 Dec 2021 16:46:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 08B188342C; Fri, 17 Dec 2021 17:46:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (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=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gqOhNFZ4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A5FB7833B8; Fri, 17 Dec 2021 17:46:21 +0100 (CET) Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) (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 3166383007 for ; Fri, 17 Dec 2021 17:46:18 +0100 (CET) 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@google.com Received: by mail-ua1-x935.google.com with SMTP id u40so5513268uad.1 for ; Fri, 17 Dec 2021 08:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:from:in-reply-to:references:date:message-id :subject:to:cc; bh=taiKHSrUeYt191hJ7TlySN/tQAD9PglPTWk7rk/cHko=; b=gqOhNFZ4X/sIDD1XE1zBm6X1bs9tFxiZMgwM/I7EGrm9m5grEtwa3goa63YfpBv/b+ nVRc5TX3rX4PrW6i9V06gwepZc/LPDJyhwQvmo0nPXybo3CxzgBREbjwu8B8nf5f4yaB cQXmMee97pOujp+04w3dD65bQWawOEFDFzfgo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:sender:from:in-reply-to:references :date:message-id:subject:to:cc; bh=taiKHSrUeYt191hJ7TlySN/tQAD9PglPTWk7rk/cHko=; b=SMhNB4xAn0RbMtZq3K1A2U+Ew4ddaMpzVRSqt3nBKF2iPNSW9kNm8h8UlrjiUQiLTb 4sDMAW275QZikWGMuQQ15csqY/k6MslHABa/xH2H1+8RfIpj0pVdU5J0hc7rmNKRDlSE c0CaB+5up7SeuhocXpTSlsfMita+DCGcyHsTOkAwP/4pnDWIU7J+CUwq6ZDZOkzpJ8Mo 0/XMucKKCT7yPF6wzEDm2IHHKksWmpS7KbB68X3a1WlJ4YysgdUKzBGWyWVyisBiXvUt G1EJUZmDCs8FMEViPAZ/JMocFcLfkpxgassCsDWZwNqieXgwdzDL0iVCcsU4xLSJADte AOIQ== X-Gm-Message-State: AOAM531HBBy/MrCobRBAzhL3BjYejLWOcWAKTzChy0koRtto5b2FPdCF kVVodenooxi4cnVDWZyi2I41fq8hFshX9Jw4Boeomj+apxw= X-Google-Smtp-Source: ABdhPJwoKv+g2gtNGb7y1eLTD0NVzdAsiGr0x/+qGxqaDdXgygngs+TYkTAhKv/mjQ3WSTlqk8aC1bpSYEXgv9wMz5M= X-Received: by 2002:ab0:7784:: with SMTP id x4mr1466884uar.143.1639759576819; Fri, 17 Dec 2021 08:46:16 -0800 (PST) Received: from 480794996271 named unknown by gmailapi.google.com with HTTPREST; Fri, 17 Dec 2021 11:46:15 -0500 MIME-Version: 1.0 From: Simon Glass In-Reply-To: <20211208165535.3924959-2-sjg@chromium.org> References: <20211208165535.3924959-2-sjg@chromium.org> <20211208165535.3924959-1-sjg@chromium.org> Date: Fri, 17 Dec 2021 11:46:15 -0500 X-Google-Sender-Auth: 9ho0yInYovE9hDRGORfKHuyGha4 Message-ID: Subject: Re: [PATCH 2/2] fdtgrep: Handle an empty output tree To: Simon Glass Cc: Artem Lapkin , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean In strange cases it is possible for fdtgrep to find nothing to output. Typically this means that the resulting SPL device tree is not going to allow anything to boot, but at present the tree is actually invalid, since it only has an END tag in the struct region. The FDT spec requires at least a root node. So add a special case to include at least this, if the FDT_REG_SUPERNODES flag is set. This ensures that grepping an empty tree still produces a valid tree. Also add comments to the enum since it is not completely obvious from the names now. The typical symptom of this problem is a message from binman: pylibfdt error -11: FDT_ERR_BADSTRUCTURE Signed-off-by: Simon Glass --- boot/fdt_region.c | 43 +++++++++++++++++++++++++++++++++++++------ include/fdt_region.h | 1 + 2 files changed, 38 insertions(+), 6 deletions(-) Applied to u-boot-dm/next, thanks!