kernel/uki_create_addons.py
Jan Stancek 0f9ed417bd kernel-5.14.0-588.el9
* Mon May 26 2025 Jan Stancek <jstancek@redhat.com> [5.14.0-588.el9]
- scsi: mpt3sas: Fix buffer overflow in mpt3sas_send_mctp_passthru_req() (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Mark device strings as nonstring (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Fix spelling mistake "receveid" -> "received" (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: update driver version to 52.100.00.00 (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Send a diag reset if target reset fails (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Report driver capability as part of IOCINFO command (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Add support for MCTP Passthrough commands (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Update MPI headers to 02.00.62 version (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Fix a locking bug in an error path (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Reduce log level of ignore_delay_remove message to KERN_INFO (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Remove unused config functions (Chandrakanth Patil) [RHEL-81907]
- scsi: Constify struct pci_error_handlers (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1 (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Add details to EEDPTagMode error message (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Update driver version to 51.100.00.00 (Chandrakanth Patil) [RHEL-81907]
- scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time (Chandrakanth Patil) [RHEL-81907]
- Revert "cgroup: Avoid -Wstringop-overflow warnings" (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: Move procfs cpuset attribute under cgroup-v1.c (Radostin Stoyanov) [RHEL-80382]
- Revert "selftests/cgroup: Drop define _GNU_SOURCE" (Radostin Stoyanov) [RHEL-80382]
- selftests/cgroup: Fix compile error in test_cpu.c (Radostin Stoyanov) [RHEL-80382]
- configs: enable CPUSETS_V1 on RHEL (Radostin Stoyanov) [RHEL-80382]
- mm: memcg: move soft limit reclaim code to memcontrol-v1.c (Radostin Stoyanov) [RHEL-80382]
- mm: memcg: introduce memcontrol-v1.c (Radostin Stoyanov) [RHEL-80382]
- mm: remove page_cpupid_xchg_last() (Radostin Stoyanov) [RHEL-80382]
- mm: use folio_xchg_last_cpupid() in wp_page_reuse() (Radostin Stoyanov) [RHEL-80382]
- mm: convert wp_page_reuse() and finish_mkwrite_fault() to take a folio (Radostin Stoyanov) [RHEL-80382]
- mm: make finish_mkwrite_fault() static (Radostin Stoyanov) [RHEL-80382]
- mm: huge_memory: use folio_xchg_last_cpupid() in __split_huge_page_tail() (Radostin Stoyanov) [RHEL-80382]
- mm: migrate: use folio_xchg_last_cpupid() in folio_migrate_flags() (Radostin Stoyanov) [RHEL-80382]
- sched/fair: use folio_xchg_last_cpupid() in should_numa_migrate_memory() (Radostin Stoyanov) [RHEL-80382]
- mm: add folio_xchg_last_cpupid() (Radostin Stoyanov) [RHEL-80382]
- mm: remove xchg_page_access_time() (Radostin Stoyanov) [RHEL-80382]
- mm: huge_memory: use a folio in change_huge_pmd() (Radostin Stoyanov) [RHEL-80382]
- mm: mprotect: use a folio in change_pte_range() (Radostin Stoyanov) [RHEL-80382]
- sched/fair: use folio_xchg_access_time() in numa_hint_fault_latency() (Radostin Stoyanov) [RHEL-80382]
- mm: add folio_xchg_access_time() (Radostin Stoyanov) [RHEL-80382]
- mm: remove page_cpupid_last() (Radostin Stoyanov) [RHEL-80382]
- mm: huge_memory: use folio_last_cpupid() in __split_huge_page_tail() (Radostin Stoyanov) [RHEL-80382]
- mm: memory: use folio_last_cpupid() in do_numa_page() (Radostin Stoyanov) [RHEL-80382]
- mm: add folio_last_cpupid() (Radostin Stoyanov) [RHEL-80382]
- mm: huge_memory: use folio_last_cpupid() in do_huge_pmd_numa_page() (Radostin Stoyanov) [RHEL-80382]
- mm_types: add virtual and _last_cpupid into struct folio (Radostin Stoyanov) [RHEL-80382]
- Documentation/cgroup-v2: clarify that zswap.writeback is ignored if zswap is disabled (Radostin Stoyanov) [RHEL-80382]
- selftests: test_zswap: add test for hierarchical zswap.writeback (Radostin Stoyanov) [RHEL-80382]
- selftests: cgroup: add tests to verify the zswap writeback path (Radostin Stoyanov) [RHEL-80382]
- selftests: fix the zswap invasive shrink test (Radostin Stoyanov) [RHEL-80382]
- selftests: add zswapin and no zswap tests (Radostin Stoyanov) [RHEL-80382]
- selftests: cgroup: update per-memcg zswap writeback selftest (Radostin Stoyanov) [RHEL-80382]
- selftests: add a sanity check for zswap (Radostin Stoyanov) [RHEL-80382]
- cgroup/rstat: Selftests for niced CPU statistics (Radostin Stoyanov) [RHEL-80382]
- cgroup/rstat: Tracking cgroup-level niced CPU time (Radostin Stoyanov) [RHEL-80382]
- selftests/cgroup: Drop define _GNU_SOURCE (Radostin Stoyanov) [RHEL-80382]
- selftests: cgroup: remove redundant enabling of memory controller (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: Move cpu.h include to cpuset-internal.h (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: add sefltest for cpuset v1 (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1 (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: rename functions shared between v1 and v2 (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move v1 interfaces to cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move validate_change_legacy to cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move legacy hotplug update to cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: add callback_lock helper (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move memory_spread to cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move relax_domain_level to cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move memory_pressure to cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: move common code to cpuset-internal.h (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: introduce cpuset-v1.c (Radostin Stoyanov) [RHEL-80382]
- cgroup: Avoid -Wstringop-overflow warnings (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: add decrease attach_in_progress helpers (Radostin Stoyanov) [RHEL-80382]
- cgroup/pids: Remove unreachable paths of pids_{can,cancel}_fork (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: Expose cpuset filesystem with cpuset v1 only (Radostin Stoyanov) [RHEL-80382]
- cgroup: Do not report unavailable v1 controllers in /proc/cgroups (Radostin Stoyanov) [RHEL-80382]
- cgroup: Disallow mounting v1 hierarchies without controller implementation (Radostin Stoyanov) [RHEL-80382]
- cgroup: Fix potential overflow issue when checking max_depth (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: Check for partition roots with overlapping CPUs (Radostin Stoyanov) [RHEL-80382]
- cgroup: clarify css sibling linkage is protected by cgroup_mutex or RCU (Radostin Stoyanov) [RHEL-80382]
- cgroup/cpuset: Remove cpuset_slab_spread_rotor (Radostin Stoyanov) [RHEL-80382]
- cgroup: update some statememt about delegation (Radostin Stoyanov) [RHEL-80382]
- redhat: configs: Enable CX231XX driver (Kate Hsuan) [RHEL-86821]
- media: usb: usbtv: Stop direct calls to queue num_buffers field (Kate Hsuan) [RHEL-86821]
- media: saa6752hs: Don't set format in sub-device state (Kate Hsuan) [RHEL-86821]
- media: i2c: Use accessors for pad config 'try_*' fields (Kate Hsuan) [RHEL-86821]
- redhat: add downstream SBAT for UKI addons (Emanuele Giuseppe Esposito) [RHEL-92594]
- uki_addons: provide custom SBAT as input parameter (Emanuele Giuseppe Esposito) [RHEL-92594]
- uki_addons: remove completely sbat/sbat.conf (Emanuele Giuseppe Esposito) [RHEL-92594]
- fbdev: efifb: Change the return value type to void (Jocelyn Falempe) [RHEL-75953]
- fbcon: Fix a NULL pointer dereference issue in fbcon_putcs (Jocelyn Falempe) [RHEL-75953]
- fbdev: efifb: Use devm_register_framebuffer() (Jocelyn Falempe) [RHEL-75953]
- fbdev: Introduce devm_register_framebuffer() (Jocelyn Falempe) [RHEL-75953]
- video: Handle HAS_IOPORT dependencies (Jocelyn Falempe) [RHEL-75953]
- fbcon: Use oops_in_progress instead of panic_cpu (Jocelyn Falempe) [RHEL-75953]
- fbcon: Add an option to disable fbcon in panic (Jocelyn Falempe) [RHEL-75953]
- mm: gup: fix infinite loop within __get_longterm_locked (Waiman Long) [RHEL-89519]
- udmabuf: fix racy memfd sealing check (Waiman Long) [RHEL-89519]
- udmabuf: udmabuf_create pin folio codestyle cleanup (Waiman Long) [RHEL-89519]
- udmabuf: pre-fault when first page fault (Waiman Long) [RHEL-89519]
- selftests/udmabuf: add tests to verify data after page migration (Waiman Long) [RHEL-89519]
- udmabuf: pin the pages using memfd_pin_folios() API (Waiman Long) [RHEL-89519]
- docs: hugetlbpage.rst: add hugetlb migration description (Waiman Long) [RHEL-89519]
- mm: hugetlb: make the hugetlb migration strategy consistent (Waiman Long) [RHEL-89519]
- mm: record the migration reason for struct migration_target_control (Waiman Long) [RHEL-89519]
- selftests: drivers/dma-buf: Improve message in selftest summary (Waiman Long) [RHEL-89519]
- selftests: drivers/dma-buf: Fix implicit declaration warns (Waiman Long) [RHEL-89519]
Resolves: RHEL-75953, RHEL-80382, RHEL-81907, RHEL-86821, RHEL-89519, RHEL-92594

Signed-off-by: Jan Stancek <jstancek@redhat.com>
2025-05-26 15:25:18 +02:00

137 lines
4.3 KiB
Python
Executable File

#!/usr/bin/env python3
#
# This script inspects a given json proving a list of addons, and
# creates an addon for each key/value pair matching the given uki, distro and
# arch provided in input.
#
# Usage: python uki_create_addons.py input_json out_dir uki distro arch [sbat]
#
# This tool requires the systemd-ukify and systemd-boot packages.
#
# Addon file
#-----------
# Each addon terminates with .addon
# Each addon contains only two types of lines:
# Lines beginning with '#' are description and thus ignored
# All other lines are command line to be added.
# The name of the end resulting addon is taken from the json hierarchy.
# For example, and addon in json['virt']['rhel']['x86_64']['hello.addon'] will
# result in an UKI addon file generated in out_dir called
# hello-virt.rhel.x86_64.addon.efi
#
# The common key, present in any sub-dict in the provided json (except the leaf dict)
# is used as place for default addons when the same addon is not defined deep
# in the hierarchy. For example, if we define test.addon (text: 'test1\n') in
# json['common']['test.addon'] = ['test1\n'] and another test.addon (text: test2) in
# json['virt']['common']['test.addon'] = ['test2'], any other uki except virt
# will have a test.addon.efi with text "test1", and virt will have a
# test.addon.efi with "test2"
import os
import sys
import json
import collections
import subprocess
UKIFY_PATH = '/usr/lib/systemd/ukify'
def usage(err):
print(f'Usage: {os.path.basename(__file__)} input_json output_dir uki distro arch [sbat]')
print(f'Error:{err}')
sys.exit(1)
def check_clean_arguments(input_json, out_dir):
# Remove end '/'
if out_dir[-1:] == '/':
out_dir = out_dir[:-1]
if not os.path.isfile(input_json):
usage(f'input_json {input_json} is not a file, or does not exist!')
if not os.path.isdir(out_dir):
usage(f'out_dir_dir {out_dir} is not a dir, or does not exist!')
return out_dir
UKICmdlineAddon = collections.namedtuple('UKICmdlineAddon', ['name', 'cmdline'])
uki_addons_list = []
uki_addons = {}
def parse_lines(lines):
cmdline = ''
for l in lines:
l = l.lstrip()
if not l:
continue
if l[0] == '#':
continue
cmdline += l.rstrip() + ' '
if cmdline == '':
return ''
return cmdline
def parse_all_addons(in_obj):
for el in in_obj.keys():
# addon found: copy it in our global dict uki_addons
if el.endswith('.addon'):
uki_addons[el] = in_obj[el]
def recursively_find_addons(in_obj, folder_list):
# end of recursion, leaf directory. Search all addons here
if len(folder_list) == 0:
parse_all_addons(in_obj)
return
# first, check for common folder
if 'common' in in_obj:
parse_all_addons(in_obj['common'])
# second, check if there is a match with the searched folder
if folder_list[0] in in_obj:
folder_next = in_obj[folder_list[0]]
folder_list = folder_list[1:]
recursively_find_addons(folder_next, folder_list)
def parse_in_json(in_json, uki_name, distro, arch):
with open(in_json, 'r') as f:
in_obj = json.load(f)
recursively_find_addons(in_obj, [uki_name, distro, arch])
for addon_name, cmdline in uki_addons.items():
addon_name = addon_name.replace(".addon","")
addon_full_name = f'{addon_name}-{uki_name}.{distro}.{arch}.addon.efi'
cmdline = parse_lines(cmdline).rstrip()
if cmdline:
uki_addons_list.append(UKICmdlineAddon(addon_full_name, cmdline))
def create_addons(out_dir, sbat):
for uki_addon in uki_addons_list:
out_path = os.path.join(out_dir, uki_addon.name)
cmd = [
f'{UKIFY_PATH}', 'build',
'--cmdline', uki_addon.cmdline,
'--output', out_path]
if sbat:
cmd.extend(['--sbat', sbat.rstrip()])
subprocess.check_call(cmd, text=True)
if __name__ == "__main__":
argc = len(sys.argv) - 1
if argc < 5 or argc > 6:
usage('too few or too many parameters!')
input_json = sys.argv[1]
out_dir = sys.argv[2]
uki_name = sys.argv[3]
distro = sys.argv[4]
arch = sys.argv[5]
custom_sbat = None
if argc == 6:
custom_sbat = sys.argv[6]
out_dir = check_clean_arguments(input_json, out_dir)
parse_in_json(input_json, uki_name, distro, arch)
create_addons(out_dir, custom_sbat)