Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5361

Beginners • How can I correctly compile the 32-bit system kernel for Raspberry Pi 5?

$
0
0
This is the official Raspberry Pi kernel compilation documentation:
https://www.raspberrypi.com/documentati ... ernel.html

I only found documentation on compiling the 64-bit system for Raspberry Pi 5 on the official Raspberry Pi kernel documentation. I made modifications to the device information of the st7735r driver module in drivers/gpu/drm/tiny/st7735r.c. Then, I used an SD card to flash the Raspberry Pi BookWorm system (version 12-5 64-bit) and successfully cross-compiled the BookWorm 64-bit system on Ubuntu. I compiled the 64-bit Raspberry Pi system kernel using the following command:

Code:

cd linuxKERNEL=kernel_2712sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2712_defconfigsudo make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbssudo mkdir mntsudo mkdir mnt/fat32sudo mkdir mnt/ext4sudo mount /dev/sdb1 mnt/fat32sudo mount /dev/sdb2 mnt/ext4sudo env PATH=$PATH make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/ext4 modules_installsudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.imgsudo cp arch/arm64/boot/Image mnt/fat32/$KERNEL.imgsudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/fat32/sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/fat32/overlays/sudo cp arch/arm64/boot/dts/overlays/README mnt/fat32/overlays/sudo umount mnt/fat32sudo umount mnt/ext4
After booting up the Raspberry Pi, I indeed found that some device information of the st7735r has been modified when using the "sudo modinfo st7735r" command.

Based on the successful compilation of the 64-bit kernel for RPI5 mentioned above, I would like to compile the 32-bit kernel for RPi5. However, I did not find the specific process for compiling the 32-bit system kernel for RPi5 in the official kernel documentation.

I naively thought that changing the

Code:

KERNEL=kernel_2712sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2712_defconfigsudo make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs
instruction to

Code:

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2712_defconfigsudo make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- Image modules dtbs
would allow me to compile successfully, but I failed.

So I tried the following method to see if I could successfully compile the 32-bit version of the system kernel for RPi5:
Note: I have already burned the 32-bit BookWorm system (version 12-5 32bit) onto a new SD card for RPi5.

Code:

cd linuxKERNEL=kernel7lsudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfigsudo make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbsmkdir mntmkdir mnt/fat32mkdir mnt/ext4sudo mount /dev/sdb1 mnt/fat32sudo mount /dev/sdb2 mnt/ext4sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.imgsudo cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img# Choose one of the following based on the kernel version  # For kernels up to 6.4:  sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/  # For kernel 6.5 and above:  sudo cp arch/arm/boot/dts/broadcom/*.dtb mnt/fat32/sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/sudo umount mnt/fat32sudo umount mnt/ext4
Then, I inserted the SD card into Raspberry Pi 5 and found that it booted up successfully and entered the system. However, when I used the “sudo modinfo st7735r” command, I noticed that the driver module information for st7735r is still the default one from the official version, not the modified one. Does this indicate that the compilation process for the 32-bit system mentioned earlier was incorrect? What should I do to correctly compile the kernel for the 32-bit system on Raspberry Pi 5?

Statistics: Posted by jieweizero — Sat Feb 24, 2024 3:40 am



Viewing all articles
Browse latest Browse all 5361

Trending Articles