Skip to content

Commit

Permalink
add btrfs kernel support and btrf-progs utilities
Browse files Browse the repository at this point in the history
Enable btrfs support in the 4.1.x kernel series.

Add the btrfs-progs utilities to the sysroot.

The btrfs-progs are installed by default for x86_64 systems.

Signed-off-by: Curt Brune <[email protected]>
  • Loading branch information
Curt Brune committed Jul 22, 2016
1 parent 35d3531 commit b5b8749
Show file tree
Hide file tree
Showing 16 changed files with 314 additions and 12 deletions.
3 changes: 3 additions & 0 deletions build-config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ endif
ifeq ($(GRUB_ENABLE),yes)
include make/grub.make
endif
ifeq ($(BTRFS_PROGS_ENABLE),yes)
include make/btrfs-progs.make
endif
ifeq ($(UEFI_ENABLE),yes)
include make/efivar.make
include make/efibootmgr.make
Expand Down
3 changes: 3 additions & 0 deletions build-config/arch/armv7a.make
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ PARTED_ENABLE = yes
# Include ext3/4 file system tools
EXT3_4_ENABLE = yes

# Include btrfs file system tools
BTRFS_PROGS_ENABLE = yes

# Default to include the i2ctools. A particular machine.make can
# override this.
I2CTOOLS_ENABLE ?= yes
Expand Down
6 changes: 6 additions & 0 deletions build-config/arch/powerpc-softfloat.make
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ UBOOT_ITB_ARCH = ppc
# Include MTD utilities
MTDUTILS_ENABLE ?= yes

# Include ext3/4 file system tools - also required for BTRFS
EXT3_4_ENABLE ?= yes

# Include btrfs file system tools
BTRFS_PROGS_ENABLE ?= yes

PLATFORM_IMAGE_COMPLETE = $(IMAGE_BIN_STAMP) $(IMAGE_UPDATER_STAMP)
UPDATER_IMAGE_PARTS = $(UPDATER_ITB) $(UPDATER_UBOOT)
UPDATER_IMAGE_PARTS_COMPLETE = $(UPDATER_ITB) $(UBOOT_INSTALL_STAMP)
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 @@ -113,6 +113,9 @@ PARTED_ENABLE = yes
# Include ext3/4 file system tools
EXT3_4_ENABLE = yes

# Include btrfs file system tools
BTRFS_PROGS_ENABLE = yes

# Include GRUB tools
GRUB_ENABLE = yes

Expand Down
7 changes: 6 additions & 1 deletion build-config/conf/kernel/4.1.23/linux.armv7a.config
Original file line number Diff line number Diff line change
Expand Up @@ -2440,7 +2440,12 @@ CONFIG_FS_MBCACHE=y
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_BTRFS_FS is not set
CONFIG_BTRFS_FS=y
# CONFIG_BTRFS_FS_POSIX_ACL is not set
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
# CONFIG_BTRFS_ASSERT is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
# CONFIG_FS_POSIX_ACL is not set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,12 @@ CONFIG_JBD2=y
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_BTRFS_FS is not set
CONFIG_BTRFS_FS=y
# CONFIG_BTRFS_FS_POSIX_ACL is not set
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
# CONFIG_BTRFS_ASSERT is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
# CONFIG_FS_DAX is not set
Expand Down
7 changes: 6 additions & 1 deletion build-config/conf/kernel/4.1.23/linux.x86_64.config
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,12 @@ CONFIG_FS_MBCACHE=y
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_BTRFS_FS is not set
CONFIG_BTRFS_FS=y
# CONFIG_BTRFS_FS_POSIX_ACL is not set
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
# CONFIG_BTRFS_ASSERT is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
# CONFIG_FS_DAX is not set
Expand Down
6 changes: 3 additions & 3 deletions build-config/conf/uclibc/0.9.33.2/uclibc.armv7a.config
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ UCLIBC_HAS_LFS=y
# MALLOC is not set
# MALLOC_SIMPLE is not set
MALLOC_STANDARD=y
# MALLOC_GLIBC_COMPAT is not set
MALLOC_GLIBC_COMPAT=y
UCLIBC_DYNAMIC_ATEXIT=y
# COMPAT_ATEXIT is not set
UCLIBC_SUSV3_LEGACY=y
Expand Down Expand Up @@ -203,8 +203,8 @@ UCLIBC_HAS_REGEX_OLD=y
UCLIBC_HAS_FNMATCH=y
UCLIBC_HAS_FNMATCH_OLD=y
# UCLIBC_HAS_WORDEXP is not set
# UCLIBC_HAS_NFTW is not set
# UCLIBC_HAS_FTW is not set
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_FTS=y
UCLIBC_HAS_GLOB=y
# UCLIBC_HAS_GNU_GLOB is not set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ UCLIBC_HAS_LFS=y
# MALLOC is not set
# MALLOC_SIMPLE is not set
MALLOC_STANDARD=y
# MALLOC_GLIBC_COMPAT is not set
MALLOC_GLIBC_COMPAT=y
UCLIBC_DYNAMIC_ATEXIT=y
# COMPAT_ATEXIT is not set
UCLIBC_SUSV3_LEGACY=y
Expand Down Expand Up @@ -204,8 +204,8 @@ UCLIBC_HAS_REGEX_OLD=y
UCLIBC_HAS_FNMATCH=y
UCLIBC_HAS_FNMATCH_OLD=y
# UCLIBC_HAS_WORDEXP is not set
# UCLIBC_HAS_NFTW is not set
# UCLIBC_HAS_FTW is not set
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_FTS=y
UCLIBC_HAS_GLOB=y
# UCLIBC_HAS_GNU_GLOB is not set
Expand Down
6 changes: 3 additions & 3 deletions build-config/conf/uclibc/0.9.33.2/uclibc.x86_64.config
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ UCLIBC_HAS_LFS=y
# MALLOC is not set
# MALLOC_SIMPLE is not set
MALLOC_STANDARD=y
# MALLOC_GLIBC_COMPAT is not set
MALLOC_GLIBC_COMPAT=y
UCLIBC_DYNAMIC_ATEXIT=y
# COMPAT_ATEXIT is not set
UCLIBC_SUSV3_LEGACY=y
Expand Down Expand Up @@ -201,8 +201,8 @@ UCLIBC_HAS_REGEX_OLD=y
UCLIBC_HAS_FNMATCH=y
UCLIBC_HAS_FNMATCH_OLD=y
# UCLIBC_HAS_WORDEXP is not set
# UCLIBC_HAS_NFTW is not set
# UCLIBC_HAS_FTW is not set
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_FTS=y
UCLIBC_HAS_GLOB=y
# UCLIBC_HAS_GNU_GLOB is not set
Expand Down
127 changes: 127 additions & 0 deletions build-config/make/btrfs-progs.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2015 Curt Brune <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
#-------------------------------------------------------------------------------
#
# This is a makefile fragment that defines the build of btrfs-progs
#

BTRFSPROGS_VERSION = v4.3.1
BTRFSPROGS_TARBALL = btrfs-progs-$(BTRFSPROGS_VERSION).tar.xz
BTRFSPROGS_TARBALL_URLS += $(ONIE_MIRROR) \
https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs
BTRFSPROGS_BUILD_DIR = $(MBUILDDIR)/btrfs-progs
BTRFSPROGS_DIR = $(BTRFSPROGS_BUILD_DIR)/btrfs-progs-$(BTRFSPROGS_VERSION)

BTRFSPROGS_SRCPATCHDIR = $(PATCHDIR)/btrfs-progs
BTRFSPROGS_DOWNLOAD_STAMP = $(DOWNLOADDIR)/btrfs-progs-download
BTRFSPROGS_SOURCE_STAMP = $(STAMPDIR)/btrfs-progs-source
BTRFSPROGS_PATCH_STAMP = $(STAMPDIR)/btrfs-progs-patch
BTRFSPROGS_CONFIGURE_STAMP = $(STAMPDIR)/btrfs-progs-configure
BTRFSPROGS_BUILD_STAMP = $(STAMPDIR)/btrfs-progs-build
BTRFSPROGS_INSTALL_STAMP = $(STAMPDIR)/btrfs-progs-install
BTRFSPROGS_STAMP = $(BTRFSPROGS_SOURCE_STAMP) \
$(BTRFSPROGS_CONFIGURE_STAMP) \
$(BTRFSPROGS_BUILD_STAMP) \
$(BTRFSPROGS_INSTALL_STAMP)

ifneq ($(EXT3_4_ENABLE),yes)
$(error BTRFS tools requires EXT3/4 support, but $$(EXT3_4_ENABLE) is not set)
endif

PHONY += btrfs-progs btrfs-progs-download btrfs-progs-source \
btrfs-progs-configure btrfs-progs-build btrfs-progs-install \
btrfs-progs-clean btrfs-progs-download-clean

BTRFSPROGS_LIBS = libbtrfs.so libbtrfs.so.0 libbtrfs.so.0.1
BTRFSPROGS_SBIN = btrfs mkfs.btrfs btrfs-debug-tree btrfs-map-logical \
btrfs-image btrfs-zero-log btrfs-find-root btrfstune \
btrfs-show-super btrfs-select-super btrfs-convert \
btrfsck

btrfs-progs: $(BTRFSPROGS_STAMP)

DOWNLOAD += $(BTRFSPROGS_DOWNLOAD_STAMP)
btrfs-progs-download: $(BTRFSPROGS_DOWNLOAD_STAMP)
$(BTRFSPROGS_DOWNLOAD_STAMP): $(PROJECT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Getting upstream btrfs-progs ===="
$(Q) $(SCRIPTDIR)/fetch-package $(DOWNLOADDIR) $(UPSTREAMDIR) \
$(BTRFSPROGS_TARBALL) $(BTRFSPROGS_TARBALL_URLS)
$(Q) touch $@

SOURCE += $(BTRFSPROGS_SOURCE_STAMP)
btrfs-progs-source: $(BTRFSPROGS_SOURCE_STAMP)
$(BTRFSPROGS_SOURCE_STAMP): $(TREE_STAMP) | $(BTRFSPROGS_DOWNLOAD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Extracting upstream btrfs-progs ===="
$(Q) $(SCRIPTDIR)/extract-package $(BTRFSPROGS_BUILD_DIR) $(DOWNLOADDIR)/$(BTRFSPROGS_TARBALL)
$(Q) touch $@

btrfs-progs-patch: $(BTRFSPROGS_PATCH_STAMP)
$(BTRFSPROGS_PATCH_STAMP): $(BTRFSPROGS_SRCPATCHDIR)/* $(BTRFSPROGS_SOURCE_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Patching btrfs-progs ===="
$(Q) $(SCRIPTDIR)/apply-patch-series $(BTRFSPROGS_SRCPATCHDIR)/series $(BTRFSPROGS_DIR)
$(Q) touch $@

btrfs-progs-configure: $(BTRFSPROGS_CONFIGURE_STAMP)
$(BTRFSPROGS_CONFIGURE_STAMP): $(E2FSPROGS_INSTALL_STAMP) \
$(BTRFSPROGS_PATCH_STAMP) | $(DEV_SYSROOT_INIT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Configure btrfs-progs-$(BTRFSPROGS_VERSION) ===="
$(Q) cd $(BTRFSPROGS_DIR) && PATH='$(CROSSBIN):$(PATH)' \
$(BTRFSPROGS_DIR)/configure \
--prefix=$(DEV_SYSROOT)/usr \
--host=$(TARGET) \
--disable-documentation \
--disable-backtrace \
CC=$(CROSSPREFIX)gcc \
CFLAGS="$(ONIE_CFLAGS)" \
$(ONIE_PKG_CONFIG)
$(Q) touch $@

ifndef MAKE_CLEAN
BTRFSPROGS_NEW_FILES = $(shell test -d $(BTRFSPROGS_DIR) && test -f $(BTRFSPROGS_BUILD_STAMP) && \
find -L $(BTRFSPROGS_DIR) -newer $(BTRFSPROGS_BUILD_STAMP) -type f \
-print -quit)
endif

btrfs-progs-build: $(BTRFSPROGS_BUILD_STAMP)
$(BTRFSPROGS_BUILD_STAMP): $(BTRFSPROGS_NEW_FILES) $(BTRFSPROGS_CONFIGURE_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Building btrfs-progs-$(BTRFSPROGS_VERSION) ===="
$(Q) PATH='$(CROSSBIN):$(PATH)' $(MAKE) -C $(BTRFSPROGS_DIR)
$(Q) touch $@

btrfs-progs-install: $(BTRFSPROGS_INSTALL_STAMP)
$(BTRFSPROGS_INSTALL_STAMP): $(SYSROOT_INIT_STAMP) $(BTRFSPROGS_BUILD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Installing btrfs-progs in $(DEV_SYSROOT) ===="
$(Q) PATH='$(CROSSBIN):$(PATH)' $(MAKE) -C $(BTRFSPROGS_DIR) install
$(Q) for file in $(BTRFSPROGS_LIBS) ; do \
cp -av $(DEV_SYSROOT)/usr/lib/$$file $(SYSROOTDIR)/usr/lib/ ; \
done
$(Q) for file in $(BTRFSPROGS_SBIN) ; do \
cp -av $(DEV_SYSROOT)/usr/bin/$$file $(SYSROOTDIR)/usr/sbin/ ; \
done
$(Q) touch $@

USERSPACE_CLEAN += btrfs-progs-clean
btrfs-progs-clean:
$(Q) rm -rf $(BTRFSPROGS_BUILD_DIR)
$(Q) rm -f $(BTRFSPROGS_STAMP)
$(Q) echo "=== Finished making $@ for $(PLATFORM)"

DOWNLOAD_CLEAN += btrfs-progs-download-clean
btrfs-progs-download-clean:
$(Q) rm -f $(BTRFSPROGS_DOWNLOAD_STAMP) $(DOWNLOADDIR)/btrfs-progs*

#-------------------------------------------------------------------------------
#
# Local Variables:
# mode: makefile-gmake
# End:
5 changes: 5 additions & 0 deletions build-config/make/images.make
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ ifeq ($(IPMITOOL_ENABLE),yes)
PACKAGES_INSTALL_STAMPS += $(IPMITOOL_INSTALL_STAMP)
endif

ifeq ($(BTRFS_PROGS_ENABLE),yes)
PACKAGES_INSTALL_STAMPS += $(BTRFSPROGS_INSTALL_STAMP)
endif


ifndef MAKE_CLEAN
SYSROOT_NEW_FILES = $(shell \
test -d $(ROOTCONFDIR)/default && \
Expand Down
Loading

0 comments on commit b5b8749

Please sign in to comment.