[meta-intel] [PATCH RFC 2/4] systemd-boot_%.bbappend: compile and deploy EFI stub

Cal Sullivan california.l.sullivan at intel.com
Thu Jul 6 17:40:22 PDT 2017


Unfortunately this adds another variable to the mix, and it would need 
to be changed in global context rather than recipe context, so in order 
to build an efi app that depends on it we'd need to add both 
IMAGE_CLASSES += "uefi_comboapp" and SYSTEMD_BOOT_BUILD_TARGET = "stub" 
to a .conf file.

I was thinking of adding some hanging functions we could depend on, but 
that would break package creation without a lot of manual work in the 
recipe.

Another option would be a standalone systemd-boot-stub recipe.

For now I'm going to send my V2 with this the same, but know I'm still 
giving this thought.

Thanks,
Cal

On 06/16/2017 04:39 AM, Mikko Ylinen wrote:
>
>
> On 14/06/17 00:37, Cal Sullivan wrote:
>>
>>
>> On 06/12/2017 09:22 AM, Wold, Saul wrote:
>>> On Fri, 2017-06-09 at 18:30 -0700, California Sullivan wrote:
>>>> The EFI stub can be used to directly boot a kernel + initramfs.
>>>> This addition was taken from meta-refkit.
>>>>
>>>> Signed-off-by: California Sullivan <california.l.sullivan at intel.com>
>>>> ---
>>>>   common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend | 8 ++++++++
>>>>   1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
>>>> b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
>>>> index f13763b..6cb7369 100644
>>>> --- a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
>>>> +++ b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
>>>> @@ -25,3 +25,11 @@ SRC_URI_append_intel-x86-common = " \
>>>>               "
>>>>     PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}"
>>>> +
>>>> +do_compile_append() {
>>>> +    oe_runmake linux${SYSTEMD_BOOT_EFI_ARCH}.efi.stub
>>>> +}
>>>> +
>>>> +do_deploy_append() {
>>>> +    install ${B}/linux*.efi.stub ${DEPLOYDIR}
>>>> +}
>>> Do these changes make it always build and deploy a stub binary? Should
>>> this be conditional?
>> It does, but its really small.
>>
>> I'm not sure what kind of conditional we could use but still have the 
>> recipe look clean. The uefi-comboapp bbclass is inherited by an image 
>> one way or another, so its variables are in recipe context and won't 
>> affect the outside world. We'd need to check EFI_PROVIDER or 
>> something, but EFI_PROVIDER is a live-image-ism, and won't 
>> necessarily be set when building a wic image, for example.
>>
>
> Long time ago I experimented with something like this but
> never sent it out to OE-Core:
>
> diff --git a/meta/recipes-bsp/systemd-boot/systemd-boot_232.bb 
> b/meta/recipes-bsp/systemd-boot/systemd-boot_232.bb
> index 0471ce2..695d0fc 100644
> --- a/meta/recipes-bsp/systemd-boot/systemd-boot_232.bb
> +++ b/meta/recipes-bsp/systemd-boot/systemd-boot_232.bb
> @@ -19,13 +19,23 @@ EXTRA_OECONF = " --enable-gnuefi \
>  TUNE_CCARGS_remove = "-mfpmath=sse"
>  COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
>
> +do_compile[vardeps] += "SYSTEMD_BOOT_BUILD_TARGET"
> +
> +# Configure whether to build the bootloader or the EFI stub.
> +# The latter option is built when setting the variable to "stub".
> +SYSTEMD_BOOT_BUILD_TARGET ??= "systemd-boot"
> +
>  do_compile() {
>         SYSTEMD_BOOT_EFI_ARCH="ia32"
>         if [ "${TARGET_ARCH}" = "x86_64" ]; then
>                 SYSTEMD_BOOT_EFI_ARCH="x64"
>         fi
>
> -       oe_runmake systemd-boot${SYSTEMD_BOOT_EFI_ARCH}.efi
> +       if [ "${SYSTEMD_BOOT_BUILD_TARGET}" = "stub" ]; then
> +               oe_runmake linux${SYSTEMD_BOOT_EFI_ARCH}.efi.stub
> +       else
> +               oe_runmake systemd-boot${SYSTEMD_BOOT_EFI_ARCH}.efi
> +       fi
>  }
>
>  do_install() {
> @@ -34,6 +44,6 @@ do_install() {
>  }
>
>  do_deploy () {
> -       install ${B}/systemd-boot*.efi ${DEPLOYDIR}
> +       install ${B}/*.efi* ${DEPLOYDIR}
>  }
>  addtask deploy before do_build after do_compile
>
>
> -- Mikko



More information about the meta-intel mailing list