diff mbox series

[isar-cip-core] efibootguard: Adapt installation to Debian upstream

Message ID 20221103083643.14912-1-Quirin.Gylstorff@siemens.com (mailing list archive)
State Handled Elsewhere
Headers show
Series [isar-cip-core] efibootguard: Adapt installation to Debian upstream | expand

Commit Message

Quirin Gylstorff Nov. 3, 2022, 8:36 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows using the Debian upstream version of efibootguard
in place.

Also add the new libebgenv to the installation.
This fixes the missing library from issue #47[1].

[1]: https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/47

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 recipes-bsp/efibootguard/efibootguard_0.12.bb        |  2 +-
 .../efibootguard/files/debian/efibootguard.install   | 12 +++++-------
 recipes-bsp/efibootguard/files/debian/rules          | 10 ++--------
 scripts/lib/wic/plugins/source/efibootguard-boot.py  | 12 ++++++++++--
 scripts/lib/wic/plugins/source/efibootguard-efi.py   | 12 ++++++++++--
 5 files changed, 28 insertions(+), 20 deletions(-)
 mode change 100755 => 100644 recipes-bsp/efibootguard/files/debian/efibootguard.install

Comments

Jan Kiszka Nov. 3, 2022, 12:07 p.m. UTC | #1
On 03.11.22 09:36, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows using the Debian upstream version of efibootguard
> in place.
> 
> Also add the new libebgenv to the installation.
> This fixes the missing library from issue #47[1].
> 
> [1]: https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/47
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  recipes-bsp/efibootguard/efibootguard_0.12.bb        |  2 +-
>  .../efibootguard/files/debian/efibootguard.install   | 12 +++++-------
>  recipes-bsp/efibootguard/files/debian/rules          | 10 ++--------
>  scripts/lib/wic/plugins/source/efibootguard-boot.py  | 12 ++++++++++--
>  scripts/lib/wic/plugins/source/efibootguard-efi.py   | 12 ++++++++++--
>  5 files changed, 28 insertions(+), 20 deletions(-)
>  mode change 100755 => 100644 recipes-bsp/efibootguard/files/debian/efibootguard.install
> 
> diff --git a/recipes-bsp/efibootguard/efibootguard_0.12.bb b/recipes-bsp/efibootguard/efibootguard_0.12.bb
> index 88dc2ed..721b9dc 100644
> --- a/recipes-bsp/efibootguard/efibootguard_0.12.bb
> +++ b/recipes-bsp/efibootguard/efibootguard_0.12.bb
> @@ -26,7 +26,7 @@ PROVIDES = "${PN}"
>  PROVIDES += "${PN}-dev"
>  
>  DEPENDS = "python3-shtab"
> -BUILD_DEB_DEPENDS = "dh-exec,autoconf-archive,gnu-efi,libpci-dev,check,pkg-config,python3-shtab"
> +BUILD_DEB_DEPENDS = "debhelper,autoconf-archive,check,gnu-efi,libpci-dev,pkg-config,python3-shtab,zlib1g-dev"
>  BUILD_DEB_DEPENDS_append_amd64 = ",libc6-dev-i386"
>  BUILD_DEB_DEPENDS_append_i386 = ",libc6-dev-i386"
>  
> diff --git a/recipes-bsp/efibootguard/files/debian/efibootguard.install b/recipes-bsp/efibootguard/files/debian/efibootguard.install
> old mode 100755
> new mode 100644
> index d3ea007..01cf974
> --- a/recipes-bsp/efibootguard/files/debian/efibootguard.install
> +++ b/recipes-bsp/efibootguard/files/debian/efibootguard.install
> @@ -1,7 +1,5 @@
> -#!/usr/bin/dh-exec
> -bg_setenv usr/bin
> -bg_printenv usr/bin
> -tools/bg_gen_unified_kernel usr/bin
> -*.efi usr/share/efibootguard
> -completion/bash/bg_printenv.bash => usr/share/bash-completion/completions/bg_printenv
> -completion/bash/bg_setenv.bash => usr/share/bash-completion/completions/bg_setenv
> +usr/bin
> +usr/lib/*/efibootguard/kernel-stub*.efi
> +usr/lib/*/efibootguard/efibootguard*.efi
> +usr/lib/*/libebgenv.so.0*
> +usr/share/efibootguard/completion
> diff --git a/recipes-bsp/efibootguard/files/debian/rules b/recipes-bsp/efibootguard/files/debian/rules
> index 82e9e0e..9c3b916 100755
> --- a/recipes-bsp/efibootguard/files/debian/rules
> +++ b/recipes-bsp/efibootguard/files/debian/rules
> @@ -1,21 +1,15 @@
>  #!/usr/bin/make -f
>  export DH_VERBOSE=1
> -export DEB_BUILD_OPTIONS=hardening=-stackprotector
> -export DPKG_EXPORT_BUILDFLAGS=1
> -include /usr/share/dpkg/default.mk
> +export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-stackprotector
> +include /usr/share/dpkg/pkg-info.mk
>  
>  override_dh_auto_test:
>  	# we do not run the tests; that avoids having to pull the fff submodule
>  
> -override_dh_auto_install:
> -	# install using Debian's .install files rather than
> -	# make install in order to have a proper package split.
> -
>  override_dh_installchangelogs:
>  	# we're not interested in changelogs
>  
>  override_dh_installdocs:
>  	# we're not interested in docs
> -
>  %:
>  	dh $@ --with autoreconf
> diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> index f9b232b..3d6b2d7 100644
> --- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
> +++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> @@ -187,10 +187,18 @@ class EfibootguardBootPlugin(SourcePlugin):
>              "armhf": "arm",
>              "i386": "ia32"
>          }
> +        distro_to_lib_arch = {
> +            "amd64": "x86_64-linux-gnu",
> +            "arm64": "aarch64-linux-gnu",
> +            "armhf": "arm-linux-gnueabihf",
> +            "i386": "i386-linux-gnu"
> +        }
>          rootfs_path = rootfs_dir.get('ROOTFS_DIR')
> -        efistub = "{rootfs_path}/usr/share/efibootguard/kernel-stub{efiarch}.efi"\
> +        distro_arch = get_bitbake_var("DISTRO_ARCH")
> +        efistub = "{rootfs_path}/usr/lib/{libpath}/efibootguard/kernel-stub{efiarch}.efi"\
>              .format(rootfs_path=rootfs_path,
> -                    efiarch=distro_to_efi_arch[get_bitbake_var("DISTRO_ARCH")])
> +                    libpath=distro_to_lib_arch[distro_arch],
> +                    efiarch=distro_to_efi_arch[distro_arch])
>          uefi_kernel_name = "linux.efi"
>          uefi_kernel_file = "{deploy_dir}/{uefi_kernel_name}"\
>              .format(deploy_dir=deploy_dir, uefi_kernel_name=uefi_kernel_name)
> diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py b/scripts/lib/wic/plugins/source/efibootguard-efi.py
> index a754ee1..2d16fe3 100644
> --- a/scripts/lib/wic/plugins/source/efibootguard-efi.py
> +++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
> @@ -59,9 +59,17 @@ class EfibootguardEFIPlugin(SourcePlugin):
>              "i386": "ia32"
>          }
>  
> +        distro_to_lib_arch = {
> +            "amd64": "x86_64-linux-gnu",
> +            "arm64": "aarch64-linux-gnu",
> +            "armhf": "arm-linux-gnueabihf",
> +            "i386": "i386-linux-gnu"
> +        }
> +
>          distro_arch = get_bitbake_var("DISTRO_ARCH")
> -        bootloader = "/usr/share/efibootguard/efibootguard{}.efi".format(
> -            distro_to_efi_arch[distro_arch])
> +        bootloader = "/usr/lib/{libpath}/efibootguard/efibootguard{efiarch}.efi".format(
> +            libpath=distro_to_lib_arch[distro_arch],
> +            efiarch=distro_to_efi_arch[distro_arch])

These arch name changes look suspicious - or does Debian do the same
for, say, systemd-boot?

Jan

>          part_rootfs_dir = "%s/disk/%s.%s" % (cr_workdir,
>                                               part.label,
>                                               part.lineno)
Quirin Gylstorff Nov. 3, 2022, 12:43 p.m. UTC | #2
Hi,

On 11/3/22 13:07, Jan Kiszka wrote:
> On 03.11.22 09:36, Quirin Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> This allows using the Debian upstream version of efibootguard
>> in place.
>>
>> Also add the new libebgenv to the installation.
>> This fixes the missing library from issue #47[1].
>>
>> [1]: https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/47
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>>   recipes-bsp/efibootguard/efibootguard_0.12.bb        |  2 +-
>>   .../efibootguard/files/debian/efibootguard.install   | 12 +++++-------
>>   recipes-bsp/efibootguard/files/debian/rules          | 10 ++--------
>>   scripts/lib/wic/plugins/source/efibootguard-boot.py  | 12 ++++++++++--
>>   scripts/lib/wic/plugins/source/efibootguard-efi.py   | 12 ++++++++++--
>>   5 files changed, 28 insertions(+), 20 deletions(-)
>>   mode change 100755 => 100644 recipes-bsp/efibootguard/files/debian/efibootguard.install
>>
>> diff --git a/recipes-bsp/efibootguard/efibootguard_0.12.bb b/recipes-bsp/efibootguard/efibootguard_0.12.bb
>> index 88dc2ed..721b9dc 100644
>> --- a/recipes-bsp/efibootguard/efibootguard_0.12.bb
>> +++ b/recipes-bsp/efibootguard/efibootguard_0.12.bb
>> @@ -26,7 +26,7 @@ PROVIDES = "${PN}"
>>   PROVIDES += "${PN}-dev"
>>   
>>   DEPENDS = "python3-shtab"
>> -BUILD_DEB_DEPENDS = "dh-exec,autoconf-archive,gnu-efi,libpci-dev,check,pkg-config,python3-shtab"
>> +BUILD_DEB_DEPENDS = "debhelper,autoconf-archive,check,gnu-efi,libpci-dev,pkg-config,python3-shtab,zlib1g-dev"
>>   BUILD_DEB_DEPENDS_append_amd64 = ",libc6-dev-i386"
>>   BUILD_DEB_DEPENDS_append_i386 = ",libc6-dev-i386"
>>   
>> diff --git a/recipes-bsp/efibootguard/files/debian/efibootguard.install b/recipes-bsp/efibootguard/files/debian/efibootguard.install
>> old mode 100755
>> new mode 100644
>> index d3ea007..01cf974
>> --- a/recipes-bsp/efibootguard/files/debian/efibootguard.install
>> +++ b/recipes-bsp/efibootguard/files/debian/efibootguard.install
>> @@ -1,7 +1,5 @@
>> -#!/usr/bin/dh-exec
>> -bg_setenv usr/bin
>> -bg_printenv usr/bin
>> -tools/bg_gen_unified_kernel usr/bin
>> -*.efi usr/share/efibootguard
>> -completion/bash/bg_printenv.bash => usr/share/bash-completion/completions/bg_printenv
>> -completion/bash/bg_setenv.bash => usr/share/bash-completion/completions/bg_setenv
>> +usr/bin
>> +usr/lib/*/efibootguard/kernel-stub*.efi
>> +usr/lib/*/efibootguard/efibootguard*.efi
>> +usr/lib/*/libebgenv.so.0*
>> +usr/share/efibootguard/completion
>> diff --git a/recipes-bsp/efibootguard/files/debian/rules b/recipes-bsp/efibootguard/files/debian/rules
>> index 82e9e0e..9c3b916 100755
>> --- a/recipes-bsp/efibootguard/files/debian/rules
>> +++ b/recipes-bsp/efibootguard/files/debian/rules
>> @@ -1,21 +1,15 @@
>>   #!/usr/bin/make -f
>>   export DH_VERBOSE=1
>> -export DEB_BUILD_OPTIONS=hardening=-stackprotector
>> -export DPKG_EXPORT_BUILDFLAGS=1
>> -include /usr/share/dpkg/default.mk
>> +export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-stackprotector
>> +include /usr/share/dpkg/pkg-info.mk
>>   
>>   override_dh_auto_test:
>>   	# we do not run the tests; that avoids having to pull the fff submodule
>>   
>> -override_dh_auto_install:
>> -	# install using Debian's .install files rather than
>> -	# make install in order to have a proper package split.
>> -
>>   override_dh_installchangelogs:
>>   	# we're not interested in changelogs
>>   
>>   override_dh_installdocs:
>>   	# we're not interested in docs
>> -
>>   %:
>>   	dh $@ --with autoreconf
>> diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
>> index f9b232b..3d6b2d7 100644
>> --- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
>> +++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
>> @@ -187,10 +187,18 @@ class EfibootguardBootPlugin(SourcePlugin):
>>               "armhf": "arm",
>>               "i386": "ia32"
>>           }
>> +        distro_to_lib_arch = {
>> +            "amd64": "x86_64-linux-gnu",
>> +            "arm64": "aarch64-linux-gnu",
>> +            "armhf": "arm-linux-gnueabihf",
>> +            "i386": "i386-linux-gnu"
>> +        }
>>           rootfs_path = rootfs_dir.get('ROOTFS_DIR')
>> -        efistub = "{rootfs_path}/usr/share/efibootguard/kernel-stub{efiarch}.efi"\
>> +        distro_arch = get_bitbake_var("DISTRO_ARCH")
>> +        efistub = "{rootfs_path}/usr/lib/{libpath}/efibootguard/kernel-stub{efiarch}.efi"\
>>               .format(rootfs_path=rootfs_path,
>> -                    efiarch=distro_to_efi_arch[get_bitbake_var("DISTRO_ARCH")])
>> +                    libpath=distro_to_lib_arch[distro_arch],
>> +                    efiarch=distro_to_efi_arch[distro_arch])
>>           uefi_kernel_name = "linux.efi"
>>           uefi_kernel_file = "{deploy_dir}/{uefi_kernel_name}"\
>>               .format(deploy_dir=deploy_dir, uefi_kernel_name=uefi_kernel_name)
>> diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py b/scripts/lib/wic/plugins/source/efibootguard-efi.py
>> index a754ee1..2d16fe3 100644
>> --- a/scripts/lib/wic/plugins/source/efibootguard-efi.py
>> +++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
>> @@ -59,9 +59,17 @@ class EfibootguardEFIPlugin(SourcePlugin):
>>               "i386": "ia32"
>>           }
>>   
>> +        distro_to_lib_arch = {
>> +            "amd64": "x86_64-linux-gnu",
>> +            "arm64": "aarch64-linux-gnu",
>> +            "armhf": "arm-linux-gnueabihf",
>> +            "i386": "i386-linux-gnu"
>> +        }
>> +
>>           distro_arch = get_bitbake_var("DISTRO_ARCH")
>> -        bootloader = "/usr/share/efibootguard/efibootguard{}.efi".format(
>> -            distro_to_efi_arch[distro_arch])
>> +        bootloader = "/usr/lib/{libpath}/efibootguard/efibootguard{efiarch}.efi".format(
>> +            libpath=distro_to_lib_arch[distro_arch],
>> +            efiarch=distro_to_efi_arch[distro_arch])
> 
> These arch name changes look suspicious - or does Debian do the same
> for, say, systemd-boot?

You mean the move to `/usr/lib/{libpath}/...` according to this quick 
search [1]. It is a pattern in Debian, see 
https://packages.debian.org/bookworm/efitools.

[1]: 
https://packages.debian.org/search?suite=bookworm&arch=any&searchon=contents&keywords=efi

Quirin

> 
> Jan
> 
>>           part_rootfs_dir = "%s/disk/%s.%s" % (cr_workdir,
>>                                                part.label,
>>                                                part.lineno)
>
Jan Kiszka Nov. 4, 2022, 6 a.m. UTC | #3
On 03.11.22 13:43, Gylstorff Quirin wrote:
> Hi,
> 
> On 11/3/22 13:07, Jan Kiszka wrote:
>> On 03.11.22 09:36, Quirin Gylstorff wrote:
>>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>>
>>> This allows using the Debian upstream version of efibootguard
>>> in place.
>>>
>>> Also add the new libebgenv to the installation.
>>> This fixes the missing library from issue #47[1].
>>>
>>> [1]: https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/47
>>>
>>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>> ---
>>>   recipes-bsp/efibootguard/efibootguard_0.12.bb        |  2 +-
>>>   .../efibootguard/files/debian/efibootguard.install   | 12 +++++-------
>>>   recipes-bsp/efibootguard/files/debian/rules          | 10 ++--------
>>>   scripts/lib/wic/plugins/source/efibootguard-boot.py  | 12 ++++++++++--
>>>   scripts/lib/wic/plugins/source/efibootguard-efi.py   | 12 ++++++++++--
>>>   5 files changed, 28 insertions(+), 20 deletions(-)
>>>   mode change 100755 => 100644
>>> recipes-bsp/efibootguard/files/debian/efibootguard.install
>>>
>>> diff --git a/recipes-bsp/efibootguard/efibootguard_0.12.bb
>>> b/recipes-bsp/efibootguard/efibootguard_0.12.bb
>>> index 88dc2ed..721b9dc 100644
>>> --- a/recipes-bsp/efibootguard/efibootguard_0.12.bb
>>> +++ b/recipes-bsp/efibootguard/efibootguard_0.12.bb
>>> @@ -26,7 +26,7 @@ PROVIDES = "${PN}"
>>>   PROVIDES += "${PN}-dev"
>>>     DEPENDS = "python3-shtab"
>>> -BUILD_DEB_DEPENDS =
>>> "dh-exec,autoconf-archive,gnu-efi,libpci-dev,check,pkg-config,python3-shtab"
>>> +BUILD_DEB_DEPENDS =
>>> "debhelper,autoconf-archive,check,gnu-efi,libpci-dev,pkg-config,python3-shtab,zlib1g-dev"
>>>   BUILD_DEB_DEPENDS_append_amd64 = ",libc6-dev-i386"
>>>   BUILD_DEB_DEPENDS_append_i386 = ",libc6-dev-i386"
>>>   diff --git
>>> a/recipes-bsp/efibootguard/files/debian/efibootguard.install
>>> b/recipes-bsp/efibootguard/files/debian/efibootguard.install
>>> old mode 100755
>>> new mode 100644
>>> index d3ea007..01cf974
>>> --- a/recipes-bsp/efibootguard/files/debian/efibootguard.install
>>> +++ b/recipes-bsp/efibootguard/files/debian/efibootguard.install
>>> @@ -1,7 +1,5 @@
>>> -#!/usr/bin/dh-exec
>>> -bg_setenv usr/bin
>>> -bg_printenv usr/bin
>>> -tools/bg_gen_unified_kernel usr/bin
>>> -*.efi usr/share/efibootguard
>>> -completion/bash/bg_printenv.bash =>
>>> usr/share/bash-completion/completions/bg_printenv
>>> -completion/bash/bg_setenv.bash =>
>>> usr/share/bash-completion/completions/bg_setenv
>>> +usr/bin
>>> +usr/lib/*/efibootguard/kernel-stub*.efi
>>> +usr/lib/*/efibootguard/efibootguard*.efi
>>> +usr/lib/*/libebgenv.so.0*
>>> +usr/share/efibootguard/completion
>>> diff --git a/recipes-bsp/efibootguard/files/debian/rules
>>> b/recipes-bsp/efibootguard/files/debian/rules
>>> index 82e9e0e..9c3b916 100755
>>> --- a/recipes-bsp/efibootguard/files/debian/rules
>>> +++ b/recipes-bsp/efibootguard/files/debian/rules
>>> @@ -1,21 +1,15 @@
>>>   #!/usr/bin/make -f
>>>   export DH_VERBOSE=1
>>> -export DEB_BUILD_OPTIONS=hardening=-stackprotector
>>> -export DPKG_EXPORT_BUILDFLAGS=1
>>> -include /usr/share/dpkg/default.mk
>>> +export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-stackprotector
>>> +include /usr/share/dpkg/pkg-info.mk
>>>     override_dh_auto_test:
>>>       # we do not run the tests; that avoids having to pull the fff
>>> submodule
>>>   -override_dh_auto_install:
>>> -    # install using Debian's .install files rather than
>>> -    # make install in order to have a proper package split.
>>> -
>>>   override_dh_installchangelogs:
>>>       # we're not interested in changelogs
>>>     override_dh_installdocs:
>>>       # we're not interested in docs
>>> -
>>>   %:
>>>       dh $@ --with autoreconf
>>> diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py
>>> b/scripts/lib/wic/plugins/source/efibootguard-boot.py
>>> index f9b232b..3d6b2d7 100644
>>> --- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
>>> +++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
>>> @@ -187,10 +187,18 @@ class EfibootguardBootPlugin(SourcePlugin):
>>>               "armhf": "arm",
>>>               "i386": "ia32"
>>>           }
>>> +        distro_to_lib_arch = {
>>> +            "amd64": "x86_64-linux-gnu",
>>> +            "arm64": "aarch64-linux-gnu",
>>> +            "armhf": "arm-linux-gnueabihf",
>>> +            "i386": "i386-linux-gnu"
>>> +        }
>>>           rootfs_path = rootfs_dir.get('ROOTFS_DIR')
>>> -        efistub =
>>> "{rootfs_path}/usr/share/efibootguard/kernel-stub{efiarch}.efi"\
>>> +        distro_arch = get_bitbake_var("DISTRO_ARCH")
>>> +        efistub =
>>> "{rootfs_path}/usr/lib/{libpath}/efibootguard/kernel-stub{efiarch}.efi"\
>>>               .format(rootfs_path=rootfs_path,
>>> -                   
>>> efiarch=distro_to_efi_arch[get_bitbake_var("DISTRO_ARCH")])
>>> +                    libpath=distro_to_lib_arch[distro_arch],
>>> +                    efiarch=distro_to_efi_arch[distro_arch])
>>>           uefi_kernel_name = "linux.efi"
>>>           uefi_kernel_file = "{deploy_dir}/{uefi_kernel_name}"\
>>>               .format(deploy_dir=deploy_dir,
>>> uefi_kernel_name=uefi_kernel_name)
>>> diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py
>>> b/scripts/lib/wic/plugins/source/efibootguard-efi.py
>>> index a754ee1..2d16fe3 100644
>>> --- a/scripts/lib/wic/plugins/source/efibootguard-efi.py
>>> +++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
>>> @@ -59,9 +59,17 @@ class EfibootguardEFIPlugin(SourcePlugin):
>>>               "i386": "ia32"
>>>           }
>>>   +        distro_to_lib_arch = {
>>> +            "amd64": "x86_64-linux-gnu",
>>> +            "arm64": "aarch64-linux-gnu",
>>> +            "armhf": "arm-linux-gnueabihf",
>>> +            "i386": "i386-linux-gnu"
>>> +        }
>>> +
>>>           distro_arch = get_bitbake_var("DISTRO_ARCH")
>>> -        bootloader =
>>> "/usr/share/efibootguard/efibootguard{}.efi".format(
>>> -            distro_to_efi_arch[distro_arch])
>>> +        bootloader =
>>> "/usr/lib/{libpath}/efibootguard/efibootguard{efiarch}.efi".format(
>>> +            libpath=distro_to_lib_arch[distro_arch],
>>> +            efiarch=distro_to_efi_arch[distro_arch])
>>
>> These arch name changes look suspicious - or does Debian do the same
>> for, say, systemd-boot?
> 
> You mean the move to `/usr/lib/{libpath}/...` according to this quick
> search [1]. It is a pattern in Debian, see
> https://packages.debian.org/bookworm/efitools.
> 
> [1]:
> https://packages.debian.org/search?suite=bookworm&arch=any&searchon=contents&keywords=efi
> 

I was rather referring to the binary name - but I misread that it would
start to carry lib-arch names as well.

Thanks, applied.

Jan
diff mbox series

Patch

diff --git a/recipes-bsp/efibootguard/efibootguard_0.12.bb b/recipes-bsp/efibootguard/efibootguard_0.12.bb
index 88dc2ed..721b9dc 100644
--- a/recipes-bsp/efibootguard/efibootguard_0.12.bb
+++ b/recipes-bsp/efibootguard/efibootguard_0.12.bb
@@ -26,7 +26,7 @@  PROVIDES = "${PN}"
 PROVIDES += "${PN}-dev"
 
 DEPENDS = "python3-shtab"
-BUILD_DEB_DEPENDS = "dh-exec,autoconf-archive,gnu-efi,libpci-dev,check,pkg-config,python3-shtab"
+BUILD_DEB_DEPENDS = "debhelper,autoconf-archive,check,gnu-efi,libpci-dev,pkg-config,python3-shtab,zlib1g-dev"
 BUILD_DEB_DEPENDS_append_amd64 = ",libc6-dev-i386"
 BUILD_DEB_DEPENDS_append_i386 = ",libc6-dev-i386"
 
diff --git a/recipes-bsp/efibootguard/files/debian/efibootguard.install b/recipes-bsp/efibootguard/files/debian/efibootguard.install
old mode 100755
new mode 100644
index d3ea007..01cf974
--- a/recipes-bsp/efibootguard/files/debian/efibootguard.install
+++ b/recipes-bsp/efibootguard/files/debian/efibootguard.install
@@ -1,7 +1,5 @@ 
-#!/usr/bin/dh-exec
-bg_setenv usr/bin
-bg_printenv usr/bin
-tools/bg_gen_unified_kernel usr/bin
-*.efi usr/share/efibootguard
-completion/bash/bg_printenv.bash => usr/share/bash-completion/completions/bg_printenv
-completion/bash/bg_setenv.bash => usr/share/bash-completion/completions/bg_setenv
+usr/bin
+usr/lib/*/efibootguard/kernel-stub*.efi
+usr/lib/*/efibootguard/efibootguard*.efi
+usr/lib/*/libebgenv.so.0*
+usr/share/efibootguard/completion
diff --git a/recipes-bsp/efibootguard/files/debian/rules b/recipes-bsp/efibootguard/files/debian/rules
index 82e9e0e..9c3b916 100755
--- a/recipes-bsp/efibootguard/files/debian/rules
+++ b/recipes-bsp/efibootguard/files/debian/rules
@@ -1,21 +1,15 @@ 
 #!/usr/bin/make -f
 export DH_VERBOSE=1
-export DEB_BUILD_OPTIONS=hardening=-stackprotector
-export DPKG_EXPORT_BUILDFLAGS=1
-include /usr/share/dpkg/default.mk
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-stackprotector
+include /usr/share/dpkg/pkg-info.mk
 
 override_dh_auto_test:
 	# we do not run the tests; that avoids having to pull the fff submodule
 
-override_dh_auto_install:
-	# install using Debian's .install files rather than
-	# make install in order to have a proper package split.
-
 override_dh_installchangelogs:
 	# we're not interested in changelogs
 
 override_dh_installdocs:
 	# we're not interested in docs
-
 %:
 	dh $@ --with autoreconf
diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
index f9b232b..3d6b2d7 100644
--- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
+++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
@@ -187,10 +187,18 @@  class EfibootguardBootPlugin(SourcePlugin):
             "armhf": "arm",
             "i386": "ia32"
         }
+        distro_to_lib_arch = {
+            "amd64": "x86_64-linux-gnu",
+            "arm64": "aarch64-linux-gnu",
+            "armhf": "arm-linux-gnueabihf",
+            "i386": "i386-linux-gnu"
+        }
         rootfs_path = rootfs_dir.get('ROOTFS_DIR')
-        efistub = "{rootfs_path}/usr/share/efibootguard/kernel-stub{efiarch}.efi"\
+        distro_arch = get_bitbake_var("DISTRO_ARCH")
+        efistub = "{rootfs_path}/usr/lib/{libpath}/efibootguard/kernel-stub{efiarch}.efi"\
             .format(rootfs_path=rootfs_path,
-                    efiarch=distro_to_efi_arch[get_bitbake_var("DISTRO_ARCH")])
+                    libpath=distro_to_lib_arch[distro_arch],
+                    efiarch=distro_to_efi_arch[distro_arch])
         uefi_kernel_name = "linux.efi"
         uefi_kernel_file = "{deploy_dir}/{uefi_kernel_name}"\
             .format(deploy_dir=deploy_dir, uefi_kernel_name=uefi_kernel_name)
diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py b/scripts/lib/wic/plugins/source/efibootguard-efi.py
index a754ee1..2d16fe3 100644
--- a/scripts/lib/wic/plugins/source/efibootguard-efi.py
+++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
@@ -59,9 +59,17 @@  class EfibootguardEFIPlugin(SourcePlugin):
             "i386": "ia32"
         }
 
+        distro_to_lib_arch = {
+            "amd64": "x86_64-linux-gnu",
+            "arm64": "aarch64-linux-gnu",
+            "armhf": "arm-linux-gnueabihf",
+            "i386": "i386-linux-gnu"
+        }
+
         distro_arch = get_bitbake_var("DISTRO_ARCH")
-        bootloader = "/usr/share/efibootguard/efibootguard{}.efi".format(
-            distro_to_efi_arch[distro_arch])
+        bootloader = "/usr/lib/{libpath}/efibootguard/efibootguard{efiarch}.efi".format(
+            libpath=distro_to_lib_arch[distro_arch],
+            efiarch=distro_to_efi_arch[distro_arch])
         part_rootfs_dir = "%s/disk/%s.%s" % (cr_workdir,
                                              part.label,
                                              part.lineno)