linux-yocto-efi-secure-boot.inc: fix rerun failure

Task do_sign of linux-yocto depends on variable GPG_PATH. When GPG_PATH
changes, it fails to rerun the task:

| Exception: FileExistsError: [Errno 17] File exists:
| 'bzImage-5.2.24-yocto-standard.p7b' -> '/path/to/tmp-glibc/work/intel_x86_64-wrs-linux/linux-yocto/5.2.x+gitAUTOINC+bbe834c1d2_370ab92a1e-r0/image/boot/bzImage.p7b'

Remove the link file before create it if exists already.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
This commit is contained in:
Kai Kang
2019-12-03 16:50:11 +08:00
committed by Jia Zhang
parent b8040ed6cc
commit f6963bf84b

View File

@@ -33,7 +33,10 @@ fakeroot python do_sign() {
shutil.copyfile(kernel, d.expand('${D}/boot/') + type + d.expand('-${KERNEL_RELEASE}'))
ext = d.expand('${SB_FILE_EXT}')
shutil.copyfile(kernel + ext, d.expand('${D}/boot/') + type + d.expand('-${KERNEL_RELEASE}' + ext))
os.symlink(type + d.expand('-${KERNEL_RELEASE}' + ext), d.expand('${D}/boot/') + type + ext)
dst = d.expand('${D}/boot/') + type + ext
if os.path.exists(dst):
os.unlink(dst)
os.symlink(type + d.expand('-${KERNEL_RELEASE}' + ext), dst)
}
# Make sure the kernel image has been signed before kernel_do_deploy()