1#!/usr/bin/env python3 2# SPDX-License-Identifier: GPL-2.0-only 3# 4# Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org> 5# 6# Generator for runtime verification monitor container 7 8from . import generator 9 10 11class Container(generator.RVGenerator): 12 template_dir = "container" 13 14 def __init__(self, extra_params={}): 15 super().__init__(extra_params) 16 self.name = extra_params.get("model_name") 17 self.main_h = self._read_template_file("main.h") 18 19 def fill_model_h(self): 20 main_h = self.main_h 21 main_h = main_h.replace("%%MODEL_NAME%%", self.name) 22 return main_h 23 24 def fill_kconfig_tooltip(self): 25 """Override to produce a marker for this container in the Kconfig""" 26 container_marker = self._kconfig_marker(self.name) + "\n" 27 result = super().fill_kconfig_tooltip() 28 if self.auto_patch: 29 self._patch_file("Kconfig", 30 self._kconfig_marker(), container_marker) 31 return result 32 return result + container_marker 33