From patchwork Mon Sep 4 20:12:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pantelis Antoniou X-Patchwork-Id: 809825 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="KzOnCvM3"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xmLgd5cSRz9t2R for ; Tue, 5 Sep 2017 06:15:25 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 79879C21F6E; Mon, 4 Sep 2017 20:13:33 +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_NONE, 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 3044AC21F4B; Mon, 4 Sep 2017 20:13:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DAA66C21EEC; Mon, 4 Sep 2017 20:12:59 +0000 (UTC) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by lists.denx.de (Postfix) with ESMTPS id C79A6C21C2F for ; Mon, 4 Sep 2017 20:12:55 +0000 (UTC) Received: by mail-wm0-f50.google.com with SMTP id v2so10137692wmf.0 for ; Mon, 04 Sep 2017 13:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xp207IB7jnVxPcialh/VExt99MWJvpeaRHq1JdjyR4w=; b=KzOnCvM3jTkkxmwlS0SeMuipevlwSX3FlqbiHQHZyTkVYxixWOzcF+PQlNL26bd4Ze ncZq58SelUbGUHWjK4cmBgo5KeNZh2DS1wQHx8LvTRK5I0PBukfoKviFGZNoclzyprkz d7StpAJ7z/2NL4sRbMUvqPIReKblB4NvMqhxk= 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:in-reply-to :references; bh=xp207IB7jnVxPcialh/VExt99MWJvpeaRHq1JdjyR4w=; b=B++/6mwhO+UZCRFMACiaIXTqTmkCm2/Carf7Ya7j7s/iLxwlqEWmLFRM5c7zif2PH4 jr8a/6SYaWi5Mb4s8+TRTJwcbTfUdH0FV7hVzhC4ozoUwpIXDi96pS97r5bpVlm0yY65 UyveA9+1fWYeRUgEkJGQgRjbBWmKzUSPgYaVYbEXhNBOFO4Yh5fe3dpkD0TcfQYHtAU2 s8wR1h26obN05kQFb3YoSNHAWq9VUAiJMNaWVQ3tscj61U34LS8iNKeLM9Yocz3Kagq+ /UvZGP2rdtj6y02n9MrtcBtjS+ZLGa6hYvTRkRb0r7PXDXrF73MMheCPaX/BzrpTAbX8 5bIw== X-Gm-Message-State: AHPjjUirunCldvXE+qFpTDIxOH7HzasqbwN3BIgGVCowH4qSAPG+1oyA D5OlGQfXuu9M6D58 X-Google-Smtp-Source: ADKCNb73bBFqAy1Yw75e/2QD9CbYBkxGNoFREkYUgJ75O1m0eoweU0DduiztvuXB9/JlS7y2z4HmBQ== X-Received: by 10.28.154.209 with SMTP id c200mr1143783wme.167.1504555975502; Mon, 04 Sep 2017 13:12:55 -0700 (PDT) Received: from localhost.localdomain ([195.97.110.117]) by smtp.gmail.com with ESMTPSA id u8sm3720435wrc.92.2017.09.04.13.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Sep 2017 13:12:55 -0700 (PDT) From: Pantelis Antoniou To: Tom Rini Date: Mon, 4 Sep 2017 23:12:11 +0300 Message-Id: <1504555943-12893-3-git-send-email-pantelis.antoniou@konsulko.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504555943-12893-1-git-send-email-pantelis.antoniou@konsulko.com> References: <1504555943-12893-1-git-send-email-pantelis.antoniou@konsulko.com> Cc: Marek Vasut , Pantelis Antoniou , Tero Kristo , u-boot@lists.denx.de, Maxime Ripard , Stefan Roese , Alan Ott Subject: [U-Boot] [PATCH v3 02/14] fdt: Introduce helper method fdt_overlay_apply_verbose() 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" Introduce fdt_overlay_apply_verbose, a method that applies an overlay but in the case of an error produces a helpful message. In addition if a base tree is found to be missing the __symbols__ node the message will point out that the probable reason is that the base tree was miscompiled without the -@ option. Signed-off-by: Pantelis Antoniou Acked-by: Simon Glass Acked-by: Simon Glass --- common/fdt_support.c | 31 +++++++++++++++++++++++++++++++ include/fdt_support.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/common/fdt_support.c b/common/fdt_support.c index 916a448..f4f9543 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1655,3 +1655,34 @@ int fdt_fixup_display(void *blob, const char *path, const char *display) } return toff; } + +#ifdef CONFIG_OF_LIBFDT_OVERLAY +/** + * fdt_overlay_apply_verbose - Apply an overlay with verbose error reporting + * + * @fdt: ptr to device tree + * @fdto: ptr to device tree overlay + * + * Convenience function to apply an overlay and display helpful messages + * in the case of an error + */ +int fdt_overlay_apply_verbose(void *fdt, void *fdto) +{ + int err; + bool has_symbols; + + err = fdt_path_offset(fdt, "/__symbols__"); + has_symbols = err >= 0; + + err = fdt_overlay_apply(fdt, fdto); + if (err < 0) { + printf("failed on fdt_overlay_apply(): %s\n", + fdt_strerror(err)); + if (!has_symbols) { + printf("base fdt does did not have a /__symbols__ node\n"); + printf("make sure you've compiled with -@\n"); + } + } + return err; +} +#endif diff --git a/include/fdt_support.h b/include/fdt_support.h index 5ef78cc..2bca4d7 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -264,6 +264,8 @@ int arch_fixup_memory_node(void *blob); int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, u32 height, u32 stride, const char *format); +int fdt_overlay_apply_verbose(void *fdt, void *fdto); + #endif /* ifdef CONFIG_OF_LIBFDT */ #ifdef USE_HOSTCC