51 Commits

Author SHA1 Message Date
Wenzong Fan dba3038152 grub-efi: fix the potential uninitialized error for variable 'err'
Fix the build errors with DEBUG_BUILD enabled:
  grub-core/loader/linux.c: In function 'grub_initrd_load':
  grub-core/loader/linux.c:326:10: error: 'err' may be used \
  uninitialized in this function [-Werror=maybe-uninitialized]

In function grub_initrd_load:
grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
          char *argv[], void *target)
{
  [snip]
  grub_err_t err;
  [snip]

  #ifdef GRUB_MACHINE_EFI
      [snip]
      err = grub_verify_file (argv[i]);
      [snip]
  #endif

  [snip]
fail:
  [snip]
  return err;
}

If the GRUB_MACHINE_EFI is not defined, the function would return an
uninitialized value for 'err'. We should initialize it when this
variable is assigned.

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2018-12-03 15:12:41 +08:00
Tom Rini 6274757665 meta-efi-secure-boot: Ensure openssl-native exists when we need it
In order to deploy our secure boot keys in DER format we need to use
openssl.  This must be listed in our DEPENDS line in order for the
sysroot to be populated correctly when we run do_sign.  Also drop the
explicit fakeroot on our empty grub-efi do_sign as we may not have
globally populated virtual/fakeroot-native at that point in time.

Fixes: 92316d4b40 ("meta-signing-key: When deploying keys UEFI keys, deploy DER format")
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-11-07 23:40:20 +08:00
Jia Zhang 139a9b656d Clean up the stuffs for stable branches
The following commits are reverted by the way:

- seloader: Fix building for rocko (bc6bbe2)
- meta-integrity: rpm: Add back in required patches for rocko (5fa9c85)

Because they are only applicable to rocko.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2018-09-20 21:21:37 -04:00
Yi Zhao 41c93d4802 efitools: refresh patch to fix QA warning
Refresh patch Build-DBX-by-default.patch

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2018-09-06 16:58:07 +08:00
Yi Zhao ec8e07c9fd efitools: add the deployed artifacts to SSTATE_DUPWHITELIST
The oe-core commit 05f6042a40bb772f7ce8d6819c5b2937d8c9808d removed
DEPLOY_DIR_IMAGE from SSTATE_DUPWHITELIST which caused a do_depoy error
when enable multilib:

$ bitbake efitools lib32-efitools

ERROR: lib32-efitools-1.7.0+gitAUTOINC+0649468475-r0 do_deploy: The
recipe lib32-efitools is trying to install files into a shared area when
those files already exist. Those files and their manifest location are:
  /buildarea/build/tmp-glibc/deploy/images/qemux86-64/LockDown.efi
      (matched in manifest-qemux86_64-efitools.deploy)
Please verify which recipe should provide the above files.

Add the deployed artifacts to SSTATE_DUPWHITELIST to fix this issue.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2018-09-06 16:57:21 +08:00
Yi Zhao e778286de8 seloader: add the deployed artifacts to SSTATE_DUPWHITELIST
The oe-core commit 05f6042a40bb772f7ce8d6819c5b2937d8c9808d removed
DEPLOY_DIR_IMAGE from SSTATE_DUPWHITELIST which caused a do_depoy error
when enable multilib:

$ bitbake seloader lib32-seloader

ERROR: lib32-seloader-0.4.6+gitAUTOINC+8b90f76a8d-r0 do_deploy: The
recipe lib32-seloader is trying to install files into a shared area when
those files already exist. Those files and their manifest location are:
  /buildarea/build/tmp-glibc/deploy/images/qemux86-64/Pkcs7VerifyDxe.efi
      (matched in manifest-qemux86_64-seloader.deploy)
  /buildarea/build/tmp-glibc/deploy/images/qemux86-64/Hash2DxeCrypto.efi
      (matched in manifest-qemux86_64-seloader.deploy)
  /buildarea/build/tmp-glibc/deploy/images/qemux86-64/efi-unsigned/Pkcs7VerifyDxe.efi
      (matched in manifest-qemux86_64-seloader.deploy)
  /buildarea/build/tmp-glibc/deploy/images/qemux86-64/efi-unsigned/Hash2DxeCrypto.efi
      (matched in manifest-qemux86_64-seloader.deploy)
Please verify which recipe should provide the above files.

Add the deployed artifacts to SSTATE_DUPWHITELIST to fix this issue.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2018-09-06 16:57:21 +08:00
Tom Rini e3f8b0e054 sbsigntool: Enable nativesdk support
There are times were we might want to include sbsigntool into an SDK so
rename the recipe and extend to include nativesdk.  We also need gnu-efi
to support nativesdk so include that in a bbappend.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-08-25 08:14:56 +08:00
Tom Rini bc6bbe2bde seloader: Fix building for rocko
When building on rocko we have gnu-efi version 3.0.6 around and seloader
needs to be told this for certain string functions to be provided by
itself rather than gnu-efi.  Add in conditional logic to pass this only
for rocko.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-07-31 22:48:35 +08:00
Jia Zhang b127b760c0 seloader: Update to 0.4.6
Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2018-07-17 05:40:04 -04:00
Jinliang Li 1812c8755b Add root parameter configuration in boot command line.
It is helpful when secure boot is enabled, because you can not
modify boot command line after boot-menu.inc is signed before deploying.

Signed-off-by: Jinliang Li <jinliang.li@linux.alibaba.com>
2018-06-26 09:40:48 +08:00
Jia Zhang b23950cf55 seloader: sync up with the latest
Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2018-05-20 07:21:54 -04:00
Kai Kang f9f181fe5c grub-efi: remove aarch64 from COMPATIBLE_HOST
Functions efi_call_foo and efi_shim_exit are not implemented for arm64
yet, so remove 'aarch64' from COMPATIBLE_HOST for now.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
2018-05-16 11:14:40 +08:00
Kai Kang 485d2db235 grub-efi: fix compile errors for arm64
It fails to build grub-efi for arm64. Add definitions of missing macros
and replace x86 specified asm codes with function grub_halt().

Signed-off-by: Kai Kang <kai.kang@windriver.com>
2018-05-11 14:13:18 +08:00
Yi Zhao 67e52b9f40 grub-efi: refresh patches to fix QA warning
Refresh the following patches:
  0003-efi-chainloader-implement-an-UEFI-Exit-service-for-s.patch
  0005-efi-chainloader-use-shim-to-load-and-verify-an-image.patch
  Grub-get-and-set-efi-variables.patch

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2018-05-10 11:20:24 +08:00
Tom Rini e00aed3e08 efitools: Rework how we deal with rpath and linking of Linux apps
- In all cases, when building Linux apps (and thus linking with gcc) we
  need to pass in the normal set of LDFLAGS for both rpath and link hash
  type.
- Rework Fix-for-the-cross-compilation.patch a bit.  When linking EFI
  apps (and thus linking with ld) we don't need to pass in other special
  flags.  When linking the "openssl" apps we do not need to spell out
  the crtN files as gcc handles that for us, they are normal Linux apps.
  Ensure that all Linux apps get our EXTRA_LDFLAGS passed in.

With all of these changes we are now able to reuse sstate cache between
build directories.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-02 14:29:20 +08:00
Jia Zhang b56c19c8af grub/boot-menu: Rename _bakup suffix to _backup
Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2018-03-19 21:50:58 -04:00
Jia Zhang fb838242ad seloader: sync up with upstream
Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2018-02-28 23:10:04 -05:00
Jackie Huang cfb63e60d7 efitools: use oe.utils.str_filter_out
oe_filter_out has been removed from oe-core so use the
replacement function oe.utils.str_filter_out.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
2018-02-07 14:56:59 +08:00
Jia Zhang 99f7472019 seloader: sync up with upstream
Signed-off-by: Jia Zhang <qianyue.zj@alibaba-inc.com>
2017-10-27 23:27:07 +08:00
Jia Zhang ffe79fe91e shim: drop fallback
shim will uninstall MOK Verify Protocol when launching fallack,
implying it is impossible to get the instance of MOK Verify Protocol
for SELoader. This behavior violates the original intention of
introducing fallback.

Signed-off-by: Jia Zhang <qianyue.zj@alibaba-inc.com>
2017-10-27 21:57:43 +08:00
Wenzong Fan a852a68227 shim: disable OVERRIDE_SECURITY_POLICY for 32bit target (#25)
Fix 32bit assembler errors:
  | /tmp/ccJyZFtJ.s: Assembler messages:
  | /tmp/ccJyZFtJ.s:268: Error: bad register name `%rsp)'
  | /tmp/ccJyZFtJ.s:269: Error: bad register name `%rdi'
  ...
  | make[1]: *** [<builtin>: security_policy.o] Error 1

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
2017-09-30 03:50:25 -04:00
Wenzong Fan 5080ec0fac grub-efi: fix build error with qemux86 (#24)
Fix the error:
  mok2verify.c:169:53: error: \
  format '%lx' expects argument of type 'long unsigned int', \
  but argument 3 has type 'grub_efi_status_t {aka int}' \
  [-Werror=format=]

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
2017-09-29 23:00:39 -04:00
Jia Zhang bfd800fe02 shim: sync up with upstream
Signed-off-by: Jia Zhang <lans.zhang2008@gmail.com>
2017-08-23 05:16:38 +08:00
Jia Zhang b1e14f4e88 encrypted-storage: use luks as the feature name for current implementation
encrypted-storage layer will include more security features about encrypted
storage so the term "encrypted-storage" won't be used to specify a dedicated
technology term such as "LUKS".

Signed-off-by: Jia Zhang <lans.zhang2008@gmail.com>
2017-08-20 15:31:11 +08:00
Jia Zhang 60588ac929 grub-efi: remove the unused patch
Signed-off-by: Jia Zhang <lans.zhang2008@gmail.com>
2017-08-18 13:24:21 +08:00
Jia Zhang e11a0bd8de efitools: fix searching openssl.cnf for target build
Currently, OPENSSL_LIB is only used for locating openssl.cnf in order
to work around openssl-1.1.x.

Signed-off-by: Jia Zhang <lans.zhang2008@gmail.com>
2017-08-17 20:39:48 +08:00
Lans Zhang d5a4de8f09 efitools: support to build with openssl-1.1.x
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-08-16 23:01:13 +08:00
Lans Zhang 104a01a25d shim: refresh fallback patchset
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-08-11 14:14:39 +08:00
Lans Zhang 03a5d21586 shim: sync up with upstream
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-08-09 10:25:25 +08:00
Lans Zhang 1078adea02 shim: sync up with upstream
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-08-03 09:56:12 +08:00
Lans Zhang a3e1038d71 shim: don't set CSV boot entry as the first boot option
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-08-01 13:13:06 +08:00
Lans Zhang f77e53d627 meta-secure-core: code style fixup
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-28 10:09:02 +08:00
Lans Zhang afea92abb3 grub-efi: remove the depreciated replacement for initrd= parameter
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-28 10:01:20 +08:00
Lans Zhang afdac6c3ca grub/boot-menu.inc: use linux and initrd commands instead of chainloader to boot kernel
Since bzImage is not signed during the build.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-27 16:19:40 +08:00
Lans Zhang 008b18270f shim: use fallback loading SELoader
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-24 17:14:51 +08:00
Lans Zhang 189b6e56ab shim: update to the latest
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-24 09:32:55 +08:00
Lans Zhang a50e927a87 seloader: sync up with upstream
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-13 15:54:12 +08:00
Lans Zhang 9de8b3cf78 seloader,libsign: fix homepage URLs
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-13 13:14:47 +08:00
Lans Zhang 8dbce3e3a0 efitools: code style fixup
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-13 13:09:41 +08:00
Lans Zhang 6d7f0155e3 seloader, libsign, cryptfs-tpm2: code style fixup
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-13 10:27:45 +08:00
Lans Zhang 3af3588ab2 grub-efi: carry forward mok2verify to grub-2.02
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-13 10:26:43 +08:00
Lans Zhang 480f1f03a0 grub-efi: rebased to 2.02
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-12 15:36:46 +08:00
Lans Zhang 676968891f Fix the occurrence of checking the existence of signing keys
packagegroups are not the end consumers of using user-key-store.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-12 11:22:40 +08:00
Lans Zhang 02ae233112 shim: enable http boot support
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-11 13:49:22 +08:00
Lans Zhang 1ec1fed661 seloader: sync up with upstream
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-03 15:53:47 +08:00
Lans Zhang 81553a81fb Rename .pem to .crt
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-07-03 15:47:53 +08:00
Lans Zhang 5233d3cf5e shim: fix OVMF crash
- httpboot.o cannot be built if ".PRECIOUS: " is placed ahead
  of "<tab>CFLAGS +=".
- uri pointer should not be freed if NULL.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-06-30 17:07:20 +08:00
Lans Zhang dcfd67c60b shim: clean up the code style
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-06-30 13:41:37 +08:00
Lans Zhang e664a331d5 code style fixup
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-06-29 10:52:06 +08:00
Lans Zhang e280094b5b shim: enable http boot support
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2017-06-26 11:43:10 +08:00