Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) # Copyright 2019 Google LLC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) import gdb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) import zlib
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) from linux import utils
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) class LxConfigDump(gdb.Command):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)     """Output kernel config to the filename specified as the command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)        argument. Equivalent to 'zcat /proc/config.gz > config.txt' on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)        a running target"""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)     def __init__(self):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)         super(LxConfigDump, self).__init__("lx-configdump", gdb.COMMAND_DATA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)                                            gdb.COMPLETE_FILENAME)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)     def invoke(self, arg, from_tty):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)         if len(arg) == 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)             filename = "config.txt"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)         else:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)             filename = arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)         try:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)             py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)             py_config_size = gdb.parse_and_eval(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)                     "sizeof(kernel_config_data) - 1 - 8 * 2")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)         except gdb.error as e:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)             raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)         inf = gdb.inferiors()[0]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)         zconfig_buf = utils.read_memoryview(inf, py_config_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)                                             py_config_size).tobytes()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)         config_buf = zlib.decompress(zconfig_buf, 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)         with open(filename, 'wb') as f:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)             f.write(config_buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)         gdb.write("Dumped config to " + filename + "\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) LxConfigDump()