[Buildroot] [PATCH 1/2] package/criu: new package
Marcus Folkesson
marcus.folkesson at gmail.com
Fri Sep 8 08:27:40 UTC 2023
Checkpoint/Restore In Userspace (CRIU), is a software tool for the Linux operating system to make it possible to freeze a running
application and checkpoint it to persistent storage as a collection of files.
Signed-off-by: Marcus Folkesson <marcus.folkesson at gmail.com>
---
package/Config.in | 1 +
package/criu/Config.in | 28 ++++++++++++++++++++++++++++
package/criu/criu.hash | 3 +++
package/criu/criu.mk | 42 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 74 insertions(+)
create mode 100644 package/criu/Config.in
create mode 100644 package/criu/criu.hash
create mode 100644 package/criu/criu.mk
diff --git a/package/Config.in b/package/Config.in
index b21a2f8c65..c6c809f59c 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2665,6 +2665,7 @@ menu "System tools"
source "package/coreutils/Config.in"
source "package/cpulimit/Config.in"
source "package/cpuload/Config.in"
+ source "package/criu/Config.in"
source "package/crun/Config.in"
source "package/daemon/Config.in"
source "package/dc3dd/Config.in"
diff --git a/package/criu/Config.in b/package/criu/Config.in
new file mode 100644
index 0000000000..158e7ced57
--- /dev/null
+++ b/package/criu/Config.in
@@ -0,0 +1,28 @@
+menuconfig BR2_PACKAGE_CRIU
+ bool "criu"
+ depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
+ depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS
+ depends on BR2_INSTALL_LIBSTDCPP # protobuf
+ depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf, libnl
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # protobuf
+ depends on !BR2_TOOLCHAIN_USES_MUSL
+ depends on !BR2_STATIC_LIBS # protobuf, libbsd
+ depends on BR2_USE_WCHAR #libbsd
+ depends on BR2_USE_MMU #libcap
+ select BR2_PACKAGE_HOST_PYTHON3_SSL
+ select BR2_PACKAGE_PROTOBUF
+ select BR2_PACKAGE_PROTOBUF_C
+ select BR2_PACKAGE_LIBAIO
+ select BR2_PACKAGE_LIBBSD
+ select BR2_PACKAGE_LIBCAP
+ select BR2_PACKAGE_LIBNET
+ select BR2_PACKAGE_LIBNL
+ select BR2_PACKAGE_PYTHON3
+ select BR2_PACKAGE_PYTHON_PIP
+ help
+ Checkpoint/Restore In Userspace (CRIU), is a software tool for the Linux operating system to make it possible to freeze a running
+ application and checkpoint it to persistent storage as a collection of files.
+
+comment "criu needs a uClibc or glibc toolchain w/ threads, dynamic library, wchar"
+ depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS \
+ || !BR2_USE_WCHAR || BR2_TOOLCHAIN_USES_MUSL
diff --git a/package/criu/criu.hash b/package/criu/criu.hash
new file mode 100644
index 0000000000..2c4a07252b
--- /dev/null
+++ b/package/criu/criu.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 6a9997981c9fe4730c848ce59346b3a22fad69b803607cb67a3f6ec0557fa474 criu-3.18.tar.gz
+sha256 568a1fa9d90e18a1a1a61ea58ec2eece16b56a5042cc72c1b4f8d4455ae6fcb7 COPYING
diff --git a/package/criu/criu.mk b/package/criu/criu.mk
new file mode 100644
index 0000000000..01b07e3f3f
--- /dev/null
+++ b/package/criu/criu.mk
@@ -0,0 +1,42 @@
+################################################################################
+#
+# CRIU
+#
+################################################################################
+
+CRIU_VERSION = 3.18
+CRIU_SOURCE = criu-$(CRIU_VERSION).tar.gz
+CRIU_SITE = https://github.com/checkpoint-restore/criu/archive/refs/tags/v$(CRIU_VERSION)
+
+CRIU_LICENSE = GPL-2.0
+CRIU_LICENSE_FILES = COPYING
+CRIU_DEPENDENCIES = host-pkgconf host-protobuf-c host-python3 host-python-pip libaio libbsd libcap libnet libnl protobuf protobuf-c python3
+
+CRIU_CFLAGS = $(TARGET_CFLAGS)
+CRIU_CFLAGS += -D__WORDSIZE -D__USE_GNU -D_GNU_SOURCE
+
+CRIU_MAKE_ENV = $(TARGET_MAKE_ENV)
+CRIU_MAKE_ENV += WERROR=0
+
+#Needed as it adds strange paths to the tool otherwise. E.g. $CROSS_COMPILE/usr/bin/gcc
+CRIU_MAKE_ENV += HOSTLD=ld
+CRIU_MAKE_ENV += HOSTCC=gcc
+
+#x86_64 is treated as x86 in criu
+ifeq ($(BR2_ARCH),x86_64)
+ CRIU_MAKE_ENV += ARCH=x86
+else
+ CRIU_MAKE_ENV += ARCH=$(BR2_ARCH)
+endif
+
+define CRIU_BUILD_CMDS
+ rm -rf $(@D)/images/google/protobuf/descriptor.proto
+ ln -s $(STAGING_DIR)/usr/include/google/protobuf/descriptor.proto $(@D)/images/google/protobuf/descriptor.proto
+ $(CRIU_MAKE_ENV) $(MAKE) USERCFLAGS="$(CRIU_CFLAGS)" -C $(@D)
+endef
+
+define CRIU_INSTALL_TARGET_CMDS
+ $(CRIU_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D) install-criu install-lib install-compel
+endef
+
+$(eval $(generic-package))
--
2.41.0
More information about the buildroot
mailing list