aufs: new kernel extension (branch yem/aufs)
v3 cover aufs: new kernel extension (branch yem/aufs)
Hello All!
This series is an attempt to introduce the aufs stacking filesystem as a Linux kernel extension, along with the corresponding userland tools.
It is based on a work by Christian Stewart, refined by Atul Singh, with further cleanups by me.
The first patch introduces the extension proper: a no-prompt package provides the source files, then used to patch the kernel code.
The second patch allows packages to instruct the kernel to isntall its userland headers, when such package needs those headers rather than the one from the toolchain (e.g. to gain access to inernals of the running kernel, like filesystems or the netrwork stack, possibly added by a kernel extension).
The third patch adds the userland aufs-util suite, used to assemble and otherwise control any aufs stack. This needs the userland headers of the running kernel because it needs to talk to the uafs internals.
Changes v2 -> v3:
- cleanups in the aufs extension: better version handling and check,
squash the extension and the package in the same patch;
- add the kernel patch to install userland headers;
- fix build of aufs-util, make it not depend on the kernel extension
so it can be used on already-patched kernels;- misc other minor cleanups
Regards,
Yann E. MORIN.
The following changes since commit 97308d8e9ae0f096ec2df8275deb063266583b91
package/ti-gfx: list supported SoCs in Config.in help text (2016-07-16 22:53:55 +0200)
are available in the git repository at:
https://gitlab.com/ymorin/buildroot.git
for you to fetch changes up to e5d42509736f56a587767b61bf0f9ceb8efd41e4
aufs-util: new package (2016-07-17 14:35:13 +0200)
----------------------------------------------------------------
Christian Stewart (2):
aufs: new kernel extension
aufs-util: new package
Yann E. MORIN (1):
linux: add an option to install runtime headers
linux/Config.ext.in | 52 ++++++++++++++++++++++ linux/Config.in | 9 ++++ linux/linux-ext-aufs.mk | 21 +++++++++ linux/linux.mk | 12 +++++ package/Config.in | 2 + package/aufs-util/0001-remove-user-settings.patch | 16 +++++++ package/aufs-util/0002-no-check-ver.patch | 24 ++++++++++ package/aufs-util/0003-no-strip-lib.patch | 18 ++++++++ package/aufs-util/0004-no-override-readdir64.patch | 27 +++++++++++ package/aufs-util/Config.in | 36 +++++++++++++++ package/aufs-util/aufs-util.mk | 41 +++++++++++++++++ package/aufs/Config.in | 16 +++++++ package/aufs/aufs.mk | 28 ++++++++++++ 13 files changed, 302 insertions(+) create mode 100644 linux/linux-ext-aufs.mk create mode 100644 package/aufs-util/0001-remove-user-settings.patch create mode 100644 package/aufs-util/0002-no-check-ver.patch create mode 100644 package/aufs-util/0003-no-strip-lib.patch create mode 100644 package/aufs-util/0004-no-override-readdir64.patch create mode 100644 package/aufs-util/Config.in create mode 100644 package/aufs-util/aufs-util.mk create mode 100644 package/aufs/Config.in create mode 100644 package/aufs/aufs.mk
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v3 1/3 aufs: new kernel extension
From: Christian Stewart <[email protected]>
[Atul:
- Removed the duplicate conditional block.
- Updated the license to GPLv2.
- Removed the visibilty of package from menuconfig.
- Removed dependencies.
- Removed the comment.
- Changed the name of variable from BR2_PACKAGE_AUFS_STANDALONE_VERSION to BR2_LINUX_KERNEL_EXT_AUFS_VERSION.
- Removed the AUFS_INSTALL_STAGING and AUFS_INSTALL_TARGET variables.
- Removed the BR2_PACKAGE_AUFS_3X and BR2_PACKAGE_AUFS_4X variables.
]
[yann.morin.1998 at free.fr:
- do not fail on version check if aufs ext is disabled
- check for empty version
- squash aufs package and linux extension in one patch
- fail if the kernel already has aufs support
- simplify handling of version
]
--- linux/Config.ext.in | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ linux/linux-ext-aufs.mk | 21 ++++++++++++++++++++ package/Config.in | 1 + package/aufs/Config.in | 16 +++++++++++++++ package/aufs/aufs.mk | 28 ++++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 linux/linux-ext-aufs.mk create mode 100644 package/aufs/Config.in create mode 100644 package/aufs/aufs.mk
linux/Config.ext.in +52 -0
@@ -64,4 +64,56 @@ config BR2_LINUX_KERNEL_EXT_FBTFT https://github.com/notro/fbtft +# aufs-standalone +config BR2_LINUX_KERNEL_EXT_AUFS + bool "Aufs Filesystem Module patch" + select BR2_PACKAGE_AUFS + help + Aufs is split in two parts: a kernel part and a userspace + part. Enabling this option automatically selects the aufs + standalone (module) package and patches the Linux kernel + built by Buildroot with the aufs kernel part (ie fs/aufs). + + It is important to use the correct branch of aufs-standalone. + +if BR2_LINUX_KERNEL_EXT_AUFS + +choice + bool "aufs-standalone series" + help + Select the major series of this version. This must match the + major version of your kernel (e.g. for kernels 3.x, select + aufs3.x; for kernels 4.x, select aufs4.x). + + Note: neither aufs1.x nor aufs2.x (both for kernels older than + 3.x) are supported. + +config BR2_LINUX_KERNEL_EXT_AUFS_SERIES_3 + bool "aufs3.x" + +config BR2_LINUX_KERNEL_EXT_AUFS_SERIES_4 + bool "aufs4.x" + +endchoice + +config BR2_LINUX_KERNEL_EXT_AUFS_SERIES + int + default 3 if BR2_LINUX_KERNEL_EXT_AUFS_SERIES_3 + default 4 if BR2_LINUX_KERNEL_EXT_AUFS_SERIES_4 + +config BR2_LINUX_KERNEL_EXT_AUFS_VERSION + string "aufs-standalone version" + default "" + help + The version you choose must match that of your kernel. Usually, + the sha1 of the cset you want to use; avoid using a branch name + as this yields non-reproducible builds. + + See the following resources to see what versions are available: + + For aufs3.x: https://sourceforge.net/p/aufs/aufs3-standalone/ref/master/branches/ + For aufs4.x: https://github.com/sfjro/aufs4-standalone/branches/all + +endif # aufs + endmenu
linux/linux-ext-aufs.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# Linux Aufs extensions +# +# Patch the linux kernel with aufs extension +################################################################################ + +LINUX_EXTENSIONS += aufs + +define AUFS_PREPARE_KERNEL + if test -d $(@D)/fs/aufs/; then \ + echo "Your kernel already supports AUFS."; \ + exit 1; \ + fi + $(APPLY_PATCHES) $(@D) $(AUFS_DIR) \ + aufs$(AUFS_VERSION_MAJOR)-kbuild.patch \ + aufs$(AUFS_VERSION_MAJOR)-base.patch \ + aufs$(AUFS_VERSION_MAJOR)-mmap.patch \ + aufs$(AUFS_VERSION_MAJOR)-standalone.patch + cp -r $(AUFS_DIR)/fs/aufs/ $(@D)/fs/ + cp $(AUFS_DIR)/include/uapi/linux/aufs_type.h $(@D)/include/uapi/linux/ +endef
package/Config.in +1 -0
@@ -147,6 +147,7 @@ menu "Development tools" endmenu menu "Filesystem and flash utilities" + source "package/aufs/Config.in" source "package/autofs/Config.in" source "package/btrfs-progs/Config.in" source "package/cifs-utils/Config.in"
package/aufs/Config.in new file +16 -0
@@ -0,0 +1,16 @@ +# Automatically selected by the corresponding linux extension +config BR2_PACKAGE_AUFS + bool + +if BR2_PACKAGE_AUFS + +# Both come from the seclection of the linux extension. +config BR2_PACKAGE_AUFS_SERIES + int + default BR2_LINUX_KERNEL_EXT_AUFS_SERIES + +config BR2_PACKAGE_AUFS_VERSION + string + default BR2_LINUX_KERNEL_EXT_AUFS_VERSION + +endif
package/aufs/aufs.mk new file +28 -0
@@ -0,0 +1,28 @@ +################################################################################ +# +# aufs +# +# patches for the linux kernel, used by the extension. +# +################################################################################ + +AUFS_VERSION = $(call qstrip,$(BR2_PACKAGE_AUFS_VERSION)) +AUFS_LICENSE = GPLv2 +AUFS_LICENSE_FILES = COPYING + +ifeq ($(BR2_PACKAGE_AUFS),y) + +ifeq ($(BR2_PACKAGE_AUFS_SERIES),3) +AUFS_SITE = http://git.code.sf.net/p/aufs/aufs3-standalone +AUFS_SITE_METHOD = git +else ifeq ($(BR2_PACKAGE_AUFS_SERIES),4) +AUFS_SITE = $(call github,sfjro,aufs4-standalone,$(AUFS_VERSION)) +endif + +ifeq ($(BR_BUILDING):$(AUFS_VERSION),y:) +$(error No aufs version specified) +endif + +endif # BR2_PACKAGE_AUFS + +$(eval $(generic-package))
Signature · 1 line
2.7.4
Thomas Petazzoni
AppliedPATCH v3 1/3 aufs: new kernel extension
Hello,
Quoted 23 lines · Yann E. MORIN
From: Christian Stewart <[email protected]>
Signed-off-by Christian Stewart <[email protected]>[Atul:
- Removed the duplicate conditional block.
- Updated the license to GPLv2.
- Removed the visibilty of package from menuconfig.
- Removed dependencies.
- Removed the comment.
- Changed the name of variable fromBR2_PACKAGE_AUFS_STANDALONE_VERSIONtoBR2_LINUX_KERNEL_EXT_AUFS_VERSION.
- Removed theAUFS_INSTALL_STAGINGandAUFS_INSTALL_TARGETvariables.
- Removed theBR2_PACKAGE_AUFS_3XandBR2_PACKAGE_AUFS_4Xvariables.
]Signed-off-by Atul Singh <[email protected]>[yann.morin.1998 at free.fr:
- do not fail on version check if aufs ext is disabled
- check for empty version
- squash aufs package and linux extension in one patch
- fail if the kernel already has aufs support
- simplify handling of version
]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 10 lines
--- linux/Config.ext.in | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ linux/linux-ext-aufs.mk | 21 ++++++++++++++++++++ package/Config.in | 1 + package/aufs/Config.in | 16 +++++++++++++++ package/aufs/aufs.mk | 28 ++++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 linux/linux-ext-aufs.mk create mode 100644 package/aufs/Config.in create mode 100644 package/aufs/aufs.mk
Applied to master, with the following changes:
[Thomas:
- Fix the apply patch logic, it was using a non-existent AUFS_VERSION_MAJOR variable. BR2_PACKAGE_AUFS_SERIES is used instead.]
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v3 2/3 linux: add an option to install runtime headers
In reply to Yann E. MORINWhen the Linux kernel is patched with new externsions (e.g. aufs), it exposes new userland headers that were not necessarily available in the headers used to build the toolchain. Those headers will expose new features, like new filesystems internals.
Add an option for such packages to request the kernel installs its headers.
We do install those headers in a non-standard location, so that:
- they do not override those provided by the toolchain;
- they do not get inadvertently used.
Packages that really need those headers will have to add the correct -I path to their CPPFLAGS.
Note: this is not documented on-purpose, as we expect the set of packages that need that to be very limited. In which case, we'll notice they need those headers, and we can instruct the submitter to use these option and variable.
--- linux/Config.in | 9 +++++++++ linux/linux.mk | 12 ++++++++++++ 2 files changed, 21 insertions(+)
linux/Config.in +9 -0
@@ -14,6 +14,15 @@ if BR2_LINUX_KERNEL config BR2_LINUX_NEEDS_MODULES bool +# Packages that need the userland headers of the *running* kernel +# rather than those of the toolchain (e.g. because they need to talk +# to low-level stuff like filesystems internals or the network stack +# internals) can select this option. +# They can then refer to the variable $(LINUX_RUNTIME_HEADERS_DIR) as +# the base where they are installed. +config BR2_LINUX_NEEDS_RUNTIME_HEADERS + bool + # # Version selection. We provide the choice between: #
linux/linux.mk +12 -0
@@ -336,6 +336,18 @@ LINUX_APPEND_DTB += ; \ endif endif +ifeq ($(BR2_LINUX_NEEDS_RUNTIME_HEADERS),y) +LINUX_INSTALL_STAGING = YES +LINUX_RUNTIME_HEADERS_DIR = $(STAGING_DIR)/opt/linux +define LINUX_INSTALL_USERLAND_HEADERS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + $(LINUX_MAKE_FLAGS) \ + INSTALL_HDR_PATH=$(LINUX_RUNTIME_HEADERS_DIR) \ + headers_install +endef +LINUX_POST_INSTALL_STAGING_HOOKS += LINUX_INSTALL_USERLAND_HEADERS +endif # BR2_LINUX_NEEDS_HEADERS + # Compilation. We make sure the kernel gets rebuilt when the # configuration has changed. define LINUX_BUILD_CMDS
Signature · 1 line
2.7.4
PATCH v3 2/3 linux: add an option to install runtime headers
Hello,
Quoted 17 lines · Yann E. MORIN
When the Linux kernel is patched with new externsions (e.g. aufs), it exposes new userland headers that were not necessarily available in the headers used to build the toolchain. Those headers will expose new features, like new filesystems internals.
Add an option for such packages to request the kernel installs its headers.
We do install those headers in a non-standard location, so that:
- they do not override those provided by the toolchain;
- they do not get inadvertently used.
Packages that really need those headers will have to add the correct -I path to their CPPFLAGS.
Quoted 6 lines
Note: this is not documented on-purpose, as we expect the set of packages that need that to be very limited. In which case, we'll notice they need those headers, and we can instruct the submitter to use these option and variable.
Signed-off-by "Yann E. MORIN" <[email protected]>
I have not applied this patch. Instead, I've tuned a bit the aufs-util package so that we can directly use the headers from $(LINUX_DIR)/include/uapi.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v3 3/3 aufs-util: new package
In reply to Yann E. MORINFrom: Christian Stewart <[email protected]>
[Atul:
- Updated the default to empty.
- Updated the license to GPLv2.
- Used patches instead of SED commands.
- CC and LD are replaced by TARGET_CC and TARGET_LD.
]
[yann.morin.1998 at free.fr:
- drop the headers_install command
- instead, instruct the kernel to install them
- add patches 0002..0004
- properly build the host tools
- don't depend on the aufs extension, for kernel already patched
- fix comment
]
--- package/Config.in | 1 + package/aufs-util/0001-remove-user-settings.patch | 16 +++++++++ package/aufs-util/0002-no-check-ver.patch | 24 +++++++++++++ package/aufs-util/0003-no-strip-lib.patch | 18 ++++++++++ package/aufs-util/0004-no-override-readdir64.patch | 27 ++++++++++++++ package/aufs-util/Config.in | 36 +++++++++++++++++++ package/aufs-util/aufs-util.mk | 41 ++++++++++++++++++++++ 7 files changed, 163 insertions(+) create mode 100644 package/aufs-util/0001-remove-user-settings.patch create mode 100644 package/aufs-util/0002-no-check-ver.patch create mode 100644 package/aufs-util/0003-no-strip-lib.patch create mode 100644 package/aufs-util/0004-no-override-readdir64.patch create mode 100644 package/aufs-util/Config.in create mode 100644 package/aufs-util/aufs-util.mk
package/Config.in +1 -0
@@ -148,6 +148,7 @@ endmenu menu "Filesystem and flash utilities" source "package/aufs/Config.in" + source "package/aufs-util/Config.in" source "package/autofs/Config.in" source "package/btrfs-progs/Config.in" source "package/cifs-utils/Config.in"
package/aufs-util/0001-remove-user-settings.patch new file +16 -0
@@ -0,0 +1,16 @@ +install: drop setting ownership + +Signed-off-by: "Yann E. MORIN" <[email protected]> + +diff --git a/Makefile b/Makefile +--- a/Makefile ++++ b/Makefile +@@ -21,7 +21,7 @@ + override CPPFLAGS += -DAUFHSM_CMD=\"/usr/bin/aufhsm\" + override CFLAGS += -O -Wall + INSTALL ?= install +-Install = ${INSTALL} -o root -g root -p ++Install = ${INSTALL} -p + ManDir = /usr/share/man + + #
package/aufs-util/0002-no-check-ver.patch new file +24 -0
@@ -0,0 +1,24 @@ +Makefile: do not check version + +The aufs-util package tries to ensure that its version is compatible +with the one in the running kernel. However, this test is flawed: the +version string in the aufs4x branch for aufs-util is aufs3.x, so it does +not match the version in the kernel when it is aufs4.x. + +Disengage this check, ion the assumption the user knows what he is +doing. + +Signed-off-by: "Yann E. MORIN" <[email protected]> + +diff --git a/Makefile b/Makefile +--- a/Makefile ++++ b/Makefile +@@ -62,7 +62,7 @@ + $(foreach v, CPPFLAGS CFLAGS INSTALL Install ManDir LibUtilHdr, \ + $(eval MAKE += ${v}="$${${v}}")) + +-all: ver_test ${Man} ${Bin} ${Etc} ++all: ${Man} ${Bin} ${Etc} + ${MAKE} -C libau $@ + ln -sf ./libau/libau*.so . + $(call MakeFHSM, $@)
package/aufs-util/0003-no-strip-lib.patch new file +18 -0
@@ -0,0 +1,18 @@ +install: do not strip libs when installing + +We want unstripped binaries in staging; stripping is done by Buildroot +as a whole in target-finalize if needed, anyway. + +Signed-off-by: "Yann E. MORIN" <[email protected]> + +diff --git a/libau/Makefile b/libau/Makefile +--- a/libau/Makefile ++++ b/libau/Makefile +@@ -37,7 +37,6 @@ + ln -sf $< $@ + ${LibSo}.${LibSoMajor}: ${LibSo}.${LibSoMajor}.${LibSoMinor} + ln -sf $< $@ +-${LibSo}.${LibSoMajor}.${LibSoMinor}: override LDFLAGS += -s + ${LibSo}.${LibSoMajor}.${LibSoMinor}: override LDLIBS += -ldl -lpthread + ${LibSo}.${LibSoMajor}.${LibSoMinor}: ${LibSoObj} + ${CC} --shared -Wl,-soname,${LibSo}.${LibSoMajor} ${LDFLAGS} \
package/aufs-util/0004-no-override-readdir64.patch new file +27 -0
@@ -0,0 +1,27 @@ +libaufs: do not include rdu64 + +rdu64 is supposed to provide the LFS variant of readdir(), readdir64(). + +However, because Buildroot is always LFS0-enabled, readdir() is always +the LFS variant. + +Besides, the comment about rdu64 is utterly wrong: it refers to 64-bit +systems, when in fact it really is about support for LFS. + +Drop it from the build, as it causes build failures due to multiple +implementations of readdir64(). + +Signed-off-by: "Yann E. MORIN" <[email protected]> + +diff --git a/libau/Makefile b/libau/Makefile +--- a/libau/Makefile ++++ b/libau/Makefile +@@ -18,7 +18,7 @@ + LibSoMinor = 7 + LibSo = libau.so + LibSoObj = libau.o \ +- rdu_lib.o rdu.o rdu64.o \ ++ rdu_lib.o rdu.o \ + pathconf.o + LibSoHdr = libau.h rdu.h +
package/aufs-util/Config.in new file +36 -0
@@ -0,0 +1,36 @@ +comment "aufs-util needs a linux kernel and a toolchain w/ threads" + depends on BR2_USE_MMU + depends on !BR2_LINUX_KERNEL || !BR2_TOOLCHAIN_HAS_THREADS + +config BR2_PACKAGE_AUFS_UTIL + bool "aufs-util" + depends on BR2_USE_MMU + depends on BR2_LINUX_KERNEL + depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_LINUX_NEEDS_RUNTIME_HEADERS + help + Aufs command line utilities. + + Needs a kernel with aufs support. A kernel + extension package is available. + + http://sourceforge.net/p/aufs/aufs-util/ + +if BR2_PACKAGE_AUFS_UTIL + +config BR2_PACKAGE_AUFS_UTIL_VERSION + string "aufs-util version" + default "" + help + The version you choose must match that of the uafs support + in your kernel. Usually, this is aufs3.x for kerenls 3.x and + aufs4.x for kernels 4.x. + + Usually, the sha1 of the cset you want to use; avoid using a + branch name as this yields non-reproducible builds. + + See the following resources to see what versions are available: + + https://sourceforge.net/p/aufs/aufs-util/ci/master/tree/ + +endif
package/aufs-util/aufs-util.mk new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 3/3 aufs-util: new package
Hello,
Quoted 18 lines · Yann E. MORIN
From: Christian Stewart <[email protected]>
Signed-off-by Christian Stewart <[email protected]>[Atul:
- Updated the default to empty.
- Updated the license to GPLv2.
- Used patches instead of SED commands.
- CC and LD are replaced byTARGET_CCandTARGET_LD.
]Signed-off-by Atul Singh <[email protected]>[yann.morin.1998 at free.fr:
- drop theheaders_installcommand
- instead, instruct the kernel to install them
- add patches 0002..0004
- properly build the host tools
- don't depend on the aufs extension, for kernel already patched
- fix comment
]
Quoted 1 line
Signed-off-by Yann E. MORIN <[email protected]>
Applied with those changes:
[Thomas:
- Remove the patch 0004-no-override-readdir64.patch, since it no longer applies to the latest version of aufs-util. Instead, add a post-patch hook that tweaks the Makefile to remove the problematic rdu64.o from the build process.
- Use directly the kernel headers from the kernel source tree, rather than having to install them. This only requires a minor trick to define "__user" to empty.]
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com