Build deb and rpm kernel packages - AmpereComputing/ampere-lts-kernel---DEPRECATED GitHub Wiki

build and install kernel locally

1. wget https://github.com/AmpereComputing/ampere-lts-kernel/archive/refs/heads/linux-5.4.y.zip; unzip linux-5.4.y.zip; cd ampere-lts-kernel-linux-5.4.y
2. <apply your own patches>
3. cp arch/arm64/configs/altra_5.4_defconfig .config
4. make olddefconfig
5. <do your own config>
6. make -j120; make modules
7. make modules_install; make install

Build kernel deb package

We need a ubuntu system or ubuntu virtual machine (ubuntu-20.04 arm64 server).

There are two ways to build deb package:

Using kernel's package scripts

  1. Install dependency.
# apt-get install libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
  1. Download and configure kernel
# wget https://github.com/AmpereComputing/ampere-lts-kernel/archive/refs/heads/linux-5.4.y.zip; unzip linux-5.4.y.zip; cd ampere-lts-kernel-linux-5.4.y
# <apply your own patches> 
# cp arch/arm64/configs/altra_5.4_defconfig .config
# make olddefconfig
# <do your own config>
  1. Build deb package
# make -j120 deb-pkg
# ls ../linux*.deb
../linux-headers-5.4.93_5.4.93-1_arm64.deb    ../linux-image-5.4.93_5.4.93-1_arm64.deb
../linux-image-5.4.93-dbg_5.4.93-1_arm64.deb  ../linux-libc-dev_5.4.93-1_arm64.deb
  1. Install kernel deb package
# dpkg -i linux*.deb
# reboot

Use build script from this site (slow and requires dependent packages)

If you want to build ubuntu-like kernel packages, try bellow. But this script has issue with parallel build. It will take >3 hours to finish.

# apt install git kernel-wedge dwarves
# git config --global user.name "Your Name"
# git config --global user.email [email protected]
# wget https://github.com/AmpereComputing/ampere-lts-kernel/archive/refs/heads/main.zip; unzip main.zip
# cd ampere-lts-kernel-main/pkg-builds/deb
# ./ampere-lts-ubuntu-build.sh
<wait for hours>

Build kernel rpm package

Use build script from this site

Need a CentOS-8.3 system or VM.

# yum groupinstall "Development Tools
# yum install ncurses-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
# wget https://github.com/AmpereComputing/ampere-lts-kernel/archive/refs/heads/main.zip; unzip main.zip
# cd ampere-lts-kernel-main/pkg-builds/rpm
# ../ampere-lts-centos-build.sh