From 9e42433ff9eeab3c3e75cbee690b334cdd3c2caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Koutn=C3=BD?= Date: Wed, 9 Aug 2023 21:31:58 +0200 Subject: [PATCH] mkosi: Copy sources under /usr in the image Originally, the source code was copied under /root/src. This home directory is part of root FS and the new mkosi building paradigm has only ephemeral root FS that is generated lazily. Any files placed on the root FS in the build environment are that excluded from the final image. It is useful to have source codes available in the image's runtime (not build time) environment for debugging. ExtraTrees= as used currently are ineffective, so change the destination to copy files under /usr to achieve the intention. gdb sees source files as: > 1354 ../src/src/systemctl/systemctl.c: No such file or directory. Modify gdb configration in the built image accordingly (that file cannot be in /root neither) to resolve to the moved sources. (Commit fdecbf7 ("Enable unprivileged image builds") envisions bind mounting or virtiofsd for nspawn or qemu containers respectively.) --- mkosi.presets/system/mkosi.conf | 2 +- .../.gdbinit => usr/share/factory/mkosi/gdbinit.d/systemd.gdb} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename mkosi.presets/system/mkosi.extra/{root/.gdbinit => usr/share/factory/mkosi/gdbinit.d/systemd.gdb} (57%) diff --git a/mkosi.presets/system/mkosi.conf b/mkosi.presets/system/mkosi.conf index aab7a13dbc2..2474d7f847b 100644 --- a/mkosi.presets/system/mkosi.conf +++ b/mkosi.presets/system/mkosi.conf @@ -8,7 +8,7 @@ Dependencies=base Autologin=yes BaseTrees=../../mkosi.output/base ExtraTrees=../../mkosi.output/base-systemd -ExtraTrees=../../src:/root/src +ExtraTrees=../../src:/usr/src/src Initrds=../../mkosi.output/initrd Packages= acl diff --git a/mkosi.presets/system/mkosi.extra/root/.gdbinit b/mkosi.presets/system/mkosi.extra/usr/share/factory/mkosi/gdbinit.d/systemd.gdb similarity index 57% rename from mkosi.presets/system/mkosi.extra/root/.gdbinit rename to mkosi.presets/system/mkosi.extra/usr/share/factory/mkosi/gdbinit.d/systemd.gdb index 1a2163e3a54..598344809c1 100644 --- a/mkosi.presets/system/mkosi.extra/root/.gdbinit +++ b/mkosi.presets/system/mkosi.extra/usr/share/factory/mkosi/gdbinit.d/systemd.gdb @@ -1,3 +1,3 @@ set debuginfod enabled off set build-id-verbose 0 -set substitute-path ../src /root/src +set substitute-path ../src /usr/src