diff options
author | Jonathan Bauer | 2018-05-07 10:48:33 +0200 |
---|---|---|
committer | Jonathan Bauer | 2018-05-07 10:48:33 +0200 |
commit | c331b16ec9414fd2e597a874e7f6d82130cdb11d (patch) | |
tree | 96f7bd1c485cafc8c6ecb38046e69daf7ab020e9 | |
parent | [openslx_tmp_mount] add chmod binary (diff) | |
download | systemd-init-c331b16ec9414fd2e597a874e7f6d82130cdb11d.tar.gz systemd-init-c331b16ec9414fd2e597a874e7f6d82130cdb11d.tar.xz systemd-init-c331b16ec9414fd2e597a874e7f6d82130cdb11d.zip |
support patches for submodules
after cloning the submodules, search for patches under
builder/patches/<submodule_name> and apply them is appropriate.
Currently:
* dnbd3:
** configurable kernel version
* qemu-xmount:
** do not pass the relocatable option (-r) to the linker since it
conflicts with "-pie" that is activated by default on newer gcc.
** fix memfd compile errors
The last patch was taken from:
http://lists.openembedded.org/pipermail/openembedded-core/2018-January/146949.html
-rwxr-xr-x | builder/build-initramfs.sh | 6 | ||||
-rw-r--r-- | builder/patches/dnbd3/01-config_kernel_version.patch | 26 | ||||
-rw-r--r-- | builder/patches/qemu-xmount/01-fix_ld_pie_relocateable.patch | 14 | ||||
-rw-r--r-- | builder/patches/qemu-xmount/02-fix_memfd_mman.patch | 28 |
4 files changed, 74 insertions, 0 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index 7fac2186..2cb675a4 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -42,6 +42,12 @@ if ! [[ -d "$_needed_location" ]]; then git clone --depth 1 --branch "$branch" ' git submodule update # --remote <- this seems like a bad idea + # apply patches for submodules + git submodule foreach ' + for p in $(find ${toplevel}/builder/patches/${path##*/} -type f -name "*.patch" | sort -n); do + patch -p1 < $p || echo "Failed to patch $path with $p - expect errors." + done 2>/dev/null + ' popd # finally copy all dracut modules under modules.d/ cp --recursive \ diff --git a/builder/patches/dnbd3/01-config_kernel_version.patch b/builder/patches/dnbd3/01-config_kernel_version.patch new file mode 100644 index 00000000..f75b65df --- /dev/null +++ b/builder/patches/dnbd3/01-config_kernel_version.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f2da9e5..8efac48 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -191,10 +191,11 @@ endif() + IF(BUILD_KERNEL_MODULE) + SET(MODULE_NAME dnbd3) + SET(MODULE_FILE ${MODULE_NAME}.ko) ++ SET(KERNEL_VERSION ${CMAKE_SYSTEM_VERSION} CACHE STRING "User-specified kernel version") + FILE(GLOB MODULE_SOURCE_FILES src/kernel/*.c src/serialize.c) + FILE(GLOB MODULE_HEADER_FILES src/kernel/*.h) + +- SET(KERNEL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build") ++ SET(KERNEL_DIR "/lib/modules/${KERNEL_VERSION}/build") + + SET(KBUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -C ${KERNEL_DIR} + M=${CMAKE_BINARY_DIR} modules +@@ -221,7 +222,7 @@ IF(BUILD_KERNEL_MODULE) + ADD_CUSTOM_TARGET(${MODULE_NAME} ALL DEPENDS ${CMAKE_BINARY_DIR}/${MODULE_FILE}) + + INSTALL(FILES ${CMAKE_BINARY_DIR}/${MODULE_NAME}.ko +- DESTINATION /lib/modules/${CMAKE_SYSTEM_VERSION}/kernel/drivers/block ++ DESTINATION /lib/modules/${KERNEL_VERSION}/kernel/drivers/block + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + ) + diff --git a/builder/patches/qemu-xmount/01-fix_ld_pie_relocateable.patch b/builder/patches/qemu-xmount/01-fix_ld_pie_relocateable.patch new file mode 100644 index 00000000..c85a8f55 --- /dev/null +++ b/builder/patches/qemu-xmount/01-fix_ld_pie_relocateable.patch @@ -0,0 +1,14 @@ +diff --git a/rules.mak b/rules.mak +index 4551b9ea70..019d6c7691 100644 +--- a/rules.mak ++++ b/rules.mak +@@ -111,7 +111,7 @@ module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS) + $(if $(findstring /,$@),$(call quiet-command,cp $@ $(subst /,-,$@), " CP $(subst /,-,$@)")) + + +-LD_REL := $(CC) -nostdlib -Wl,-r ++LD_REL := $(CC) -nostdlib -r + + %.mo: + $(call quiet-command,$(LD_REL) -o $@ $^," LD -r $(TARGET_DIR)$@") + diff --git a/builder/patches/qemu-xmount/02-fix_memfd_mman.patch b/builder/patches/qemu-xmount/02-fix_memfd_mman.patch new file mode 100644 index 00000000..8b272085 --- /dev/null +++ b/builder/patches/qemu-xmount/02-fix_memfd_mman.patch @@ -0,0 +1,28 @@ +diff --git a/configure b/configure +index 116a916aec..aefe9cef71 100755 +--- a/configure ++++ b/configure +@@ -3642,7 +3642,7 @@ fi + # check if memfd is supported + memfd=no + cat > $TMPC << EOF +-#include <sys/memfd.h> ++#include <sys/mman.h> + + int main(void) + { +diff --git a/util/memfd.c b/util/memfd.c +index 7c406914c5..3636f0d9fd 100644 +--- a/util/memfd.c ++++ b/util/memfd.c +@@ -34,9 +34,7 @@ + + #include "qemu/memfd.h" + +-#ifdef CONFIG_MEMFD +-#include <sys/memfd.h> +-#elif defined CONFIG_LINUX ++#if defined CONFIG_LINUX && !defined CONFIG_MEMFD + #include <sys/syscall.h> + #include <asm/unistd.h> + |