Asking advices for customizing a RockyLinux based ISO with specific version of kernel

Hi,

I’m trying to make a RockyLinux based ISO which will install specific version of kernel, say 5.4 LTS, automatically. I have figured out a way to to this, see next section. But I still have questions:

  1. Is it a good idea to replace the kernel related rpms in BaseOS, so the installation will install specific version of kernel by default?
  2. Are there any other methods to to this?

My way to do this

  1. Download kernel 5.4 from elrepo.org, and put them in a directory ./localrepo.
  2. Make a repo with createrepo against ./localrepo directory.

Following is the resulting repo:

tmp/rocky8/
❯ tree localrepo
localrepo
├── Packages
│   ├── kernel-lt-5.4.179-1.el8.elrepo.x86_64.rpm
│   ├── kernel-lt-core-5.4.179-1.el8.elrepo.x86_64.rpm
│   └── kernel-lt-modules-5.4.179-1.el8.elrepo.x86_64.rpm
└── repodata
    ├── 5078e86eea6133a97495be8f38ac37fb057509fb3cb2c15d602c0acce22388f0-other.xml.gz
    ├── 52a88a26b19f84b7691d8beeb1d94fbfe983769d69ab9a86f4bec0d4f852dba0-primary.sqlite.bz2
    ├── c8082299e8d8093dbdbc7d31ce79ecd7b7aecd2ed5908f35795b8f2c6d42e632-filelists.sqlite.bz2
    ├── ceb4660fa015d54844913e066e130633f36e82386d5ba4e679d89856bb5a7954-other.sqlite.bz2
    ├── dc209f17d2b7d751f25b937e47d5ed5b576949780652ea756ccf1d27a9123d99-filelists.xml.gz
    ├── f0ae38968a117cf251220a4aa97a4e4ace55c221deb966ce639a8683e41732fe-primary.xml.gz
    └── repomd.xml

2 directories, 10 files
  1. Extract Rocky Linux 8.5 ISO to ./iso
  2. Copy the localrepo I just created to ./iso/localrepo/
  3. Add a kickstart file in ./isolinux/custom.ks:
#version=RHEL8
graphical
cdrom

repo --name="local" --baseurl=file:///run/install/sources/mount-0000-cdrom/localrepo

%packages
@^custom-environment
@standard
kexec-tools
kernel-lt
%end

keyboard --xlayouts='us'
lang en_US.UTF-8

network --hostname=localhost.localdomain

firstboot --enable

ignoredisk --only-use=sda
bootloader --append="crashkernel=auto" --location=mbr --boot-drive=sda
clearpart --all
part / --fstype="xfs" --ondisk=sda --size=39935
part /boot --fstype="xfs" --ondisk=sda --size=1024

timezone America/New_York --isUtc

rootpw --plaintext rocky

The kernel-lt package is kernel 5.4 LTS version.

  1. Add an entry to isolinux.cfg:
label custom_linux
  menu label ^Install Customize Rocky Linux 8
  kernel vmlinuz
  append inst.ks=hd:LABEL=Rocky-8-5-x86_64-dvd:/isolinux/custom.ks initrd=initrd.img inst.stage2=hd:LABEL=Rocky-8-5-x86_64-dvd quiet
  1. Create ISO using genisoimage and implantisomd5

The custom_linux entry in isolinux will install kernel (from BaseOS) and kernel-lt (from localrepo) both. After installation, the grub has three entries: