Thread (18 messages) flat view 18 messages, 3 authors, 2021-12-20

Re: [Buildroot] [PATCH 2/3] package/dracut: new host package

From: Arnout Vandecappelle <hidden>
Date: 2021-12-16 20:35:52


On 15/12/2021 19:00, Thierry Bultel wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
  package/Config.in.host        |  1 +
  package/dracut/Config.in.host |  8 ++++++++
  package/dracut/dracut.mk      | 22 ++++++++++++++++++++++
  3 files changed, 31 insertions(+)
  create mode 100644 package/dracut/Config.in.host
  create mode 100644 package/dracut/dracut.mk
diff --git a/package/Config.in.host b/package/Config.in.host
index 0e8b071a2b..42f671a78f 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -15,6 +15,7 @@ menu "Host utilities"
  	source "package/cross-ldd/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"
diff --git a/package/dracut/Config.in.host b/package/dracut/Config.in.host
new file mode 100644
index 0000000000..8ed41d3719
--- /dev/null
+++ b/package/dracut/Config.in.host
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_DRACUT
+	bool "host dracut"
  Contrary to cross-ldd, I *do* think that it's useful to have a Config.in.host 
for host-dracut, because that is indeed a tool you'd use in post-image scripts.
Even if there's a dracut fs, there are probably still use cases not covered by 
it so it's useful standalone as well.
+	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.
  Wrapping is not correct here. Please use utils/check-package before submitting.
quoted hunk ↗ jump to hunk
+
+	https://dracut.wiki.kernel.org
diff --git a/package/dracut/dracut.mk b/package/dracut/dracut.mk
new file mode 100644
index 0000000000..8de89603a5
--- /dev/null
+++ b/package/dracut/dracut.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# dracut
+#
+################################################################################
+
+DRACUT_VERSION = 055
+DRACUT_SOURCE = dracut-$(DRACUT_VERSION).tar.xz
+DRACUT_SITE = https://mirrors.edge.kernel.org/pub/linux/utils/boot/dracut
  Use BR2_KERNEL_MIRROR instead (at least, I think that should work, right?)

  Regards,
  Arnout
+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
+
+HOST_DRACUT_POST_INSTALL_HOOKS+=HOST_DRACUT_POST_INSTALL_ENABLE_FAKEROOT
+
+$(eval $(host-autotools-package))
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help