From f00717d56cb3078d90fb096f7771d17b4fa19fb5 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 20 Nov 2020 08:16:25 +0100 Subject: [BUILD] add support for atomic operations not supported by hardware This change links the dnbd3-server with 'libatomic' to add support for atomic operations not supported by hardware (especially 32-bit hardware architectures, such as ARM). Thus the dnbd3-server can also run on a Raspberry Pi 1 running Rasperry Pi OS. Note that the dnbd3-server is still linked to the libatomic, even if the hardware supports atomic operations. In this case, the compiler resolves atomic operations and replaces them automatically with specific built-in functions. This unnecessary linkage can be removed in the future if the GCC supports an upcoming option called automatic linking of libatomic (--enable-autolink-libatomic). --- CMakeLists.txt | 4 ++-- README.md | 14 ++++++++++++++ src/server/CMakeLists.txt | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bad9c00..65b9ebb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release) set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md) # set DEB generator specific packaging options - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libfuse2, libjansson4") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libfuse2, libjansson4, libatomic1") if(DNBD3_KERNEL_MODULE) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/deb/postinst "depmod -a\n") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/deb/postrm "depmod -a\n") @@ -141,7 +141,7 @@ if(CMAKE_BUILD_TYPE MATCHES Release) endif(DNBD3_KERNEL_MODULE) # set RPM generator specific packaging options - set(CPACK_RPM_PACKAGE_REQUIRES "glibc, fuse-libs, jansson") + set(CPACK_RPM_PACKAGE_REQUIRES "glibc, fuse-libs, jansson, libatomic") set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib" "/lib/modules" "/lib/modules/${CMAKE_SYSTEM_VERSION}" diff --git a/README.md b/README.md index 1e60477..954fbe9 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This repository contains the source code for the following dnbd3 components: The dnbd3 components can be built for the following Linux kernel versions and Unix distributions: - Archlinux with **Linux kernel 5.9.x** or **5.4.x** + - Raspberry Pi OS with **Linux kernel 5.4.x** - Ubuntu 20.04 with **Linux kernel 5.4.x** - Ubuntu 18.04 with **Linux kernel 4.19.x** - CentOS 8 with **Linux kernel 4.18.x** @@ -37,6 +38,19 @@ pacman -S git \ rpm-tools ``` +#### Raspberry Pi OS with Linux kernel 5.4.x +```shell +apt-get install git \ + make \ + cmake \ + gcc \ + raspberrypi-kernel-headers \ + libfuse-dev \ + libjansson-dev \ + afl \ + rpm +``` + #### Ubuntu 20.04 with Linux kernel 5.4.x ```shell apt-get install git \ diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 463f944..038d626 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -55,7 +55,7 @@ add_executable(dnbd3-server ${CMAKE_CURRENT_SOURCE_DIR}/altservers.c ${CMAKE_CURRENT_SOURCE_DIR}/uplink.c ${CMAKE_CURRENT_SOURCE_DIR}/urldecode.c) target_include_directories(dnbd3-server PRIVATE ${JANSSON_INCLUDE_DIR}) -target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES}) +target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared atomic ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES}) if(DNBD3_SERVER_FUSE) find_package(Fuse REQUIRED) -- cgit v1.2.3-55-g7522