Site Tools


Sidebar

software:fedora:raspi4_kernelcompile

Summary of my issues with self compiled kernels

  • Raspberry 4.19.* kernels, plain from Raspbian or recompiled: haven't seen issues
  • any 5.4 and 5.6 kernels from the Raspbian trees, or the 5.4 kernel from Raspbian repos: Can not run the raspi4 with power from the Thinkpad via usb3 (the raspi is not booting then). Its a known issue
  • recompiled Raspberry 5.6 kernels: temperature reading not possible: “cat: /sys/devices/virtual/thermal/thermal_zone0/temp: Invalid argument”

Recompiling the Raspbian kernel on Fedora

dnf -y install gcc flex make bison openssl-devel elfutils-libelf-devel ncurses-devel

cd /usr/src
wget https://github.com/raspberrypi/linux/archive/raspberrypi-kernel_1.20200212-1.tar.gz
tar zxf raspberrypi-kernel_1.20200212-1.tar.gz
ln -nfs linux-raspberrypi-kernel_1.20200212-1 linux

modprobe configs
zcat /proc/config.gz > /usr/src/linux/.config

cd /usr/src/linux
make oldconfig
# make menuconfig

make -j5 Image 
make -j5 modules 
make -j5 modules_install

# If you hit this error:
# modules_install/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x38): first defined here
# ..then execute this:
sed -i 's/^YYLTYPE yylloc;$/extern YYLTYPE yylloc;/'  /usr/src/linux/scripts/dtc/dtc-lexer.l

mv /boot/kernel8.img /boot/kernel8.img.org
cp -vrfp /usr/src/linux/arch/arm64/boot/Image /boot/kernel8.img
cp -vrfp /usr/src/linux/System.map /boot/System.map

reboot

Trying to run the Fedora kernel

I have no serial adapter connected, not even HDMI output active, so was just shooting in the dark here. This does not work for me.

echo 'kernel=vmlinuz-5.6.10-300.fc32.aarch64' >>/boot/config.txt

Compiling the Raspberry 5.4.y kernel on Fedora

# First, on a plain Rasbperry (not Fedora32), install the 5.4
# Raspberry kernel.  Along with that, firmware upgrades are done
BRANCH=master rpi-update

# Then create a tarfile of /lib/modules/* to capture the
# 5.4 kernel modules, and copy the tarfile to a remote system.
# The Fedora installation steps will create a new second partition,
# overwriting the modules.

# Then install Fedora, so you will come up with a deployed
# Fedora32 with 64bit kernel, 5.4.35-v8+
dnf -y install gcc flex make bison openssl-devel \
  elfutils-libelf-devel ncurses-devel

# I did not see tarballs, so cloning latest 5.4..
cd /usr/src
# git clone https://github.com/raspberrypi/linux/tree/rpi-5.4.y
wget https://github.com/raspberrypi/linux/archive/rpi-5.4.y.zip
unzip rpi-5.4.y.zip
ln -nfs rpi-5.4.y linux

modprobe configs
zcat /proc/config.gz > /usr/src/linux/.config

cd /usr/src/linux
make oldconfig
# make menuconfig
vi .config
# CONFIG_LOCALVERSION="-v8ch"

make -j5 Image 
make -j5 modules 
make -j5 modules_install
make dtbs

cp /boot/bcm2711-rpi-4-b.dtb /boot/bcm2711-rpi-4-b.dtb.org
cp arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb /boot/

cp -r /boot/overlays/ /boot/overlays.org
\cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
\cp arch/arm/boot/dts/overlays/README /boot/overlays/

cp arch/arm64/boot/Image /boot/kernel8ch.img
cp System.map /boot/System.map
echo 'kernel=kernel8ch.img' >>/boot/config.txt

reboot

Compiling the Raspberry 5.6.y kernel on Fedora

# First, install Fedora with the 5.4.y kernel as per above.

cd /usr/src
wget https://github.com/raspberrypi/linux/archive/rpi-5.6.y.zip
unzip rpi-5.6.y.zip
rm linux
ln -nfs rpi-5.6.y linux

modprobe configs
zcat /proc/config.gz > /usr/src/linux/.config

cd /usr/src/linux
make oldconfig
# make menuconfig
vi .config
# CONFIG_LOCALVERSION="-v8ch"

make -j5 Image 
make -j5 modules 
make -j5 modules_install
make dtbs

cp /boot/bcm2711-rpi-4-b.dtb /boot/bcm2711-rpi-4-b.dtb.org5.4
cp arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb /boot/

cp -r /boot/overlays/ /boot/overlays.org5.4
\cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
\cp arch/arm/boot/dts/overlays/README /boot/overlays/

cp arch/arm64/boot/Image /boot/kernel8-5.6ch.img
cp System.map /boot/System.map
vi /boot/config.txt
# 'kernel=kernel8-5.6ch.img'

reboot

Compiling the Fedora kernel

software/fedora/raspi4_kernelcompile.txt · Last modified: 2022/11/13 12:06 by 127.0.0.1