From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: Re: [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs
Date: Fri, 15 Nov 2019 15:09:40 +0100 [thread overview]
Message-ID: <20191115140940.GD1287@pengutronix.de> (raw)
In-Reply-To: <20191114160116.20379-3-rhi@pengutronix.de>
On Thu, Nov 14, 2019 at 05:01:16PM +0100, Roland Hieber wrote:
> Add small helpers to start from scratch with a new ptxconfig and/or
> platformconfig. We do that by creating a standard directory structure,
> then creating a minimal config file, selecting it, and calling oldconfig
> on the created file while setting PTXDIST_FORCE to ignore all errors
> about it not being a valid configuration file.
>
> When initialising a new BSP, create the platformconfig first so the
> selection of the ptxconfig does not complain about a missing
> platformconfig.
>
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
>
> ---
>
> I was also thinking about using 'alldefconfig' instead of 'oldconfig' so
> that PTXdist does not ask so many questions for every package that can
> be enabled in the ptxconfig, but then several important settings get
> lost, like project name, toolchain/compiler version, compiler triplet
> etc. Maybe we can ask those up front instead and pre-prime the config
> accordingly, like it is already done now for the platform name in
> PLATFORM.
> ---
> bin/ptxdist | 19 ++++++++++++
> doc/ref_parameter.inc | 5 ++++
> scripts/lib/ptxd_lib_init.sh | 57 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 81 insertions(+)
> create mode 100644 scripts/lib/ptxd_lib_init.sh
>
> diff --git a/bin/ptxdist b/bin/ptxdist
> index cd673a9f3dd6..e1e0f5f7503d 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -938,6 +938,9 @@ PTXdist $(printf "%-24s" ${PTXDIST_VERSION_FULL}) Build System for Embedded Linu
>
> Setup and Project Actions:
>
> + init [<platformname>] initialise a new BSP in the current directory
> + init-platform [<name>] initialise a new platform in the current BSP
> +
> menu enter main control menu
>
> setup setup per-user preferences
> @@ -2035,6 +2038,22 @@ EOF
> do_${cmd}
> exit
> ;;
> + init)
> + ptxd_lib_init_platform "$@" &&
> + ptxd_lib_init &&
> + ptxd_dialog_msgbox \
> + "Adapt the new BSP to your needs by running:\n\n" \
> + " ptxdist menuconfig\n" \
> + " ptxdist menuconfig platform"
> + exit
> + ;;
> + init-platform)
> + ptxd_lib_init_platform "$@" &&
> + ptxd_dialog_msgbox \
> + "Adapt the new platform to your needs by running:\n\n" \
> + " ptxdist menuconfig platform"
> + exit
> + ;;
> image)
> if [ ${#} -eq 0 ]; then
> echo "No image given."
> diff --git a/doc/ref_parameter.inc b/doc/ref_parameter.inc
> index 74689b9d3cff..29203713f879 100644
> --- a/doc/ref_parameter.inc
> +++ b/doc/ref_parameter.inc
> @@ -1,6 +1,11 @@
> Setup and Project Actions
> ~~~~~~~~~~~~~~~~~~~~~~~~~
>
> +``init <platformname>``, ``init-platform <platformname>``
> + initialise a new BSP in the current directory, or add a new platform to the
> + current BSP. This action creates all required config files, and then calls
> + *menuconfig* on them, and can be used to start a new BSP from scratch.
> +
> ``menu``
> this starts a dialog based frontend for those who do not like typing
> commands. It will gain us access to the most common parameters to
> diff --git a/scripts/lib/ptxd_lib_init.sh b/scripts/lib/ptxd_lib_init.sh
> new file mode 100644
> index 000000000000..a5ff71f557f9
> --- /dev/null
> +++ b/scripts/lib/ptxd_lib_init.sh
> @@ -0,0 +1,57 @@
> +#!/bin/bash
> +
> +ptxd_lib_init() {
> + PTXDIST_PTXCONFIG="configs/ptxconfig"
> +
> + if [ -z "${PTXDIST_FORCE}" ] && [ -e "${PTXDIST_PTXCONFIG}" ]; then
> + echo -e \
> + "error: the file '${PTXDIST_PTXCONFIG}' already exists,\n" \
> + " use '--force' to overwrite it."
> + return 1
> + fi
> +
> + if [ -z "${PTXDIST_FORCE}" ] && [ -e "${PTXDIST_PTXCONFIG_DEFAULT}" ]; then
> + ptxd_dialog_msgbox \
> + "error: the file '${PTXDIST_PTXCONFIG_DEFAULT}' already exists,\n" \
> + " use '--force' to overwrite it."
> + return 1
> + fi
Check with '-h' as well, at least for PTXDIST_PTXCONFIG_DEFAULT. '-e' does
not match on broken symlinks.
> +
> + PTXDIST_FORCE=1
> + mkdir -p "$(dirname "${PTXDIST_PTXCONFIG}")" &&
> + echo > "${PTXDIST_PTXCONFIG}" &&
touch?
> + do_select ptxconfig "${PTXDIST_PTXCONFIG}" &&
I'd like to avoid that. It should not be necessary with only one config.
> + do_config alldefconfig
> +}
> +
> +ptxd_lib_init_platform() {
> + local platformname="$1"
> + if [ -z "$platformname" ]; then
> + read -p 'New platform name? ' platformname
> + fi
> + if [ -z "$platformname" ]; then
> + echo "Platform name cannot be empty."
> + return 1
> + fi
> + PTXDIST_PLATFORMCONFIG="configs/platform-${platformname}/platformconfig"
> +
> + if [ -z "${PTXDIST_FORCE}" ] && [ -e "${PTXDIST_PLATFORMCONFIG}" ]; then
> + ptxd_dialog_msgbox \
> + "error: the file '${PTXDIST_PLATFORMCONFIG}' already exists,\n" \
> + " use '--force' to overwrite it."
> + return 1
> + fi
> +
> + if [ -z "${PTXDIST_FORCE}" ] && [ -e "${PTXDIST_PLATFORMCONFIG_DEFAULT}" ]; then
> + ptxd_dialog_msgbox \
> + "error: the file '${PTXDIST_PLATFORMCONFIG_DEFAULT}' already exists,\n" \
> + " use '--force' to overwrite it."
> + return 1
> + fi
see above.
> +
> + PTXDIST_FORCE=1
> + mkdir -p "$(dirname "${PTXDIST_PLATFORMCONFIG}")" &&
> + echo "PTXCONF_PLATFORM=\"${platformname}\"" > "${PTXDIST_PLATFORMCONFIG}" &&
> + do_select platformconfig "${PTXDIST_PLATFORMCONFIG}" &&
same as above.
> + do_config oldconfig platform
Why oldconfig here and alldefconfig above?
Michael
> +}
> --
> 2.24.0
>
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
next prev parent reply other threads:[~2019-11-15 14:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 16:01 [ptxdist] [PATCH 1/3] ptxdist: _get_config_ptx: fix --force logic Roland Hieber
2019-11-14 16:01 ` [ptxdist] [PATCH 2/3] platforms: toolchain: bump default toolchain version Roland Hieber
2019-11-14 16:01 ` [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs Roland Hieber
2019-11-15 14:09 ` Michael Olbrich [this message]
2019-11-15 14:30 ` Roland Hieber
2019-11-16 10:21 ` Michael Olbrich
2019-11-27 9:37 ` Roland Hieber
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=20191115140940.GD1287@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ptxdist@pengutronix.de \
--cc=rhi@pengutronix.de \
/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