ROCK Pi X - Custom/tuned Linux kernel

Additional patch (rolled up from Andi Kleen):
https://www.cen64.com/uploads/rockpix/lto-5.8.patch

Kernel is now compiled with FLTO (full link time optimization) which reduces kernel size when compressed by ~2.75%. Biggest benefits of this are more efficient code execution due to compiler optimizations that are performed by GCC though.

Anyways, new kernel is posted. Hope you enjoy.

I will briefly look into compiling kernel with -Os instead of -O2 next.

1 Like

Updated to latest release, no problems so far

1 Like

Added links for Linux 5.8.11.

1 Like

Is it possible to include the USB Type-C drivers? Or are they not necessary?

Could you also add FUSE?

USB C doesn’t need driver, the PD/QC protocol is managed by an IC.

But is it possible to retrieve information from the IC? Could it act like a regular USB-C port in the case that I’m using battery power?

I added USB-C software support just in case, but without any PD protocol support.
FUSE also added.

Debs are republished with same names.

The PD/QC protocol IC doesn’t talk to the processor. It only talks to the power adapter.

Didn’t workout for me with a fresh install of Ubuntu 20.04, error on the last command.

could you advise on the removal command.

dpkg --remove …?

Thank you.
Looking forward to it being compatible.

Updated to Linux 5.8.17.

Patches rebased against new kernel:

1 Like

Are you gonna be updating the patches for 5.9?

No. It’s too much work to rebase for every series, and nothing about 5.9 is particularly earth-shattering for the Rock Pi X’s components/Silvermont.

ZSTD compression?

can this kernel support GPIOs and SPI port? where is the .config file?

.config is in the deb, just run ar -x blahblah.deb and then tar -xf data.tar.xz.

Try it, I enabled everything that made sense for this board.

cat boot/config-5.8.17 | grep 'GPIO\|SPI' | grep -v '^#'
CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_REGMAP_SPI=m
CONFIG_KEYBOARD_GPIO=m
CONFIG_SERIAL_MCTRL_GPIO=m
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_PXA2XX=m
CONFIG_SPI_PXA2XX_PCI=m
CONFIG_SPI_DYNAMIC=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_GPIO_ACPI=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_SYSFS=y
CONFIG_SND_SPI=y
CONFIG_SND_SOC_I2C_AND_SPI=m
CONFIG_RTC_I2C_AND_SPI=y
CONFIG_INTEL_INT0002_VGPIO=m
1 Like

So perhaps maybe for 5.10?

Also it seems you didn’t update the patches, as I keep getting failed builds during the patch phase…

The patches in my build tree match what are posted. It must be a problem with your build process as these apply cleanly to the 5.8.17 sources.

build-host $ md5sum *.patch
3b507ca4337a078e01542143de2ddae8  brcmfmac-5.8.patch
de39747f4146bdec5ff461784c79cd58  lto-5.8.patch
2ec0ded441d2ed15357e8bbd36af25b8  mtune-silvermont.patch
me@test:~/sandbox/linux-5.8.17$ patch -Np1 -i ~/Downloads/brcmfmac-5.8.patch 
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
me@test:~/sandbox/linux-5.8.17$ patch -Np1 -i ~/Downloads/lto-5.8.patch 
patching file Documentation/kbuild/lto-build.rst
patching file Makefile
Hunk #3 succeeded at 949 (offset -4 lines).
Hunk #4 succeeded at 1130 (offset -4 lines).
Hunk #5 succeeded at 1772 (offset -4 lines).
patching file arch/x86/Kconfig
patching file arch/x86/kernel/alternative.c
patching file arch/x86/purgatory/Makefile
patching file arch/x86/realmode/Makefile
patching file drivers/firmware/efi/libstub/Makefile
Hunk #1 succeeded at 56 (offset -1 lines).
Hunk #2 succeeded at 123 (offset -1 lines).
patching file drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
patching file drivers/media/platform/sti/delta/delta-ipc.c
patching file drivers/misc/lkdtm/Makefile
patching file drivers/xen/time.c
patching file include/asm-generic/export.h
patching file include/asm-generic/vmlinux.lds.h
Hunk #1 succeeded at 439 (offset 2 lines).
patching file include/linux/compiler_attributes.h
patching file include/linux/export.h
patching file include/linux/init.h
patching file include/linux/linkage.h
patching file init/Kconfig
patching file kernel/Makefile
patching file kernel/bpf/core.c
patching file kernel/locking/spinlock.c
patching file scripts/Makefile
patching file scripts/Makefile.build
patching file scripts/Makefile.crc
patching file scripts/Makefile.lib
patching file scripts/Makefile.lto
patching file scripts/Makefile.modfinal
patching file scripts/elf_file_offset
patching file scripts/gcc-ld
patching file scripts/genksyms/genksyms.c
patching file scripts/genksyms/genksyms.h
patching file scripts/genksyms/parse.y
patching file scripts/kallsyms.c
Hunk #4 succeeded at 145 with fuzz 2 (offset 10 lines).
Hunk #5 succeeded at 173 (offset 14 lines).
Hunk #6 succeeded at 188 (offset 14 lines).
Hunk #7 succeeded at 411 (offset 14 lines).
Hunk #8 succeeded at 434 (offset 14 lines).
Hunk #9 succeeded at 478 (offset 14 lines).
Hunk #10 succeeded at 528 (offset 14 lines).
Hunk #11 succeeded at 565 (offset 14 lines).
Hunk #12 succeeded at 846 (offset 14 lines).
Hunk #13 succeeded at 859 (offset 14 lines).
Hunk #14 succeeded at 889 (offset 14 lines).
patching file scripts/link-vmlinux.sh
patching file scripts/mod/modpost.c
Hunk #1 succeeded at 1988 (offset 9 lines).
Hunk #2 succeeded at 2014 (offset 9 lines).
Hunk #3 succeeded at 2031 (offset 9 lines).
Hunk #4 succeeded at 2076 (offset 9 lines).
Hunk #5 succeeded at 2114 (offset 9 lines).
patching file scripts/patchfile.c

Found some cycles this weekend, decided to rebase everything onto 5.9(.8) this weekend and got it booted… doing some testing prior to releasing.

Andi Kleen may have stopped supporting the FLTO patches (as Clang LTO is supported instead for 5.10rc presumably?) and I don’t know how long I can keep them going as it’s very detailed kernel work.

There was a tricky little optimization that broke the LTO builds hopping from 5.8 to 5.9 that I had to figure out that would have ordinarily been a part of those patches.

1 Like

Kernel 5.9.8 binary and patches posted.

New patch set lto-tjs.patch is my patches on top of Andi Kleen’s LTO patches. It was needed because they now do pointer comparison for some optimization, and the LTO was reordering the functions during the link step that broke the pointer comparison optimization.