1

I am working with Linux built with Yocto. I need to add some changes to /etc/ssh/sshd_config file. I created the following patch file using meld:

--- a/sshd_config
+++ b/sshd_config
@@ -116,3 +116,8 @@
 #  AllowTcpForwarding no
 #  PermitTTY no
 #  ForceCommand cvs server
+
+#SFTP server configuration
+Match Group root
+ChrootDirectory /share
+ForceCommand internal-sftp

In meta-mylayer/recipes-connectivity/openssh I created the openssh_8.2p1.bbappend file with the following content:

FILESEXTRAPATHS_prepend := "${THISDIR}:"
SRC_URI += "file://configure_sftp_server.patch"

In the same directory I put my .patch file. The problem is that Yocto shows neither errors nor warnings during building the image but it doesn't apply my patch.

After creating the patch file I was changed first two lines because in meld version they contained absolute paths to compared files. I suppose that this may be the problem but I don't know what I should write.

Thank you in advance for any help.

tomi7654
  • 15
  • 3

2 Answers2

1

I think the issue is that there's a configuration process that creates sshd_config during the compile process that occurs after the patch is applied, overwriting your patches. There's probably a better way (tapping into and modifying that configuration process), but failing to find documentation on that, I found I could apply the patch by adding a do_compile_append stage. Calling the file something other than .patch keeps the Yocto system from trying to apply it twice (and flagging an error).

   SRC_URI += " file://my_patch.latepatch "
    
    do_compile_append() {
       patch -i ../my_patch.latepatch
    }
JPA
  • 11
  • 1
0

Looks correct to me, if the openssh version is correct. You can check in the build/tmp/work folder whether your patch found it's way to the build process.

The main reason I met for unapplied patches is that some fool in an earlier layer did a do_install_append overwriting all patches instead of applying a proper patch.

To find something like this, do a

grep -r do_install_append sources/*/recipes-connectivity/openssh*
Philippos
  • 13,237
  • 2
  • 37
  • 76