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

Bastian Germann bage at linutronix.de
Tue Nov 16 03:28:37 CET 2021


Am 15.11.21 um 23:11 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>
> ---
>   elbepack/debianize/panels/kernel.py | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/elbepack/debianize/panels/kernel.py b/elbepack/debianize/panels/kernel.py
> index 4700f4ba9..6f72f9ff7 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,16 @@ class Kernel(Panel):
>               return "uinstall"
>           return "install"
>   
> +    def sed_delete(filename, pattern):
> +        system("sed --in-place --expression='/%s/d' '%s'" % (pattern, filename))

Please do that natively in Python.

> +
>       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 +95,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.sed_delete(self.image_dst, "firmware")
> 


More information about the elbe-devel mailing list