* .config and "make" / turning off all debug @ 2023-02-21 16:16 Hanasaki Jiji 2023-02-22 0:17 ` Randy Dunlap 0 siblings, 1 reply; 5+ messages in thread From: Hanasaki Jiji @ 2023-02-21 16:16 UTC (permalink / raw) To: LIST - Linux Kernel Is there a command line parameter to Make that will disable anything that results in a debuggable kernel? Is there a tool that will modify .config removing anything that will result in a debuggable kernel? Thank you. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: .config and "make" / turning off all debug 2023-02-21 16:16 .config and "make" / turning off all debug Hanasaki Jiji @ 2023-02-22 0:17 ` Randy Dunlap 2023-02-23 0:21 ` Hanasaki Jiji 0 siblings, 1 reply; 5+ messages in thread From: Randy Dunlap @ 2023-02-22 0:17 UTC (permalink / raw) To: Hanasaki Jiji, LIST - Linux Kernel; +Cc: Linux Kbuild mailing list [-- Attachment #1: Type: text/plain, Size: 3769 bytes --] Hi-- On 2/21/23 08:16, Hanasaki Jiji wrote: > Is there a command line parameter to Make that will disable anything > that results in a debuggable kernel? No. > Is there a tool that will modify .config removing anything that will > result in a debuggable kernel? We don't have a nice, clean, packaged way to do this. It also depends on what you mean by DEBUG. I would first disable CONFIG_COMPILE_TEST, then decide if you want TRACE/TRACING features disabled or enabled. Also decide whether you want DEBUGFS options enabled or disabled. There are a couple of things that you can try. YMMV. Neither of these is a complete solution; option 2 requires the user to update the list of config options that should be disabled as needed. (1) Use a script to convert all occurrences of /CONFIG.*DEBUG=y/ to /# CONFIG.*DEBUG is not set/. This misses a few CONFIG options where "DEBUG" is toward the middle of the CONFIG option, like CONFIG_DEBUG_RSEQ, CONFIG_DEBUG_TEST_DRIVER_REMOVE, CONFIG_C710_DEBUG_ASSUMPTIONS, CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING, CONFIG_DRM_DEBUG_xyzzz (a few like this), CONFIG_DEBUG_KERNEL_DC, CONFIG_NOUVEAU_DEBUG_xyzzz (a few), CONFIG_DRM_I915_DEBUG_xyzzz (a few), CONFIG_SND_SOC_SOF_xyzzz (several), CONFIG_HFI1_DEBUG_SDMA_ORDER, CONFIG_AFS_DEBUG_CURSOR, CONFIG_DEBUG_NET, lots of entries in the Kernel Hacking menu. Then there are several SELFTEST config options, but they are not always spelled "SELFTEST"; they might just be spelled TEST or TESTS. I'll attach a Perl script (from 2009) that begins the work on option 1, but I haven't used it since forever. (2) Make a "mini.config" file that contains a list of all the options that you want to have set in a certain way (can be either enabled or disabled). Then use $ KCONFIG_ALLCONFIG=your.mini.config make allmodconfig This is the documented and supported way. It is documented in Documentation/kbuild/kconfig.rst: <begin quote> KCONFIG_ALLCONFIG ----------------- (partially based on lkml email from/by Rob Landley, re: miniconfig) -------------------------------------------------- The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also use the environment variable KCONFIG_ALLCONFIG as a flag or a filename that contains config symbols that the user requires to be set to a specific value. If KCONFIG_ALLCONFIG is used without a filename where KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config` checks for a file named "all{yes/mod/no/def/random}.config" (corresponding to the `*config` command that was used) for symbol values that are to be forced. If this file is not found, it checks for a file named "all.config" to contain forced values. This enables you to create "miniature" config (miniconfig) or custom config files containing just the config symbols that you are interested in. Then the kernel config system generates the full .config file, including symbols of your miniconfig file. This 'KCONFIG_ALLCONFIG' file is a config file which contains (usually a subset of all) preset config symbols. These variable settings are still subject to normal dependency checks. Examples:: KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig or:: KCONFIG_ALLCONFIG=mini.config make allnoconfig or:: make KCONFIG_ALLCONFIG=mini.config allnoconfig These examples will disable most options (allnoconfig) but enable or disable the options that are explicitly listed in the specified mini-config files. <end quote> Note that this only works with "make allyesconfig/allmodconfig/allnoconfig/randconfig" variants. You could try it and see if it works for you. I'll also attach a sample "disable.all.debug.config" file for this option. You will need to update this CONFIG options list continually. HTH. Good luck. -- ~Randy [-- Attachment #2: config.debug.off --] [-- Type: text/plain, Size: 575 bytes --] #! /usr/bin/perl # config.debug.off: change all /CONFIG_xyz_DEBUG=y/ to /# CONFIG_xyz_DEBUG is not set/ # Randy Dunlap, April-2009 # $VER = "001"; use Getopt::Std; getopts("v"); my $changecount = 0; sub usage() { print "usage: config.debug.off [-v] < config.file1 > config.file2 [ver. $VER]\n"; print " -v : verbose\n"; exit (1); } ##if ($opt_v) { } LINE: while ($line = <STDIN>) { chomp $line; if ($line =~ /^(CONFIG.*_DEBUG)=y/) { print "# $1 is not set\n"; $changecount++; } else { print "$line\n"; } } printf STDERR "$changecount lines changed\n"; [-- Attachment #3: disable.all.debug.config --] [-- Type: application/x-config, Size: 6970 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: .config and "make" / turning off all debug 2023-02-22 0:17 ` Randy Dunlap @ 2023-02-23 0:21 ` Hanasaki Jiji 2023-02-23 0:29 ` Randy Dunlap 0 siblings, 1 reply; 5+ messages in thread From: Hanasaki Jiji @ 2023-02-23 0:21 UTC (permalink / raw) To: LIST - Linux Kernel, Linux Kbuild mailing list Hello, Thank you so much for helping out. Might the below accomplish the task? cat f | grep -v DEBUG| grep -v TRACE | grep -v TRACING > newConfigFileWithout On Tue, Feb 21, 2023 at 7:17 PM Randy Dunlap <rdunlap@infradead.org> wrote: > > Hi-- > > On 2/21/23 08:16, Hanasaki Jiji wrote: > > Is there a command line parameter to Make that will disable anything > > that results in a debuggable kernel? > > No. > > > Is there a tool that will modify .config removing anything that will > > result in a debuggable kernel? > > We don't have a nice, clean, packaged way to do this. > > It also depends on what you mean by DEBUG. I would first disable > CONFIG_COMPILE_TEST, then decide if you want TRACE/TRACING features > disabled or enabled. Also decide whether you want DEBUGFS > options enabled or disabled. > > There are a couple of things that you can try. YMMV. > > Neither of these is a complete solution; option 2 requires > the user to update the list of config options that should be disabled > as needed. > > (1) Use a script to convert all occurrences of > /CONFIG.*DEBUG=y/ to /# CONFIG.*DEBUG is not set/. > > This misses a few CONFIG options where "DEBUG" is toward the middle > of the CONFIG option, like CONFIG_DEBUG_RSEQ, CONFIG_DEBUG_TEST_DRIVER_REMOVE, > CONFIG_C710_DEBUG_ASSUMPTIONS, CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING, > CONFIG_DRM_DEBUG_xyzzz (a few like this), CONFIG_DEBUG_KERNEL_DC, > CONFIG_NOUVEAU_DEBUG_xyzzz (a few), CONFIG_DRM_I915_DEBUG_xyzzz (a few), > CONFIG_SND_SOC_SOF_xyzzz (several), CONFIG_HFI1_DEBUG_SDMA_ORDER, > CONFIG_AFS_DEBUG_CURSOR, CONFIG_DEBUG_NET, lots of entries in the > Kernel Hacking menu. Then there are several SELFTEST config options, > but they are not always spelled "SELFTEST"; they might just be spelled > TEST or TESTS. > > I'll attach a Perl script (from 2009) that begins the work on option 1, > but I haven't used it since forever. > > (2) Make a "mini.config" file that contains a list of all the options that you > want to have set in a certain way (can be either enabled or disabled). > Then use > $ KCONFIG_ALLCONFIG=your.mini.config make allmodconfig > > This is the documented and supported way. It is documented in > Documentation/kbuild/kconfig.rst: > > <begin quote> > > KCONFIG_ALLCONFIG > ----------------- > (partially based on lkml email from/by Rob Landley, re: miniconfig) > > -------------------------------------------------- > > The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also > use the environment variable KCONFIG_ALLCONFIG as a flag or a filename > that contains config symbols that the user requires to be set to a > specific value. If KCONFIG_ALLCONFIG is used without a filename where > KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config` > checks for a file named "all{yes/mod/no/def/random}.config" > (corresponding to the `*config` command that was used) for symbol values > that are to be forced. If this file is not found, it checks for a > file named "all.config" to contain forced values. > > This enables you to create "miniature" config (miniconfig) or custom > config files containing just the config symbols that you are interested > in. Then the kernel config system generates the full .config file, > including symbols of your miniconfig file. > > This 'KCONFIG_ALLCONFIG' file is a config file which contains > (usually a subset of all) preset config symbols. These variable > settings are still subject to normal dependency checks. > > Examples:: > > KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig > > or:: > > KCONFIG_ALLCONFIG=mini.config make allnoconfig > > or:: > > make KCONFIG_ALLCONFIG=mini.config allnoconfig > > These examples will disable most options (allnoconfig) but enable or > disable the options that are explicitly listed in the specified > mini-config files. > > <end quote> > > Note that this only works with "make allyesconfig/allmodconfig/allnoconfig/randconfig" > variants. You could try it and see if it works for you. > > I'll also attach a sample "disable.all.debug.config" file for this option. > You will need to update this CONFIG options list continually. > > HTH. Good luck. > > -- > ~Randy ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: .config and "make" / turning off all debug 2023-02-23 0:21 ` Hanasaki Jiji @ 2023-02-23 0:29 ` Randy Dunlap 2023-02-24 0:09 ` Hanasaki Jiji 0 siblings, 1 reply; 5+ messages in thread From: Randy Dunlap @ 2023-02-23 0:29 UTC (permalink / raw) To: Hanasaki Jiji, LIST - Linux Kernel, Linux Kbuild mailing list Hi, On 2/22/23 16:21, Hanasaki Jiji wrote: > Hello, > > Thank you so much for helping out. > > Might the below accomplish the task? > > cat f | grep -v DEBUG| grep -v TRACE | grep -v TRACING > newConfigFileWithout It will disable CONFIG_DEBUG_FS. That's OK if that's what you want to do. But this will just give you something to begin with. It will need more work. There are lots of config options that use "select" to force another config option to be set/enabled. Even if you disable an option and you have one of these other options set/enabled, they will just enable the DEBUG/TRACE options again for you. When you find one of these, they pretty much have to be checked and tuned one-by-one. It can take a lot of time to do that. -- ~Randy https://people.kernel.org/tglx/notes-about-netiquette ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: .config and "make" / turning off all debug 2023-02-23 0:29 ` Randy Dunlap @ 2023-02-24 0:09 ` Hanasaki Jiji 0 siblings, 0 replies; 5+ messages in thread From: Hanasaki Jiji @ 2023-02-24 0:09 UTC (permalink / raw) To: LIST - Linux Kernel, Linux Kbuild mailing list CONFIG_DEBUG_FS appears to be a relevant to kernel development. So, turning that off should be fine for me. The below are from grep SELECT. Looking each up, none seem to enable DEBUG/TRACE elsewhere. However I am still somewhat a newbie. CONFIG_PROCESSOR_SELECT= CONFIG_B44_PCI_AUTOSELECT= CONFIG_B44_PCICORE_AUTOSELECT= CONFIG_B43_PCI_AUTOSELECT= CONFIG_B43_PCICORE_AUTOSELECT= CONFIG_B43LEGACY_PCI_AUTOSELECT= CONFIG_B43LEGACY_PCICORE_AUTOSELECT= CONFIG_MEDIA_SUBDRV_AUTOSELECT= CONFIG_INTEL_SPEED_SELECT_INTERFACE= If interest are the keys for grep LEGACY or _LEGACY which, semantically, I would hope to be able to turnoff/disable on hardware more current than perhaps 3-5 years ago or a KVM or VirtualBox VM. Your thoughts and input are appreciated. Thank you, On Wed, Feb 22, 2023 at 7:29 PM Randy Dunlap <rdunlap@infradead.org> wrote: > > Hi, > > On 2/22/23 16:21, Hanasaki Jiji wrote: > > Hello, > > > > Thank you so much for helping out. > > > > Might the below accomplish the task? > > > > cat f | grep -v DEBUG| grep -v TRACE | grep -v TRACING > newConfigFileWithout > > It will disable CONFIG_DEBUG_FS. That's OK if that's what you want to do. > > But this will just give you something to begin with. It will need more work. > There are lots of config options that use "select" to force another config > option to be set/enabled. Even if you disable an option and you have one of > these other options set/enabled, they will just enable the DEBUG/TRACE options > again for you. > > When you find one of these, they pretty much have to be checked and tuned > one-by-one. It can take a lot of time to do that. > > > -- > ~Randy > https://people.kernel.org/tglx/notes-about-netiquette ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-24 0:11 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-21 16:16 .config and "make" / turning off all debug Hanasaki Jiji 2023-02-22 0:17 ` Randy Dunlap 2023-02-23 0:21 ` Hanasaki Jiji 2023-02-23 0:29 ` Randy Dunlap 2023-02-24 0:09 ` Hanasaki Jiji
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®