NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/57498: Raspberry PI zero 2 w support lacking + rpi support for camera



>Number:         57498
>Category:       kern
>Synopsis:       Raspberry PI zero 2 w support lacking + rpi support for camera
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 03 17:10:00 +0000 2023
>Originator:     Dave Tyson <dtyson%anduin.org.uk@localhost>
>Release:        NetBSD 10.99.4
>Organization:
anduin
>Environment:
	
	
System: NetBSD 10.99.4 (GENERIC) #0: Sun Jul  2 23:51:01 BST 2023
 root%cruncher.anduin.org.uk@localhost:/usr/obj/arm7/sys/arch/evbarm/compile/GENERIC
Architecture: earmv7hf
Machine: evbarm
>Description:
There is no native dtb for the Raspberry Pi Zero 2 w provided in current/NetBSD 10. Users have to copy the dtb used by the Raspberry Pi 3. In addition the rpi02w needs later firmware files then exist in current/NetBSD 10. The firmware files shipped with NetBSD do not include the start*x.elf and fixup*x.dat varients needed to rpi camera. 	
>How-To-Repeat:
Build an armv7 image and burn it to an sdcard. Insert into an rpi02w and note the image does not boot. Add a dtb entry and update the firmware files. Note it now boots but there is no wifi.	
>Fix:

Download:
https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/bcm2837-rpi-zero-2-w.dts
https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/bcm283x-rpi-wifi-bt.dtsi
https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/bcm283x-rpi-led-deprecated.dtsi
saving files into
/usr/src/sys/external/gpl2/dts/dist/arch/arm/boot/dts

Hook to build bcm2837-rpi-zero-2-w.dtb:

--- sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile.orig	2021-11-07 16:50:04.000000000 +0000
+++ sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile	2023-06-01 22:22:06.584198168 +0100
@@ -90,6 +90,7 @@
 	bcm2837-rpi-3-b.dtb \
 	bcm2837-rpi-3-b-plus.dtb \
 	bcm2837-rpi-cm3-io3.dtb \
+	bcm2837-rpi-zero-2-w.dtb \
 	bcm2711-rpi-400.dtb \
 	bcm2711-rpi-4-b.dtb \
 	bcm2835-rpi-zero.dtb \


Update the boot firmware pulling in the *_x.* files needed if you want to use the rpi camera

Download:
https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat
https://github.com/raspberrypi/firmware/blob/master/boot/fixup_cd.dat
https://github.com/raspberrypi/firmware/blob/master/boot/fixup_x.dat
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4.dat
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4x.dat
https://github.com/raspberrypi/firmware/blob/master/boot/fixup4cd.dat
https://github.com/raspberrypi/firmware/blob/master/boot/start.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start_cd.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start_x.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start4.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start4x.elf
https://github.com/raspberrypi/firmware/blob/master/boot/start4cd.elf
saving files into
/usr/src/external/broadcom/rpi-firmware/dist

Hook the extra *_x.* files into the firmware release lists

--- distrib/utils/embedded/conf/rpi.conf.orig	2022-11-19 09:19:27.000000000 +0000
+++ distrib/utils/embedded/conf/rpi.conf	2023-06-02 21:20:00.122564028 +0100
@@ -10,7 +10,7 @@
 . ${DIR}/conf/evbarm.conf
 
 firmwaredir=$src/external/broadcom/rpi-firmware/dist
-firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
+firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat fixup_x.dat start.elf start_cd.elf start_x.elf"
 
 make_fstab() {
 	make_fstab_evbarm

--- distrib/utils/embedded/conf/rpi_inst.conf.orig	2022-11-19 09:19:27.000000000 +0000
+++ distrib/utils/embedded/conf/rpi_inst.conf	2023-06-02 21:20:19.826723347 +0100
@@ -32,7 +32,7 @@
 }
 
 firmwaredir=$src/external/broadcom/rpi-firmware/dist
-firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
+firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat fixup_x.dat start.elf start_cd.elf start_x.elf"
 
 populate() {
 	cat > ${mnt}/boot/cmdline.txt << EOF


--- distrib/utils/embedded/conf/armv7.conf.orig	2023-04-19 19:39:18.000000000 +0100
+++ distrib/utils/embedded/conf/armv7.conf	2023-06-02 22:38:05.851366635 +0100
@@ -50,7 +50,7 @@
 
 populate_rpi() {
 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
-	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
+	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat fixup_x.dat start.elf start_cd.elf start_x.elf"
 
 	# The GENERIC .img kernel img is used for RPI2
 	if [ -f "${mnt}/boot/netbsd-GENERIC.img" ]; then


--- distrib/utils/embedded/conf/arm64.conf.orig	2022-10-15 19:32:30.000000000 +0100
+++ distrib/utils/embedded/conf/arm64.conf	2023-06-02 21:22:20.128754451 +0100
@@ -59,7 +59,7 @@
 
 populate_rpi() {
 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
-	firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup_cd.dat fixup.dat start4cd.elf start4.elf start_cd.elf start.elf"
+	firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup4x.dat fixup_cd.dat fixup.dat fixup_x.dat start4cd.elf start4.elf start4x.elf start_cd.elf start.elf start_x.elf"
 
 	cat > "${mnt}/boot/cmdline.txt" << EOF
 root=NAME=${gpt_label_ffs} console=${console}


--- distrib/utils/embedded/conf/arm64mbr.conf.orig	2021-07-01 18:31:21.000000000 +0100
+++ distrib/utils/embedded/conf/arm64mbr.conf	2023-06-02 21:23:43.386056160 +0100
@@ -44,7 +44,7 @@
 
 populate_rpi() {
 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
-	firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup_cd.dat fixup.dat start4cd.elf start4.elf start_cd.elf start.elf"
+	firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup4x.dat fixup_cd.dat fixup.dat fixup_x.dat start4cd.elf start4.elf start4x.elf start_cd.elf start.elf start_x.elf"
 
 	cat > "${mnt}/boot/cmdline.txt" << EOF
 root=ld0a console=${console}


finally run make update-sets in /usr/src/sys/dtb to update the dtb lists


With this fix the correct dtb for the rpi02w is build and installed togther with the Broadcom firmware needed to boot. The firmware for all the rpi models now includes the 'x' varient needed to use the rpi camera.

Note although the wifi is detected for the rpi02w, it fails to load the correct firmware and so doesn't yet work. The device needs the brcmfmac43436 firmware and some mods to the brfm device driver to correctly identify the chip on the board. Testing has shown that loading that firmware does enable the wifi to work, but it is falky under heavy load. I will submit another pr once I have investigated the problem fully.

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index