Skip to content

Instantly share code, notes, and snippets.

@eqhmcow
Last active July 18, 2023 00:52
Show Gist options
  • Save eqhmcow/a8b234ef4791769671c95c3ac7909d81 to your computer and use it in GitHub Desktop.
Save eqhmcow/a8b234ef4791769671c95c3ac7909d81 to your computer and use it in GitHub Desktop.
build new kernel for CentOS 7
# something like this...
docker run -it oraclelinux:7
yum install rpm-build git wget vim oracle-softwarecollection-release-el7 scl-utils oraclelinux-developer-release-el7 oracle-epel-release-el7
yum-config-manager --enable ol7_software_collections
yum-config-manager --enable ol7_latest ol7_optional_latest
yum-config-manager --enable ol7_developer
git clone https://git.centos.org/rpms/kernel.git
cd kernel
git checkout c7-sig-altarch-lts-5-4
cd ..
mv kernel rpmbuild
cd rpmbuild/SOURCES
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.tar.xz
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.4.240.xz
chmod a+x filter-modules.sh
cd
yum install https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/rpm-4.13.0.2-1.el7.c8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/rpm-build-4.13.0.2-1.el7.c8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/rpm-libs-4.13.0.2-1.el7.c8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/rpm-plugin-selinux-4.13.0.2-1.el7.c8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/rpm-build-libs-4.13.0.2-1.el7.c8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/python2-rpm-4.13.0.2-1.el7.c8.x86_64.rpm
yum install m4 perl-devel perl-generators make gcc hmaccalc bison flex net-tools elfutils-devel devtoolset-8-build devtoolset-8-binutils devtoolset-8-gcc devtoolset-8-make python3-rpm-macros python3-devel zlib-devel binutils-devel newt-devel xz-devel audit-libs-devel java-devel numactl-devel gettext ncurses-devel pciutils-devel python-docutils llvm-toolset-7 libcap-devel libcap-ng-devel openssl openssl-devel pesign
xmlto asciidoc rpm
yum install "perl(ExtUtils::Embed)"
yum install llvm-toolset-7.0
yum install https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0/7.0.1/2.el7/x86_64/llvm-toolset-7.0-7.0.1-2.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-clang/7.0.1/1.el7/x86_64/llvm-toolset-7.0-clang-7.0.1-1.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-lldb/7.0.1/1.el7/x86_64/llvm-toolset-7.0-lldb-7.0.1-1.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-lld/7.0.1/2.el7/x86_64/llvm-toolset-7.0-lld-7.0.1-2.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-llvm/7.0.1/4.el7/x86_64/llvm-toolset-7.0-llvm-7.0.1-4.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-python-lit/0.7.1/1.el7/noarch/llvm-toolset-7.0-python2-lit-0.7.1-1.el7.noarch.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0/7.0.1/2.el7/x86_64/llvm-toolset-7.0-runtime-7.0.1-2.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-llvm/7.0.1/4.el7/x86_64/llvm-toolset-7.0-llvm-libs-7.0.1-4.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-clang/7.0.1/1.el7/x86_64/llvm-toolset-7.0-clang-libs-7.0.1-1.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-libomp/7.0.1/2.el7/x86_64/llvm-toolset-7.0-libomp-7.0.1-2.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-compiler-rt/7.0.1/3.el7/x86_64/llvm-toolset-7.0-compiler-rt-7.0.1-3.el7.x86_64.rpm https://cbs.centos.org/kojifiles/packages/llvm-toolset-7.0-lld/7.0.1/2.el7/x86_64/llvm-toolset-7.0-lld-libs-7.0.1-2.el7.x86_64.rpm
cat > /etc/rpm/macros.dist
# dist macros.
%centos_ver 7
%centos 7
%rhel 7
%dist .el7
%el7 1
rpmbuild -bb --target x86_64 rpmbuild/SPECS/kernel.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment