[elbe-devel] [PATCH v3 2/2] debianize: Add source for in_kernel_firmware

Bastian Germann bage at linutronix.de
Tue Nov 16 14:39:54 CET 2021


Am 16.11.21 um 14:27 schrieb viraj at linutronix.de:
> From: Viraj Shah <viraj.shah at linutronix.de>
> 
> Add check for in_kernel_firmware. If kernel version is greater than
> 4.13, firmware files will not be installed.
> 
> Signed-off-by: Viraj Shah <viraj.shah at linutronix.de>

Reviewed-by: Bastian Germann <bage at linutronix.de>

> ---
>   elbepack/debianize/panels/kernel.py | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/elbepack/debianize/panels/kernel.py b/elbepack/debianize/panels/kernel.py
> index 4700f4ba9..f37ef0745 100644
> --- a/elbepack/debianize/panels/kernel.py
> +++ b/elbepack/debianize/panels/kernel.py
> @@ -18,7 +18,7 @@ from elbepack.debianize.widgets.radio import RadioGroup
>   from elbepack.directories import mako_template_dir
>   from elbepack.templates import template
>   from elbepack.shellhelper import system
> -
> +from pkg_resources import parse_version
>   
>   class ImgType(object):
>       BZ = "bzImage"
> @@ -55,11 +55,23 @@ class Kernel(Panel):
>               return "uinstall"
>           return "install"
>   
> +    def pattern_delete(filename, pattern):
> +        f_r = open(filename,"r")
> +        lines = f_r.readlines()
> +        f_r.close()
> +        f_w = open(filename,"w")
> +        for line in lines:
> +            if not pattern in line:
> +                f_w.write(line)
> +        f_w.close()
> +
>       def debianize(self):
>   
>           self.deb['imgtype_install'] = Kernel.imgtype_to_install(self.deb['imgtype'])
>           self.tmpl_dir = os.path.join(mako_template_dir, 'debianize/kernel')
>           pkg_name = self.deb['k_version'] + '-' + self.deb['p_name']
> +        self.deb['in_kernel_firmware'] = int(parse_version(self.deb['k_version']) <= parse_version('v4.13'))
> +        self.image_dst = 'debian/linux-image-%s.install' % pkg_name
>   
>           for tmpl in [
>               'control',
> @@ -90,3 +102,6 @@ class Kernel(Panel):
>   
>           self.hint = "use 'dpkg-buildpackage -a%s' to build the package" % (
>                   self.deb['p_arch'])
> +
> +        if not self.deb['in_kernel_firmware']:
> +            Kernel.pattern_delete(self.image_dst, "firmware")
> 


More information about the elbe-devel mailing list