* [ptxdist] [PATCH 1/3] ptxdist: _get_config_ptx: fix --force logic @ 2019-11-14 16:01 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 0 siblings, 2 replies; 7+ messages in thread From: Roland Hieber @ 2019-11-14 16:01 UTC (permalink / raw) To: ptxdist; +Cc: Roland Hieber When --force is used to override that message, PTXDIST_FORCE is set to true in parse_first(), resulting in the message to be shown. Signed-off-by: Roland Hieber <rhi@pengutronix.de> --- bin/ptxdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ptxdist b/bin/ptxdist index 9394b1739190..cd673a9f3dd6 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -250,7 +250,7 @@ _get_config_ptx() { configfile_version="$(ptxd_get_ptxconf PTXCONF_CONFIGFILE_VERSION)" - if [ $? -ne 0 -a -n "${PTXDIST_FORCE}" ]; then + if [ $? -ne 0 -a -z "${PTXDIST_FORCE}" ]; then ptxd_dialog_msgbox \ "error: the config file '${PTXDIST_PTXCONFIG#${PTXDIST_WORKSPACE}/}'\n" \ " is missing the symbol 'PTXCONF_CONFIGFILE_VERSION',\n" \ -- 2.24.0 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* [ptxdist] [PATCH 2/3] platforms: toolchain: bump default toolchain version 2019-11-14 16:01 [ptxdist] [PATCH 1/3] ptxdist: _get_config_ptx: fix --force logic Roland Hieber @ 2019-11-14 16:01 ` Roland Hieber 2019-11-14 16:01 ` [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs Roland Hieber 1 sibling, 0 replies; 7+ messages in thread From: Roland Hieber @ 2019-11-14 16:01 UTC (permalink / raw) To: ptxdist; +Cc: Roland Hieber Prefer the currently released version for new platforms. Signed-off-by: Roland Hieber <rhi@pengutronix.de> --- platforms/toolchain.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platforms/toolchain.in b/platforms/toolchain.in index c219fe29de25..026e4395c3ad 100644 --- a/platforms/toolchain.in +++ b/platforms/toolchain.in @@ -5,7 +5,7 @@ menu "toolchain " config CROSSCHAIN_VENDOR string prompt "check for specific toolchain vendor" - default "OSELAS.Toolchain-2016.06" + default "OSELAS.Toolchain-2019.09" help Add here an unique vendor string to ensure this project will be build with the correct toolchain. @@ -19,7 +19,7 @@ config CROSSCHAIN_VENDOR config CROSSCHAIN_CHECK string prompt "check for specific gcc version" - default "5.4.0" + default "9.2.1" help PTXdist calls your cross compiler with -dumpversion and compares the output with this string. This should help @@ -47,7 +47,7 @@ if LIBC_GLIBC config GLIBC_VERSION string prompt "glibc version" - default "2.23" + default "2.30" help Specify the glibc version this BSP shall be built with. This information is used to guess the toolchain path if you use "ptxdist toolchain" -- 2.24.0 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs 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 ` Roland Hieber 2019-11-15 14:09 ` Michael Olbrich 1 sibling, 1 reply; 7+ messages in thread From: Roland Hieber @ 2019-11-14 16:01 UTC (permalink / raw) To: ptxdist; +Cc: Roland Hieber 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 + + PTXDIST_FORCE=1 + mkdir -p "$(dirname "${PTXDIST_PTXCONFIG}")" && + echo > "${PTXDIST_PTXCONFIG}" && + do_select ptxconfig "${PTXDIST_PTXCONFIG}" && + 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 + + PTXDIST_FORCE=1 + mkdir -p "$(dirname "${PTXDIST_PLATFORMCONFIG}")" && + echo "PTXCONF_PLATFORM=\"${platformname}\"" > "${PTXDIST_PLATFORMCONFIG}" && + do_select platformconfig "${PTXDIST_PLATFORMCONFIG}" && + do_config oldconfig platform +} -- 2.24.0 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs 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 2019-11-15 14:30 ` Roland Hieber 0 siblings, 1 reply; 7+ messages in thread From: Michael Olbrich @ 2019-11-15 14:09 UTC (permalink / raw) To: ptxdist; +Cc: Roland Hieber 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs 2019-11-15 14:09 ` Michael Olbrich @ 2019-11-15 14:30 ` Roland Hieber 2019-11-16 10:21 ` Michael Olbrich 0 siblings, 1 reply; 7+ messages in thread From: Roland Hieber @ 2019-11-15 14:30 UTC (permalink / raw) To: ptxdist On Fri, Nov 15, 2019 at 03:09:40PM +0100, Michael Olbrich wrote: > 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. Oh, right. > > + > > + PTXDIST_FORCE=1 > > + mkdir -p "$(dirname "${PTXDIST_PTXCONFIG}")" && > > + echo > "${PTXDIST_PTXCONFIG}" && > > touch? Hmm, that was copied from ptxd_lib_init_platform(), but yes, could be a touch too if we stay with 'oldconfig' instead of 'alldefconfig' (see below). > > + do_select ptxconfig "${PTXDIST_PTXCONFIG}" && > > I'd like to avoid that. It should not be necessary with only one config. Ah, I didn't fully realise that ptxdist chooses configs/ptxconfig automatically. Then we don't even need to check for the selected_ptxconfig symlink, I guess? > > + 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. OK. > > + > > + PTXDIST_FORCE=1 > > + mkdir -p "$(dirname "${PTXDIST_PLATFORMCONFIG}")" && > > + echo "PTXCONF_PLATFORM=\"${platformname}\"" > "${PTXDIST_PLATFORMCONFIG}" && > > + do_select platformconfig "${PTXDIST_PLATFORMCONFIG}" && > > same as above. OK. > > + do_config oldconfig platform > > Why oldconfig here and alldefconfig above? Because I sent the patch too hastily before catching the train... :) That was left over from my previous experiments with alldefconfig and oldconfig, see the note below the commit message above. I think I'd stick with 'oldconfig' for now (for both configs), even if that means pressing Enter a lot on all the available packages in ptxconfig. When we ask upfront about the "important" settings before doing 'alldefconfig', we would effectively implement the prompting part of kconfig in ptxdist, and I don't see the point for that. - Roland -- Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de | Steuerwalder Str. 21 | https://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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs 2019-11-15 14:30 ` Roland Hieber @ 2019-11-16 10:21 ` Michael Olbrich 2019-11-27 9:37 ` Roland Hieber 0 siblings, 1 reply; 7+ messages in thread From: Michael Olbrich @ 2019-11-16 10:21 UTC (permalink / raw) To: ptxdist On Fri, Nov 15, 2019 at 03:30:23PM +0100, Roland Hieber wrote: > On Fri, Nov 15, 2019 at 03:09:40PM +0100, Michael Olbrich wrote: > > 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. > > Oh, right. > > > > + > > > + PTXDIST_FORCE=1 > > > + mkdir -p "$(dirname "${PTXDIST_PTXCONFIG}")" && > > > + echo > "${PTXDIST_PTXCONFIG}" && > > > > touch? > > Hmm, that was copied from ptxd_lib_init_platform(), but yes, could be > a touch too if we stay with 'oldconfig' instead of 'alldefconfig' (see > below). > > > > + do_select ptxconfig "${PTXDIST_PTXCONFIG}" && > > > > I'd like to avoid that. It should not be necessary with only one config. > > Ah, I didn't fully realise that ptxdist chooses configs/ptxconfig > automatically. Then we don't even need to check for the > selected_ptxconfig symlink, I guess? You need to test that. Having a selected_* link when something else was explicitly used instead had some strange effects in the past. I'm not sure if that's all fixed. > > > + 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. > > OK. > > > > + > > > + PTXDIST_FORCE=1 > > > + mkdir -p "$(dirname "${PTXDIST_PLATFORMCONFIG}")" && > > > + echo "PTXCONF_PLATFORM=\"${platformname}\"" > "${PTXDIST_PLATFORMCONFIG}" && > > > + do_select platformconfig "${PTXDIST_PLATFORMCONFIG}" && > > > > same as above. > > OK. > > > > + do_config oldconfig platform > > > > Why oldconfig here and alldefconfig above? > > Because I sent the patch too hastily before catching the train... :) > That was left over from my previous experiments with alldefconfig and > oldconfig, see the note below the commit message above. I think I'd > stick with 'oldconfig' for now (for both configs), even if that means > pressing Enter a lot on all the available packages in ptxconfig. When we > ask upfront about the "important" settings before doing 'alldefconfig', > we would effectively implement the prompting part of kconfig in ptxdist, > and I don't see the point for that. The problem with oldconfig is, that it's hard to stop at the important options. How about explicit prompts for stuff like vendor / project and the have an actual defconfig for the rest? It might be nice to have multiple defconfigs to choose from, but I'm reluctant to do that, because without testing it'll be hard to maintain something useful. Michael -- 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH 3/3] ptxdist: add 'init', 'init-platform' commands to create new configs 2019-11-16 10:21 ` Michael Olbrich @ 2019-11-27 9:37 ` Roland Hieber 0 siblings, 0 replies; 7+ messages in thread From: Roland Hieber @ 2019-11-27 9:37 UTC (permalink / raw) To: ptxdist On Sat, Nov 16, 2019 at 11:21:20AM +0100, Michael Olbrich wrote: > On Fri, Nov 15, 2019 at 03:30:23PM +0100, Roland Hieber wrote: > > On Fri, Nov 15, 2019 at 03:09:40PM +0100, Michael Olbrich wrote: > > > 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. > > > > Oh, right. > > > > > > + > > > > + PTXDIST_FORCE=1 > > > > + mkdir -p "$(dirname "${PTXDIST_PTXCONFIG}")" && > > > > + echo > "${PTXDIST_PTXCONFIG}" && > > > > > > touch? > > > > Hmm, that was copied from ptxd_lib_init_platform(), but yes, could be > > a touch too if we stay with 'oldconfig' instead of 'alldefconfig' (see > > below). > > > > > > + do_select ptxconfig "${PTXDIST_PTXCONFIG}" && > > > > > > I'd like to avoid that. It should not be necessary with only one config. > > > > Ah, I didn't fully realise that ptxdist chooses configs/ptxconfig > > automatically. Then we don't even need to check for the > > selected_ptxconfig symlink, I guess? > > You need to test that. Having a selected_* link when something else was > explicitly used instead had some strange effects in the past. I'm not sure > if that's all fixed. > > > > > + 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. > > > > OK. > > > > > > + > > > > + PTXDIST_FORCE=1 > > > > + mkdir -p "$(dirname "${PTXDIST_PLATFORMCONFIG}")" && > > > > + echo "PTXCONF_PLATFORM=\"${platformname}\"" > "${PTXDIST_PLATFORMCONFIG}" && > > > > + do_select platformconfig "${PTXDIST_PLATFORMCONFIG}" && > > > > > > same as above. > > > > OK. > > > > > > + do_config oldconfig platform > > > > > > Why oldconfig here and alldefconfig above? > > > > Because I sent the patch too hastily before catching the train... :) > > That was left over from my previous experiments with alldefconfig and > > oldconfig, see the note below the commit message above. I think I'd > > stick with 'oldconfig' for now (for both configs), even if that means > > pressing Enter a lot on all the available packages in ptxconfig. When we > > ask upfront about the "important" settings before doing 'alldefconfig', > > we would effectively implement the prompting part of kconfig in ptxdist, > > and I don't see the point for that. > > The problem with oldconfig is, that it's hard to stop at the important > options. How about explicit prompts for stuff like vendor / project and the > have an actual defconfig for the rest? Another option that came to my mind: calling oldconfig not via do_config, but generate a new kconfig file that includes just the "important"/"nonverbose" sections of the existing menu, and use kconfig on that. This way we can have kconfig just ask for the "important" stuff without prompting for all the packages, and then afterwards just do a normal alldefconfig on the rest. > It might be nice to have multiple defconfigs to choose from, but I'm > reluctant to do that, because without testing it'll be hard to maintain > something useful. Yeah, that's what I thought too. - Roland -- Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de | Steuerwalder Str. 21 | https://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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-27 9:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2019-11-15 14:30 ` Roland Hieber 2019-11-16 10:21 ` Michael Olbrich 2019-11-27 9:37 ` Roland Hieber
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox