You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a working card image, works with my v4l app, camera works fine.
I made a network booting image of the same files, boots ok its just now it hard locks loading the module. Modprobe of other modules is ok.
Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
I can switch between booting form the sd card or the LAN, sdcard always works, LAN boot always locks if I try and load the module.
Even tried copying the modules to a tempfs mount point and using "modprobe -d", still locks up.
Testing with a 3B+ booting from SD card but with an NFS root partition I see no problems - it just works.
Are you booting:
a) with no SD card, TFTP for bootcode.bin and start.elf, NFS root,
b) bootcode.bin on SD card, then TFTP boot for start.elf and NFS root, or
c) firmware and kernel on SD card, root on NFS drive?
With #2335 I did have it failing on a 2 or 3B with only bootcode.bin on the SD card and talking to PiServer.
I couldn't determine a reason for it stalling NFS, but not having called bcm_host_init resulted in the VCHI calls during bcm2835-v4l2 probe to have nasty side-effects. I'll see if I can fire up my PiServer install again and reproduce.
Updated my PiServer from 4.9.xx to 4.14.34 (latest from apt).
Reproducable on a 3B IFF you have the camera plugged in. Without the camera it checks the number of cameras detected (0) and aborts. Most odd as both bits use the same MMAL framework.
Board is a Pi 3B+, yes with the camera attached. The idea is to have NFS booted cameras, I have purchases 10 camera modules so it would be great if this could be sorted. I assure the issue is real and can provide unexciting video if needs be.
Thanks, Jon.
pelwell's just confirmed that he had no camera attached, so that sort of confirms my earlier debug.
I have seen a little mismatch in resource allocation/free, but don't see how that would cause these issues. It's odd as there isn't anything fundamentally different between SD card and network booting.
I've currently broken my kernel build of the V4L2 driver totally so that it won't load, therefore need to fix that first :-(
It's odd as there isn't anything fundamentally different between SD card and network booting.
I am not a kernel hacker for linux but I do write embedded firmware, for my 2c worth I suspect it is either an assumption about ISR order or frequency.
I did an rpi-update, now running
Linux raspberrypi 4.14.37-v7+ #1111 SMP Thu Apr 26 13:56:59 BST 2018 armv7l GNU/Linux
This is much the same, except it returns the prompt before crashing after "modprobe bcm2835-v4l2" . PS this new kernel/firmware version is slightly less reliable NFS booting than before. Sometimes stops on the IP details summary and fails to continue..... odd ...
18 days zero comments. Am I correct that the issue is within the Broadcom binary b******ks (tm)? I am assuming this is not an issue I can investigate ?
Sorry, busy on other issues/tasks. It got an initial triage and is now in the queue to investigate.
Am I correct that the issue is within the Broadcom binary b******ks (tm)? I am assuming this is not an issue I can investigate ?
Incorrect as noted in #2335 (comment)
Anything calling bcm_host_init before the bcm2835-v4l2 module is loaded appears to resolve the issue. Source for bcm_host_init is in the normal place for userland code if you wished to investigate exactly which bit is making the module happy.
if you wished to investigate exactly which bit is making the module happy
Ok, I will have a look, what is the best place to browse the source of the specific RPI shipped version of the "bcm2835-v4l2" module ?
I don't know how the vc code interacts with the kernel code.
I note that bcm_host_init() is protected from multiple init calls "if (initted) return;" so a hack (rather than a true fix) would be to arrange it that the module called bcm_host_init() before it started 'real work' and see if that improves it. I need to read up on getting enough of a build environment to modify the module.....
"You're on a network booted system so need to update the files that your TFTP server is handing out."
Yes, I know :-)
I login to the NFS booted Pi via ssh - as default it is read only
I issue # mount -o remount rw /
Check it
root@raspberrypicamera:~# ls >x
root@raspberrypicamera:~# rm x
Yep, it is read/write ok.
My NFS root has a "/boot" this is the same contents as the firmware directory the Pi booted from
(on the NFS server itself)
root@mail:/disks/vol1/tftpboot/rpi_cctv/boot# cp -av ../../25bcbfa6/* .
Now rpi-update can see a normal read/write "/" and a true representation of "/boot" - in the past I simply ran rpi-update at this point and all was good, then copied the firmware back into the serial number directory.
"Go to https://github.com/Hexxeh/rpi-firmware, download the start*.elf files and fixup.* files, and put them in the directory that your TFTP server is using"
Thanks, I will give that a go.... in case the overlays have changed I will try replacing all files with a new one and copying back config.txt and cmdline.txt as I think those are the only user settings ?
One thing to be aware of is that this won't update the bootcode.bin downloaded by the bootrom, which doesn't support the serial number subdirectories,
Sorry, I don't understand. Isn't the bootcode.bin the same binary however it is loaded by the Pi... what does not support the serial number subdirectories?, you have lost me at this point.
When the boot ROM downloads bootcode.bin from the TFTP server (as a 3B+ can when booting with no SD card) it only looks for bootcode.bin, not <serial>/bootcode.bin, despite the fact that bootcode.bin itself will then search for <serial>/start.elf etc. This isn't a problem because the same image will run on all models and will be backwards compatible, but it may catch you out if you thought you were updating it when actually you were just overwriting <serial>/bootcode.bin.
PS I uploaded the camera client/server code to github for safe keeping, bit rough at the moment, but works ok. It looks static on the video but is updating 14 frames a second.
My next job is top try and figure out how to write my date/time stamp over the camera frame then have the Pi jpeg encode the result. At the moment I use v4l to read the frame as YUV, convert to RGB, overlay the text then jpeg encode and send the image to the server.
My next job is top try and figure out how to write my date/time stamp over the camera frame then have the Pi jpeg encode the result. At the moment I use v4l to read the frame as YUV, convert to RGB, overlay the text then jpeg encode and send the image to the server.
Eek! Why do people hate YUV so much?
The camera can spit out RGB in a number of flavours (conversion done in vector code on the VPU), so no need to do the conversion in your app.
Hardware accelerated JPEG encode requires YUV, so it has to convert back from your RGB frame. Memory says there are some mechanisms for JPEG to contain RGB, but they are relatively uncommon.
It's a slight shame that you chose to use V4L2, as the camera subsystem can do basic annotations, as demonstrated in https://www.youtube.com/watch?v=WnnKrVSMbng. They're always top and centre at the moment as I haven't had the inclination to add the plumbing to move it around.
It's a slight shame that you chose to use V4L2, as the camera subsystem can do basic annotations
Nice demo video :-)
I have an RPI specific version of the camera code, that use v4l at the moment but can work in any way the Pi is happy with. It uses memory mapped I/O to read the state of the IR light level and to toggle the IRCUT filter on the camera module I am using, so it is non portable at that point:
What I really need from an API is just a way to scribble into the framebuffer between the camera capture and some form of hrdware Jpeg encode. Does any API exist for my to plug into the YUV buffer and still let the Pi hardware encode the jpeg. I did look for demos/code and did not come up with a great deal.
I could not find any good examples of encoding a camera jpeg on the Pi video engine for example, I only want one jpeg at a time as I need to decide to send it or drop it depending on network conditions. I am using TCP and cant afford for the buffer to bloat to the point it becomes non real-time.
As for RGB24 rather than YUV, it's mostly because I can work with RGB in my head hence that is what most of my code references, I can probably work with YUV but only with several google pages open ;-)
It has been so long since I looked at this, I was wrong, the generic V4l code uses YUV if opening the device for RGB fails OR (and it is an important or) the size of the RGB image is wrong. Seems V4l has a fault on some cameras, claims it opens in RGB but does not, in that case the code 'falls back' to YUV and adds a conversion to RGB.
The code overlaying the text is RGB though and the Jpeg encode is via libjpeg rather than the v4l API.
See lines 672+
Video of configuration tool, changes server settings and also passes settings to any connected cameras. https://youtu.be/8yGgJwwZ700
Activity
jonshouse1 commentedon Apr 23, 2018
Just tried upgrading
Still freezes machine, Keyboard unresponsive, does not ping etc etc...
jonshouse1 commentedon Apr 23, 2018
Did an rpi-update, still same, tried a couple of different PSU for good luck as well
6by9 commentedon Apr 24, 2018
This looks like a duplicate of #2335 (ignore the title).
pelwell commentedon Apr 24, 2018
Testing with a 3B+ booting from SD card but with an NFS root partition I see no problems - it just works.
Are you booting:
a) with no SD card, TFTP for bootcode.bin and start.elf, NFS root,
b) bootcode.bin on SD card, then TFTP boot for start.elf and NFS root, or
c) firmware and kernel on SD card, root on NFS drive?
pelwell commentedon Apr 24, 2018
Now tested with a fully network-booted 3B+ - again, no problems.
6by9 commentedon Apr 24, 2018
With #2335 I did have it failing on a 2 or 3B with only bootcode.bin on the SD card and talking to PiServer.
I couldn't determine a reason for it stalling NFS, but not having called bcm_host_init resulted in the VCHI calls during bcm2835-v4l2 probe to have nasty side-effects. I'll see if I can fire up my PiServer install again and reproduce.
6by9 commentedon Apr 24, 2018
Updated my PiServer from 4.9.xx to 4.14.34 (latest from apt).
Reproducable on a 3B IFF you have the camera plugged in. Without the camera it checks the number of cameras detected (0) and aborts. Most odd as both bits use the same MMAL framework.
jonshouse1 commentedon Apr 24, 2018
No SD card.
I have firmware in a directory with the name of the Pi serial number "25bcbfa6"
root@mail:/disks/vol1/tftpboot/25bcbfa6# md5sum * e3ab88859237eeb7f8deb8ef9f9af2bd bcm2708-rpi-0-w.dtb 3501aebf7f08798dfa44f38422b30550 bcm2708-rpi-b.dtb 8154d0a768147413019fa98c18ac9398 bcm2708-rpi-b-plus.dtb b07a7eccd032e98e5ee866c02f415f84 bcm2708-rpi-cm.dtb 4c73875b9db6a1e55824e3b3f005406f bcm2709-rpi-2-b.dtb a81f9a6a9bbc7b83209512021c9c248b bcm2710-rpi-3-b.dtb c2e9f69eff3551644a600721eed4ea07 bcm2710-rpi-3-b-plus.dtb 5d0680a605e98ba5ff7e3716ecab27d0 bcm2710-rpi-cm3.dtb 17efaf1c1ef89289168d71cdc8194982 bootcode.bin 935439b96482e274890752e0a4c16946 cmdline.OLD 0875c9770bb841b69915a74a82e4eb3d cmdline.txt e3f0a57ceef109eb13d94df7f8b95132 config.txt d7810fab7487fb0aad327b76f1be7cd7 COPYING.linux 253315e7f9ca4b64dbe69a62f2456c50 fixup_cd.dat da5a8b0ad03be4dc6deaad85eca8e52d fixup.dat 59775794d283ab35d83532fc8fdefe46 fixup_db.dat c1b836cccef2a337f8e236154c5d15eb fixup_x.dat bdc6492254aec36a53f90506a22ba6a9 issue.txt 2926f6994558d63e70d6f3999a082a90 kernel7.img d092c0f9628577f8970adbf7eecc49c1 kernel.img 4a4d169737c0786fb9482bb6d30401d1 LICENCE.broadcom bcd91fdfffb0cf7518016189fca363ee LICENSE.oracle md5sum: overlays: Is a directory e203c4d048030f412acbf7034dc4886a start_cd.elf c8c3486368d8be92ffe1673eccc68911 start_db.elf 8a8e2c3cf9b6ce177e50f748eb91e816 start.elf 9fc019c14638acd381f9027317cc855a start_x.elfRoot file system is then via NFS.
Board is a Pi 3B+, yes with the camera attached. The idea is to have NFS booted cameras, I have purchases 10 camera modules so it would be great if this could be sorted. I assure the issue is real and can provide unexciting video if needs be.
Thanks, Jon.
6by9 commentedon Apr 24, 2018
pelwell's just confirmed that he had no camera attached, so that sort of confirms my earlier debug.
I have seen a little mismatch in resource allocation/free, but don't see how that would cause these issues. It's odd as there isn't anything fundamentally different between SD card and network booting.
I've currently broken my kernel build of the V4L2 driver totally so that it won't load, therefore need to fix that first :-(
pelwell commentedon Apr 24, 2018
I can also confirm that it wedges with a camera attached.
With some VCHIQ logging enabled at the same I see the following kernel logging:
Note the (presumably fatal) dwc_otg messages, and the subsequent NFS death.
jonshouse1 commentedon Apr 24, 2018
jonshouse1 commentedon Apr 28, 2018
Any update on this ?
I did an rpi-update, now running
Linux raspberrypi 4.14.37-v7+ #1111 SMP Thu Apr 26 13:56:59 BST 2018 armv7l GNU/Linux
This is much the same, except it returns the prompt before crashing after "modprobe bcm2835-v4l2" . PS this new kernel/firmware version is slightly less reliable NFS booting than before. Sometimes stops on the IP details summary and fails to continue..... odd ...
Thanks,
Jon
jonshouse1 commentedon May 11, 2018
18 days zero comments. Am I correct that the issue is within the Broadcom binary b******ks (tm)? I am assuming this is not an issue I can investigate ?
6by9 commentedon May 11, 2018
Sorry, busy on other issues/tasks. It got an initial triage and is now in the queue to investigate.
Incorrect as noted in #2335 (comment)
Anything calling bcm_host_init before the bcm2835-v4l2 module is loaded appears to resolve the issue. Source for bcm_host_init is in the normal place for userland code if you wished to investigate exactly which bit is making the module happy.
jonshouse1 commentedon May 11, 2018
Ok, I will have a look, what is the best place to browse the source of the specific RPI shipped version of the "bcm2835-v4l2" module ?
I don't know how the vc code interacts with the kernel code.
I note that bcm_host_init() is protected from multiple init calls "if (initted) return;" so a hack (rather than a true fix) would be to arrange it that the module called bcm_host_init() before it started 'real work' and see if that improves it. I need to read up on getting enough of a build environment to modify the module.....
16 remaining items
jonshouse1 commentedon Jun 27, 2018
"You're on a network booted system so need to update the files that your TFTP server is handing out."
Yes, I know :-)
I login to the NFS booted Pi via ssh - as default it is read only
I issue
# mount -o remount rw /Check it
Yep, it is read/write ok.
My NFS root has a "/boot" this is the same contents as the firmware directory the Pi booted from
(on the NFS server itself)
root@mail:/disks/vol1/tftpboot/rpi_cctv/boot# cp -av ../../25bcbfa6/* .
Now rpi-update can see a normal read/write "/" and a true representation of "/boot" - in the past I simply ran rpi-update at this point and all was good, then copied the firmware back into the serial number directory.
jonshouse1 commentedon Jun 27, 2018
pelwell commentedon Jun 27, 2018
One thing to be aware of is that this won't update the bootcode.bin downloaded by the bootrom, which doesn't support the serial number subdirectories,
jonshouse1 commentedon Jun 27, 2018
Sorry, I don't understand. Isn't the bootcode.bin the same binary however it is loaded by the Pi... what does not support the serial number subdirectories?, you have lost me at this point.
pelwell commentedon Jun 27, 2018
When the boot ROM downloads bootcode.bin from the TFTP server (as a 3B+ can when booting with no SD card) it only looks for
bootcode.bin, not<serial>/bootcode.bin, despite the fact that bootcode.bin itself will then search for<serial>/start.elfetc. This isn't a problem because the same image will run on all models and will be backwards compatible, but it may catch you out if you thought you were updating it when actually you were just overwriting<serial>/bootcode.bin.jonshouse1 commentedon Jun 27, 2018
"when actually you were just overwriting /bootcode.bin."
Great, I understand now, thanks :-)
Glad you mentioned that, I was looking at the ftfboot directory just now thinking I must delete some of these stray files....
jonshouse1 commentedon Jun 27, 2018
Yay ...
Thanks :-)
jonshouse1 commentedon Jun 27, 2018
PS I uploaded the camera client/server code to github for safe keeping, bit rough at the moment, but works ok. It looks static on the video but is updating 14 frames a second.
My next job is top try and figure out how to write my date/time stamp over the camera frame then have the Pi jpeg encode the result. At the moment I use v4l to read the frame as YUV, convert to RGB, overlay the text then jpeg encode and send the image to the server.
Linux desktop viewer.
https://www.youtube.com/watch?v=ilA25ho_u-k&feature=youtu.be
The code, server, client and desktop apps.
https://github.com/jonshouse1/jcamsys
6by9 commentedon Jun 27, 2018
Eek! Why do people hate YUV so much?
The camera can spit out RGB in a number of flavours (conversion done in vector code on the VPU), so no need to do the conversion in your app.
Hardware accelerated JPEG encode requires YUV, so it has to convert back from your RGB frame. Memory says there are some mechanisms for JPEG to contain RGB, but they are relatively uncommon.
It's a slight shame that you chose to use V4L2, as the camera subsystem can do basic annotations, as demonstrated in https://www.youtube.com/watch?v=WnnKrVSMbng. They're always top and centre at the moment as I haven't had the inclination to add the plumbing to move it around.
jonshouse1 commentedon Jun 27, 2018
Nice demo video :-)
I have an RPI specific version of the camera code, that use v4l at the moment but can work in any way the Pi is happy with. It uses memory mapped I/O to read the state of the IR light level and to toggle the IRCUT filter on the camera module I am using, so it is non portable at that point:
https://github.com/jonshouse1/jcamsys/tree/master/jcamsys_camera_rpi/jcamsys_camera_rpi_v0.4
What I really need from an API is just a way to scribble into the framebuffer between the camera capture and some form of hrdware Jpeg encode. Does any API exist for my to plug into the YUV buffer and still let the Pi hardware encode the jpeg. I did look for demos/code and did not come up with a great deal.
I could not find any good examples of encoding a camera jpeg on the Pi video engine for example, I only want one jpeg at a time as I need to decide to send it or drop it depending on network conditions. I am using TCP and cant afford for the buffer to bloat to the point it becomes non real-time.
As for RGB24 rather than YUV, it's mostly because I can work with RGB in my head hence that is what most of my code references, I can probably work with YUV but only with several google pages open ;-)
jonshouse1 commentedon Jun 27, 2018
It has been so long since I looked at this, I was wrong, the generic V4l code uses YUV if opening the device for RGB fails OR (and it is an important or) the size of the RGB image is wrong. Seems V4l has a fault on some cameras, claims it opens in RGB but does not, in that case the code 'falls back' to YUV and adds a conversion to RGB.
The code overlaying the text is RGB though and the Jpeg encode is via libjpeg rather than the v4l API.
See lines 672+
Video of configuration tool, changes server settings and also passes settings to any connected cameras.
https://youtu.be/8yGgJwwZ700
cosmetic, hide error output of stat in preinst and postinst files and…
JamesH65 commentedon Jul 31, 2019
Closing this issue as questions answered/issue resolved.