From patchwork Sun Apr 7 00:10:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadym Kochan X-Patchwork-Id: 1079678 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vZMVvPbP"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44cDFz1jTCz9sPg for ; Sun, 7 Apr 2019 10:00:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 872CF87B5D; Sun, 7 Apr 2019 00:00:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KUKt9eO7zi-p; Sun, 7 Apr 2019 00:00:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 0D22A87B21; Sun, 7 Apr 2019 00:00:14 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9CB4C1BF846 for ; Sun, 7 Apr 2019 00:00:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 99FC223E8D for ; Sun, 7 Apr 2019 00:00:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FLkfcBwZKNgG for ; Sun, 7 Apr 2019 00:00:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by silver.osuosl.org (Postfix) with ESMTPS id 775BB23BC0 for ; Sun, 7 Apr 2019 00:00:11 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id u21so6923263lfu.2 for ; Sat, 06 Apr 2019 17:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=mbvldHr4az0QW6ZdjL2GFQAxOCq0kJsCJlcauJpVX40=; b=vZMVvPbPqYYKC9VLfG6tDpJfpUZ4nuatHYlgsVXuU8b1MXRD/fEaItOHLzFtt+ld0P Mg434HLfchgtRuYTC8fm/qLVN3wy+khPq1ACcLUxeZ2qV2U3zSv4lnHnEB2iK7gSpMw0 0bzWX5UBUNbVYVI1r09BmipbpV0qTf5AjlBaoG6N+HgCMNkOn+p10p0DFdsugte1d2S/ JzUQBNESWAIqTNEa/SMzXPhu98S9sKa/mCwGTvCtcEKte0YdjDcTC1le7V5oZ91UxVud KmP4MJIpSfIdGtHA2yKwL9kPE7AQfdmJlti/4q8VdEGXJRey0BqTgN03zfFd54XOv817 Xl8g== 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; bh=mbvldHr4az0QW6ZdjL2GFQAxOCq0kJsCJlcauJpVX40=; b=A21WIgz8AowhvSHBuAZDXLV5HWFJJjyQXP+b8Die5rmx2a+ZtawrltU203NEPWaWXm f6HErAWyZeIwv/HpOLnbzi9G0lIMQ63/usilkwye7Q41wp8uRD9KPhCrCWESGcRp07WJ o22waUbwB2BV40mHcersHut/qqJSgk7kkBwFgHtVDPwTvF/ctjLeAS83neETXTbTXvJE I06XfDTiij9ff0lHxNLK0KgBsJfKrywN0IEONtP65l6C9I+/ZTfShnbdg074ir1kYRKk 5tSUSbkj1J6oRXjhTFxdrdicEOzu2oL6x/JIyUUt3Mk1YD70q46rrPeR4Av/sjEYGEhD OqRA== X-Gm-Message-State: APjAAAU2u768DWvn5ufdQ/OYuXdJ2s74x5WsNlA84PNXpA2f9YREpxYs mhVk4TKVhXyEcUm+zUfAmYOsGklp X-Google-Smtp-Source: APXvYqxu+gOG8K8ao/KBPB9azK0e7IpLGjYh7/8Ko7C2A6erN7VaoQEH6QuRp/oNC0tEtRev2m93qA== X-Received: by 2002:ac2:50d8:: with SMTP id h24mr10817804lfm.7.1554595209307; Sat, 06 Apr 2019 17:00:09 -0700 (PDT) Received: from vkochan-ThinkPad-T470p.lan ([93.75.250.209]) by smtp.gmail.com with ESMTPSA id x3sm108291lff.21.2019.04.06.17.00.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Apr 2019 17:00:08 -0700 (PDT) From: Vadim Kochan To: buildroot@buildroot.org Date: Sun, 7 Apr 2019 03:10:06 +0300 Message-Id: <20190407001006.12925-1-vadim4j@gmail.com> X-Mailer: git-send-email 2.14.1 Subject: [Buildroot] [RFC 1/1] support/kconfig: Allow to override 'default' config property X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vadim Kochan MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add kconfig patch which allows to apply last visible config's "default" property. This allows to override default value for the same config symbol from other Config.in file, e.g.: system/Config.in: config BR2_TARGET_GENERIC_GETTY_PORT string "TTY port" default "console" help Specify a port to run a getty on. now the same symbol value might be overriden by Config.in from external's one: ${external_vendor_tree}/Config.in: config BR2_TARGET_GENERIC_GETTY_PORT string default "tty1" But why is the purpose of this if the value might be specified by the user in defconfig ? So, it allows for external projects to be more easy used w/o looking into their default defconfigs and specifying these default values in local defconfig, but external tree project might do this automatically by specifying default values like in the above example. And because it is the "default" property the user still can choose the own value. Signed-off-by: Vadim Kochan --- .../22-apply-last-visible-default-property.patch | 20 ++++++++++++++++++++ support/kconfig/patches/series | 1 + support/kconfig/symbol.c | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 support/kconfig/patches/22-apply-last-visible-default-property.patch diff --git a/support/kconfig/patches/22-apply-last-visible-default-property.patch b/support/kconfig/patches/22-apply-last-visible-default-property.patch new file mode 100644 index 0000000000..c57490fe6d --- /dev/null +++ b/support/kconfig/patches/22-apply-last-visible-default-property.patch @@ -0,0 +1,20 @@ +--- kconfig.orig/symbol.c 2019-04-07 03:02:49.263944705 +0300 ++++ kconfig/symbol.c 2019-04-07 03:03:15.367944606 +0300 +@@ -114,14 +114,14 @@ + + static struct property *sym_get_default_prop(struct symbol *sym) + { +- struct property *prop; ++ struct property *prop, *found = NULL; + + for_all_defaults(sym, prop) { + prop->visible.tri = expr_calc_value(prop->visible.expr); + if (prop->visible.tri != no) +- return prop; ++ found = prop; + } +- return NULL; ++ return found; + } + + static struct property *sym_get_range_prop(struct symbol *sym) diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series index e5a6f69d8f..9b3a37c4e6 100644 --- a/support/kconfig/patches/series +++ b/support/kconfig/patches/series @@ -10,3 +10,4 @@ 19-merge_config.sh-add-br2-external-support.patch 20-merge_config.sh-Allow-to-define-config-prefix.patch 21-Avoid-false-positive-matches-from-comment-lines.patch +22-apply-last-visible-default-property.patch diff --git a/support/kconfig/symbol.c b/support/kconfig/symbol.c index f0b2e3b310..337dc55b5a 100644 --- a/support/kconfig/symbol.c +++ b/support/kconfig/symbol.c @@ -114,14 +114,14 @@ struct property *sym_get_env_prop(struct symbol *sym) static struct property *sym_get_default_prop(struct symbol *sym) { - struct property *prop; + struct property *prop, *found = NULL; for_all_defaults(sym, prop) { prop->visible.tri = expr_calc_value(prop->visible.expr); if (prop->visible.tri != no) - return prop; + found = prop; } - return NULL; + return found; } static struct property *sym_get_range_prop(struct symbol *sym)