This system consists of two main components:
- A server that automatically compiles the latest TKG kernel and hosts a Pacman repository.
- A client (your main PC) that installs the kernel from this repository.
The automation script checks for new kernel versions daily, compiles them with TKG patches, and updates the repository accordingly.
- A Linux server (preferably Arch-based) with sufficient resources to compile kernels.
- A client PC running Arch Linux or an Arch-based distribution.
- Basic knowledge of Linux system administration and bash scripting.
-
Install required packages:
sudo pacman -S base-devel git curl wget nginx cronie
-
Create a directory for the repository:
sudo mkdir -p /srv/http/kernel-repo sudo chown $USER:$USER /srv/http/kernel-repo
-
Set permissions for the TKG and repository directories:
Since the directories are outside of your home folder, ensure that your user has the necessary permissions to access and modify the files. Use the following commands to change the ownership and permissions:
sudo chown -R $USER:$USER /srv/http/tkg /srv/http/kernel-repo sudo chmod -R 755 /srv/http/tkg /srv/http/kernel-repo
If Nginx needs to access the repository, ensure it has read access:
sudo chown -R http:http /srv/http/kernel-repo sudo chmod -R 755 /srv/http/kernel-repo
Alternatively, to allow both your user and Nginx to access the repository:
sudo chown -R $USER:http /srv/http/kernel-repo sudo chmod -R 775 /srv/http/kernel-repo
-
Configure Nginx: Edit
/etc/nginx/nginx.conf
and add:server { listen 80; server_name your-server-ip; # Replace with your server's IP address location /kernel-repo/ { root /srv/http; autoindex on; } }
-
Start and enable Nginx:
sudo systemctl start nginx sudo systemctl enable nginx
-
Clone this repository, and edit the script for your needs:
git clone https://github.com/zerschranzer/tkg-kernel-automation.git cd tkg-kernel-automation
-
Set up a cron job to run the script daily at 3 AM:
crontab -e
Add the following line:
0 3 * * * /path/to/tkg-kernel-automation/build_kernel.sh
Ensure that your cron daemon is running (
sudo systemctl enable --now cronie
).
-
Edit
/etc/pacman.conf
on your client PC and add:[customkernel] Server = http://your-server-ip/kernel-repo SigLevel = Optional TrustAll
-
Update the package database:
sudo pacman -Sy
-
Install the custom kernel (after compiling it on the server), for example:
sudo pacman -S linux611-tkg-pds sudo pacman -S linux611-tkg-pds-headers
The build_kernel.sh
script contains several variables you can customize:
TKG_KERNEL_DIR
: Path to the TKG kernel directory.REPO_DIR
: Path to the repository directory.REPO_NAME
: Name of the repository.KERNEL_TYPE
: Choose between "stable" or "mainline".- Various kernel configuration options (e.g.,
CPUSCHED
,PROCESSOR_OPT
).
Edit these variables according to your preferences before running the script.
The script will automatically run daily at 3 AM (as configured in the cron job). It will:
- Check for a new kernel version.
- If a new version is available, download the latest TKG patches.
- Compile the kernel with your specified options.
- Move the compiled kernel package to the repository.
- Update the repository database.
On your client PC, you can update to the latest kernel by running:
sudo pacman -Syu
- Keep your server and client systems up to date.
- Periodically review and update the kernel configuration options as needed.
- If the kernel fails to compile, check the build logs in the TKG kernel directory.
- If the client can't access the repository, ensure Nginx is running and the firewall allows connections.