-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for RHEL/CentOS 7/8 Kernels (#96)
* CentOS compilation This PR will bring support to CentOS kernels * centos: Kernel compilation This commit brings the necessary changes to compile the kerne, but there are steps yet with the library * centos: New docker files * centos: Centos7 adjusts * centos: centos7 adjust to docker file * centos: centos7 missing \ * Add support for patching broken CentOS 7 shitty kernels and apply strstr patch * centos: Fix compilation on CentOS 7 with docker * centos: Fixes to CentOS 8 * Minor tweaks to make CentOS 7 & 8 more similar Intended goal here is to eventually figure out how to merge the two CentOS 7 & 8 build environments. They are now fairly similar with some minor exceptions: ```sh prologic@Jamess-iMac Thu Mar 12 09:33:40 ~/NetData/kernel-collector (centos) 2 $ diff -Ndry Dockerfile.glibc.centos7 Dockerfile.glibc.centos8 FROM centos:7.7.1908 AS build | FROM centos:8.1.1911 AS build ARG ARCH=x86 ARG ARCH=x86 ENV ARCH=$ARCH ENV ARCH=$ARCH ARG KERNEL_VERSION=3.10.0-1062.12.1.el7 | ARG KERNEL_VERSION=4.18.0-147.5.1.el8_1 ENV KERNEL_VERSION=$KERNEL_VERSION ENV KERNEL_VERSION=$KERNEL_VERSION ENV _LIBC=glibc ENV _LIBC=glibc RUN yum update -y && \ RUN yum update -y && \ yum groupinstall -y "Development tools" && \ yum groupinstall -y "Development tools" && \ yum install -y asciidoc audit-libs-devel bash bc binutils yum install -y asciidoc audit-libs-devel bash bc binutils bison diffutils elfutils elfutils-devel \ bison diffutils elfutils elfutils-devel \ elfutils-libelf-devel findutils flex gawk elfutils-libelf-devel findutils flex gawk gzip hmaccalc hostname java-devel m4 make gzip hmaccalc hostname java-devel m4 make module-init-tools ncurses-devel net-tools module-init-tools ncurses-devel net-tools numactl-devel openssl openssl-devel patch numactl-devel openssl openssl-devel patch perl perl-ExtUtils-Embed pesign python-dev | perl perl-ExtUtils-Embed pesign redhat-rpm python-docutils redhat-rpm-config rpm-buil | rpm-build sh-utils tar xmlto xz zlib-devel xmlto xz zlib-devel glibc-headers < < RUN yum install -y centos-release-scl && \ < yum-config-manager --enable rhel-server-rhscl-7-rpms && \ < yum install -y llvm-toolset-7.0* < RUN cd ~/ && mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCE RUN cd ~/ && mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCE echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros && echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros && rpm -i http://vault.centos.org/7.7.1908/updates/Source/SP | rpm -i http://vault.centos.org/8.1.1911/BaseOS/Source/SPa RUN cd ~/rpmbuild/SOURCES && \ RUN cd ~/rpmbuild/SOURCES && \ tar -xf linux-${KERNEL_VERSION}.tar.xz && \ tar -xf linux-${KERNEL_VERSION}.tar.xz && \ mkdir -p /usr/src/kernels/ && \ mkdir -p /usr/src/kernels/ && \ ln -s linux-${KERNEL_VERSION} /usr/src/kernels/$(uname -r ln -s linux-${KERNEL_VERSION} /usr/src/kernels/$(uname -r cp -f kernel-3.10.0-x86_64.config linux-${KERNEL_VERSION} < cd linux-${KERNEL_VERSION} && \ cd linux-${KERNEL_VERSION} && \ make oldconfig && \ | make defconfig && \ make prepare && \ make prepare && \ make scripts && \ make scripts && \ make headers_install make headers_install WORKDIR /kernel-collector WORKDIR /kernel-collector COPY .dockerfiles/build.sh /build.sh COPY .dockerfiles/build.sh /build.sh COPY . . COPY . . ENTRYPOINT ["scl"] | CMD ["/build.sh"] CMD ["enable", "llvm-toolset-7.0", "./build.sh"] < ``` * Trigger CI * Fix execution bit on patch_kernel.sh * Import CI checks from netdata/netdata for shell and yaml * Add build-special job for RHEL/CentOS OS(es) / Kernels * Trigger CI * Fixed CMD of centos7 buidl env * Fix a bunch of build errors related to the kernels we're building against * Fixed clang version detection * centos: this brings the missing ifdef * Fixed missing/wrong deps for llvm/clang on CentOS8 and wrong include path for clang/llvm libs * Fixed artifacts for CentOS/RHEL Co-authored-by: James Mills <prologic@shortcircuit.net.au>
- Loading branch information
1 parent
9693fec
commit ddb1c2d
Showing
13 changed files
with
246 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
# Runs various ReviewDog based checks against PR with suggested changes to improve quality | ||
name: Review | ||
on: | ||
pull_request: | ||
jobs: | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git clone repository | ||
uses: actions/checkout@v2 | ||
- name: Run shellcheck | ||
uses: reviewdog/action-shellcheck@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reporter: github-pr-check | ||
path: "." | ||
pattern: "*.sh*" | ||
exclude: "./.git/*" | ||
|
||
yamllint: | ||
name: yamllint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git clone repository | ||
uses: actions/checkout@v2 | ||
- name: Run yamllint | ||
uses: reviewdog/action-yamllint@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reporter: github-pr-check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
yaml-files: | ||
- '*.yaml' | ||
- '*.yml' | ||
- '.yamllint' | ||
|
||
rules: | ||
braces: enable | ||
brackets: enable | ||
colons: enable | ||
commas: enable | ||
comments: disable | ||
comments-indentation: disable | ||
document-end: disable | ||
document-start: | ||
level: warning | ||
empty-lines: enable | ||
empty-values: disable | ||
hyphens: enable | ||
indentation: enable | ||
key-duplicates: enable | ||
key-ordering: disable | ||
line-length: disable | ||
new-line-at-end-of-file: enable | ||
new-lines: enable | ||
octal-values: enable | ||
quoted-strings: disable | ||
trailing-spaces: enable | ||
truthy: disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM centos:7.7.1908 AS build | ||
|
||
ARG ARCH=x86 | ||
ENV ARCH=$ARCH | ||
|
||
ARG KERNEL_VERSION=3.10.0-1062.12.1.el7 | ||
ENV KERNEL_VERSION=$KERNEL_VERSION | ||
|
||
ENV _LIBC=glibc | ||
|
||
RUN yum update -y && \ | ||
yum groupinstall -y "Development tools" && \ | ||
yum install -y asciidoc audit-libs-devel bash bc binutils binutils-devel \ | ||
bison diffutils elfutils elfutils-devel \ | ||
elfutils-libelf-devel findutils flex gawk gcc gettext \ | ||
gzip hmaccalc hostname java-devel m4 make \ | ||
module-init-tools ncurses-devel net-tools newt-devel \ | ||
numactl-devel openssl openssl-devel patch pciutils-devel \ | ||
perl perl-ExtUtils-Embed pesign python-devel \ | ||
python-docutils redhat-rpm-config rpm-build sh-utils tar \ | ||
xmlto xz zlib-devel glibc-headers | ||
|
||
RUN yum install -y centos-release-scl && \ | ||
yum-config-manager --enable rhel-server-rhscl-7-rpms && \ | ||
yum install -y llvm-toolset-7.0* | ||
|
||
RUN mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \ | ||
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros && \ | ||
rpm -i http://vault.centos.org/7.7.1908/updates/Source/SPackages/kernel-${KERNEL_VERSION}.src.rpm 2>&1 | ||
|
||
RUN cd ~/rpmbuild/SOURCES && \ | ||
tar -xf linux-${KERNEL_VERSION}.tar.xz && \ | ||
cp -f kernel-3.10.0-x86_64.config linux-${KERNEL_VERSION}/.config | ||
|
||
RUN cd /usr/src && \ | ||
ln -s ~/rpmbuild/SOURCES/linux-${KERNEL_VERSION} linux | ||
|
||
RUN cd /usr/src/linux && \ | ||
make oldconfig && \ | ||
make prepare && \ | ||
make scripts && \ | ||
make headers_install | ||
|
||
WORKDIR /kernel-collector | ||
|
||
COPY .dockerfiles/build.sh /build.sh | ||
COPY . . | ||
|
||
ENTRYPOINT ["scl"] | ||
CMD ["enable", "llvm-toolset-7.0", "/build.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM centos:8.1.1911 AS build | ||
|
||
ARG ARCH=x86 | ||
ENV ARCH=$ARCH | ||
|
||
ARG KERNEL_VERSION=4.18.0-147.5.1.el8_1 | ||
ENV KERNEL_VERSION=$KERNEL_VERSION | ||
|
||
ENV _LIBC=glibc | ||
|
||
RUN yum update -y && \ | ||
yum groupinstall -y "Development tools" && \ | ||
yum install -y asciidoc audit-libs-devel bash bc binutils binutils-devel \ | ||
bison diffutils elfutils elfutils-devel \ | ||
elfutils-libelf-devel findutils flex gawk gcc gettext \ | ||
gzip hmaccalc hostname java-devel m4 make \ | ||
module-init-tools ncurses-devel net-tools newt-devel \ | ||
numactl-devel openssl openssl-devel patch pciutils-devel \ | ||
perl perl-ExtUtils-Embed pesign redhat-rpm-config \ | ||
rpm-build sh-utils tar xmlto xz zlib-devel clang llvm | ||
|
||
RUN mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \ | ||
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros && \ | ||
rpm -i http://vault.centos.org/8.1.1911/BaseOS/Source/SPackages/kernel-${KERNEL_VERSION}.src.rpm 2>&1 | ||
|
||
RUN cd ~/rpmbuild/SOURCES && \ | ||
tar -xf linux-${KERNEL_VERSION}.tar.xz && \ | ||
mkdir -p /usr/src/kernels | ||
|
||
RUN cd /usr/src && \ | ||
ln -s ~/rpmbuild/SOURCES/linux-${KERNEL_VERSION} linux | ||
|
||
RUN cd /usr/src/linux && \ | ||
make defconfig && \ | ||
make prepare && \ | ||
make scripts && \ | ||
make headers_install | ||
|
||
WORKDIR /kernel-collector | ||
|
||
COPY .dockerfiles/build.sh /build.sh | ||
COPY . . | ||
|
||
CMD ["/build.sh"] |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef _NETDATA_ASM_GOTO_H_ | ||
# define _NETDATA_ASM_GOTO_H_ 1 | ||
|
||
# include <linux/types.h> | ||
# include <linux/version.h> | ||
|
||
# ifndef RHEL_RELEASE_VERSION | ||
# define RHEL_RELEASE_VERSION(x,y) ((x << 8) + (y)) | ||
# endif | ||
|
||
# if RHEL_RELEASE_CODE && \ | ||
RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,0) | ||
# ifdef asm_volatile_goto | ||
# undef asm_volatile_goto | ||
# define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") | ||
# endif | ||
# endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) | ||
|
||
prefix=/usr | ||
libdir=/usr/lib64 | ||
includedir=${prefix}/include | ||
|
||
Name: libbpf | ||
Description: BPF library | ||
Version: 0.0.3 | ||
Libs: -L${libdir} -lbpf | ||
Requires.private: libelf | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters