diff options
author | Mikko Rapeli <mikko.rapeli@linaro.org> | 2024-10-23 15:08:32 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-25 15:12:22 +0100 |
commit | c50552a2a5bf62b113975bdeb171860068ba9994 (patch) | |
tree | 6bb1909ea89c574b15ccf765d9bc3425fe89f6f8 /scripts | |
parent | ceaff21850b9705dafc3afcedf5cc42e1a68a8a6 (diff) | |
download | poky-c50552a2a5bf62b113975bdeb171860068ba9994.tar.gz |
wic bootimg-efi.py: keep timestamps and add debug prints
Keep timestamps etc to help build reproducibility.
Add prints to see what is being copied to ESP partition.
(From OE-Core rev: cedcd25c5e3cd002dd34651c182193731d7c964b)
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 7cc5131541..d00f5428da 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py | |||
@@ -43,16 +43,18 @@ class BootimgEFIPlugin(SourcePlugin): | |||
43 | if initrd: | 43 | if initrd: |
44 | initrds = initrd.split(';') | 44 | initrds = initrd.split(';') |
45 | for rd in initrds: | 45 | for rd in initrds: |
46 | cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) | 46 | cp_cmd = "cp -v -p %s/%s %s" % (bootimg_dir, rd, hdddir) |
47 | exec_cmd(cp_cmd, True) | 47 | out = exec_cmd(cp_cmd, True) |
48 | logger.debug("initrd files:\n%s" % (out)) | ||
48 | else: | 49 | else: |
49 | logger.debug("Ignoring missing initrd") | 50 | logger.debug("Ignoring missing initrd") |
50 | 51 | ||
51 | if dtb: | 52 | if dtb: |
52 | if ';' in dtb: | 53 | if ';' in dtb: |
53 | raise WicError("Only one DTB supported, exiting") | 54 | raise WicError("Only one DTB supported, exiting") |
54 | cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) | 55 | cp_cmd = "cp -v -p %s/%s %s" % (bootimg_dir, dtb, hdddir) |
55 | exec_cmd(cp_cmd, True) | 56 | out = exec_cmd(cp_cmd, True) |
57 | logger.debug("dtb files:\n%s" % (out)) | ||
56 | 58 | ||
57 | @classmethod | 59 | @classmethod |
58 | def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): | 60 | def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): |
@@ -150,6 +152,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
150 | "%s/hdd/boot/loader/loader.conf", cr_workdir) | 152 | "%s/hdd/boot/loader/loader.conf", cr_workdir) |
151 | cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") | 153 | cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") |
152 | cfg.write(loader_conf) | 154 | cfg.write(loader_conf) |
155 | logger.debug("loader.conf:\n%s" % (loader_conf)) | ||
153 | cfg.close() | 156 | cfg.close() |
154 | 157 | ||
155 | configfile = creator.ks.bootloader.configfile | 158 | configfile = creator.ks.bootloader.configfile |
@@ -401,30 +404,33 @@ class BootimgEFIPlugin(SourcePlugin): | |||
401 | exec_native_cmd(objcopy_cmd, native_sysroot) | 404 | exec_native_cmd(objcopy_cmd, native_sysroot) |
402 | else: | 405 | else: |
403 | if source_params.get('install-kernel-into-boot-dir') != 'false': | 406 | if source_params.get('install-kernel-into-boot-dir') != 'false': |
404 | install_cmd = "install -m 0644 %s/%s %s/%s" % \ | 407 | install_cmd = "install -v -p -m 0644 %s/%s %s/%s" % \ |
405 | (staging_kernel_dir, kernel, hdddir, kernel) | 408 | (staging_kernel_dir, kernel, hdddir, kernel) |
406 | exec_cmd(install_cmd) | 409 | out = exec_cmd(install_cmd) |
410 | logger.debug("Installed kernel files:\n%s" % out) | ||
407 | 411 | ||
408 | if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): | 412 | if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): |
409 | for src_path, dst_path in cls.install_task: | 413 | for src_path, dst_path in cls.install_task: |
410 | install_cmd = "install -m 0644 -D %s %s" \ | 414 | install_cmd = "install -v -p -m 0644 -D %s %s" \ |
411 | % (os.path.join(kernel_dir, src_path), | 415 | % (os.path.join(kernel_dir, src_path), |
412 | os.path.join(hdddir, dst_path)) | 416 | os.path.join(hdddir, dst_path)) |
413 | exec_cmd(install_cmd) | 417 | out = exec_cmd(install_cmd) |
418 | logger.debug("Installed IMAGE_EFI_BOOT_FILES:\n%s" % out) | ||
414 | 419 | ||
415 | try: | 420 | try: |
416 | if source_params['loader'] == 'grub-efi': | 421 | if source_params['loader'] == 'grub-efi': |
417 | shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, | 422 | shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, |
418 | "%s/grub.cfg" % cr_workdir) | 423 | "%s/grub.cfg" % cr_workdir) |
419 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: | 424 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: |
420 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) | 425 | cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) |
421 | exec_cmd(cp_cmd, True) | 426 | exec_cmd(cp_cmd, True) |
422 | shutil.move("%s/grub.cfg" % cr_workdir, | 427 | shutil.move("%s/grub.cfg" % cr_workdir, |
423 | "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) | 428 | "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) |
424 | elif source_params['loader'] == 'systemd-boot': | 429 | elif source_params['loader'] == 'systemd-boot': |
425 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: | 430 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: |
426 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) | 431 | cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) |
427 | exec_cmd(cp_cmd, True) | 432 | out = exec_cmd(cp_cmd, True) |
433 | logger.debug("systemd-boot files:\n%s" % out) | ||
428 | elif source_params['loader'] == 'uefi-kernel': | 434 | elif source_params['loader'] == 'uefi-kernel': |
429 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") | 435 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") |
430 | if not kernel: | 436 | if not kernel: |
@@ -445,8 +451,9 @@ class BootimgEFIPlugin(SourcePlugin): | |||
445 | raise WicError("UEFI stub kernel is incompatible with target %s" % target) | 451 | raise WicError("UEFI stub kernel is incompatible with target %s" % target) |
446 | 452 | ||
447 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith(kernel)]: | 453 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith(kernel)]: |
448 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, kernel_efi_image) | 454 | cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, kernel_efi_image) |
449 | exec_cmd(cp_cmd, True) | 455 | out = exec_cmd(cp_cmd, True) |
456 | logger.debug("uefi-kernel files:\n%s" % out) | ||
450 | else: | 457 | else: |
451 | raise WicError("unrecognized bootimg-efi loader: %s" % | 458 | raise WicError("unrecognized bootimg-efi loader: %s" % |
452 | source_params['loader']) | 459 | source_params['loader']) |
@@ -455,13 +462,15 @@ class BootimgEFIPlugin(SourcePlugin): | |||
455 | 462 | ||
456 | startup = os.path.join(kernel_dir, "startup.nsh") | 463 | startup = os.path.join(kernel_dir, "startup.nsh") |
457 | if os.path.exists(startup): | 464 | if os.path.exists(startup): |
458 | cp_cmd = "cp %s %s/" % (startup, hdddir) | 465 | cp_cmd = "cp -v -p %s %s/" % (startup, hdddir) |
459 | exec_cmd(cp_cmd, True) | 466 | out = exec_cmd(cp_cmd, True) |
467 | logger.debug("startup files:\n%s" % out) | ||
460 | 468 | ||
461 | for paths in part.include_path or []: | 469 | for paths in part.include_path or []: |
462 | for path in paths: | 470 | for path in paths: |
463 | cp_cmd = "cp -r %s %s/" % (path, hdddir) | 471 | cp_cmd = "cp -v -p -r %s %s/" % (path, hdddir) |
464 | exec_cmd(cp_cmd, True) | 472 | exec_cmd(cp_cmd, True) |
473 | logger.debug("include_path files:\n%s" % out) | ||
465 | 474 | ||
466 | du_cmd = "du -bks %s" % hdddir | 475 | du_cmd = "du -bks %s" % hdddir |
467 | out = exec_cmd(du_cmd) | 476 | out = exec_cmd(du_cmd) |
@@ -489,12 +498,14 @@ class BootimgEFIPlugin(SourcePlugin): | |||
489 | 498 | ||
490 | label = part.label if part.label else "ESP" | 499 | label = part.label if part.label else "ESP" |
491 | 500 | ||
492 | dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d" % \ | 501 | dosfs_cmd = "mkdosfs -v -n %s -i %s -C %s %d" % \ |
493 | (label, part.fsuuid, bootimg, blocks) | 502 | (label, part.fsuuid, bootimg, blocks) |
494 | exec_native_cmd(dosfs_cmd, native_sysroot) | 503 | exec_native_cmd(dosfs_cmd, native_sysroot) |
504 | logger.debug("mkdosfs:\n%s" % (str(out))) | ||
495 | 505 | ||
496 | mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) | 506 | mcopy_cmd = "mcopy -v -p -i %s -s %s/* ::/" % (bootimg, hdddir) |
497 | exec_native_cmd(mcopy_cmd, native_sysroot) | 507 | out = exec_native_cmd(mcopy_cmd, native_sysroot) |
508 | logger.debug("mcopy:\n%s" % (str(out))) | ||
498 | 509 | ||
499 | chmod_cmd = "chmod 644 %s" % bootimg | 510 | chmod_cmd = "chmod 644 %s" % bootimg |
500 | exec_cmd(chmod_cmd) | 511 | exec_cmd(chmod_cmd) |