Skip to content

RHEL 9 on the Honeycomb LX2

Robert Brown edited this page Dec 24, 2023 · 20 revisions

Compiling the Red Hat Enterprise Linux 9 Kernel for the Honeycomb LX2 Board

This page provides a walkthrough of how to modify a default RHEL9 kernel to operate on the Honeycomb LX2 motherboard.

This is currently not building successfully with kernel-5.14.0-284.18.1.el9_2.src.rpm, due to this issue. I have not created a standalone patch for it at this point. The last version that I have been successfully able to compile from source with no additional bespoke patches was 5.14.0-70.30.1.

General Kernel Compilation Process

The following is the still somewhat manual process I'm using to compile the kernel. This can likely be automated and optimized, but I'm not familiar enough with the RPM packaging process to get there. If you have ideas on how to improve, please reach out.

  • Visit RedHat Package Browser
    • In the "Product Variant" dropdown, select "Red Hat Enterprise Linux for ARM64", version 9
    • Click the 'packages' tab, search for kernel-headers, download the latest RPM
    • Then search for kernel, download the latest SRPM
  • rpm -Uvh kernel-headers-VERSION.el9_2.aarch64.rpm
  • rpm -Uvh kernel-VERSION.el9_2.src.rpm
  • dnf install rpm-build
  • cd $HOME/rpmbuild/SPECS
  • dnf builddep kernel.spec
  • rpmbuild -bb --with baseonly --without debuginfo kernel.spec
    • Wait until kernel build begins, then hit CTRL-C - usually after 60 seconds or so. The reason I do this is so I can obtain the .config file from the RHEL build.
    • This is a hack - I'm not sure how to derive the .config from the SRPM as the build process seems to perform some operations on it.
  • cd $HOME/rpmbuild/BUILD/kernel-VERSION.el9_2/linux-VERSION.el9.aarch64
  • cp .config .config_orig
  • make oldconfig
  • make menuconfig

The following kernel options were required to be enabled on a default RHEL 9 kernel for full hardware support. Tested with 5.14.0-70.26.1. Note that other options are necessary (CONFIG_PHYLINK and CONFIG_PHYLIB for two examples) but in the case of RHEL they were enabled by default.

Here is both the 'make menuconfig' path to the options as well as what actually is turned on in the config file. The letter in parenthesis below (e) is the hotkey to use in the visual menu to jump right to that config item. IE in the Device Drivers menu, hit "B" to jump right to "Bus Devices". The order of enabling options below is important, some later options only become available after the earlier config items in this list are enabled.

  • Platform Selection -> ARMv8 based Freescale Layerscape SoC family -> enable
    • Enables ARCH_LAYERSCAPE
  • Device Drivers -> Bus Devices (b) -> QorIQ DPAA2 fsl-mc bus driver (q) -> enable (NOTE: Enabled by default on 5.14.0-162.6.1 and later)
    • Enables CONFIG_FSL_MC_BUS
  • Device Drivers -> Bus Devices (b) -> Management Complex (MC) userspace support -> enable (appears after the option above is enabled)
    • Enables CONFIG_FSL_MC_UAPI_SUPPORT
  • Device Drivers -> SOC (System On Chip) Specific Drivers -> NXP/Freescale QorIQ SoC drivers -> QorIQ DPAA2 DPIO driver -> enable
    • Enables CONFIG_FSL_MC_DPIO
  • Device Drivers -> Network device support (e) -> Ethernet driver support (e) -> Freescale DPAA2 Ethernet -> enable
    • Enables CONFIG_FSL_DPAA2_ETH
  • Device Drivers -> Network device support (e) -> PHY Device support and infrastructure (p) -> SFP cage support -> enable
    • Enables SFP
  • Device Drivers -> EDAC (Error Detection And Correction) reporting (e) -> Freescale Layerscape DDR -> enable
    • Enables CONFIG_EDAC_LAYERSCAPE
  • Device Drivers -> IOMMU Hardware Support (i) -> Default to disabling bypass on ARM SMMU v1 and v2 -> enable
    • Enables CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
  • Cryptographic API (c) -> Hardware crypto devices (a) -> QorIQ DPAA2 CAAM (DPSECI) driver (q) -> enable
    • Enables CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM

Not entirely sure yet about the EDAC option, that did not appear to enable EDAC support on the board.

  • Exit/save after enabling the options from the top of this page.
  • Run through the following commands, which uncomment the architecture line, kills the version strings, adds a ".honeycomb" to the package and kernel names to avoid conflicts with the base RHEL packages, and adds a few additional config options that were not saved upon exit from the menuconfig.
sed '1 i # arm64' -i .config
sed '/^CONFIG_CC_VERSION_TEXT/d' -i .config
sed '/^CONFIG_GCC_VERSION/d' -i .config
sed '/^CONFIG_AS_VERSION/d' -i .config
sed '/^CONFIG_LD_VERSION/d' -i .config
cp .config ~/rpmbuild/SOURCES/kernel-aarch64-rhel.config
sed 's/# define buildid .local/%define buildid .honeycomb/g' -i ~/rpmbuild/SPECS/kernel.spec
cat <<EOF > ~/rpmbuild/SOURCES/kernel-local
# CONFIG_RELR is not set
# CONFIG_INIT_STACK_ALL_PATTERN is not set
# CONFIG_INIT_STACK_ALL_ZERO is not set
EOF

cd $HOME/rpmbuild/SPECS
rpmbuild -bb --define '_with_verbose 1' --with baseonly --without debuginfo kernel.spec

This should drop you a set of kernel packages in $HOME/rpmbuild/RPMS. Install the normal way and off you go. One note - don't use "rpm -u" to upgrade the packages or it will remove your currently running kernel. If the new kernel didn't build for some reason you won't have a fallback. Instead, I use "rpm -i" to install the packages in addition to the running kernel. After reboot you can remove the old packages if you wish to do so.

rpm -i kernel-5.14.0-70.26.1.honeycomb.el9.aarch64.rpm kernel-core-5.14.0-70.26.1.honeycomb.el9.aarch64.rpm kernel-headers-5.14.0-70.26.1.honeycomb.el9.aarch64.rpm kernel-modules-5.14.0-70.26.1.honeycomb.el9.aarch64.rpm
grubby --default-kernel

Finally, I usually save a dmesg output and compare the old/new kernels to make sure nothing was missed. Before rebooting just hit 'dmesg > $HOME/kernel-old.txt' and you can compare against a dmesg from your newly running kernel after rebooting.