build: Move everything criu related into criu directory

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2016-02-15 15:26:55 +03:00 committed by Pavel Emelyanov
parent 3410d39514
commit db6cb69394
349 changed files with 765 additions and 1128 deletions

24
.gitignore vendored
View file

@ -6,31 +6,15 @@
*.out
*.swp
*.swo
*-blob.h
*.so
.git-ignore
*.patch
*.pyc
criu
cscope*
tags
TAGS
Makefile.local
syscall-x86-64.S
include/syscall.h
include/syscall-codes.h
protobuf/*.c
protobuf/*.h
protobuf/google/protobuf/*.c
protobuf/google/protobuf/*.h
include/version.h
arch/x86/sys-exec-tbl.c
arch/x86/syscalls.S
pie/pie.lds.S
pie/piegen/piegen
include/config.h
protobuf-desc-gen.h
criu.pc
build
images/*.c
images/*.h
images/google/protobuf/*.c
images/google/protobuf/*.h
.gitid
usr/

View file

@ -1,4 +1,5 @@
-include ../Makefile.inc
include $(__nmk_dir)/include.mk
include $(__nmk_dir)/macro.mk
ASCIIDOC := asciidoc
A2X := a2x
@ -9,10 +10,9 @@ XMLS := $(patsubst %.txt,%.xml,$(SRC))
MANS := $(patsubst %.txt,%.8,$(SRC))
MAN8DIR := $(MANDIR)/man8
GROFF=groff
PAPER=$(shell paperconf 2>/dev/null || echo letter)
GROFF_OPTS := -Tps -t -dpaper=$(PAPER) -P-p$(PAPER) \
-man -msafer -rC1 -rD1 -rS11
GROFF :=groff
PAPER :=$(shell paperconf 2>/dev/null || echo letter)
GROFF_OPTS := -Tps -t -dpaper=$(PAPER) -P-p$(PAPER) -man -msafer -rC1 -rD1 -rS11
PSS := $(MANS:%.8=%.ps)
PDFS := $(MANS:%.8=%.pdf)
@ -27,20 +27,20 @@ check:
done
%.8: %.txt
$(E) " GEN " $@
$(call msg-gen, $@)
$(Q) $(ASCIIDOC) -b docbook -d manpage -o $(patsubst %.8,%.xml,$@) $<
$(Q) $(XMLTO) man --skip-validation $(patsubst %.8,%.xml,$@) 2>/dev/null
%.ps: %.8
$(E) " GEN " $@
$(call msg-gen, $@)
$(Q) $(GROFF) $(GROFF_OPTS) $^ > $@
%.pdf: %.ps
$(E) " GEN " $@
$(call msg-gen, $@)
$(Q) ps2pdf $< $@
clean:
$(E) " CLEAN "
$(call msg-clean, "Documentation")
$(Q) rm -f $(XMLS) $(MANS) $(PSS) $(PDFS)
install: $(MANS)

416
Makefile
View file

@ -1,98 +1,52 @@
#
# Import the build engine first
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
export __nmk_dir
include $(__nmk_dir)/include.mk
VERSION_MAJOR := 1
VERSION_MINOR := 8
VERSION_SUBLEVEL :=
VERSION_EXTRA :=
VERSION_NAME :=
VERSION_SO_MAJOR := 1
VERSION_SO_MINOR := 0
export VERSION_MAJOR VERSION_MINOR VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
export VERSION_SO_MAJOR VERSION_SO_MINOR
include $(__nmk_dir)/macro.mk
#
# FIXME zdtm building procedure requires implicit rules
# so I can't use strict make file mode and drop completely
# all of implicit rules, so I tuned only .SUFFIXES:
#
# In future zdtm makefiles need to be fixed and the line below
# may be uncommented.
#
#MAKEFLAGS := -r -R
#
# Common definitions
#
FIND := find
CSCOPE := cscope
RM := rm -f
LD := $(CROSS_COMPILE)ld
CC := $(CROSS_COMPILE)gcc
NM := $(CROSS_COMPILE)nm
SH := bash
MAKE := make
OBJCOPY := $(CROSS_COMPILE)objcopy
# To build host helpers.
HOSTCC ?= gcc
HOSTLD ?= ld
export HOSTCC HOSTLD
CFLAGS += $(USERCFLAGS)
HOSTCFLAGS ?= $(CFLAGS)
export CFLAGS
export HOSTCC
export HOSTLD
HOSTCFLAGS ?= $(CFLAGS)
export HOSTCFLAGS
#
# Where we live.
SRC_DIR := $(CURDIR)
export SRC_DIR
ifeq ($(ARCH),x86_64)
ARCH := x86
#
# General architecture specific options.
UNAME-M := $(shell uname -m)
export UNAME-M
ifeq ($(ARCH),arm)
ARMV := $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
DEFINES := -DCONFIG_ARMV$(ARMV)
USERCFLAGS += -Wa,-mimplicit-it=always
ifeq ($(ARMV),6)
USERCFLAGS += -march=armv6
endif
ifeq ($(ARMV),7)
USERCFLAGS += -march=armv7-a
endif
PROTOUFIX := y
endif
ifeq ($(ARCH),x86)
SRCARCH := x86
DEFINES := -DCONFIG_X86_64
LDARCH := i386:x86-64
VDSO := y
endif
ifeq ($(ARCH),ia32)
SRCARCH := x86
DEFINES := -DCONFIG_X86_32
LDARCH := i386
ldflags-y += -m elf_i386
VDSO := y
USERCFLAGS += -m32
PROTOUFIX := y
export PROTOUFIX ldflags-y
endif
ifeq ($(GCOV),1)
LDFLAGS += -lgcov
DEBUG := 1 # disable optimization if we want to measure code coverage
%.o $(PROGRAM): override CFLAGS += --coverage -fno-exceptions -fno-inline
endif
ifeq ($(shell echo $(ARCH) | sed -e 's/arm.*/arm/'),arm)
ARMV := $(shell echo $(ARCH) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
SRCARCH := arm
DEFINES := -DCONFIG_ARMV$(ARMV)
USERCFLAGS += -Wa,-mimplicit-it=always
ifeq ($(ARMV),6)
USERCFLAGS += -march=armv6
endif
ifeq ($(ARMV),7)
USERCFLAGS += -march=armv7-a
endif
PROTOUFIX := y
export PROTOUFIX
DEFINES := -DCONFIG_X86_64
endif
ifeq ($(ARCH),aarch64)
@ -103,200 +57,97 @@ endif
# The PowerPC 64 bits architecture could be big or little endian.
# They are handled in the same way.
#
ifeq ($(shell echo $(ARCH) | sed -e 's/ppc64.*/ppc64/'),ppc64)
ifeq ($(ARCH),ppc64)
error := $(error ppc64 big endian not yet supported)
endif
SRCARCH := ppc64
DEFINES := -DCONFIG_PPC64
LDARCH := powerpc:common64
VDSO := y
ifeq ($(ARCH),powerpc)
ifeq ($(UNAME-M),ppc64)
error := $(error ppc64 big endian not yet supported)
endif
DEFINES := -DCONFIG_PPC64
endif
LDARCH ?= $(SRCARCH)
SRC_DIR ?= $(CURDIR)
ARCH_DIR := arch/$(SRCARCH)
$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
export PROTOUFIX DEFINES USERCFLAGS
#
# piegen might be disabled by hands. Don't use it until
# you know what you're doing.
ifneq ($(filter ia32 x86 ppc64le, $(ARCH)),)
ifneq ($(PIEGEN),no)
piegen-y := y
export piegen-y
endif
endif
# Independent options for all tools.
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_GNU_SOURCE
cflags-y += -iquote include -iquote pie -iquote . -I/usr/include/libnl3
cflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include
cflags-y += -fno-strict-aliasing
export cflags-y
CFLAGS += $(USERCFLAGS)
LIBS := -lrt -lpthread -lprotobuf-c -ldl -lnl-3
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_GNU_SOURCE
WARNINGS := -Wall
WARNINGS := -Wall
ifneq ($(WERROR),0)
WARNINGS += -Werror
WARNINGS += -Werror
endif
ifeq ($(DEBUG),1)
DEFINES += -DCR_DEBUG
CFLAGS += -O0 -ggdb3
DEFINES += -DCR_DEBUG
CFLAGS += -O0 -ggdb3
else
CFLAGS += -O2 -g
CFLAGS += -O2 -g
endif
ifeq ($(GMON),1)
CFLAGS += -pg
GMONLDOPT := -pg
endif
CFLAGS += $(WARNINGS) $(DEFINES)
SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
CRIU-SO := libcriu
CRIU-LIB := lib/c/$(CRIU-SO).so
CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
ifeq ($(piegen-y),y)
piegen := pie/piegen/piegen
endif
export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO
export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
export USERCFLAGS
export cflags-y
export VDSO
include Makefile.inc
include Makefile.config
include scripts/Makefile.version
include scripts/Makefile.rules
.SUFFIXES:
CFLAGS += $(WARNINGS) $(DEFINES)
#
# shorthand
build-old := -r -R -f scripts/Makefile.build makefile=Makefile obj
build-old-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj
# Protobuf images first, they are not depending
# on anything else.
$(eval $(call gen-built-in,images))
PHONY += images
PROGRAM := criu
#
# CRIU building done in own directory
# with slightly different rules so we
# can't use nmk engine directly (we
# build syscalls library and such).
#
# But note that we're already included
# the nmk so we can reuse it there.
criu/%: images/built-in.o
$(Q) $(MAKE) -C criu $@
criu: images/built-in.o
$(Q) $(MAKE) -C criu all
criu/criu: criu
PHONY += criu
.PHONY: all zdtm test rebuild clean distclean tags cscope \
docs help pie protobuf $(ARCH_DIR) clean-built lib crit
all: config pie $(VERSION_HEADER) $(CRIU-LIB)
$(Q) $(MAKE) $(PROGRAM)
$(Q) $(MAKE) crit
protobuf/%::
$(Q) $(MAKE) $(build-old)=protobuf $@
protobuf:
$(Q) $(MAKE) $(build-old)=protobuf all
$(ARCH_DIR)/%:: protobuf config
$(Q) $(MAKE) $(build-old)=$(ARCH_DIR) $@
$(ARCH_DIR): protobuf config
$(Q) $(MAKE) $(build-old)=$(ARCH_DIR) all
ifeq ($(piegen-y),y)
pie/piegen/%: config
$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build-old)=pie/piegen $@
pie/piegen: config
$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build-old)=pie/piegen all
$(piegen): pie/piegen/built-in.o
$(E) " LINK " $@
$(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
.PHONY: pie/piegen
endif
pie: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build-old)=pie all
%.o %.i %.s %.d: $(VERSION_HEADER) pie
$(Q) $(MAKE) $(build-old-crtools)=. $@
built-in.o: $(VERSION_HEADER) pie
$(Q) $(MAKE) $(build-old-crtools)=. $@
lib/%:: $(VERSION_HEADER) config built-in.o
#
# Libraries next once criu it ready
# (we might generate headers and such
# when building criu itself).
lib/%: criu
$(Q) $(MAKE) -C lib $@
lib: $(VERSION_HEADER) config built-in.o
lib: criu
$(Q) $(MAKE) -C lib all
PHONY += lib
$(CRIU-LIB): lib
@true
crit: lib
@true
PROGRAM-BUILTINS += protobuf/built-in.o
PROGRAM-BUILTINS += built-in.o
$(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS): config
$(PROGRAM): $(ARCH-LIB) $(PROGRAM-BUILTINS)
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
zdtm: all
$(Q) $(MAKE) -C test/zdtm all
test: zdtm
$(Q) $(MAKE) -C test
all: criu lib
PHONY += all
clean-built:
$(Q) $(RM) $(VERSION_HEADER)
$(Q) $(MAKE) $(build-old)=$(ARCH_DIR) clean
$(Q) $(MAKE) $(build-old)=protobuf clean
$(Q) $(MAKE) $(build-old)=pie/piegen clean
$(Q) $(MAKE) $(build-old)=pie clean
$(Q) $(MAKE) $(build)=images clean
$(Q) $(MAKE) -C criu clean
$(Q) $(MAKE) -C lib clean
$(Q) $(MAKE) $(build-old-crtools)=. clean
$(Q) $(MAKE) -C Documentation clean
$(Q) $(RM) ./include/config.h
$(Q) $(RM) ./$(PROGRAM)
rebuild: clean-built
$(E) " FORCE-REBUILD"
$(Q) $(MAKE)
PHONY += clean-built
clean: clean-built
$(E) " CLEAN"
$(Q) $(RM) ./*.img
$(Q) $(RM) ./*.out
$(Q) $(RM) ./*.bin
$(Q) $(RM) ./*.{gcda,gcno,gcov} ./test/`pwd`/*.{gcda,gcno,gcov}
$(Q) $(RM) ./pie/*.{gcda,gcno,gcov} ./pie/piegen/*.{gcda,gcno,gcov}
$(Q) $(RM) -r ./gcov
$(Q) $(RM) protobuf-desc-gen.h
$(Q) $(MAKE) -C test $@
$(Q) $(RM) ./*.pyc
$(Q) $(RM) -r build
$(Q) $(RM) -r usr
$(call msg-clean, criu)
PHONY += clean
distclean: clean
$(E) " DISTCLEAN"
$(Q) $(RM) ./tags
$(Q) $(RM) ./cscope*
tags:
$(E) " GEN " $@
$(Q) $(RM) tags
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' -print | xargs ctags -a
cscope:
$(E) " GEN " $@
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' ! -type l -print > cscope.files
$(Q) $(CSCOPE) -bkqu
#
# Non-CRIU stuff.
#
docs:
$(Q) $(MAKE) -s -C Documentation all
PHONY += docs
zdtm: all
$(Q) $(MAKE) -C test/zdtm all
PHONY += zdtm
test: zdtm
$(Q) $(MAKE) -C test
PHONY += test
dist: tar
tar: criu-$(CRTOOLSVERSION).tar.bz2
@ -305,37 +156,39 @@ criu-$(CRTOOLSVERSION).tar.bz2:
v$(CRTOOLSVERSION) | bzip2 > $@
.PHONY: dist tar
install: install-criu install-man
tags:
$(call msg-gen, $@)
$(Q) $(RM) tags
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' -print | xargs ctags -a
PHONY += tags
install-criu: all $(CRIU-LIB) install-crit
$(E) " INSTALL " $(PROGRAM)
$(Q) mkdir -p $(DESTDIR)$(SBINDIR)
$(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
$(Q) install -m 755 $(CRIU-LIB) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
$(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
$(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
$(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
$(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
$(Q) sed -e 's,@version@,$(CRTOOLSVERSION),' \
-e 's,@libdir@,$(LIBDIR),' \
-e 's,@includedir@,$(dir $(INCLUDEDIR)),' \
lib/criu.pc.in > criu.pc
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
$(Q) install -m 644 criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
cscope:
$(call msg-gen, $@)
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' ! -type l -print > cscope.files
$(Q) $(CSCOPE) -bkqu
PHONY += cscope
install-man:
$(Q) $(MAKE) -C Documentation install
gcov:
$(E) " GCOV"
$(Q) test -d gcov || mkdir gcov && \
cp *.{gcno,c} test/`pwd`/ && \
geninfo --output-filename gcov/crtools.h.info --no-recursion . && \
geninfo --output-filename gcov/crtools.ns.info --no-recursion test/`pwd`/ && \
sed -i 's#/test/`pwd`##' gcov/crtools.ns.info && \
cd gcov && \
lcov --rc lcov_branch_coverage=1 --add-tracefile crtools.h.info \
--add-tracefile crtools.ns.info --output-file criu.info && \
genhtml --rc lcov_branch_coverage=1 --output-directory html criu.info
@echo "Code coverage report is in `pwd`/gcov/html/ directory."
PHONY += gcov
install-crit: crit
$(E) " INSTALL crit"
$(Q) python scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
docker-build:
docker build -t criu .
PHONY += docker-build
.PHONY: install install-man install-crit install-criu
docker-test:
docker run --rm -it --privileged criu ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
PHONY += docker-test
help:
@echo ' Targets:'
@ -350,28 +203,15 @@ help:
@echo ' cscope - Generate cscope database'
@echo ' rebuild - Force-rebuild of [*] targets'
@echo ' test - Run zdtm test-suite'
@echo ' gcov - Make code coverage report'
@echo ' gcov - Make code coverage report'
PHONY += help
gcov:
$(E) " GCOV"
$(Q) test -d gcov || mkdir gcov && \
cp *.{gcno,c} test/`pwd`/ && \
geninfo --output-filename gcov/crtools.h.info --no-recursion . && \
geninfo --output-filename gcov/crtools.ns.info --no-recursion test/`pwd`/ && \
sed -i 's#/test/`pwd`##' gcov/crtools.ns.info && \
cd gcov && \
lcov --rc lcov_branch_coverage=1 --add-tracefile crtools.h.info --add-tracefile crtools.ns.info --output-file criu.info && \
genhtml --rc lcov_branch_coverage=1 --output-directory html criu.info
@echo "Code coverage report is in `pwd`/gcov/html/ directory."
.PHONY: gcov
include Makefile.install
docker-build:
docker build -t criu .
.PHONY: $(PHONY)
docker-test:
docker run --rm -it --privileged criu ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
.DEFAULT_GOAL := all
.DEFAULT_GOAL := all
# include optional local rules
#
# Optional local include.
-include Makefile.local

View file

@ -1,94 +0,0 @@
obj-y += parasite-syscall.o
obj-y += mem.o
obj-y += rst-malloc.o
obj-y += cr-restore.o
obj-y += crtools.o
obj-y += image.o
obj-y += image-desc.o
obj-y += net.o
obj-y += tun.o
obj-y += proc_parse.o
obj-y += sysfs_parse.o
obj-y += cr-dump.o
obj-y += cr-show.o
obj-y += cr-check.o
obj-y += cr-dedup.o
obj-y += util.o
obj-y += bfd.o
obj-y += action-scripts.o
obj-y += sysctl.o
obj-y += ptrace.o
obj-y += kcmp-ids.o
obj-y += rbtree.o
obj-y += log.o
obj-y += libnetlink.o
obj-y += sockets.o
obj-y += sk-inet.o
obj-y += sk-tcp.o
obj-y += sk-unix.o
obj-y += sk-packet.o
obj-y += sk-netlink.o
obj-y += sk-queue.o
obj-y += files.o
obj-y += files-reg.o
obj-y += files-ext.o
obj-y += pipes.o
obj-y += fifo.o
obj-y += file-ids.o
obj-y += namespaces.o
obj-y += uts_ns.o
obj-y += ipc_ns.o
obj-y += netfilter.o
obj-y += shmem.o
obj-y += eventfd.o
obj-y += eventpoll.o
obj-y += mount.o
obj-y += fsnotify.o
obj-y += irmap.o
obj-y += signalfd.o
obj-y += pstree.o
obj-y += bitmap.o
obj-y += protobuf.o
obj-y += protobuf-desc.o
obj-y += tty.o
obj-y += cr-exec.o
obj-y += file-lock.o
obj-y += page-pipe.o
obj-y += page-xfer.o
obj-y += page-read.o
obj-y += pagemap-cache.o
obj-y += kerndat.o
obj-y += stats.o
obj-y += cgroup.o
obj-y += timerfd.o
obj-y += aio.o
obj-y += string.o
obj-y += sigframe.o
obj-y += lsm.o
ifeq ($(VDSO),y)
obj-y += vdso.o
obj-y += pie/util-vdso.o
endif
obj-y += cr-service.o
obj-y += plugin.o
obj-y += cr-errno.o
obj-y += pie/pie-relocs.o
obj-y += seize.o
obj-y += fault-injection.o
obj-y += pie/util-fd.o
obj-y += pie/util.o
obj-y += seccomp.o
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif
PROTOBUF_GEN := scripts/protobuf-gen.sh
protobuf-desc.c: protobuf-desc-gen.h
protobuf-desc-gen.h: $(PROTOBUF_GEN) include/protobuf-desc.h
$(E) " GEN " $@
$(Q) $(SH) $(obj)/$(PROTOBUF_GEN) > $@
cleanup-y += protobuf-desc-gen.h

View file

@ -1,18 +0,0 @@
# Installation paths
PREFIX ?= /usr/local
SBINDIR ?= $(PREFIX)/sbin
MANDIR ?= $(PREFIX)/share/man
SYSTEMDUNITDIR ?= $(PREFIX)/lib/systemd/system/
LOGROTATEDIR ?= $(PREFIX)/etc/logrotate.d/
LIBDIR ?= $(PREFIX)/lib
# For recent Debian/Ubuntu with multiarch support
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture \
-qDEB_HOST_MULTIARCH 2>/dev/null)
ifneq "$(DEB_HOST_MULTIARCH)" ""
LIBDIR ?= $(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
# For most other systems
else ifeq "$(shell uname -m)" "x86_64"
LIBDIR ?= $(PREFIX)/lib64
endif
INCLUDEDIR ?= $(PREFIX)/include/criu

31
Makefile.install Normal file
View file

@ -0,0 +1,31 @@
install: install-criu install-man
install-criu: all $(CRIU-LIB) install-crit
$(E) " INSTALL " $(PROGRAM)
$(Q) mkdir -p $(DESTDIR)$(SBINDIR)
$(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
$(Q) install -m 755 $(CRIU-LIB) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
$(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
$(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
$(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
$(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
$(Q) sed -e 's,@version@,$(CRTOOLSVERSION),' \
-e 's,@libdir@,$(LIBDIR),' \
-e 's,@includedir@,$(dir $(INCLUDEDIR)),' \
lib/criu.pc.in > criu.pc
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
$(Q) install -m 644 criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
install-man:
$(Q) $(MAKE) -C Documentation install
install-crit: crit
$(E) " INSTALL crit"
$(Q) python scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
.PHONY: install install-man install-crit install-criu

View file

@ -1,59 +0,0 @@
targets += syscalls
targets += crtools
SYS-ASM := syscalls.S
syscalls-asm-y += $(SYS-ASM:.S=).o
crtools-obj-y += crtools.o
crtools-obj-y += cpu.o
SYS-DEF := ../arm/syscall.def
SYS-ASM-COMMON := syscall-common.S
SYS-TYPES := include/syscall-types.h
SYS-CODES := include/syscall-codes.h
SYS-PROTO := include/syscall.h
SYS-GEN := ../scripts/arm/gen-syscalls.pl
SYS-GEN-TBL := ../scripts/arm/gen-sys-exec-tbl.pl
SYS-EXEC-TBL := sys-exec-tbl.c
syscalls-asm-y-asmflags += -fpie -Wstrict-prototypes -Wa,--noexecstack
syscalls-asm-y-asmflags += -nostdlib -fomit-frame-pointer -I$(obj)
ASMFLAGS += -D__ASSEMBLY__
ARCH_BITS := 64
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/$(SYS-DEF) $(obj)/$(SYS-ASM-COMMON) $(SYS-TYPES)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN) \
$(obj)/$(SYS-DEF) \
$(SYS-CODES) \
$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
$(SYS-ASM-COMMON) \
$(SYS-TYPES) \
$(ARCH_BITS)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/$(SYS-DEF)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN-TBL) \
$(obj)/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL) \
$(ARCH_BITS)
_all += $(obj)/$(SYS-EXEC-TBL)
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
cleanup-y += $(SYS-CODES)
cleanup-y += $(SYS-PROTO)
ifneq ($(MAKECMDGOALS),clean)
deps-after := $(obj)/$(SYS-ASM)
incdeps := y
endif

View file

@ -1,59 +0,0 @@
targets += syscalls
targets += crtools
SYS-ASM := syscalls.S
syscalls-asm-y += $(SYS-ASM:.S=).o
crtools-obj-y += crtools.o
crtools-obj-y += cpu.o
SYS-DEF := syscall.def
SYS-ASM-COMMON := syscall-common.S
SYS-TYPES := include/syscall-types.h
SYS-CODES := include/syscall-codes.h
SYS-PROTO := include/syscall.h
SYS-GEN := ../scripts/arm/gen-syscalls.pl
SYS-GEN-TBL := ../scripts/arm/gen-sys-exec-tbl.pl
SYS-EXEC-TBL := sys-exec-tbl.c
syscalls-asm-y-asmflags += -fpie -Wstrict-prototypes -Wa,--noexecstack
syscalls-asm-y-asmflags += -nostdlib -fomit-frame-pointer -I$(obj)
ASMFLAGS += -D__ASSEMBLY__
ARCH_BITS := 32
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/$(SYS-DEF) $(obj)/$(SYS-ASM-COMMON) $(SYS-TYPES)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN) \
$(obj)/$(SYS-DEF) \
$(SYS-CODES) \
$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
$(SYS-ASM-COMMON) \
$(SYS-TYPES) \
$(ARCH_BITS)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/$(SYS-DEF)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN-TBL) \
$(obj)/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL) \
$(ARCH_BITS)
_all += $(obj)/$(SYS-EXEC-TBL)
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
cleanup-y += $(SYS-CODES)
cleanup-y += $(SYS-PROTO)
ifneq ($(MAKECMDGOALS),clean)
deps-after := $(obj)/$(SYS-ASM)
incdeps := y
endif

View file

@ -1,55 +0,0 @@
targets += syscalls
targets += crtools
SYS-ASM := syscalls.S
syscalls-asm-y += $(SYS-ASM:.S=).o
crtools-obj-y += crtools.o
crtools-obj-y += cpu.o
SYS-DEF := syscall-ppc64.def
SYS-ASM-COMMON := syscall-common-ppc64.S
SYS-TYPES := include/syscall-types.h
SYS-CODES := include/syscall-codes.h
SYS-PROTO := include/syscall.h
SYS-GEN := syscalls-ppc64.sh
SYS-EXEC-TBL := sys-exec-tbl.c
syscalls-asm-y-asmflags := -fpie -Wstrict-prototypes -Wa,--noexecstack
syscalls-asm-y-asmflags += -nostdlib -fomit-frame-pointer -I$(obj)
ASMFLAGS += -D__ASSEMBLY__
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/$(SYS-DEF) $(obj)/$(SYS-ASM-COMMON) $(SYS-TYPES)
$(E) " GEN " $@
$(Q) $(SH) \
$(obj)/$(SYS-GEN) --asm \
$(obj)/$(SYS-DEF) \
$(SYS-CODES) \
$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
$(SYS-ASM-COMMON) \
$(SYS-TYPES)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN) $(obj)/$(SYS-DEF)
$(E) " GEN " $@
$(Q) $(SH) \
$(obj)/$(SYS-GEN) --exec \
$(obj)/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL)
_all += $(obj)/$(SYS-EXEC-TBL)
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
cleanup-y += $(SYS-CODES)
cleanup-y += $(SYS-PROTO)
ifneq ($(MAKECMDGOALS),clean)
deps-after := $(obj)/$(SYS-ASM)
incdeps := y
endif

View file

@ -1,57 +0,0 @@
#!/bin/sh
gen_asm() {
in=$1
codesout=$2
codesinc=`echo $2 | sed -e 's/.*include\///g'`
protosout=$3
asmout=$4
asmcommon=`echo $5 | sed -e 's/.*include\///g'`
prototypes=`echo $6 | sed -e 's/.*include\///g'`
codesdef=`echo $codesout | sed -e 's/.*include\///g' | tr "[[:space:]].-" _`
protosdef=`echo $protosout | sed -e 's/.*include\///g' | tr "[[:space:]].-" _`
echo "/* Autogenerated, don't edit */" > $codesout
echo "#ifndef $codesdef" >> $codesout
echo "#define $codesdef" >> $codesout
echo "/* Autogenerated, don't edit */" > $protosout
echo "#ifndef $protosdef" >> $protosout
echo "#define $protosdef" >> $protosout
echo "#ifndef CR_NOGLIBC" >> $protosout
echo "#error This file should only be used in the parasite code" >> $protosout
echo "#endif" >> $protosout
echo "#include \"$prototypes\"" >> $protosout
echo "#include \"$codesinc\"" >> $protosout
echo "/* Autogenerated, don't edit */" > $asmout
echo "#include \"$codesinc\"" >> $asmout
echo "#include \"$asmcommon\"" >> $asmout
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "#define", $1, $2}' >> $codesout
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "extern long ", $3, $4, ";"}' >> $protosout
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "SYSCALL(", $3, ",", $2, ")"}' >> $asmout
echo "#endif /* $codesdef */" >> $codesout
echo "#endif /* $protosdef */" >> $protosout
}
gen_exec() {
in=$1
codecout=$2
echo "/* Autogenerated, don't edit */" > $codecout
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "SYSCALL(", substr($3, 5), ",", $2, ")"}' >> $codecout
}
if [ "$1" = "--asm" ]; then
shift
gen_asm $@
fi
if [ "$1" = "--exec" ]; then
shift
gen_exec $@
fi

173
criu/Makefile Normal file
View file

@ -0,0 +1,173 @@
#
# CRIU version.
VERSION_MAJOR := 2
VERSION_MINOR := 0
VERSION_SUBLEVEL :=
VERSION_EXTRA :=
VERSION_NAME :=
export VERSION_MAJOR VERSION_MINOR
export VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
#
# HOST part is needed to build helper
# tools such as piegen.
HOSTCC ?= gcc
HOSTLD ?= ld
HOSTCFLAGS ?= $(CFLAGS)
CFLAGS += $(USERCFLAGS)
export HOSTCC HOSTLD HOSTCFLAGS
ifeq ($(ARCH),x86)
SRCARCH := x86
LDARCH := i386:x86-64
VDSO := y
endif
ifeq ($(ARCH),arm)
SRCARCH := arm
endif
ifeq ($(ARCH),arm64)
ARCH := aarch64
SRCARCH := aarch64
VDSO := y
endif
ifeq ($(ARCH),powerpc)
ARCH := ppc64
SRCARCH := ppc64
LDARCH := powerpc:common64
VDSO := y
endif
LDARCH ?= $(SRCARCH)
export SRCARCH LDARCH VDSO
SRCARCH ?= $(ARCH)
LDARCH ?= $(SRCARCH)
ARCH_DIR := arch/$(SRCARCH)
export SRCARCH LDARCH ARCH_DIR VDSO
$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
#
# General flags.
ccflags-y += -fno-strict-aliasing
ccflags-y += -iquote $(SRC_DIR)/criu/include
ccflags-y += -iquote $(SRC_DIR)/images
ccflags-y += -iquote $(SRC_DIR)/criu/pie
ccflags-y += -iquote $(SRC_DIR)/criu/$(ARCH_DIR)
ccflags-y += -iquote $(SRC_DIR)/criu/$(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/
ccflags-y += -I/usr/include/libnl3
export ccflags-y
LIBS := -lrt -lpthread -lprotobuf-c -ldl -lnl-3
ifeq ($(GMON),1)
CFLAGS += -pg
GMONLDOPT := -pg
endif
#
# piegen tool might be disabled by hands. Don't use it until
# you know what you're doing.
ifneq ($(filter ia32 x86 ppc64,$(ARCH)),)
ifneq ($(PIEGEN),no)
piegen-y := y
export piegen-y
endif
endif
#
# Version header file.
include Makefile.version
#
# Configure variables.
include Makefile.config
config: $(VERSION_HEADER)
#
# System calls library.
SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
$(SYSCALL-LIB): config
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all
PHONY += $(SYSCALL-LIB)
#
# Architecture dependant part.
ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
$(ARCH-LIB): config $(SYSCALL-LIB)
$(Q) $(MAKE) $(call build-as,Makefile,$(ARCH_DIR)) $@
PHONY += $(ARCH-LIB)
#
# piegen tool needed for PIE code.
ifeq ($(piegen-y),y)
piegen := pie/piegen/piegen
pie/piegen/%: config
$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS) $(WARNINGS) $(DEFINES)" $(MAKE) $(build)=pie/piegen $@
pie/piegen: config
$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS) $(WARNINGS) $(DEFINES)" $(MAKE) $(build)=pie/piegen all
$(piegen): pie/piegen/built-in.o
$(call msg-link, $@)
$(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
PHONY += pie/piegen
endif
#
# PIE library code.
pie/lib.a: $(ARCH-LIB)
$(Q) $(MAKE) $(call build-as,Makefile.library,pie) all
#
# PIE code blobs themseves.
pie: $(ARCH_DIR) $(piegen) pie/lib.a
$(Q) $(MAKE) $(build)=pie all
PHONY += pie
#
# CRIU executable
PROGRAM-BUILTINS += ../images/built-in.o
PROGRAM-BUILTINS += built-in.o
PROGRAM-BUILTINS += pie/lib.a
PROGRAM-BUILTINS += $(SYSCALL-LIB)
LIBS += arch/$(ARCH)/crtools.built-in.o
built-in.o: pie/lib.a
$(Q) $(MAKE) $(call build-as,Makefile.crtools,.) all
criu: $(PROGRAM-BUILTINS) built-in.o
$(call msg-link, $@)
$(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
PHONY += criu
#
# Cleanup everything.
clean:
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) $@
$(Q) $(MAKE) $(call build-as,Makefile.library,pie) $@
$(Q) $(MAKE) $(call build-as,Makefile.crtools,.) $@
$(Q) $(MAKE) $(build)=pie/piegen $@
$(Q) $(MAKE) $(build)=pie $@
$(Q) $(RM) ./*.{gcda,gcno,gcov}
$(Q) $(RM) ./pie/*.{gcda,gcno,gcov}
$(Q) $(RM) ./pie/piegen/*.{gcda,gcno,gcov}
$(Q) $(RM) -r ./gcov
$(Q) $(RM) $(VERSION_HEADER)
$(Q) $(RM) $(CONFIG_HEADER)
#
# Final @all target.
all: $(PHONY)
@true
.PHONY: $(PHONY) clean

View file

@ -1,54 +1,61 @@
include scripts/utilities.mak
include scripts/feature-tests.mak
include $(__nmk_dir)/utils.mk
include ../scripts/feature-tests.mak
CONFIG := include/config.h
CONFIG_HEADER := include/config.h
ifeq ($(call try-cc,$(LIBBSD_DEV_TEST),-lbsd),y)
LIBS += -lbsd
DEFINES += -DCONFIG_HAS_LIBBSD
LIBS += -lbsd
DEFINES += -DCONFIG_HAS_LIBBSD
endif
ifeq ($(call pkg-config-check,libselinux),y)
LIBS := -lselinux $(LIBS)
DEFINES += -DCONFIG_HAS_SELINUX
LIBS += -lselinux $(LIBS)
DEFINES += -DCONFIG_HAS_SELINUX
endif
$(CONFIG): scripts/utilities.mak scripts/feature-tests.mak include/config-base.h
$(E) " GEN " $@
$(CONFIG_HEADER): include/config-base.h
$(call msg-gen, $@)
$(Q) @echo '#ifndef __CR_CONFIG_H__' > $@
$(Q) @echo '#define __CR_CONFIG_H__' >> $@
$(Q) @echo '' >> $@
$(Q) @echo '#include "config-base.h"' >> $@
$(Q) @echo '' >> $@
ifeq ($(call try-cc,$(TCP_REPAIR_TEST),),y)
ifeq ($(call try-cc,$(TCP_REPAIR_TEST),,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_TCP_REPAIR' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(call try-cc,$(PRLIMIT_TEST),),y)
ifeq ($(call try-cc,$(PRLIMIT_TEST),,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_PRLIMIT' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(call try-cc,$(STRLCPY_TEST),$(LIBS)),y)
ifeq ($(call try-cc,$(STRLCPY_TEST),$(LIBS),$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_STRLCPY' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(call try-cc,$(STRLCAT_TEST),$(LIBS)),y)
ifeq ($(call try-cc,$(STRLCAT_TEST),$(LIBS),$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_STRLCAT' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(call try-cc,$(PTRACE_PEEKSIGINFO_TEST),),y)
ifeq ($(call try-cc,$(PTRACE_PEEKSIGINFO_TEST),,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_PEEKSIGINFO_ARGS' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(VDSO),y)
$(Q) @echo '#define CONFIG_VDSO' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd),y)
ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd,$(DEFINES)),y)
$(Q) @echo '#define CONFIG_HAS_SETPROCTITLE_INIT' >> $@
$(Q) @echo '' >> $@
endif
ifeq ($(call try-cc,$(MEMFD_TEST),),y)
$(Q) @echo '#define CONFIG_HAS_MEMFD' >> $@
endif
ifeq ($(piegen-y),y)
$(Q) @echo '#define CONFIG_PIEGEN' >> $@
$(Q) @echo '' >> $@
endif
$(Q) @echo '#endif /* __CR_CONFIG_H__ */' >> $@
config: $(CONFIG)
.PHONY: config
config: $(CONFIG_HEADER)
PHONY += config

92
criu/Makefile.crtools Normal file
View file

@ -0,0 +1,92 @@
ccflags-y += -iquote $(ARCH)
obj-y += action-scripts.o
obj-y += aio.o
obj-y += bfd.o
obj-y += bitmap.o
obj-y += cgroup.o
obj-y += cr-check.o
obj-y += cr-dedup.o
obj-y += cr-dump.o
obj-y += cr-errno.o
obj-y += cr-exec.o
obj-y += cr-restore.o
obj-y += cr-service.o
obj-y += cr-show.o
obj-y += crtools.o
obj-y += eventfd.o
obj-y += eventpoll.o
obj-y += fault-injection.o
obj-y += fifo.o
obj-y += file-ids.o
obj-y += file-lock.o
obj-y += files-ext.o
obj-y += files.o
obj-y += files-reg.o
obj-y += fsnotify.o
obj-y += image-desc.o
obj-y += image.o
obj-y += ipc_ns.o
obj-y += irmap.o
obj-y += kcmp-ids.o
obj-y += kerndat.o
obj-y += libnetlink.o
obj-y += log.o
obj-y += lsm.o
obj-y += mem.o
obj-y += mount.o
obj-y += namespaces.o
obj-y += netfilter.o
obj-y += net.o
obj-y += pagemap-cache.o
obj-y += page-pipe.o
obj-y += page-read.o
obj-y += page-xfer.o
obj-y += parasite-syscall.o
obj-y += pie/pie-relocs.o
obj-y += pie-util-fd.o
obj-y += pie-util.o
obj-y += pipes.o
obj-y += plugin.o
obj-y += proc_parse.o
obj-y += protobuf-desc.o
obj-y += protobuf.o
obj-y += pstree.o
obj-y += ptrace.o
obj-y += rbtree.o
obj-y += rst-malloc.o
obj-y += seccomp.o
obj-y += seize.o
obj-y += shmem.o
obj-y += sigframe.o
obj-y += signalfd.o
obj-y += sk-inet.o
obj-y += sk-netlink.o
obj-y += sk-packet.o
obj-y += sk-queue.o
obj-y += sk-tcp.o
obj-y += sk-unix.o
obj-y += sockets.o
obj-y += stats.o
obj-y += string.o
obj-y += sysctl.o
obj-y += sysfs_parse.o
obj-y += timerfd.o
obj-y += tty.o
obj-y += tun.o
obj-y += util.o
obj-y += uts_ns.o
ifeq ($(VDSO),y)
obj-y += pie-util-vdso.o
obj-y += vdso.o
endif
PROTOBUF_GEN := $(SRC_DIR)/scripts/protobuf-gen.sh
protobuf-desc.c: protobuf-desc-gen.h
protobuf-desc-gen.h: $(PROTOBUF_GEN) include/protobuf-desc.h
$(call msg-gen, $@)
$(Q) $(SH) $(PROTOBUF_GEN) > $@
cleanup-y += protobuf-desc-gen.h

View file

@ -1,24 +1,23 @@
CRTOOLSVERSION := $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR))$(if $(VERSION_SUBLEVEL),.$(VERSION_SUBLEVEL))
VERSION_HEADER := include/version.h
GITID_FILE := .gitid
GITID := $(shell if [ -d ".git" ]; then git describe; fi)
VERSION_HEADER := include/version.h
GITID_FILE := ../.gitid
GITID := $(shell if [ -d "../.git" ]; then cd .. && git describe; fi)
ifeq ($(GITID),)
GITID := 0
GITID := 0
else
GITID_FILE_VALUE := $(shell if [ -f '.gitid' ]; then if [ `cat .gitid` = $(GITID) ]; then echo y; fi; fi)
GITID_FILE_VALUE := $(shell if [ -f '$(GITID_FILE)' ]; then if [ `cat '$(GITID_FILE)'` = $(GITID) ]; then echo y; fi; fi)
ifneq ($(GITID_FILE_VALUE),y)
.PHONY: $(GITID_FILE)
endif
endif
$(GITID_FILE):
$(E) " GEN " $@
$(call msg-gen, $@)
$(Q) echo "$(GITID)" > $(GITID_FILE)
$(VERSION_HEADER): Makefile scripts/Makefile.version $(GITID_FILE)
$(E) " GEN " $@
$(VERSION_HEADER): Makefile.version $(GITID_FILE)
$(call msg-gen, $@)
$(Q) echo "/* Autogenerated, do not edit */" > $(VERSION_HEADER)
$(Q) echo "#ifndef __CR_VERSION_H__" >> $(VERSION_HEADER)
$(Q) echo "#define __CR_VERSION_H__" >> $(VERSION_HEADER)
@ -28,9 +27,5 @@ $(VERSION_HEADER): Makefile scripts/Makefile.version $(GITID_FILE)
$(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $(VERSION_HEADER)
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $(VERSION_HEADER)
##
## In case if someone add last resort rule
## together with .SUFFIXES not cleaned, this
## will slow down the build procedure
scripts/Makefile.version::
Makefile.version:
@true

View file

View file

@ -0,0 +1,7 @@
builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR)
ccflags-y += -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
obj-y += cpu.o
obj-y += crtools.o

View file

@ -0,0 +1,50 @@
builtin-name := syscalls.built-in.o
SYS-TYPES := ../../include/syscall-types.h
SYS-CODES := ../../include/syscall-codes.h
SYS-PROTO := ../../include/syscall.h
SYS-DEF := syscall.def
SYS-ASM-COMMON := syscall-common.S
SYS-GEN := ../scripts/arm/gen-syscalls.pl
SYS-GEN-TBL := ../scripts/arm/gen-sys-exec-tbl.pl
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
SYS-ASM := syscalls.S
obj-y += $(SYS-ASM:.S=).o
ARCH_BITS := 64
SYS-EXEC-TBL := sys-exec-tbl.c
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-CODES) \
$(obj)/$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
syscalls/$(SYS-ASM-COMMON) \
$(obj)/$(SYS-TYPES) \
$(ARCH_BITS)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN-TBL) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL) \
$(ARCH_BITS)
all-y += $(obj)/$(SYS-EXEC-TBL)
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
cleanup-y += $(obj)/$(SYS-CODES)
cleanup-y += $(obj)/$(SYS-PROTO)

View file

@ -0,0 +1 @@
../../arm/syscalls/syscall.def

6
criu/arch/arm/Makefile Normal file
View file

@ -0,0 +1,6 @@
builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
obj-y += cpu.o
obj-y += crtools.o

View file

@ -0,0 +1,50 @@
builtin-name := syscalls.built-in.o
SYS-TYPES := ../../include/syscall-types.h
SYS-CODES := ../../include/syscall-codes.h
SYS-PROTO := ../../include/syscall.h
SYS-DEF := syscall.def
SYS-ASM-COMMON := syscall-common.S
SYS-GEN := ../scripts/arm/gen-syscalls.pl
SYS-GEN-TBL := ../scripts/arm/gen-sys-exec-tbl.pl
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
SYS-ASM := syscalls.S
obj-y += $(SYS-ASM:.S=).o
ARCH_BITS := 32
SYS-EXEC-TBL := sys-exec-tbl.c
$(obj)/$(SYS-ASM): $(obj)/$(SYS-GEN) $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-CODES) \
$(obj)/$(SYS-PROTO) \
$(obj)/$(SYS-ASM) \
syscalls/$(SYS-ASM-COMMON) \
$(obj)/$(SYS-TYPES) \
$(ARCH_BITS)
$(obj)/syscalls.o: $(obj)/$(SYS-ASM)
$(obj)/$(SYS-EXEC-TBL): $(obj)/$(SYS-GEN-TBL) $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
$(Q) perl \
$(obj)/$(SYS-GEN-TBL) \
$(obj)/syscalls/$(SYS-DEF) \
$(obj)/$(SYS-EXEC-TBL) \
$(ARCH_BITS)
all-y += $(obj)/$(SYS-EXEC-TBL)
cleanup-y += $(obj)/$(SYS-EXEC-TBL) $(obj)/$(SYS-ASM)
cleanup-y += $(obj)/$(SYS-CODES)
cleanup-y += $(obj)/$(SYS-PROTO)

6
criu/arch/ppc64/Makefile Normal file
View file

@ -0,0 +1,6 @@
builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
obj-y += cpu.o
obj-y += crtools.o

View file

@ -0,0 +1,50 @@
builtin-name := syscalls.built-in.o
SYS-TYPES := ../../include/syscall-types.h
SYS-CODES := ../../include/syscall-codes.h
SYS-PROTO := ../../include/syscall.h
SYS-DEF := syscall-ppc64.tbl
SYS-ASM-COMMON := syscall-common-ppc64.S
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
asflags-y += -fpie -Wstrict-prototypes -Wa,--noexecstack
asflags-y += -iquote $(obj) -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
SYS-ASM := syscalls.S
obj-y += $(SYS-ASM:.S=).o
$(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__" >> $@
$(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__" >> $@
$(Q) cat $< | awk '/^__NR/{print "#define", $$1, $$2}' >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */" >> $@
cleanup-y += $(obj)/$(SYS-CODES)
$(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
$(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "#ifndef __ASM_CR_SYSCALL_PROTO_H__" >> $@
$(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H__" >> $@
$(Q) echo "#include \"syscall-codes.h\"" >> $@
$(Q) echo "#include \"syscall-types.h\"" >> $@
$(Q) cat $< | awk '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}' >> $@
$(Q) echo "#endif /* __ASM_CR_SYSCALL_PROTO_H__ */" >> $@
cleanup-y += $(obj)/$(SYS-PROTO)
$(obj)/$(SYS-ASM): $(obj)/syscalls/$(SYS-DEF) $(obj)/syscalls/$(SYS-ASM-COMMON) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
$(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) echo "#include \"syscall-codes.h\"" >> $@
$(Q) echo "#include \"syscalls/$(SYS-ASM-COMMON)\"" >> $@
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", $$3, ",", $$2, ")"}' >> $@
cleanup-y += $(obj)/$(SYS-ASM)
SYS-EXEC-TBL := sys-exec-tbl.c
$(obj)/$(SYS-EXEC-TBL): $(obj)/syscalls/$(SYS-DEF) $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
$(E) " GEN " $@
$(Q) echo "/* Autogenerated, don't edit */" > $@
$(Q) cat $< | awk '/^__NR/{print "SYSCALL(", substr($$3, 5), ",", $$2, ")"}' >> $@
cleanup-y += $(obj)/$(SYS-EXEC-TBL)
all-y += $(obj)/$(SYS-EXEC-TBL)

Some files were not shown because too many files have changed in this diff Show more