From eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 Mon Sep 17 00:00:00 2001 From: Dave Cobbley Date: Tue, 14 Aug 2018 10:05:37 -0700 Subject: [Subtree] Removing import-layers directory As part of the move to subtrees, need to bring all the import layers content to the top level. Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f Signed-off-by: Dave Cobbley Signed-off-by: Brad Bishop --- poky/meta/classes/rootfsdebugfiles.bbclass | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 poky/meta/classes/rootfsdebugfiles.bbclass (limited to 'poky/meta/classes/rootfsdebugfiles.bbclass') diff --git a/poky/meta/classes/rootfsdebugfiles.bbclass b/poky/meta/classes/rootfsdebugfiles.bbclass new file mode 100644 index 000000000..e2ba4e364 --- /dev/null +++ b/poky/meta/classes/rootfsdebugfiles.bbclass @@ -0,0 +1,41 @@ +# This class installs additional files found on the build host +# directly into the rootfs. +# +# One use case is to install a constant ssh host key in +# an image that gets created for just one machine. This +# solves two issues: +# - host key generation on the device can stall when the +# kernel has not gathered enough entropy yet (seen in practice +# under qemu) +# - ssh complains by default when the host key changes +# +# For dropbear, with the ssh host key store along side the local.conf: +# 1. Extend local.conf: +# INHERIT += "rootfsdebugfiles" +# ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ;" +# 2. Boot the image once, copy the dropbear_rsa_host_key from +# the device into your build conf directory. +# 3. A optional parameter can be used to set file mode +# of the copied target, for instance: +# ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key 0600;" +# in case they might be required to have a specific mode. (Shoundn't be too open, for example) +# +# Do not use for production images! It bypasses several +# core build mechanisms (updating the image when one +# of the files changes, license tracking in the image +# manifest, ...). + +ROOTFS_DEBUG_FILES ?= "" +ROOTFS_DEBUG_FILES[doc] = "Lists additional files or directories to be installed with 'cp -a' in the format 'source1 target1;source2 target2;...'" + +ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files ;" +rootfs_debug_files () { + #!/bin/sh -e + echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target mode; do + if [ -e "$source" ]; then + mkdir -p $(dirname $target) + cp -a $source $target + [ -n "$mode" ] && chmod $mode $target + fi + done +} -- cgit v1.2.3