3 # Jailhouse, a Linux-based partitioning hypervisor
5 # Copyright (c) Siemens AG, 2014
7 # This work is licensed under the terms of the GNU GPL, version 2. See
8 # the COPYING file in the top-level directory.
10 # This script will collect information needed to generate a Jailhouse
11 # configuration for hypervisor and root cell (Linux).
14 # $ jailhouse-config-collect.sh mytarget.tar
16 # Copying files and directories from /sys and /proc is surprisingly hard
17 # it would be nice to use just one tool together with the list of files.
18 # The main problem is that stat does not report the correct file sizes. In
19 # procfs files seem to have a size of 0 while in sysfs they ofter appear
20 # bigger than they really are.
21 # Archivers like tar/cpio etc. can not be used for procfs and sysfs.
22 # This scripts first gets a temporary copy of all the files we want. After
23 # copying the files can be archived with tar.
28 echo "Usage: $0 mytarget.tar" 1>&2
32 filelist="${filelist}"
34 tmpdir=/tmp/jailhouse-config-collect.$$
39 # copy all the files we need to a temporary directory first
44 dstdir=$tmpdir/$(dirname $f)
51 echo "Warning: $f does not exist" 1>&2
55 # now archive it and remove temporary copy
56 tar -C $tmpdir -cf $1 .