<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to add custom config lines to a Kconfig fragment?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123116/how-to-add-custom-config-lines-to-a-kconfig-fragment</link><description>Using NCS 3.0.2 I have multiple build variants of my project, based on the same custom PCB but with different parts fitted, and different functionality. So I have create different build configs with custom dts files - this works OK. 
 I would like to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Jul 2025 07:35:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123116/how-to-add-custom-config-lines-to-a-kconfig-fragment" /><item><title>RE: How to add custom config lines to a Kconfig fragment?</title><link>https://devzone.nordicsemi.com/thread/543290?ContentTypeID=1</link><pubDate>Wed, 23 Jul 2025 07:35:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc4e8a75-15c5-4a8d-bc76-cf5ab3d45e99</guid><dc:creator>Hieu</dc:creator><description>[quote user="Nick_RA"]What you seem to have done is made a config for the application; what I need to do is add extra fragments to different build configurations so each build has its own Kconfig add-on.[/quote]
&lt;p&gt;Ah I see. Adding a new Kconfig is exactly what the snippet you shared did, so I thought that was the intention.&lt;/p&gt;
&lt;p&gt;If you want Kconfig fragment, you can just create a new .conf file with similar syntax to the familiar prj.conf, like this.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/c348718_5F00_custom_5F00_kconfig_5F00_250723_5F00_01.zip"&gt;devzone.nordicsemi.com/.../c348718_5F00_custom_5F00_kconfig_5F00_250723_5F00_01.zip&lt;/a&gt;&lt;/p&gt;
[quote user="Nick_RA"]I wonder what you mean by wrong file &lt;em&gt;type&lt;/em&gt;? Does it need to be a particular name and extension?[/quote]
&lt;p&gt;Yes.&amp;nbsp;Both file name and extension are significant to the build system. Please refer to both NCS and Zephyr application development guides:&lt;/p&gt;
&lt;p&gt;NCS:&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-3.0.2/page/nrf/app_dev.html"&gt;Application development&lt;br /&gt;&lt;/a&gt;Zephyr:&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-3.0.2/page/zephyr/develop/index.html"&gt;Developing with Zephyr&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom config lines to a Kconfig fragment?</title><link>https://devzone.nordicsemi.com/thread/543238?ContentTypeID=1</link><pubDate>Tue, 22 Jul 2025 16:39:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dac3912-f6e3-4f64-95dc-bae12e6c7e5b</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;I wonder what you mean by wrong file &lt;em&gt;type&lt;/em&gt;? Does it need to be a particular name and extension?&lt;/p&gt;
&lt;p&gt;What you seem to have done is made a config for the application; what I need to do is add extra fragments to different build configurations so each build has its own Kconfig add-on.&lt;/p&gt;
&lt;p&gt;I saved your config into a text file, then added it to a test build configuration as an Extra Kconfig fragment like so:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;source &amp;quot;Kconfig.zephyr&amp;quot;

menu &amp;quot;Custom Kconfig file&amp;quot;

config FOO
  bool &amp;quot;foobar&amp;quot;
  default n

endmenu&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/customconfig.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but this gives the same result.&lt;/p&gt;
&lt;p&gt;(by the way, are the source, menu/endmenu required?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom config lines to a Kconfig fragment?</title><link>https://devzone.nordicsemi.com/thread/543169?ContentTypeID=1</link><pubDate>Tue, 22 Jul 2025 12:12:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81ad3e57-385a-42a2-ad4a-2441b51df49a</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Nick_RA,&lt;/p&gt;
&lt;p&gt;I wonder if you are using the wrong file type. Here is a setup I just tested in NCS v3.0.2 based on just Hello World sample.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/c348718_5F00_custom_5F00_kconfig_5F00_250722_5F00_01.zip"&gt;devzone.nordicsemi.com/.../c348718_5F00_custom_5F00_kconfig_5F00_250722_5F00_01.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>