-
Notifications
You must be signed in to change notification settings - Fork 32
/
create_base_fragment.sh
executable file
·127 lines (115 loc) · 2.55 KB
/
create_base_fragment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
# SPDX-FileCopyrightText: Omar Sandoval <[email protected]>
# SPDX-License-Identifier: MIT
set -euo pipefail
# Options that the distro config may override but we want to use the default
# for.
default_options=(
'ATA'
'BLK_DEV_NVME'
'CONSOLE_LOGLEVEL[^=]*'
'DEBUG_INFO_BTF'
'DEFAULT_HOSTNAME'
'GCC_PLUGIN_STRUCTLEAK[^=]*'
'HID'
'HYPERVISOR_GUEST'
'LEDS_CLASS'
'LOCALVERSION'
'MODULE_COMPRESS[^=]*'
'MODULE_SIG[^=]*'
'NVM'
'NVME_CORE'
'SCSI'
'SECURITY_LOCKDOWN_LSM[^=]*'
'USB'
'VFIO'
)
trap 'rm -f .config lsmod defconfig' EXIT
zcat -f "${1:-/proc/config.gz}" |
grep -v -E "$(IFS="|"; echo "^CONFIG_(${default_options[*]})=")" > .config
make olddefconfig
# Disable all (non-built-in) modules.
echo "Module Size Used by" > lsmod
make LSMOD=lsmod localmodconfig
make savedefconfig
echo "# Generated defconfig" > base.fragment
echo "silent" >> base.fragment
cat defconfig - << "EOF" >> base.fragment
endsilent
# General sanity.
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_LOCALVERSION_AUTO=y
# Module compression makes kernel installation really slow and makes it harder
# to use debugging tools.
CONFIG_MODULE_COMPRESS=n
# Debugging.
CONFIG_BPF_KPROBE_OVERRIDE=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_DEBUG_KERNEL=y
CONFIG_KPROBES=y
CONFIG_KPROBE_EVENTS=y
CONFIG_UPROBES=y
CONFIG_UPROBE_EVENTS=y
# Filesystems.
CONFIG_BTRFS_FS=m
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_EXT4_FS=m
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_FAT_DEFAULT_UTF8=y
CONFIG_FUSE_FS=m
CONFIG_ISO9660_FS=m
CONFIG_NLS_CODEPAGE_437=m
CONFIG_NLS_ISO8859_1=m
CONFIG_SQUASHFS=m
CONFIG_SQUASHFS_DECOMP_MULTI=y
CONFIG_SQUASHFS_FILE_DIRECT=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZLIB=y
CONFIG_VFAT_FS=m
CONFIG_XFS_FS=m
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_QUOTA=y
CONFIG_XFS_RT=y
# NFS.
CONFIG_FSCACHE=m
CONFIG_FSCACHE_STATS=y
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_NFSD_V4_SECURITY_LABEL=y
CONFIG_NFS_FS=m
CONFIG_NFS_FSCACHE=y
CONFIG_NFS_SWAP=y
CONFIG_NFS_V2=m
CONFIG_NFS_V3=m
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=m
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_1_MIGRATION=y
CONFIG_NFS_V4_2=y
CONFIG_NFS_V4_SECURITY_LABEL=y
# Block devices.
CONFIG_ATA=m
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NULL_BLK=m
CONFIG_BLK_DEV_NVME=m
CONFIG_BLK_DEV_SD=m
CONFIG_CHR_DEV_SG=m
CONFIG_SCSI=m
CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_MOD=m
CONFIG_SCSI_SCAN_ASYNC=y
EOF