Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[IMPROVED] Shell script for pretty kernel config comparison
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Tue May 09, 2023 6:12 pm    Post subject: Reply with quote

Code:
amd64 /usr/src/linux-6.3.1-gentoo-std # diff .config .config.old
amd64 /usr/src/linux-6.3.1-gentoo-std #
whereas:
Code:
amd64 /usr/src/linux-6.3.1-gentoo-std # cfcfg .config .config.old
# Linux/x86 6.3.1-gentoo Kernel Configuration ---> # Linux/x86 6.3.1-gentoo Kernel Configuration
amd64 /usr/src/linux-6.3.1-gentoo-std #
Is that the expected behavior?

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2009

PostPosted: Tue May 09, 2023 6:20 pm    Post subject: Reply with quote

CaptainBlood wrote:
...
Code:
amd64 /usr/src/linux-6.3.1-gentoo-std # cfcfg .config .config.old
# Linux/x86 6.3.1-gentoo Kernel Configuration ---> # Linux/x86 6.3.1-gentoo Kernel Configuration
amd64 /usr/src/linux-6.3.1-gentoo-std #
Is that the expected behavior?

Yes, it treats the heading lines (if any) specially.
It prints the heading line from each of the two config files so you know what kernel versions you were comparing - might be useful if you save the output and come back to it months later and wonder what it was all about - the sort of thing I do when clearing lint from my home directory :-)
_________________
Greybeard
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2009

PostPosted: Tue May 09, 2023 6:28 pm    Post subject: Reply with quote

mv wrote:
... There is now an ebuild in the mv overlay.

Thanks.
{That might help me avoid today's "WTF" moment:
I use fscrypt to encrypt my home directory, and that of my system admin userid (I keep them separate, my home ID isn't part of wheel, etc. as a layer of "security"). I put my copy of cfcfg into /usr/local/bin, using "mv" from the admin id, and logged out. Come to use it from my home account, and get "key not available". ???? Ah, the security in fscrypt goes with the file - literally, when it moves; that means the file's only readable when the admin user is logged in. I should have used "cp" and not "mv", or even better "install". I live and learn, and raise questions on the fscrypt mailing list (or would do if they'd allow submissions from Yahoo userids; that's another WTF...)
}
_________________
Greybeard
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2009

PostPosted: Sat Jul 15, 2023 6:15 pm    Post subject: Reply with quote

I've updated the tool on sourceforge.
The new version adds a new command
Code:
cfgsymbols <filename>

which scans a kernel source directory (typically /usr/src/linux, but can be elsewhere) for Kconfig files, and creates a symbol table file containing
Code:
ITEM=Prompt text

cfcfg now respects an environment variable CFGSYMBOLS set to the name of such a file, in which case the output will be annotated with the symbol prompts as comments.
See the screen captures on the sourceforge project for details.
Note that the symbols file is large (16,000 entries for kernel 6.4), and building it might be slow on some hardware.

Here's some sample output, uncoloured:
Code:
# Linux/x86 6.3.10 Kernel Configuration ---> # Linux/x86 6.4.3 Kernel Configuration
|  CC_VERSION_TEXT="clang version 15.0.7"--->"clang version 16.0.5"
|  CLANG_VERSION=150007--->160005
|  AS_VERSION=150007--->160005
|  LLD_VERSION=150007--->160005
   # General setup
       # RCU Subsystem
-          SRCU=y
-      PRINTK_SAFE_LOG_BUF_SHIFT=12      # Temporary per-CPU printk log buffer size (12 => 4KB, 13 => 8KB)
|  FUNCTION_PADDING_BYTES=16--->11
-  PREFIX_SYMBOLS=y
   # General architecture-dependent options
+      MMU_LAZY_TLB_REFCOUNT=y
+      ARCH_USES_CFI_TRAPS=y
+      CFI_CLANG=y       # Use Clang's Control Flow Integrity (CFI)


As before, comparing with /dev/null, and passing the new "-a" parameter (to hid non-annotated lines) will pretty-print your configuration, but now with added annotations. For example, here's the start of my current config:
Code:
# Linux/x86 6.4.3 Kernel Configuration --->
   # General setup
+      WERROR=y          # Compile the kernel with warnings as errors
+      LOCALVERSION="-git"       # Local version - append to kernel release
+      BUILD_SALT=""     # Build ID Salt
+      KERNEL_ZSTD=y     # Kernel compression mode: ZSTD
+      DEFAULT_INIT=""   # Default init path
+      DEFAULT_HOSTNAME="ryzen"          # Default hostname
+      SYSVIPC=y         # System V IPC
+      POSIX_MQUEUE=y    # POSIX Message Queues
       # IRQ subsystem
+          SPARSE_IRQ=y          # Support sparse irq numbering
       # Timers subsystem
+          NO_HZ_IDLE=y          # Timer tick handling: Idle dynticks system (tickless idle)
+          HIGH_RES_TIMERS=y     # High Resolution Timer Support
+          CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=100          # Clocksource watchdog maximum allowable skew (in μs)
+      PREEMPT_VOLUNTARY=y       # Preemption Model: Voluntary Kernel Preemption (Desktop)
+      SCHED_CORE=y      # Core Scheduling for SMT
       # CPU/Task time and stats accounting
+          TICK_CPU_ACCOUNTING=y         # Cputime accounting: Simple tick based cputime accounting
+          BSD_PROCESS_ACCT=y    # BSD Process Accounting
+          TASKSTATS=y   # Export task/process statistics through netlink
+          TASK_DELAY_ACCT=y     # Enable per-task delay accounting
+          TASK_XACCT=y          # Enable extended accounting over taskstats
+          TASK_IO_ACCOUNTING=y          # Enable per-task storage I/O accounting
+      CPU_ISOLATION=y   # CPU isolation
+      IKCONFIG=y        # Kernel .config support
+      IKCONFIG_PROC=y   # Enable access to .config through /proc/config.gz
+      LOG_BUF_SHIFT=17          # Kernel log buffer size (16 => 64KB, 17 => 128KB)
+      LOG_CPU_MAX_BUF_SHIFT=13          # CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)
+      CGROUPS=y         # Control Group support
+      BLK_CGROUP=y      # IO controller
+      CGROUP_SCHED=y    # CPU controller
+      FAIR_GROUP_SCHED=y        # Group scheduling for SCHED_OTHER
+      CGROUP_FREEZER=y          # Freezer controller
+      CGROUP_DEVICE=y   # Device controller
+      CGROUP_CPUACCT=y          # Simple CPU accounting controller
+      NAMESPACES=y      # Namespaces support
+      UTS_NS=y          # UTS namespace
+      IPC_NS=y          # IPC namespace
+      USER_NS=y         # User namespace
+      PID_NS=y          # PID Namespaces
+      NET_NS=y          # Network namespace
+      CHECKPOINT_RESTORE=y      # Checkpoint/restore support

Note that a fair proportion of items are set by the kernel configurator rather than explicitly, but the "-a" switch removes ones that can never be set from a menu.
_________________
Greybeard
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sat Jul 15, 2023 7:56 pm    Post subject: Reply with quote

Goverp wrote:
I've updated the tool on sourceforge.

Bumped in the mv overlay. Minor note: The file is called *.tgz, but actually it is uncompressed. (Please do not consider this as a suggestion to modify the file without a version bump: otherwise the checksum in the overlay would break.)
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2009

PostPosted: Sun Jul 16, 2023 7:11 am    Post subject: Reply with quote

mv wrote:
Goverp wrote:
I've updated the tool on sourceforge.

Bumped in the mv overlay. Minor note: The file is called *.tgz, but actually it is uncompressed. (Please do not consider this as a suggestion to modify the file without a version bump: otherwise the checksum in the overlay would break.)

Thanks.
I must have forgotten the -z option in the tar command. I'll leave it - it's small enough without compression.
_________________
Greybeard
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum