diff options
-rw-r--r-- | generic/etc/init.d/fake-overlayfs | 46 | ||||
-rw-r--r-- | rules/fake-overlayfs.in | 45 | ||||
-rw-r--r-- | rules/fake-overlayfs.make | 100 | ||||
-rw-r--r-- | rules/initmethod-bbinit.in | 6 | ||||
-rw-r--r-- | rules/initmethod-bbinit.make | 6 |
5 files changed, 203 insertions, 0 deletions
diff --git a/generic/etc/init.d/fake-overlayfs b/generic/etc/init.d/fake-overlayfs new file mode 100644 index 000000000..b6cf8c000 --- /dev/null +++ b/generic/etc/init.d/fake-overlayfs @@ -0,0 +1,46 @@ +#!/bin/sh + +# +# /etc/init.d/fake-overlay +# + +OVERLAY_DIRS="@OVERLAY_DIRLIST@" + +bdir=/tmp/.fake-overlay-root + +fake_overlay() { + mkdir $bdir + mount -o bind / $bdir + IFS=: + set $OVERLAY_DIRS + while [ $# -gt 0 ]; do + if [ -z "$1" ]; then + shift + continue + fi + echo $1 + src="$bdir$1" + dst="$1/" + test -e "$dst" || mkdir $dst + cp -a "$src/"* "$src/".[^.]* "$src/"..?* $dst 2> /dev/null + shift + done + umount $bdir +} + +# +# Main +# + +case $1 in + + start) + echo "${PREFIX}copying files to tmpfs..." + fake_overlay + ;; + stop) + ;; + *) + echo "Usage: $0 [start|stop]" + ;; +esac diff --git a/rules/fake-overlayfs.in b/rules/fake-overlayfs.in new file mode 100644 index 000000000..1a1e3def0 --- /dev/null +++ b/rules/fake-overlayfs.in @@ -0,0 +1,45 @@ +## SECTION=rootfs + +menuconfig FAKE_OVERLAYFS + tristate + prompt "fake-overlayfs " + help + fake an overlay filesystem like unionfs by copying the original + content to a tmpfs. + + +if FAKE_OVERLAYFS + +comment "Copy the content of these directories" + +config FAKE_OVERLAYFS_VAR + bool "/var" + select ROOTFS_VAR if ROOTFS + +if !FAKE_OVERLAYFS_VAR + +config FAKE_OVERLAYFS_VAR_RUN + bool "/var/run" + select ROOTFS_VAR_RUN if ROOTFS + +config FAKE_OVERLAYFS_VAR_LIB + bool "/var/lib" + select ROOTFS_VAR_LIB if ROOTFS + +config FAKE_OVERLAYFS_VAR_TMP + bool "/var/tmp" + select ROOTFS_VAR_TMP if ROOTFS + +config FAKE_OVERLAYFS_VAR_CACHE + bool "/var/cache" + select ROOTFS_VAR_CACHE if ROOTFS + +endif + +config FAKE_OVERLAYFS_OTHER + string "other" + help + A list of other directories, separated by ':'. + +endif + diff --git a/rules/fake-overlayfs.make b/rules/fake-overlayfs.make new file mode 100644 index 000000000..fbb63b11e --- /dev/null +++ b/rules/fake-overlayfs.make @@ -0,0 +1,100 @@ +# -*-makefile-*- +# +# Copyright (C) 2010 by Michael Olbrich <m.olbrich@pengutronix.de> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_FAKE_OVERLAYFS) += fake-overlayfs + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +$(STATEDIR)/fake-overlayfs.get: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Extract +# ---------------------------------------------------------------------------- + +$(STATEDIR)/fake-overlayfs.extract: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +$(STATEDIR)/fake-overlayfs.prepare: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Compile +# ---------------------------------------------------------------------------- + +$(STATEDIR)/fake-overlayfs.compile: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/fake-overlayfs.install: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +ifdef PTXCONF_FAKE_OVERLAYFS_VAR +FAKE_OVERLAYFS_BASE_DIRS += /var +endif +ifdef PTXCONF_FAKE_OVERLAYFS_VAR_RUN +FAKE_OVERLAYFS_BASE_DIRS += /var/run +endif +ifdef PTXCONF_FAKE_OVERLAYFS_VAR_LIB +FAKE_OVERLAYFS_BASE_DIRS += /var/lib +endif +ifdef PTXCONF_FAKE_OVERLAYFS_VAR_TMP +FAKE_OVERLAYFS_BASE_DIRS += /var/tmp +endif +ifdef PTXCONF_FAKE_OVERLAYFS_VAR_CACHE +FAKE_OVERLAYFS_BASE_DIRS += /var/cache +endif + +FAKE_OVERLAYFS_DIRS = $(call remove_quotes, $(PTXCONF_FAKE_OVERLAYFS_OTHER)):$(subst $(space),:,$(FAKE_OVERLAYFS_BASE_DIRS)) + + +$(STATEDIR)/fake-overlayfs.targetinstall: + @$(call targetinfo) + + @$(call install_init, fake-overlayfs) + @$(call install_fixup,fake-overlayfs,PACKAGE,fake-overlayfs) + @$(call install_fixup,fake-overlayfs,PRIORITY,optional) + @$(call install_fixup,fake-overlayfs,VERSION,1.0) + @$(call install_fixup,fake-overlayfs,SECTION,base) + @$(call install_fixup,fake-overlayfs,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>") + @$(call install_fixup,fake-overlayfs,DEPENDS,) + @$(call install_fixup,fake-overlayfs,DESCRIPTION,missing) + + @$(call install_alternative, fake-overlayfs, 0, 0, 0755, \ + /etc/init.d/fake-overlayfs) + @$(call install_replace, fake-overlayfs, /etc/init.d/fake-overlayfs, \ + @OVERLAY_DIRLIST@, $(FAKE_OVERLAYFS_DIRS)) + + @$(call install_finish,fake-overlayfs) + + @$(call touch) + +# vim: syntax=make diff --git a/rules/initmethod-bbinit.in b/rules/initmethod-bbinit.in index fa39b3b71..7e73afd91 100644 --- a/rules/initmethod-bbinit.in +++ b/rules/initmethod-bbinit.in @@ -273,6 +273,12 @@ config INITMETHOD_BBINIT_LINK_RT_SET_BANDWIDTH prompt "rt-set-bandwidth" default "S03rt-set-bandwidth" +config INITMETHOD_BBINIT_LINK_FAKE_OVERLAYFS + string + depends on FAKE_OVERLAYFS + prompt "fake-overlayfs" + default "S00fake-overlayfs" + endmenu endif diff --git a/rules/initmethod-bbinit.make b/rules/initmethod-bbinit.make index 6e4c501d7..6787a0589 100644 --- a/rules/initmethod-bbinit.make +++ b/rules/initmethod-bbinit.make @@ -357,6 +357,12 @@ ifneq ($(call remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_RT_SET_BANDWIDTH)), /etc/rc.d/$(PTXCONF_INITMETHOD_BBINIT_LINK_RT_SET_BANDWIDTH)) endif +ifneq ($(call remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_FAKE_OVERLAYFS)),) + @$(call install_link, initmethod-bbinit, \ + ../init.d/fake-overlayfs, \ + /etc/rc.d/$(PTXCONF_INITMETHOD_BBINIT_LINK_FAKE_OVERLAYFS)) +endif + @$(call install_finish, initmethod-bbinit) @$(call touch) |