1. Overview
The patches were developed to provide solutions for SSIF host timeout,
of Ampere® Altra® and Altra® Max processors. 

 
The patches are for compatibility with Linux 4.18, CentOS 4.18, 
CentOS 4.18 ampere kernel and 5.10 kernels.
 
These patches are provided for development and testing purposes. Customers
are encouraged to test them fully in their production environments.
 
If problems are encountered or enhancement is needed for these patches,
please contact support@amperecomputing.com.
 

2. Files List
-----------------
collins_ipmi_ssif_issue_tuned_kernel_4.18.patch			: for general Linux kernel 4.18+
collins_ipmi_ssif_issue_tuned_kernel_4.18-Ampere.patch	: for Ampere SRP release package's CentOS8 Ampere kernel 
collins_ipmi_ssif_issue_tuned_kernel_5.10.patch			: for general Linux kernel 5.10+
collins_ipmi_ssif_issue_tuned_kernel_4.18_c8_365_el8.patch	: for CentOS 8 4.18_365+
Ampere-Altra-family-SSIF-patch-for-kernel-6.1.patch		: for general Linux kernel 6.x

3. Rebuild CentOS kernel 

This instruction is about build the Linux kernel on ARM64 machine, suggest to build it on VM or docker environment. 

3.1 Install Necessary Packages

	# follow original guide to install necessary packages
	yum groupinstall "Development Tools"
	yum install ncurses-devel
	yum install hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
	# Install EPEL packages
	sudo yum install epel-release
	# Enable powertools packages
	sudo dnf config-manager --set-enabled powertools
	
3.2 Fetch CentOS Linux Kernel Source

	This steps will fetch current version CentOS kernel source code.
	It will download current kernel version of kernel.src.rpm.
	
		cd ~
		mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
		echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

		KVER=`uname -r | sed 's/\.aarch64//'`
		rpm -i https://vault.centos.org/8-stream/BaseOS/Source/SPackages/kernel-$KVER.src.rpm
		
3.3 Install Kernel Necessary Package

		After get the kernel source code, it still needs some extra software packages to build 
		the CentOS Linux kernel. If it doesn’t enable powertool on previous step, this step will fail.
		
		cd ~/rpmbuild/SPECS

		for pkg in `rpmbuild -bp --target=$(uname -m) kernel.spec 2>&1 | grep 'is needed by' |awk '{print $1}' | tr '\n' ' '`;do sudo yum install $pkg -y;done
		
3.4 Apply Patch 

	the patch file "collins_ipmi_ssif_issue_tuned_kernel_4.18_c8_365_el8.patch" is used for CentOS 365 and above, 
	it needs to put the file to the build system 

	cd ~/rpmbuild/SPECS and edit kernel.spec, find "Patch999999" and add new record above it
	
	ex:
	== begin ==
	## Patches needed for building this package

	Patch000001: collins_ipmi_ssif_issue_tuned_kernel_4.18_c8_365_el8.patch

	# empty final patch to facilitate testing of kernel patches
	Patch999999: linux-kernel-test.patch
	== end ==
	
	
	
	and add another record before "ApplyOptionalPatch linux-kernel-test.patch"
	ex:
	== begin ==
	ApplyOptionalPatch new_patch_4.18.patch
	ApplyOptionalPatch linux-kernel-test.patch
	== end ==
	
	then, copy the file "collins_ipmi_ssif_issue_tuned_kernel_4.18_c8_365_el8.patch" to ~/rpmbuild/SOURCES/


3.4 Build CentOS Linux kernel

	# Executes  the  "%prep" stage from the spec file, will not compile it
	rpmbuild -bp --target=$(uname -m) kernel.spec
	# compile kernel source code
	rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log


3.5 Install RPM packages

	if everything is ok, the file will output on ~/rpmbuild/RPMS/aarch64/

	Install rpm command, here is an example to install necessary kernel module. 
		
		yum localinstall  kernel-4.18.0-408.el8.aarch64.rpm kernel-core-4.18.0-408.el8.aarch64.rpm kernel-headers-4.18.0-408.el8.aarch64.rpm kernel-modules-4.18.0-408.el8.aarch64.rpm kernel-modules-extra-4.18.0-408.el8.aarch64.rpm