Skip to content

Commit

Permalink
add kexec-tools to build system
Browse files Browse the repository at this point in the history
This patch adds the kexec-tools (kexec and kdump) to the ONIE build
system.

These tools are built by default for x86 platforms and included in the
final image.

For powerpc these tools can be built, but are not by default.  To
build these tools for a powerpc platform add this to the platform's
machine.make:

  KEXEC_ENABLE = yes

Signed-off-by: Curt Brune <[email protected]>
  • Loading branch information
Curt Brune committed Jun 4, 2015
1 parent bb295dc commit 02f34e4
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build-config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ endif
ifeq ($(DOSFSTOOLS_ENABLE),yes)
include make/dosfstools.make
endif
ifeq ($(KEXEC_ENABLE),yes)
include make/kexec-tools.make
endif
include make/images.make
include make/demo.make

Expand Down
3 changes: 3 additions & 0 deletions build-config/arch/x86_64.make
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ ETHTOOL_ENABLE ?= yes
# Include dosfstools
DOSFSTOOLS_ENABLE = yes

# Include kexec-tools
KEXEC_ENABLE = yes

# Update this if the GRUB configuration mechanism changes from one
# release to the next.
ONIE_CONFIG_VERSION = 1
Expand Down
4 changes: 4 additions & 0 deletions build-config/make/images.make
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ ifeq ($(DOSFSTOOLS_ENABLE),yes)
PACKAGES_INSTALL_STAMPS += $(DOSFSTOOLS_INSTALL_STAMP)
endif

ifeq ($(KEXEC_ENABLE),yes)
PACKAGES_INSTALL_STAMPS += $(KEXEC_INSTALL_STAMP)
endif

ifndef MAKE_CLEAN
SYSROOT_NEW_FILES = $(shell \
test -d $(ROOTCONFDIR)/default && \
Expand Down
112 changes: 112 additions & 0 deletions build-config/make/kexec-tools.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2015 Curt Brune <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
#-------------------------------------------------------------------------------
#
# This is a makefile fragment that defines the build of kexec-tools
#

KEXEC_VERSION = 2.0.9
KEXEC_TARBALL = kexec-tools-$(KEXEC_VERSION).tar.xz
KEXEC_TARBALL_URLS += $(ONIE_MIRROR) \
https://www.kernel.org/pub/linux/utils/kernel/kexec
KEXEC_BUILD_DIR = $(MBUILDDIR)/kexec-tools
KEXEC_DIR = $(KEXEC_BUILD_DIR)/kexec-tools-$(KEXEC_VERSION)

KEXEC_SRCPATCHDIR = $(PATCHDIR)/kexec-tools
KEXEC_DOWNLOAD_STAMP = $(DOWNLOADDIR)/kexec-tools-download
KEXEC_SOURCE_STAMP = $(STAMPDIR)/kexec-tools-source
KEXEC_PATCH_STAMP = $(STAMPDIR)/kexec-tools-patch
KEXEC_CONFIGURE_STAMP = $(STAMPDIR)/kexec-tools-configure
KEXEC_BUILD_STAMP = $(STAMPDIR)/kexec-tools-build
KEXEC_INSTALL_STAMP = $(STAMPDIR)/kexec-tools-install
KEXEC_STAMP = $(KEXEC_SOURCE_STAMP) \
$(KEXEC_PATCH_STAMP) \
$(KEXEC_CONFIGURE_STAMP) \
$(KEXEC_BUILD_STAMP) \
$(KEXEC_INSTALL_STAMP)

PHONY += kexec-tools kexec-tools-download kexec-tools-source \
kexec-tools-configure kexec-tools-build kexec-tools-install kexec-tools-clean \
kexec-tools-download-clean

KEXEC_SBIN = kexec kdump

kexec-tools: $(KEXEC_STAMP)

DOWNLOAD += $(KEXEC_DOWNLOAD_STAMP)
kexec-tools-download: $(KEXEC_DOWNLOAD_STAMP)
$(KEXEC_DOWNLOAD_STAMP): $(PROJECT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Getting upstream kexec-tools ===="
$(Q) $(SCRIPTDIR)/fetch-package $(DOWNLOADDIR) $(UPSTREAMDIR) \
$(KEXEC_TARBALL) $(KEXEC_TARBALL_URLS)
$(Q) touch $@

SOURCE += $(KEXEC_SOURCE_STAMP)
kexec-tools-source: $(KEXEC_SOURCE_STAMP)
$(KEXEC_SOURCE_STAMP): $(TREE_STAMP) | $(KEXEC_DOWNLOAD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Extracting upstream kexec-tools ===="
$(Q) $(SCRIPTDIR)/extract-package $(KEXEC_BUILD_DIR) $(DOWNLOADDIR)/$(KEXEC_TARBALL)
$(Q) touch $@

# For PowerPC add booke support
powerpc_KEXEC_CONFIG_OPTS = --with-booke

kexec-tools-configure: $(KEXEC_CONFIGURE_STAMP)
$(KEXEC_CONFIGURE_STAMP): $(ZLIB_INSTALL_STAMP) \
$(KEXEC_SOURCE_STAMP) | $(DEV_SYSROOT_INIT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Configure kexec-tools-$(KEXEC_VERSION) ===="
$(Q) cd $(KEXEC_DIR) && PATH='$(CROSSBIN):$(PATH)' \
$(KEXEC_DIR)/configure \
--prefix=$(DEV_SYSROOT)/usr \
--host=$(TARGET) \
$($(ARCH)_KEXEC_CONFIG_OPTS) \
CC=$(CROSSPREFIX)gcc \
CFLAGS="$(ONIE_CFLAGS)"
$(Q) touch $@

ifndef MAKE_CLEAN
KEXEC_NEW_FILES = $(shell test -d $(KEXEC_DIR) && test -f $(KEXEC_BUILD_STAMP) && \
find -L $(KEXEC_DIR) -newer $(KEXEC_BUILD_STAMP) -type f \
\! -name symlinks \! -name symlinks.o -print -quit)
endif

kexec-tools-build: $(KEXEC_BUILD_STAMP)
$(KEXEC_BUILD_STAMP): $(KEXEC_NEW_FILES) $(KEXEC_CONFIGURE_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Building kexec-tools-$(KEXEC_VERSION) ===="
$(Q) PATH='$(CROSSBIN):$(PATH)' $(MAKE) -C $(KEXEC_DIR)
$(Q) touch $@

kexec-tools-install: $(KEXEC_INSTALL_STAMP)
$(KEXEC_INSTALL_STAMP): $(SYSROOT_INIT_STAMP) $(KEXEC_BUILD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Installing kexec-tools in $(DEV_SYSROOT) ===="
PATH='$(CROSSBIN):$(PATH)' \
$(MAKE) -C $(KEXEC_DIR) install
$(Q) for f in $(KEXEC_SBIN) ; do \
cp -a $(DEV_SYSROOT)/usr/sbin/$$f $(SYSROOTDIR)/usr/sbin ; \
done
$(Q) touch $@

USERSPACE_CLEAN += kexec-tools-clean
kexec-tools-clean:
$(Q) rm -rf $(KEXEC_BUILD_DIR)
$(Q) rm -f $(KEXEC_STAMP)
$(Q) echo "=== Finished making $@ for $(PLATFORM)"

DOWNLOAD_CLEAN += kexec-tools-download-clean
kexec-tools-download-clean:
$(Q) rm -f $(KEXEC_DOWNLOAD_STAMP) $(DOWNLOADDIR)/kexec-tools*

#-------------------------------------------------------------------------------
#
# Local Variables:
# mode: makefile-gmake
# End:
1 change: 1 addition & 0 deletions upstream/kexec-tools-2.0.9.tar.xz.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ff087d5a0caaec3f21687b7fd930be835954f0ba kexec-tools-2.0.9.tar.xz

0 comments on commit 02f34e4

Please sign in to comment.