当前位置:网站首页>BSP tailoring of Quanzhi platform (3) Appendix II: description of kernel hacking configuration

BSP tailoring of Quanzhi platform (3) Appendix II: description of kernel hacking configuration

2022-06-09 06:27:00 szembed

The following technologies are embedded in yingpengfei A40I/T3 Core board (CoM-X40I) And main control board (SBC-X40I) Verified on , welcome communication ! CoM-X40I The core board and SBC-X40I See the figure below for the main board :
 Insert picture description here
 Insert picture description here
 Insert picture description here

 Kernel hacking

explain : kernel hack Options

Show timing information on printks

CONFIG_PRINTK_TIME

On the console and syslog() The output of the system call contains printk() The time stamp of the message , In order to directly display the time spent in each step of the kernel startup process . Be careful : Whether this item is enabled or not , The timestamp is always recorded in /dev/kmsg in , Opening this item is only equivalent to using "printk.time=1" Kernel boot parameters .

Default message log level (1-7)

CONFIG_DEFAULT_MESSAGE_LOGLEVEL

printk() The default level of the kernel message log , The value range is [1,7]. Any printk The displayed string is usually recorded in /var/log/messages In the document . The larger the value, the more detailed the message will be displayed :1=ALERT,2=CRIT,3=ERR,4=WARNING,5=NOTICE,6=INFO,7=DEBUG.

Enable __deprecated logic

CONFIG_ENABLE_WARN_DEPRECATED

Open at compile time " Against the use of " Logic check , Turning this off will not display something like "warning: 'foo' is deprecated (declared at kernel/power/somefile.c:1234)" Such warning messages .

Enable __must_check logic

CONFIG_ENABLE_MUST_CHECK

Open at compile time " Must check " Logic check , Turning this off will not display something like "warning: ignoring return value of 'foo', declared with attribute warn_unused_result" Such warning messages .

Warn for stack frames larger than (needs gcc 4.4)

CONFIG_FRAME_WARN

Stack frame size warning threshold , Setting too small will result in too many compile time warnings , Set to "0" Warning can be turned off , need GCC-4.4 Or later

Strip assembler-generated symbols during link

CONFIG_STRIP_ASM_SYMS

Split the internal symbols generated by the assembler when connecting ( similar '.Lxxx'), This will purify get_wchan() And so on , It can also reduce the kernel size . Recommended Opening .

Magic SysRq key

CONFIG_MAGIC_SYSRQ

Turn on " Magic key "(SysRq, Allow users to press Alt+PrintScreen Then send special commands to the kernel ) Support ( Can pass "echo 0 > /proc/sys/kernel/sysrq" close ). because SysRq It will bring security risks ( Allow unregistered operations ), So you should only open it when you really need it . For more details, see "Documentation/sysrq.txt" file

Enable magic SysRq key functions by default

CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE

Set which magic keys are enabled by default . Set to "1" Indicates that all magic keys are turned on , Set to "0" Indicates that all magic keys are disabled . Or in accordance with "Documentation/sysrq.txt" The guidance of the document sets a specific code point .

Generate readable assembler code

CONFIG_READABLE_ASM

Generate human readable assembly output , To facilitate kernel debugging . This disables some compilation optimizations , It will also slow down the kernel .

Enable unused/obsolete exported symbols

CONFIG_UNUSED_SYMBOLS

Export useless and obsolete symbols , This will make the kernel unnecessarily larger . Proposed closure .

Debug Filesystem

CONFIG_DEBUG_FS

debugfs It is a virtual file system used by kernel developers to store debugging information . Don't choose if you don't engage in kernel development

Run 'make headers_check' when building vmlinux

CONFIG_HEADERS_CHECK

Run when compiling the kernel 'make headers_check' Command to check the correctness of the kernel header file , You should enable this option when you modify the kernel header file related to user space

Enable full Section mismatch analysis

CONFIG_DEBUG_SECTION_MISMATCH

Check for invalid references at compile time . For kernel developers only

Make section mismatch errors non-fatal

CONFIG_SECTION_MISMATCH_WARN_ONLY

If you choose "N", So once it appears "section mismatch", Will directly cause compilation failure ( Instead of just throwing a warning ). Recommended election "N".

Kernel debugging

CONFIG_DEBUG_KERNEL

For kernel developers only .[ Tips ] If you turn it on CONFIG_EXPERT, This item will be forced to be selected , If that's not what you want , You can use it in the root directory of the kernel source tree "sed -i '/select DEBUG_KERNEL/d' usr/src/linux/init/Kconfig" Command to remove this dependency .

Panic on Oops

CONFIG_PANIC_ON_OOPS

When kernel oops when , direct panic fall ( amount to Windows Blue screen crash ), This ensures that the kernel stops working , Avoid unpredictable consequences . Equivalent to using "oops=panic" Kernel boot parameters . An uncertain choice "Y".

panic timeout

CONFIG_PANIC_TIMEOUT

How to handle kernel crashes (panic):(1) Set up as "0" It means infinite waiting , Do nothing ;(2) If it is set as a positive integer, it means to wait for the set number of seconds before restarting ;(3) If it is set to a negative integer, it means immediate restart .

Enable extra timekeeping sanity checking

CONFIG_DEBUG_TIMEKEEPING

For kernel developers only

Detect Hung Tasks

CONFIG_DETECT_HUNG_TASK

Detect pending tasks ( The process is locked or frozen , In an uninterrupted state "D" state ). Since only... Can be detected , No further processing , So it is only used to help kernel debugging .

Collect scheduler debugging info

CONFIG_SCHED_DEBUG

Provide a "/proc/sched_debug" File to help debug the scheduler . Only for kernel development and debugging scheduler .

Collect scheduler statistics

CONFIG_SCHEDSTATS

Collect scheduler Statistics , And show it in "/proc/schedstat" In file . Can be used to debug the scheduler , Or tweak specific applications . An uncertain choice "N".

Collect kernel timers statistics

CONFIG_TIMER_STATS

Collect statistics on kernel timers , And show it in "/proc/timer_stats" In file . Use "echo 1 > /proc/timer_stats" Turn on Statistics , Use "echo 0 > /proc/timer_stats" Turn off Statistics . An uncertain choice "N".

Debug object operations

CONFIG_DEBUG_OBJECTS

Track the lifecycle of various objects (life time), And verify various operations on these objects . For kernel debugging only .

Debug slab memory allocations

CONFIG_DEBUG_SLAB

Yes slab Check the memory allocation

SLUB debugging on by default

CONFIG_SLUB_DEBUG_ON

Default on SLUB Memory allocator debugging function . Debugging only , Do not use in production environments .

Enable SLUB performance statistics

CONFIG_SLUB_STATS

collect SLUB Performance statistics for memory allocator . Debugging only , Do not use in production environments .

Kernel memory leak detector

CONFIG_DEBUG_KMEMLEAK

Kernel memory leak detection . For kernel debugging only .

Debug preemptible kernel

CONFIG_DEBUG_PREEMPT

Debug the active preemption feature of the kernel . For kernel developers only

RT Mutex debugging, deadlock detection

CONFIG_DEBUG_RT_MUTEXES

Yes Rr Mutex Semantically check and deadlock detection and report .

Built-in scriptable tester for rt-mutexes

CONFIG_RT_MUTEX_TESTER

rt-mutex The viewer

Spinlock and rw-lock debugging: basic checks

CONFIG_DEBUG_SPINLOCK

spinlock rw-lock Check and report lock semantics

Mutex debugging: basic checks

CONFIG_DEBUG_MUTEXES

mutex Semantic check and escalation

Lock debugging: detect incorrect freeing of live locks

CONFIG_DEBUG_LOCK_ALLOC

For kernel developers only

Lock debugging: prove locking correctness

CONFIG_PROVE_LOCKING

For kernel developers only

Lock usage statistics

CONFIG_LOCK_STAT

For kernel developers only

Lock dependency engine debugging

CONFIG_DEBUG_LOCKDEP

For kernel developers only

Sleep inside atomic section checking

CONFIG_DEBUG_ATOMIC_SLEEP

If you sleep in an atom or use a locking mechanism , A warning will be reported

Locking API boot-time self-tests

CONFIG_DEBUG_LOCKING_API_SELFTESTS

Run a short lock at kernel startup / Unlock function (spinlocks,rwlocks,mutexes,rwsems) Self test . For kernel developers only

Stack utilization instrumentation

CONFIG_DEBUG_STACK_USAGE

For kernel developers only

kobject debugging

CONFIG_DEBUG_KOBJECT

kobject Debugging information will be sent to syslog

Verbose BUG() reporting (adds 70K)

CONFIG_DEBUG_BUGVERBOSE

In the kernel panic Let it go BUG() Function reports more detailed information . The kernel will grow 70-100K.

Compile the kernel with debug info

CONFIG_DEBUG_INFO

Compile the kernel in debug mode (gcc -g)., Debugging information is added during compilation

Debug VM

CONFIG_DEBUG_VM

For kernel developers only

Debug VM translations

CONFIG_DEBUG_VIRTUAL

For kernel developers only

Debug filesystem writers count

CONFIG_DEBUG_WRITECOUNT

Will catch vfsmount writer Wrong use

Debug memory initialisation

CONFIG_DEBUG_MEMORY_INIT

Add additional rationality checks during memory initialization . An uncertain choice "Y".

Debug linked list manipulation

CONFIG_DEBUG_LIST

start-up list_sort function , Call when the system starts , It will affect the startup time

Linked list sorting test

CONFIG_TEST_LIST_SORT

start-up list_sort function , Call when the system starts , It will affect the startup time

Debug SG table operations

CONFIG_DEBUG_SG

SG Check the watch , You can check that the driver is not initialized scatter-gather The situation of

Debug notifier call chains

CONFIG_DEBUG_NOTIFIERS

For kernel developers only

Debug credential management

CONFIG_DEBUG_CREDENTIALS

Certificate management debugging

Compile the kernel with frame pointers

CONFIG_FRAME_POINTER

Commissioning certificate management , For kernel developers only

Delay each boot printk message by N milliseconds

CONFIG_BOOT_PRINTK_DELAY

It allows you to read the boot information of the kernel , Every print will have a delay millisecond ,boot_delay = N

Stack backtrace support

CONFIG_STACKTRACE

Stack backtracking support

RCU Debugging

For kernel developers only . It is recommended to select all sub items "N".

Kprobes sanity tests

CONFIG_KPROBES_SANITY_TEST

For kernel developers only

Self test for the backtrace code

CONFIG_BACKTRACE_SELF_TEST

Stack backtracking self checking code

Force extended block device numbers and spread them

CONFIG_DEBUG_BLOCK_EXT_DEVT

For kernel developers only

Force weak per-cpu definitions

CONFIG_DEBUG_FORCE_WEAK_PER_CPU

For kernel developers only

Debug access to per_cpu maps

CONFIG_DEBUG_PER_CPU_MAPS

For kernel developers only

Linux Kernel Dump Test Tool Module

CONFIG_LKDTM

For kernel developers only

Notifier error injection

CONFIG_NOTIFIER_ERROR_INJECTION

For kernel developers only

Fault-injection framework

CONFIG_FAULT_INJECTION

This can be seen Documentation/fault-injection

Latency measuring infrastructure

CONFIG_LATENCYTOP

For kernel developers only

Strict user copy size checks

CONFIG_DEBUG_STRICT_USER_COPY_CHECKS

For kernel developers only

Debug page memory allocations

CONFIG_DEBUG_PAGEALLOC

Check the page memory request ,

Tracers

CONFIG_FTRACE

For kernel developers only . Recommended election "N".

Runtime Testing

Run time self checking . It is recommended to select all sub items "N".

Red-Black tree test

CONFIG_RBTREE_TEST

For kernel developers only

Interval tree test

CONFIG_INTERVAL_TREE_TEST

For kernel developers only

Remote debugging over FireWire early on boot

CONFIG_PROVIDE_OHCI1394_DMA_INIT

For kernel developers only

Remote debugging over FireWire with firewire-ohci

CONFIG_FIREWIRE_OHCI_REMOTE_DMA

For kernel developers only

Build targets in Documentation/ tree

CONFIG_BUILD_DOCSRC

Compile the kernel source code tree "Documentation" Target in directory . An uncertain choice "N".

Enable dynamic printk() support

CONFIG_DYNAMIC_DEBUG

For kernel developers only

Enable debugging of DMA-API usage

CONFIG_DMA_API_DEBUG

DMA-API Check of usage

Perform an atomic64_t self-test at boot

CONFIG_ATOMIC64_SELFTEST

Start a... When starting aatomic64_t Self examination of

Self test for hardware accelerated raid6 recovery

CONFIG_ASYNC_RAID6_TEST

For kernel developers only

Sample kernel code

CONFIG_SAMPLES

Kernel sample code . For kernel developers only

KGDB: kernel debugger

CONFIG_KGDB

KGDB Debugging tools

kmemcheck: trap use of uninitialized memory

CONFIG_KMEMCHECK

For kernel developers only

Test functions located in the string_helpers module at runtime

CONFIG_TEST_STRING_HELPERS

For kernel developers only

Test kstrto*() family of functions at runtime

CONFIG_TEST_KSTRTOX

For kernel developers only

Filter access to /dev/mem

CONFIG_STRICT_DEVMEM

If elected "N", So the user space root Users will be able to use /dev/mem Access all memory space ( Including user space and kernel space ), To facilitate kernel debugging . If elected "Y", So the kernel space except PCI and BIOS Part and outside the data area , Access is prohibited , To protect the system . An uncertain choice "Y".

Enable verbose x86 bootup info messages

CONFIG_X86_VERBOSE_BOOTUP

Show extra... At startup bzimage Unzip message , Display detailed kernel boot information . Recommended election "N" Make the boot process quieter ( The error message will still be displayed ).

Early printk

CONFIG_EARLY_PRINTK

Output kernel logs directly to VGA Buffer or serial port . This helps debug those that cause the system to crash before the console is initialized bug.

Early printk via EHCI debug port

CONFIG_EARLY_PRINTK_DBGP

Support to directly pass the kernel log EHCI Debug port output . choose "N", Unless you want to debug the kernel .

Dump the EFI pagetable

CONFIG_EFI_PGT_DUMP

For kernel developers only

Check for stack overflows

CONFIG_DEBUG_STACKOVERFLOW

For kernel developers only

Export kernel pagetable layout to userspace via debugfs

CONFIG_X86_PTDUMP

For kernel developers only

Write protect kernel read-only data structures

CONFIG_DEBUG_RODATA

For kernel developers only

Set loadable kernel module data as NX and text as RO

CONFIG_DEBUG_SET_MODULE_RONX

Mark the data area of the kernel module as NX( Unenforceable ), The text segment is marked as RO( read-only ), To prevent defective modules ( For example, a module implanted with a virus ) Damage to the system , It can also prevent certain types of kernel intrusion . This needs to be CPU Support NX position (CPU flags It should contain "nx" sign ). But it also has side effects : Will conflict with runtime code patches , It also causes the dynamic kernel trace to fail . Recommended election "Y", Unless you need to debug the kernel , Or you need to patch the running modules .

Testcase for the NX non-executable stack feature

CONFIG_DEBUG_NX_TEST

For the processor NX Test cases for . For kernel developers only

Set upper limit of TLB entries to flush one-by-one

CONFIG_DEBUG_TLBFLUSH

For kernel developers only

Enable doublefault exception handler

CONFIG_DOUBLEFAULT

For kernel developers only

Enable IOMMU debugging

CONFIG_IOMMU_DEBUG

For kernel developers only

Enable IOMMU stress-test mode

CONFIG_IOMMU_STRESS

For kernel developers only

IOMMU leak tracing

CONFIG_IOMMU_LEAK

For kernel developers only

x86 instruction decoder selftest

CONFIG_X86_DECODER_SELFTEST

For kernel developers only

IO delay type

IO Delay mode

port 0x80 based port-IO delay

CONFIG_IO_DELAY_0X80

Conventional Linux IO Delay mode , Time-tested , It is also the safest default .

port 0xed based port-IO delay

CONFIG_IO_DELAY_0XED

be based on 0xed Port of IO Delay mode , Mainly to avoid and based on 0x80 The motherboard diagnostic card of the port conflicts . Most people don't have a motherboard diagnostic card , Unless those hardware engineers who specialize in mainboard maintenance .

udelay based port-IO delay

CONFIG_IO_DELAY_UDELAY

Use the kernel side udelay() Function as a delay method ( Simple delay 2 Microsecond ). Can not occupy any IO Port space .

no port-IO delay

CONFIG_IO_DELAY_NONE

Do not use any port-IO Delay mechanism . As long as your machine is not antique , It is recommended to select this item .

Debug boot parameters

CONFIG_DEBUG_BOOT_PARAMS

For kernel developers only

CPA self-test code

CONFIG_CPA_DEBUG

For kernel developers only

Allow gcc to uninline functions marked 'inline'

CONFIG_OPTIMIZE_INLINING

allow GCC Mark as inline (inline) The function of becomes non inline (uninline). choose "Y" The code will be completely ignored "inline" Mark , Completely by GCC It is up to you to decide whether you should inline the function . because GCC4.x The series updates the algorithm to determine whether a function should be inlined , choose "Y" after , The compiled kernel size will be reduced ( But the running speed may not be improved ). Recommended election "Y".

NMI Selftest

CONFIG_DEBUG_NMI_SELFTEST

For non maskable interrupts (Non Maskable Interrupt) Carry out self inspection , For kernel developers only

ATOM Punit debug driver

CONFIG_PUNIT_ATOM_DEBUG

For kernel developers only

原网站

版权声明
本文为[szembed]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090605261840.html