@@ -14,6 +14,7 @@ menu "Host utilities"
source "package/cramfs/Config.in.host"
source "package/cryptsetup/Config.in.host"
source "package/dbus-python/Config.in.host"
+ source "package/dracut/Config.in.host"
source "package/dfu-util/Config.in.host"
source "package/dos2unix/Config.in.host"
source "package/dosfstools/Config.in.host"
new file mode 100644
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_HOST_DRACUT
+ bool
+ select BR2_PACKAGE_HOST_KMOD
+ select BR2_PACKAGE_HOST_CROSS_LDD
+ help
+ dracut is used to create an initramfs image by
+ copying tools and files from an installed system
+ and combining it with the dracut framework.
+
+ https://dracut.wiki.kernel.org
new file mode 100644
@@ -0,0 +1,28 @@
+################################################################################
+#
+# dracut
+#
+################################################################################
+
+DRACUT_VERSION = 055
+DRACUT_SOURCE = dracut-$(DRACUT_VERSION).tar.xz
+DRACUT_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/boot/dracut
+DRACUT_LICENSE = GPL-2.0
+DRACUT_LICENSE_FILES = COPYING
+
+HOST_DRACUT_DEPENDENCIES += host-pkgconf host-kmod host-cross-ldd
+
+define HOST_DRACUT_POST_INSTALL_ENABLE_FAKEROOT
+ $(SED) '/unset LD_LIBRARY_PATH/d' $(HOST_DIR)/bin/dracut
+ $(SED) '/unset LD_PRELOAD/d' $(HOST_DIR)/bin/dracut
+endef
+
+define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
+ $(INSTALL) -D -m 0755 package/dracut/dracut_wrapper.sh \
+ $(HOST_DIR)/usr/bin/dracut_wrapper.sh
+endef
+
+HOST_DRACUT_POST_INSTALL_HOOKS+=HOST_DRACUT_POST_INSTALL_ENABLE_FAKEROOT
+HOST_DRACUT_POST_INSTALL_HOOKS+=HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
+
+$(eval $(host-autotools-package))
new file mode 100644
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$*" ]; then
+ echo "No argument supplied"
+ exit
+fi
+
+DRACUT_LDD=${TARGET_CROSS}ldd \
+DRACUT_INSTALL="${HOST_DIR}/lib/dracut/dracut-install" \
+dracutbasedir=${HOST_DIR}/usr/lib/dracut \
+dracutsysrootdir=${TARGET_DIR} \
+${HOST_DIR}/bin/dracut "$@"
dracut is the tool used by desktop distributions to build initrds. In the embedded world, it can be very usefull, too, for instance when wanting to create an initramfs for a system recovery mode. Whereas it is definitively possible to achieve this with buildroot, the process is to have a dedicated buildroot configuration for that, and perform a full build. Instead of doing that, the idea is to use dracut to pick the needed binaries/shared libraries, configuration files, or kernel modules from the 'target' directory. The advantage is to save build time, and also to have a consistency between the packages versions taken for the recovery and the production filesystem. Signed-off-by: Thierry Bultel <thierry.bultel@linatsea.fr> --- Changes v1 -> v2 (all suggested by Arnoult) - added a wrapper script --- package/Config.in.host | 1 + package/dracut/Config.in.host | 10 ++++++++++ package/dracut/dracut.mk | 28 ++++++++++++++++++++++++++++ package/dracut/dracut_wrapper.sh | 14 ++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 package/dracut/Config.in.host create mode 100644 package/dracut/dracut.mk create mode 100644 package/dracut/dracut_wrapper.sh