mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-18 11:19:19 +01:00
kernel: Use new kernel configuration rendering method
Import kernel-config infrastructure from BLFS and use it for kernel configuration. Note that kernel-config.py is slightly different from BLFS: we need role="nodump" for <screen> here.
This commit is contained in:
parent
2cf01ab702
commit
70bf5512d9
@ -130,84 +130,15 @@
|
||||
<para>Be sure to enable/disable/set the following features or the system might
|
||||
not work correctly or boot at all:</para>
|
||||
|
||||
<screen role="nodump" revision="sysv"><emphasis role='blue'>G</emphasis>eneral setup --->
|
||||
[ ] <emphasis role='blue'>C</emphasis>ompile the kernel with warnings as errors [CONFIG_WERROR]
|
||||
<emphasis role='blue'>C</emphasis>PU/Task time and stats accounting --->
|
||||
[*] <emphasis role='blue'>P</emphasis>ressure stall information tracking [CONFIG_PSI]
|
||||
[ ] <emphasis role='blue'>R</emphasis>equire boot parameter to enable pressure stall information tracking
|
||||
[CONFIG_PSI_DEFAULT_DISABLED]
|
||||
< > <emphasis role='blue'>E</emphasis>nable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS]
|
||||
[*] <emphasis role='blue'>C</emphasis>ontrol Group support [CONFIG_CGROUPS] --->
|
||||
[*] M<emphasis role='blue'>e</emphasis>mory controller [CONFIG_MEMCG]
|
||||
[ ] <emphasis role='blue'>C</emphasis>onfigure standard kernel features (expert users) [CONFIG_EXPERT]
|
||||
<!-- To editors: for updating kernel configuration, edit
|
||||
kernel/*.toml and regenerate kernel/*.xml with
|
||||
"make -C kernel KERNEL_TREE=</usr/src/linux-&linux-version> -->
|
||||
|
||||
<emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
[*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel [CONFIG_RELOCATABLE]
|
||||
[*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE]
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="kernel/sysv.xml"/>
|
||||
|
||||
<emphasis role='blue'>G</emphasis>eneral architecture-dependent options --->
|
||||
[*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [CONFIG_STACKPROTECTOR]
|
||||
[*] <emphasis role='blue'>S</emphasis>trong Stack Protector [CONFIG_STACKPROTECTOR_STRONG]
|
||||
|
||||
<emphasis role='blue'>D</emphasis>evice Drivers --->
|
||||
<emphasis role='blue'>G</emphasis>eneric Driver Options --->
|
||||
[ ] <emphasis role='blue'>S</emphasis>upport for uevent helper [CONFIG_UEVENT_HELPER]
|
||||
[*] M<emphasis role='blue'>a</emphasis>intain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]
|
||||
[*] <emphasis role='blue'>A</emphasis>utomount devtmpfs at /dev, after the kernel mounted the rootfs
|
||||
[CONFIG_DEVTMPFS_MOUNT]
|
||||
<emphasis role='blue'>G</emphasis>raphics support --->
|
||||
<emphasis role='blue'>F</emphasis>rame buffer Devices --->
|
||||
<*> <emphasis role='blue'>S</emphasis>upport for frame buffer devices --->
|
||||
<emphasis role='blue'>C</emphasis>onsole display driver support --->
|
||||
[*] <emphasis role='blue'>F</emphasis>ramebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE]</screen>
|
||||
|
||||
<screen role="nodump" revision="systemd">
|
||||
General setup --->
|
||||
[ ] Compile the kernel with warnings as errors [CONFIG_WERROR]
|
||||
[ ] Auditing Support [CONFIG_AUDIT]
|
||||
CPU/Task time and stats accounting --->
|
||||
[*] Pressure stall information tracking [CONFIG_PSI]
|
||||
[ ] Require boot parameter to enable pressure stall information tracking
|
||||
[CONFIG_PSI_DEFAULT_DISABLED]
|
||||
< > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS]
|
||||
[*] Control Group support [CONFIG_CGROUPS] --->
|
||||
[*] Memory controller [CONFIG_MEMCG]
|
||||
[ ] Configure standard kernel features (expert users) [CONFIG_EXPERT]
|
||||
|
||||
Processor type and features --->
|
||||
[*] Build a relocatable kernel [CONFIG_RELOCATABLE]
|
||||
[*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE]
|
||||
|
||||
General architecture-dependent options --->
|
||||
[*] Enable seccomp to safely compute untrusted bytecode [CONFIG_SECCOMP]
|
||||
[*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR]
|
||||
[*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG]
|
||||
|
||||
[*] Networking support ---> [CONFIG_NET]
|
||||
Networking options --->
|
||||
[*] TCP/IP networking [CONFIG_INET]
|
||||
<*> The IPv6 protocol [CONFIG_IPV6]
|
||||
|
||||
Device Drivers --->
|
||||
Generic Driver Options --->
|
||||
[ ] Support for uevent helper [CONFIG_UEVENT_HELPER]
|
||||
[*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]
|
||||
[*] Automount devtmpfs at /dev, after the kernel mounted the rootfs
|
||||
[CONFIG_DEVTMPFS_MOUNT]
|
||||
Firmware Loader --->
|
||||
[ ] Enable the firmware sysfs fallback mechanism [CONFIG_FW_LOADER_USER_HELPER]
|
||||
Firmware Drivers --->
|
||||
[*] Export DMI identification via sysfs to userspace [CONFIG_DMIID]
|
||||
Graphics support --->
|
||||
Frame buffer Devices --->
|
||||
<*> Support for frame buffer devices --->
|
||||
Console display driver support --->
|
||||
[*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE]
|
||||
|
||||
File systems --->
|
||||
[*] Inotify support for userspace [CONFIG_INOTIFY_USER]
|
||||
Pseudo filesystems --->
|
||||
[*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL]</screen>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="kernel/systemd.xml"/>
|
||||
|
||||
<para>Enable some additional features if you are building a 64-bit
|
||||
system. If you are using menuconfig, enable them in the order of
|
||||
@ -216,31 +147,23 @@ File systems --->
|
||||
<parameter>CONFIG_X86_X2APIC</parameter> because an option only
|
||||
shows up after its dependencies are selected.</para>
|
||||
|
||||
<screen role="nodump"><emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
[*] <emphasis role='blue'>S</emphasis>upport x2apic [CONFIG_X86_X2APIC]
|
||||
|
||||
Device Drivers --->
|
||||
[*] <emphasis role='blue'>P</emphasis>CI Support ---> [CONFIG_PCI]
|
||||
[*] M<emphasis role='blue'>e</emphasis>ssage Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI]
|
||||
[*] <emphasis role='blue'>I</emphasis>OMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT]
|
||||
[*] <emphasis role='blue'>S</emphasis>upport for Interrupt Remapping [CONFIG_IRQ_REMAP]</screen>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="kernel/x2apic.xml"/>
|
||||
|
||||
<para>If you are building a 32-bit system running on a hardware
|
||||
with RAM more than 4GB, adjust the configuration so the kernel will
|
||||
be able to use up to 64GB physical RAM:</para>
|
||||
|
||||
<screen role="nodump"><emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
H<emphasis role='blue'>i</emphasis>gh Memory Support --->
|
||||
(X) <emphasis role='blue'>6</emphasis>4GB [CONFIG_HIGHMEM64G]</screen>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="kernel/highmem.xml"/>
|
||||
|
||||
<para>If the partition for the LFS system is in a NVME SSD (i. e. the
|
||||
device node for the partition is <filename>/dev/nvme*</filename>
|
||||
instead of <filename>/dev/sd*</filename>), enable NVME support or
|
||||
the LFS system won't boot:</para>
|
||||
|
||||
<screen role="nodump"><emphasis role='blue'>D</emphasis>evice Drivers --->
|
||||
N<emphasis role='blue'>V</emphasis>ME Support --->
|
||||
<*> N<emphasis role='blue'>V</emphasis>M Express block device [CONFIG_BLK_DEV_NVME]</screen>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="kernel/nvme.xml"/>
|
||||
</note>
|
||||
|
||||
<note revision="systemd">
|
||||
|
2
chapter10/kernel/.gitignore
vendored
Normal file
2
chapter10/kernel/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
__pycache__
|
||||
s-kernel-version
|
19
chapter10/kernel/Makefile
Normal file
19
chapter10/kernel/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
INPUT = $(wildcard *.toml)
|
||||
OUTPUT = $(patsubst %.toml, %.xml, $(INPUT))
|
||||
|
||||
ifeq ($(KERNEL_TREE),)
|
||||
$(error "must set KERNEL_TREE=/path/to/kernel/source")
|
||||
endif
|
||||
|
||||
all: $(OUTPUT)
|
||||
|
||||
kernel.version: s-kernel-version; @true
|
||||
s-kernel-version: Makefile kernel_version.py
|
||||
./kernel_version.py $(KERNEL_TREE) > tmp-kernel.version
|
||||
if ! diff tmp-kernel.version $@ 2>/dev/null >/dev/null; then \
|
||||
mv tmp-kernel.version kernel.version; \
|
||||
fi
|
||||
touch s-kernel-version
|
||||
|
||||
%.xml: %.toml kernel-config.py kernel_version.py kernel.version
|
||||
./kernel-config.py $(KERNEL_TREE) $< > $@
|
1
chapter10/kernel/highmem.toml
Normal file
1
chapter10/kernel/highmem.toml
Normal file
@ -0,0 +1 @@
|
||||
HIGHMEM64G='X'
|
8
chapter10/kernel/highmem.xml
Normal file
8
chapter10/kernel/highmem.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!-- Automatically generated by kernel-config.py
|
||||
DO NOT EDIT! -->
|
||||
<screen role="nodump"><emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
H<emphasis role='blue'>i</emphasis>gh Memory Support --->
|
||||
(X) <emphasis role='blue'>6</emphasis>4GB [HIGHMEM64G]</screen>
|
293
chapter10/kernel/kernel-config.py
Executable file
293
chapter10/kernel/kernel-config.py
Executable file
@ -0,0 +1,293 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright 2023 The LFS Editors
|
||||
|
||||
# Stupid script to render "mconf"-style kernel configuration
|
||||
# Usage: kernel-config.py [path to kernel tree] [needed config].toml
|
||||
# The toml file should be like:
|
||||
# for bool and tristate:
|
||||
# EXT4="*"
|
||||
# DRM="*M"
|
||||
# EXPERT=" "
|
||||
# DRM_I915="*M"
|
||||
# for choice:
|
||||
# HIGHMEM64G="X"
|
||||
# an entry with comment:
|
||||
# DRM_I915 = { value = " *M", comment = "for i915, crocus, or iris" }
|
||||
|
||||
choice_bit = 1 << 30
|
||||
ind0 = 0
|
||||
ind1 = 0
|
||||
menu_id = 1
|
||||
stack = []
|
||||
if_stack = []
|
||||
|
||||
expand_var_mp = { 'SRCARCH': 'x86' }
|
||||
main_dep = {}
|
||||
|
||||
def expand_var(s):
|
||||
for k in expand_var_mp:
|
||||
s = s.replace('$(' + k + ')', expand_var_mp[k])
|
||||
return s
|
||||
|
||||
def pop_stack(cond):
|
||||
global ind0, ind1, stack
|
||||
assert(cond(stack[-1][0]))
|
||||
s, i0, i1, _ = stack[-1]
|
||||
stack = stack[:-1]
|
||||
ind0 -= i0
|
||||
ind1 -= i1
|
||||
|
||||
def pop_stack_while(cond):
|
||||
while stack and cond(stack[-1][0]):
|
||||
pop_stack(cond)
|
||||
|
||||
def cur_menu():
|
||||
global stack
|
||||
return stack[-1][3] if stack else 0
|
||||
|
||||
def cur_if():
|
||||
global if_stack
|
||||
return if_stack[-1][:] if if_stack else []
|
||||
|
||||
def clean_dep(d):
|
||||
d = d.strip()
|
||||
if d.endswith('=y') or d.endswith('=M'):
|
||||
d = d[:-2]
|
||||
elif d.endswith(' != ""'):
|
||||
d = d[:-6]
|
||||
return d
|
||||
|
||||
def parse_config(buf):
|
||||
global ind0, ind1, stack, menu_id
|
||||
is_choice = buf[0].strip() == 'choice'
|
||||
is_menu = buf[0].startswith('menu') or is_choice
|
||||
is_nonconfig_menu = buf[0].startswith('menu ') or is_choice
|
||||
key = None if is_nonconfig_menu else buf[0].split()[1].strip()
|
||||
title = buf[0][len('menu '):] if is_nonconfig_menu else None
|
||||
deps = ['menu'] + cur_if()
|
||||
klass = None
|
||||
|
||||
for line in buf[1:]:
|
||||
line = line.strip()
|
||||
if line.startswith('depends on '):
|
||||
new_deps = line[len('depends on '):].split('&&')
|
||||
deps += [clean_dep(x) for x in new_deps]
|
||||
elif line.startswith('prompt'):
|
||||
title = line[len('prompt '):]
|
||||
else:
|
||||
for prefix in ['tristate', 'bool', 'string']:
|
||||
if line.startswith(prefix + ' '):
|
||||
title = line[len(prefix) + 1:]
|
||||
klass = prefix
|
||||
elif line == prefix:
|
||||
klass = prefix
|
||||
elif line.startswith('def_' + prefix + ' '):
|
||||
klass = prefix
|
||||
else:
|
||||
continue
|
||||
|
||||
if '"' in line:
|
||||
tail = line[line.rfind('"') + 1:].strip()
|
||||
if tail[:3] == 'if ':
|
||||
deps += [clean_dep(x) for x in tail[3:].split('&&')]
|
||||
|
||||
pop_stack_while(lambda x: x not in deps)
|
||||
|
||||
menu_id += is_menu
|
||||
internal_key = key or menu_id
|
||||
if stack:
|
||||
fa = stack[-1][0]
|
||||
if fa == 'menu':
|
||||
fa = cur_menu() & ~choice_bit
|
||||
main_dep[internal_key] = fa
|
||||
|
||||
val = known_config.get(key)
|
||||
comment = None
|
||||
forced = None
|
||||
|
||||
if type(val) == dict:
|
||||
comment = val.get('comment')
|
||||
forced = val.get('forced')
|
||||
val = val['value']
|
||||
|
||||
klass = klass or 'string'
|
||||
if title:
|
||||
title = title.strip().lstrip('"')
|
||||
title = title[:title.find('"')]
|
||||
|
||||
if not val:
|
||||
pass
|
||||
elif klass == 'string':
|
||||
val = '(' + val + ')'
|
||||
else:
|
||||
assert((val == 'X') == bool(cur_menu() & choice_bit))
|
||||
if (val == 'X'):
|
||||
val = '(X)'
|
||||
else:
|
||||
val = list(val)
|
||||
val.sort()
|
||||
for c in val:
|
||||
if c not in 'M* ' or (c == 'M' and klass != 'tristate'):
|
||||
raise Exception('unknown setting %s for %s' % (c, key))
|
||||
bracket = None
|
||||
if klass == 'tristate' and forced != '*' :
|
||||
bracket = '{}' if forced else '<>'
|
||||
else:
|
||||
bracket = '--' if forced else '[]'
|
||||
|
||||
val = bracket[0] + '/'.join(val) + bracket[1]
|
||||
|
||||
arrow = ' --->' if is_menu else ''
|
||||
r = [ind0, val, ind1, title, arrow, internal_key, cur_menu(), comment]
|
||||
|
||||
# Don't indent for untitled (internal) entries
|
||||
x = 2 if title else 0
|
||||
|
||||
key = key or 'menu'
|
||||
menu = (menu_id if is_menu else cur_menu())
|
||||
menu |= choice_bit if is_choice else 0
|
||||
stack_ent = (key, 2, 0, menu) if is_menu else (key, 0, x, menu)
|
||||
ind0 += stack_ent[1]
|
||||
ind1 += stack_ent[2]
|
||||
stack += [stack_ent]
|
||||
|
||||
return r
|
||||
|
||||
def load_kconfig(file):
|
||||
global ind0, ind1, stack, path, menu_id, if_stack
|
||||
r = []
|
||||
config_buf = []
|
||||
with open(path + file) as f:
|
||||
for line in f:
|
||||
if config_buf:
|
||||
if not (line.startswith('\t') or line.startswith(' ')):
|
||||
r += [parse_config(config_buf)]
|
||||
config_buf = []
|
||||
else:
|
||||
config_buf += [line]
|
||||
continue
|
||||
if line.startswith('source') or line.startswith('\tsource'):
|
||||
sub = expand_var(line.strip().split()[1].strip('"'))
|
||||
r += load_kconfig(sub)
|
||||
elif line.startswith('config') or line.startswith('menu'):
|
||||
config_buf = [line]
|
||||
elif line.startswith('choice'):
|
||||
config_buf = [line]
|
||||
elif line.startswith('endmenu') or line.startswith('endchoice'):
|
||||
pop_stack_while(lambda x: x != 'menu')
|
||||
pop_stack(lambda x: x == 'menu')
|
||||
elif line.startswith('if '):
|
||||
line = line[3:]
|
||||
top = cur_if()
|
||||
top += [x.strip() for x in line.split("&&")]
|
||||
if_stack += [top]
|
||||
elif line.startswith('endif'):
|
||||
if_stack = if_stack[:-1]
|
||||
return r
|
||||
|
||||
known_config = {}
|
||||
|
||||
def escape(x):
|
||||
return x.replace('<', '<').replace('>', '>')
|
||||
|
||||
from sys import argv
|
||||
import tomllib
|
||||
|
||||
path = argv[1]
|
||||
if path[-1] != '/':
|
||||
path += '/'
|
||||
with open(argv[2], 'rb') as f:
|
||||
known_config = tomllib.load(f)
|
||||
|
||||
r = load_kconfig('Kconfig')
|
||||
|
||||
# Refcount all menus
|
||||
|
||||
index_ikey = {}
|
||||
for i in reversed(range(len(r))):
|
||||
index_ikey[r[i][5]] = i
|
||||
|
||||
for i in reversed(range(len(r))):
|
||||
if r[i][1] != None:
|
||||
key = r[i][5]
|
||||
fa = main_dep.get(key)
|
||||
if not fa:
|
||||
continue
|
||||
j = index_ikey[fa]
|
||||
if type(fa) == int or not r[j][3]:
|
||||
# The main dependency is a menu or untitled magic entry,
|
||||
# just mark it used
|
||||
r[j][1] = ''
|
||||
if r[j][1] is None:
|
||||
raise Exception('[%s] needs unselected [%s]' % (key, fa))
|
||||
|
||||
r = [i for i in r if i[1] != None and i[3]]
|
||||
|
||||
# Now we are going to pretty-print r
|
||||
|
||||
## Calculate the maximum value length for each menu
|
||||
max_val_len = {}
|
||||
for _, val, _, _, _, _, menu, _ in r:
|
||||
x = max_val_len.get(menu) or 0
|
||||
max_val_len[menu] = max(x, len(val))
|
||||
|
||||
## Output
|
||||
|
||||
max_line = 80
|
||||
buf = []
|
||||
|
||||
done = [x[5] for x in r] + ['revision']
|
||||
for i in known_config:
|
||||
if i not in done:
|
||||
raise Exception("%s seems not exist" % i)
|
||||
|
||||
for i0, val, i1, title, arrow, key, menu, comment in r:
|
||||
rem = max_line
|
||||
|
||||
if val:
|
||||
val += (max_val_len[menu] - len(val)) * ' '
|
||||
|
||||
rem -= i0 + i1 + bool(val) + len(val)
|
||||
line = i0 * ' ' + escape(val) + (i1 + bool(val)) * ' '
|
||||
|
||||
rem -= len(arrow)
|
||||
|
||||
if len(title) > rem:
|
||||
title = title[:rem - 3] + '...'
|
||||
|
||||
b = title.lstrip('YyMmNnHh')
|
||||
a = title[:len(title) - len(b)]
|
||||
b0 = "<emphasis role='blue'>" + escape(b[0]) + "</emphasis>"
|
||||
line += escape(a) + b0 + escape(b[1:]) + escape(arrow)
|
||||
|
||||
rem -= len(title)
|
||||
|
||||
key = ' [' + key + ']' if type(key) == str else ''
|
||||
|
||||
if len(key) <= rem:
|
||||
line += (rem - len(key)) * ' ' + key
|
||||
else:
|
||||
key = '... ' + key
|
||||
line += '\n' + ' ' * (max_line - len(key)) + key
|
||||
if type(comment) == str:
|
||||
comment = [comment]
|
||||
if comment:
|
||||
comment = '\n'.join([' ' * i0 + '# ' + line for line in comment])
|
||||
line = escape(comment) + ':\n' + line
|
||||
|
||||
buf += [line.rstrip()]
|
||||
|
||||
from jinja2 import Template
|
||||
|
||||
t = Template('''<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!-- Automatically generated by kernel-config.py
|
||||
DO NOT EDIT! -->
|
||||
<screen role="nodump"{{ rev }}>{{ '\n'.join(buf) }}</screen>''')
|
||||
|
||||
rev = known_config.get('revision')
|
||||
rev = ' revision="%s"' % rev if rev else ''
|
||||
print(t.render(rev = rev, buf = buf))
|
1
chapter10/kernel/kernel.version
Normal file
1
chapter10/kernel/kernel.version
Normal file
@ -0,0 +1 @@
|
||||
6.4.7
|
27
chapter10/kernel/kernel_version.py
Executable file
27
chapter10/kernel/kernel_version.py
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
def kernel_version(path):
|
||||
version = None
|
||||
patchlevel = None
|
||||
sublevel = None
|
||||
|
||||
with open(path + 'Makefile') as f:
|
||||
for line in f:
|
||||
if line.startswith('VERSION ='):
|
||||
version = line[len('VERSION ='):].strip()
|
||||
elif line.startswith('PATCHLEVEL ='):
|
||||
patchlevel = line[len('PATCHLEVEL ='):].strip()
|
||||
elif line.startswith('SUBLEVEL ='):
|
||||
sublevel = line[len('SUBLEVEL ='):].strip()
|
||||
|
||||
assert(version and patchlevel and sublevel)
|
||||
return '.'.join([version, patchlevel, sublevel])
|
||||
|
||||
if __name__ == '__main__':
|
||||
from sys import argv
|
||||
|
||||
path = argv[1]
|
||||
if path[:-1] != '/':
|
||||
path += '/'
|
||||
|
||||
print(kernel_version(path))
|
1
chapter10/kernel/nvme.toml
Normal file
1
chapter10/kernel/nvme.toml
Normal file
@ -0,0 +1 @@
|
||||
BLK_DEV_NVME='*'
|
8
chapter10/kernel/nvme.xml
Normal file
8
chapter10/kernel/nvme.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!-- Automatically generated by kernel-config.py
|
||||
DO NOT EDIT! -->
|
||||
<screen role="nodump"><emphasis role='blue'>D</emphasis>evice Drivers --->
|
||||
N<emphasis role='blue'>V</emphasis>ME Support --->
|
||||
<*> N<emphasis role='blue'>V</emphasis>M Express block device [BLK_DEV_NVME]</screen>
|
30
chapter10/kernel/systemd.toml
Normal file
30
chapter10/kernel/systemd.toml
Normal file
@ -0,0 +1,30 @@
|
||||
# This part should be sync with sysv.toml
|
||||
WERROR=' '
|
||||
PSI='*'
|
||||
PSI_DEFAULT_DISABLED=' '
|
||||
IKHEADERS=' '
|
||||
CGROUPS='*'
|
||||
MEMCG='*'
|
||||
EXPERT=' '
|
||||
RELOCATABLE='*'
|
||||
RANDOMIZE_BASE='*'
|
||||
STACKPROTECTOR='*'
|
||||
STACKPROTECTOR_STRONG='*'
|
||||
UEVENT_HELPER=' '
|
||||
DEVTMPFS='*'
|
||||
DEVTMPFS_MOUNT='*'
|
||||
FB='*'
|
||||
FRAMEBUFFER_CONSOLE='*'
|
||||
|
||||
AUDIT=' '
|
||||
NET='*'
|
||||
INET='*'
|
||||
IPV6='*'
|
||||
FW_LOADER=' *'
|
||||
FW_LOADER_USER_HELPER='*'
|
||||
DMIID='*'
|
||||
INOTIFY_USER='*'
|
||||
TMPFS='*'
|
||||
TMPFS_POSIX_ACL='*'
|
||||
|
||||
revision='systemd'
|
48
chapter10/kernel/systemd.xml
Normal file
48
chapter10/kernel/systemd.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!-- Automatically generated by kernel-config.py
|
||||
DO NOT EDIT! -->
|
||||
<screen role="nodump" revision="systemd"><emphasis role='blue'>G</emphasis>eneral setup --->
|
||||
[ ] <emphasis role='blue'>C</emphasis>ompile the kernel with warnings as errors [WERROR]
|
||||
[ ] <emphasis role='blue'>A</emphasis>uditing support [AUDIT]
|
||||
<emphasis role='blue'>C</emphasis>PU/Task time and stats accounting --->
|
||||
[*] <emphasis role='blue'>P</emphasis>ressure stall information tracking [PSI]
|
||||
[ ] <emphasis role='blue'>R</emphasis>equire boot parameter to enable pressure stall information tracking
|
||||
... [PSI_DEFAULT_DISABLED]
|
||||
< > <emphasis role='blue'>E</emphasis>nable kernel headers through /sys/kernel/kheaders.tar.xz [IKHEADERS]
|
||||
[*] <emphasis role='blue'>C</emphasis>ontrol Group support ---> [CGROUPS]
|
||||
[*] M<emphasis role='blue'>e</emphasis>mory controller [MEMCG]
|
||||
[ ] <emphasis role='blue'>C</emphasis>onfigure standard kernel features (expert users) ---> [EXPERT]
|
||||
<emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
[*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel [RELOCATABLE]
|
||||
[*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image (KASLR) [RANDOMIZE_BASE]
|
||||
<emphasis role='blue'>G</emphasis>eneral architecture-dependent options --->
|
||||
[*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [STACKPROTECTOR]
|
||||
[*] <emphasis role='blue'>S</emphasis>trong Stack Protector [STACKPROTECTOR_STRONG]
|
||||
[*] N<emphasis role='blue'>e</emphasis>tworking support ---> [NET]
|
||||
N<emphasis role='blue'>e</emphasis>tworking options --->
|
||||
[*] <emphasis role='blue'>T</emphasis>CP/IP networking [INET]
|
||||
<*> <emphasis role='blue'>T</emphasis>he IPv6 protocol ---> [IPV6]
|
||||
<emphasis role='blue'>D</emphasis>evice Drivers --->
|
||||
<emphasis role='blue'>G</emphasis>eneric Driver Options --->
|
||||
[ ] <emphasis role='blue'>S</emphasis>upport for uevent helper [UEVENT_HELPER]
|
||||
[*] M<emphasis role='blue'>a</emphasis>intain a devtmpfs filesystem to mount at /dev [DEVTMPFS]
|
||||
[*] <emphasis role='blue'>A</emphasis>utomount devtmpfs at /dev, after the kernel mounted the rootfs
|
||||
... [DEVTMPFS_MOUNT]
|
||||
<emphasis role='blue'>F</emphasis>irmware loader --->
|
||||
< /*> <emphasis role='blue'>F</emphasis>irmware loading facility [FW_LOADER]
|
||||
[*] <emphasis role='blue'>E</emphasis>nable the firmware sysfs fallback mechanism
|
||||
... [FW_LOADER_USER_HELPER]
|
||||
<emphasis role='blue'>F</emphasis>irmware Drivers --->
|
||||
[*] <emphasis role='blue'>E</emphasis>xport DMI identification via sysfs to userspace [DMIID]
|
||||
<emphasis role='blue'>G</emphasis>raphics support --->
|
||||
<emphasis role='blue'>F</emphasis>rame buffer Devices --->
|
||||
<*> <emphasis role='blue'>S</emphasis>upport for frame buffer devices ---> [FB]
|
||||
<emphasis role='blue'>C</emphasis>onsole display driver support --->
|
||||
[*] <emphasis role='blue'>F</emphasis>ramebuffer Console support [FRAMEBUFFER_CONSOLE]
|
||||
<emphasis role='blue'>F</emphasis>ile systems --->
|
||||
[*] <emphasis role='blue'>I</emphasis>notify support for userspace [INOTIFY_USER]
|
||||
<emphasis role='blue'>P</emphasis>seudo filesystems --->
|
||||
[*] <emphasis role='blue'>T</emphasis>mpfs virtual memory file system support (former shm fs) [TMPFS]
|
||||
[*] <emphasis role='blue'>T</emphasis>mpfs POSIX Access Control Lists [TMPFS_POSIX_ACL]</screen>
|
18
chapter10/kernel/sysv.toml
Normal file
18
chapter10/kernel/sysv.toml
Normal file
@ -0,0 +1,18 @@
|
||||
WERROR=' '
|
||||
PSI='*'
|
||||
PSI_DEFAULT_DISABLED=' '
|
||||
IKHEADERS=' '
|
||||
CGROUPS='*'
|
||||
MEMCG='*'
|
||||
EXPERT=' '
|
||||
RELOCATABLE='*'
|
||||
RANDOMIZE_BASE='*'
|
||||
STACKPROTECTOR='*'
|
||||
STACKPROTECTOR_STRONG='*'
|
||||
UEVENT_HELPER=' '
|
||||
DEVTMPFS='*'
|
||||
DEVTMPFS_MOUNT='*'
|
||||
FB='*'
|
||||
FRAMEBUFFER_CONSOLE='*'
|
||||
|
||||
revision='sysv'
|
32
chapter10/kernel/sysv.xml
Normal file
32
chapter10/kernel/sysv.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!-- Automatically generated by kernel-config.py
|
||||
DO NOT EDIT! -->
|
||||
<screen role="nodump" revision="sysv"><emphasis role='blue'>G</emphasis>eneral setup --->
|
||||
[ ] <emphasis role='blue'>C</emphasis>ompile the kernel with warnings as errors [WERROR]
|
||||
<emphasis role='blue'>C</emphasis>PU/Task time and stats accounting --->
|
||||
[*] <emphasis role='blue'>P</emphasis>ressure stall information tracking [PSI]
|
||||
[ ] <emphasis role='blue'>R</emphasis>equire boot parameter to enable pressure stall information tracking
|
||||
... [PSI_DEFAULT_DISABLED]
|
||||
< > <emphasis role='blue'>E</emphasis>nable kernel headers through /sys/kernel/kheaders.tar.xz [IKHEADERS]
|
||||
[*] <emphasis role='blue'>C</emphasis>ontrol Group support ---> [CGROUPS]
|
||||
[*] M<emphasis role='blue'>e</emphasis>mory controller [MEMCG]
|
||||
[ ] <emphasis role='blue'>C</emphasis>onfigure standard kernel features (expert users) ---> [EXPERT]
|
||||
<emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
[*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel [RELOCATABLE]
|
||||
[*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image (KASLR) [RANDOMIZE_BASE]
|
||||
<emphasis role='blue'>G</emphasis>eneral architecture-dependent options --->
|
||||
[*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [STACKPROTECTOR]
|
||||
[*] <emphasis role='blue'>S</emphasis>trong Stack Protector [STACKPROTECTOR_STRONG]
|
||||
<emphasis role='blue'>D</emphasis>evice Drivers --->
|
||||
<emphasis role='blue'>G</emphasis>eneric Driver Options --->
|
||||
[ ] <emphasis role='blue'>S</emphasis>upport for uevent helper [UEVENT_HELPER]
|
||||
[*] M<emphasis role='blue'>a</emphasis>intain a devtmpfs filesystem to mount at /dev [DEVTMPFS]
|
||||
[*] <emphasis role='blue'>A</emphasis>utomount devtmpfs at /dev, after the kernel mounted the rootfs
|
||||
... [DEVTMPFS_MOUNT]
|
||||
<emphasis role='blue'>G</emphasis>raphics support --->
|
||||
<emphasis role='blue'>F</emphasis>rame buffer Devices --->
|
||||
<*> <emphasis role='blue'>S</emphasis>upport for frame buffer devices ---> [FB]
|
||||
<emphasis role='blue'>C</emphasis>onsole display driver support --->
|
||||
[*] <emphasis role='blue'>F</emphasis>ramebuffer Console support [FRAMEBUFFER_CONSOLE]</screen>
|
5
chapter10/kernel/x2apic.toml
Normal file
5
chapter10/kernel/x2apic.toml
Normal file
@ -0,0 +1,5 @@
|
||||
X86_X2APIC='*'
|
||||
PCI='*'
|
||||
PCI_MSI='*'
|
||||
IOMMU_SUPPORT='*'
|
||||
IRQ_REMAP='*'
|
12
chapter10/kernel/x2apic.xml
Normal file
12
chapter10/kernel/x2apic.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!-- Automatically generated by kernel-config.py
|
||||
DO NOT EDIT! -->
|
||||
<screen role="nodump"><emphasis role='blue'>P</emphasis>rocessor type and features --->
|
||||
[*] <emphasis role='blue'>S</emphasis>upport x2apic [X86_X2APIC]
|
||||
<emphasis role='blue'>D</emphasis>evice Drivers --->
|
||||
[*] <emphasis role='blue'>P</emphasis>CI support ---> [PCI]
|
||||
[*] M<emphasis role='blue'>e</emphasis>ssage Signaled Interrupts (MSI and MSI-X) [PCI_MSI]
|
||||
[*] <emphasis role='blue'>I</emphasis>OMMU Hardware Support ---> [IOMMU_SUPPORT]
|
||||
[*] <emphasis role='blue'>S</emphasis>upport for Interrupt Remapping [IRQ_REMAP]</screen>
|
Loading…
Reference in New Issue
Block a user