mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
202 lines
5.4 KiB
Plaintext
202 lines
5.4 KiB
Plaintext
# Changes to this file are automatically trigger kernel reconfigures
|
|
# even without using the linux-reconfigure target.
|
|
#
|
|
# Beware that buildroot can override some of the configurations we make, e.g.
|
|
# it forces CONFIG_BLK_DEV_INITRD=y when BR2_TARGET_ROOTFS_CPIO is on.
|
|
|
|
CONFIG_MODULE_SRCVERSION_ALL=y
|
|
CONFIG_BLK_DEV_INITRD=y
|
|
|
|
# GDB debugging.
|
|
CONFIG_DEBUG_FS=y
|
|
CONFIG_DEBUG_INFO=y
|
|
CONFIG_DEBUG_KERNEL=y
|
|
CONFIG_GDB_SCRIPTS=y
|
|
|
|
# Non-static variables show up on /proc/kallsyms
|
|
# https://stackoverflow.com/questions/20196636/does-kallsyms-have-all-the-symbol-of-kernel-functions/44614878#44614878
|
|
CONFIG_KALLSYMS_ALL=y
|
|
|
|
# zcat /proc/config.gz
|
|
CONFIG_IKCONFIG=y
|
|
CONFIG_IKCONFIG_PROC=y
|
|
|
|
# TODO make example.
|
|
# This seems to allow userspace to create arbitrary configuration trees,
|
|
# which kernel modules can then read and interpret.
|
|
CONFIG_CONFIGFS_FS=y
|
|
|
|
# KGDB
|
|
CONFIG_CONSOLE_POLL=y
|
|
CONFIG_KDB_CONTINUE_CATASTROPHIC=0
|
|
CONFIG_KDB_DEFAULT_ENABLE=0x1
|
|
CONFIG_KDB_KEYBOARD=y
|
|
CONFIG_KGDB=y
|
|
CONFIG_KGDB_KDB=y
|
|
CONFIG_KGDB_LOW_LEVEL_TRAP=y
|
|
CONFIG_KGDB_SERIAL_CONSOLE=y
|
|
CONFIG_KGDB_TESTS=y
|
|
CONFIG_KGDB_TESTS_ON_BOOT=n
|
|
CONFIG_MAGIC_SYSRQ=y
|
|
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
|
|
CONFIG_SERIAL_KGDB_NMI=n
|
|
|
|
# Module.symvers in kernel tree and modules tree contains CRC of signatures.
|
|
# TODO: I think the CRC are stored in the built kernel and module, and checked
|
|
# at insmod, but bgrep did not find it in kernel image.
|
|
# Does not show in /proc/kallyms either.
|
|
CONFIG_MODVERSIONS=y
|
|
|
|
# ftrace
|
|
CONFIG_DYNAMIC_FTRACE=y
|
|
CONFIG_FTRACE=y
|
|
CONFIG_FTRACE_SYSCALLS=y
|
|
CONFIG_FUNCTION_GRAPH_TRACER=y
|
|
CONFIG_FUNCTION_PROFILER=y
|
|
CONFIG_FUNCTION_TRACER=y
|
|
CONFIG_HWLAT_TRACER=y
|
|
CONFIG_IRQSOFF_TRACER=y
|
|
CONFIG_SCHED_TRACER=y
|
|
CONFIG_STACK_TRACER=y
|
|
CONFIG_TRACER_SNAPSHOT=y
|
|
|
|
# 9P
|
|
CONFIG_9P_FS=y
|
|
CONFIG_9P_FS_POSIX_ACL=y
|
|
CONFIG_9P_FS_SECURITY=y
|
|
CONFIG_NETWORK_FILESYSTEMS=y
|
|
CONFIG_NET_9P=y
|
|
CONFIG_NET_9P_DEBUG=y
|
|
CONFIG_NET_9P_VIRTIO=y
|
|
|
|
## Virtio. TODO: aarch64 hangs before boot if I do all of these.
|
|
#CONFIG_RPMSG_VIRTIO=y
|
|
#CONFIG_VIRTIO_BALLOON=y
|
|
#CONFIG_VIRTIO_BLK=y
|
|
#CONFIG_VIRTIO_BLK_SCSI=y
|
|
#CONFIG_VIRTIO_INPUT=y
|
|
#CONFIG_VIRTIO_PCI=y
|
|
#CONFIG_VIRTIO_VSOCKETS=y
|
|
|
|
## Networking
|
|
|
|
# Will everything blow up?
|
|
# https://superuser.com/questions/684005/how-does-one-permanently-disable-gnu-linux-networking/1255015#1255015
|
|
#CONFIG_NET=n
|
|
|
|
# If given, we can use QEMU 2.9.0 default x86 networking without any -net or -netdev options,
|
|
# since E1000 is the default networking device as mentioned at:
|
|
# https://en.wikibooks.org/w/index.php?title=QEMU/Networking&oldid=3268753
|
|
CONFIG_E1000=y
|
|
|
|
## x86
|
|
|
|
# https://stackoverflow.com/questions/20069620/print-kernels-page-table-entries
|
|
# cat /sys/kernel/debug/kernel_page_tables
|
|
CONFIG_X86_PTDUMP=y
|
|
|
|
## ARM
|
|
|
|
# LEDs:
|
|
#
|
|
# cd /sys/class/leds/versatile:0
|
|
# cat max_brightness
|
|
# echo 255 >brightness
|
|
#
|
|
# https://raspberrypi.stackexchange.com/questions/697/how-do-i-control-the-system-leds-using-my-software
|
|
#
|
|
# Relevant QEMU files:
|
|
#
|
|
# - hw/arm/versatilepb.c
|
|
# - hw/misc/arm_sysctl.c
|
|
#
|
|
# Relevant kernel files:
|
|
#
|
|
# - arch/arm/boot/dts/versatile-pb.dts
|
|
# - drivers/leds/led-class.c
|
|
# - drivers/leds/leds-sysctl.c
|
|
#
|
|
# Try hacking QEMU's `hw/misc/arm_sysctl.c` with a printf:
|
|
#
|
|
# static void arm_sysctl_write(void *opaque, hwaddr offset,
|
|
# uint64_t val, unsigned size)
|
|
# {
|
|
# arm_sysctl_state *s = (arm_sysctl_state *)opaque;
|
|
#
|
|
# switch (offset) {
|
|
# case 0x08: /* LED */
|
|
# printf("LED val = %llx\n", (unsigned long long)val);
|
|
#
|
|
# to obeserve when the callback is made. But beware that one of the LEDs
|
|
# has a heartbeat trigger by default (specified on dts), so it will produce a lot of output.
|
|
CONFIG_LEDS_CLASS=y
|
|
CONFIG_LEDS_CLASS_FLASH=y
|
|
CONFIG_LEDS_SYSCON=y
|
|
CONFIG_LEDS_TRIGGERS=y
|
|
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
|
|
CONFIG_LEDS_TRIGGER_CPU=y
|
|
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
|
CONFIG_LEDS_TRIGGER_GPIO=y
|
|
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
|
|
CONFIG_LEDS_TRIGGER_ONESHOT=y
|
|
CONFIG_LEDS_TRIGGER_TIMER=y
|
|
CONFIG_NEW_LEDS=y
|
|
|
|
# GPIO.
|
|
CONFIG_ARM_AMBA=y
|
|
CONFIG_GPIOLIB=y
|
|
CONFIG_GPIO_SYSFS=y
|
|
CONFIG_GPIO_PL061=y
|
|
|
|
# In target:
|
|
#
|
|
# modprobe dummy-irq irq=34
|
|
# insmod /platform_device.ko
|
|
#
|
|
# Outcome:
|
|
#
|
|
# lkmc_platform_device_write offset=0 value=12345678 size=4
|
|
# dummy-irq: interrupt occurred on IRQ 34
|
|
#
|
|
# When the device generates an IRQ, the dummy module also snoops it.
|
|
#
|
|
# The IRQ number 34 was found by via dmesg on a previous "insmod /platform_device.ko".
|
|
CONFIG_DUMMY_IRQ=m
|
|
|
|
## aarch64
|
|
|
|
# For some reason not selected by default as it was for arm, and pci modules fail to build.
|
|
# Not that we have PCI working on ARM anyways.
|
|
CONFIG_PCI=y
|
|
|
|
# Like CONFIG_X86_PTDUMP for ARM.
|
|
CONFIG_ARM64_PTDUMP=y
|
|
|
|
## UIO
|
|
|
|
# Userspace drivers: allow you to handle IRQs and do memory IO from userland through a /dev file.
|
|
#
|
|
# Superseded by the more featureful VFIO.
|
|
#
|
|
# Documentation/DocBook/uio-howto.tmpl contains actual userland examples
|
|
# for the generic examples under drivers/uio
|
|
#
|
|
# UIO interface in a nutshell:
|
|
#
|
|
# - blocking read / poll: waits until interrupts
|
|
# - write: call irqcontrol callback. Default: 0 or 1 to enable / disable interrupts.
|
|
# - mmap: access device memory
|
|
|
|
# All other UIO depend on this module.
|
|
CONFIG_UIO=m
|
|
|
|
# Generic platform devices.
|
|
# https://yurovsky.github.io/2014/10/10/linux-uio-gpio-interrupt/
|
|
CONFIG_UIO_DMEM_GENIRQ=m
|
|
CONFIG_UIO_PDRV_GENIRQ=m
|
|
|
|
# https://github.com/rumpkernel/wiki/wiki/Howto:-Accessing-PCI-devices-from-userspace
|
|
# /sys/class/uio/
|
|
# /sys/class/uio/uio0
|
|
CONFIG_UIO_PCI_GENERIC=m
|