Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Edwards <grant.b.edwards@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] Project configuration management
Date: Mon, 4 Apr 2016 19:09:53 +0000 (UTC)	[thread overview]
Message-ID: <ndue61$oov$1@ger.gmane.org> (raw)
In-Reply-To: 24791852-D548-43A1-8E3D-C39D69F479BB@vestiacom.com

On 2016-04-04, Mateusz S?upny <mateusz.slupny@vestiacom.com> wrote:

> We are using buildroot for building a series of projects. What I
> feel is missing in buildroot is a way to store different
> configurations in scope of a single project. For example, we would
> like to prepare three types of builds, let's name them "Release",
> that is the basic build, "Develop", that is a Release build +
> dropbear + some other utilities, and "Extra", that contains all
> configuration options from Develop + some additional tools (gdb,
> valgrind, etc.). To achieve that, we have to maintain total of
> (number of projects) x (number of build types) different
> configuration files that are almost identical.

To address this issue, I use a single default config file for the
project, and then a build shell script that makes modifications to the
.config file for each "build type":

# bash functions used to manipulate linux kernel-style .config
# files.

function SyncConfig()
{
    yes '' | $Make oldconfig >/dev/null
}

function UnsetValue()
{
    dosync=y
    test "$1" = '-n' && { dosync=n; shift; }
    Variable="$1"
    echo "UnsetValue $Variable"
    sed -i "s/^${Variable}=.*/# ${Variable} is not set/g" .config
    test $dosync = y && SyncConfig
    return 0
}

function SetValue()
{
    dosync=y
    test "$1" = '-n' && { dosync=n; shift; }
    Variable="$1"
    # default value is 'y'
    Value="${2-y}"
    echo "SetValue $Variable $Value"
    # if value isn't 'y', then put it in double quotes
    test "$Value" != y && Value="\"$Value\""
    # escape any slashes
    Value=${Value//\//\\\/}
    sed -i "s/^${Variable}=.*/${Variable}=${Value}/g" .config
    sed -i "s/^# ${Variable} is not set.*/${Variable}=${Value}/g" .config
    test $dosync = y && SyncConfig
    return 0
}


-- 
Grant Edwards               grant.b.edwards        Yow! It's a lot of fun
                                  at               being alive ... I wonder if
                              gmail.com            my bed is made?!?

      parent reply	other threads:[~2016-04-04 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04 13:55 [Buildroot] Project configuration management Mateusz Słupny
2016-04-04 18:44 ` Thomas Petazzoni
2016-04-04 20:45   ` Arnout Vandecappelle
2016-04-05 11:14     ` Mateusz Słupny
2016-04-06 14:52     ` Thomas Petazzoni
2016-04-06 16:01       ` Gustavo Zacarias
2016-04-04 19:09 ` Grant Edwards [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ndue61$oov$1@ger.gmane.org' \
    --to=grant.b.edwards@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox