summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2015-04-13 08:44:38 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-24 11:06:55 +0100
commitbef330582e5724a8ba3bcad755aab42b846a49ed (patch)
tree4452646e7ee9708647d62fe825af854a8f41d443
parente156b085cc0b570b7d152c5f6a1019a5aa7a6c34 (diff)
downloadpoky-bef330582e5724a8ba3bcad755aab42b846a49ed.tar.gz
rootfsdebugfiles.bbclass: quick-and-dirty installation of additional files
The main motivation for this class was the observation that a) a core-image can hang under qemu when the kernel does not have enough entropy to generate the ssh host key b) ssh complains about changing ssh host key files when rebooting the same machine with different images For debugging it is okay to reuse an ssh host key generated on the device before. There may be also similar use cases, so the class is generic enough to also copy more than one file or directory, with dropbear_rsa_host_key given as example. The documentation and naming of the class makes it clear that it should not be used for production images. (From OE-Core rev: ae4d605d802edb4c8bdb2dbee1b0c36d7730c07f) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/rootfsdebugfiles.bbclass36
1 files changed, 36 insertions, 0 deletions
diff --git a/meta/classes/rootfsdebugfiles.bbclass b/meta/classes/rootfsdebugfiles.bbclass
new file mode 100644
index 0000000000..a558871e99
--- /dev/null
+++ b/meta/classes/rootfsdebugfiles.bbclass
@@ -0,0 +1,36 @@
1# This class installs additional files found on the build host
2# directly into the rootfs.
3#
4# One use case is to install a constant ssh host key in
5# an image that gets created for just one machine. This
6# solves two issues:
7# - host key generation on the device can stall when the
8# kernel has not gathered enough entropy yet (seen in practice
9# under qemu)
10# - ssh complains by default when the host key changes
11#
12# For dropbear, with the ssh host key store along side the local.conf:
13# 1. Extend local.conf:
14# INHERIT += "rootfsdebugfiles"
15# ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ;"
16# 2. Boot the image once, copy the dropbear_rsa_host_key from
17# the device into your build conf directory.
18#
19# Do not use for production images! It bypasses several
20# core build mechanisms (updating the image when one
21# of the files changes, license tracking in the image
22# manifest, ...).
23
24ROOTFS_DEBUG_FILES ?= ""
25ROOTFS_DEBUG_FILES[doc] = "Lists additional files or directories to be installed with 'cp -a' in the format 'source1 target1;source2 target2;...'"
26
27ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files ;"
28rootfs_debug_files () {
29 #!/bin/sh -e
30 echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target; do
31 if [ -e "$source" ]; then
32 mkdir -p $(dirname $target)
33 cp -a $source $target
34 fi
35 done
36}