mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH 5/7] ptxdist: implement 'defconfig' commands for kconfig packages
Date: Tue, 22 Sep 2020 00:17:26 +0200	[thread overview]
Message-ID: <20200921221728.3229-5-rhi@pengutronix.de> (raw)
In-Reply-To: <20200921221728.3229-1-rhi@pengutronix.de>

The current process to generate a kernel .config file from a defconfig
is a bit cumbersome:

  $ ptxdist extract kernel
  $ cd platform-foo/build-target/linux-<version>
  $ make ARCH=... CROSS_COMPILE=... foo_defconfig
  $ cp .config ../../../configs/platform-foo/kernelconfig

All kernel and barebox rules and templates already support the
<package>_%config target since commit b0f9f2fe33ca9027a554 (2020-08-07,
"barebox, kernel: enable use of {allyes, allno, allmod, alldef,
rand}config"), so we only need to wire them into the command line
parser, and then we can easily get a defconfig like this:

  $ ptxdist defconfig kernel                # most ARCHs
  $ ptxdist imx_v6_v7_defconfig kernel      # e.g. with ARCH=arm

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 bin/ptxdist           | 15 ++++++++++++++-
 doc/ref_parameter.rst |  9 +++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 0d5e4328e1d6..c2cf744f70a8 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -705,6 +705,9 @@ Setup and Project Actions:
 
   menuconfig barebox		configure the bootloader Barebox
 
+  [<prefix>]defconfig [<pkg>]	generate a default config file for <pkg>
+				e.g.: ptxdist multi_v7_defconfig kernel
+
   oldconfig			run 'make oldconfig' on ptxconfig file
   allmodconfig			run 'make allmodconfig' on ptxconfig file
   allyesconfig			run 'make allyesconfig' on ptxconfig file
@@ -1267,6 +1270,16 @@ do_config()
 	case "${config}" in
 	menuconfig|nconfig|oldconfig|all*config|randconfig)
 		;;
+	*defconfig)
+		case "${part}" in
+			"ptx"|"ptxdist"|""|"setup"|"platform"|"board"|"user"|"collection")
+				echo
+				echo "${PTXDIST_LOG_PROMPT}error: cannot do a '${config}' for part '${part}'"
+				echo
+				exit 1
+				;;
+		esac
+		;;
 	*)
 		echo
 		echo "${PTXDIST_LOG_PROMPT}error: invalid use of '${FUNCNAME} ${@}'"
@@ -1625,7 +1638,7 @@ parse_second()
 
 ######## *config, *setup, toolchain
 
-		menuconfig|nconfig|oldconfig|allmodconfig|allyesconfig|allnoconfig|alldefconfig|randconfig)
+		menuconfig|nconfig|oldconfig|allmodconfig|allyesconfig|allnoconfig|*defconfig|randconfig)
 			do_config "${cmd}" "${@}"
 			exit
 			;;
diff --git a/doc/ref_parameter.rst b/doc/ref_parameter.rst
index 1d54fa4b4428..ac1e06c5335e 100644
--- a/doc/ref_parameter.rst
+++ b/doc/ref_parameter.rst
@@ -95,6 +95,15 @@ Setup and Project Actions
   functionality as ``menuconfig``. It can be used instead of ``menuconfig``
   for all the component described above.
 
+``[<prefix>]defconfig [<package>]``
+  generate a default config file for kconfig-based packages (kernel, barebox).
+  The ``[<prefix>]`` can be given optionally to use a specific defconfig file,
+  which depends on the respective package and the architecture.
+  Examples::
+
+    $ ptxdist defconfig kernel                # most ARCHs
+    $ ptxdist imx_v6_v7_defconfig kernel      # e.g. for ARCH=arm
+
 ``oldconfig [<component>]``, ``allmodconfig [<component>]``, ``allyesconfig [<component>]``, ``allnoconfig [<component>]``, ``alldefconfig [<component>]``, ``randconfig [<component>]``
   this action will run the corresponding kconfig action for the specified
   component. ``oldconfig`` will prompt for all new options.
-- 
2.28.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

  parent reply	other threads:[~2020-09-21 22:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 22:17 [ptxdist] [PATCH 1/7] kernel: bump default version and md5sum Roland Hieber
2020-09-21 22:17 ` [ptxdist] [PATCH 2/7] platform: bump default toolchain version Roland Hieber
2020-09-21 22:17 ` [ptxdist] [PATCH 3/7] kernel, barebox: add descriptive help text for md5sum config options Roland Hieber
2020-09-21 22:17 ` [ptxdist] [PATCH 4/7] image-root-tgz: build by default, and add a help text Roland Hieber
2020-09-22  8:17   ` Michael Olbrich
2020-09-22  9:08     ` Roland Hieber
2020-09-21 22:17 ` Roland Hieber [this message]
2020-09-22  8:26   ` [ptxdist] [PATCH 5/7] ptxdist: implement 'defconfig' commands for kconfig packages Michael Olbrich
2020-09-21 22:17 ` [ptxdist] [PATCH 6/7] rules: move magic symbol into rules/ptxdist-version.in Roland Hieber
2020-09-21 22:17 ` [ptxdist] [PATCH 7/7] ptxdist: add 'init' commands to create new configs Roland Hieber
2020-09-22  9:46   ` Michael Olbrich
2020-09-23 12:22     ` Roland Hieber
2020-09-24 13:42       ` Michael Olbrich
2020-09-27 21:46         ` Roland Hieber
2020-09-22  8:13 ` [ptxdist] [PATCH 1/7] kernel: bump default version and md5sum Michael Olbrich
2020-09-22  9:17   ` 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=20200921221728.3229-5-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@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