Commands for reading, loading and unloading drivers on BeagleBone Black? - beagleboneblack

I am using a BeagleBone Black with Xenomai and RTnet on top. As some real-time programs are not working it could be that the installed drivers on my BeagleBone Black are still the standard drivers and not the real-time drivers.
As I did not find anything on internet (only how to install drivers for Windows when using BeagleBone Black) I would like to ask you if anybody knows a command for BeagleBone Black to read, load and unload installed drivers on BBB?

I have found the commands for read, load and unload driver/modules. See the following output of the command window: the commands are lsmod for reading, insmod for loading and rmmod for unloading.
# lsmod
Module Size Used by Tainted: G
rtipv4 18699 0
rtpacket 4179 0
rt_ticpsw 26115 0
rt_davinci_mdio 4570 0
rt_smsc 2165 0
rtnet 28479 3 rtipv4,rtpacket,rt_ticpsw
omap_rng 4174 0
# insmod
BusyBox v1.22.1 (2019-03-16 12:39:06 CET) multi-call binary.
Usage: insmod FILE [SYMBOL=VALUE]...
Load the specified kernel modules into the kernel
# rmmod
BusyBox v1.22.1 (2019-03-16 12:39:06 CET) multi-call binary.
Usage: rmmod [-wfa] [MODULE]...
Unload kernel modules
-w Wait until the module is no longer used
-f Force unload
-a Remove all unused modules (recursively)
#

Related

Error installing Nvidia Drivers Fedora 35 Kernel 5.16.15

Spent three days trying to install nvidia graphic card drivers in Fedora 35 running on kernel 5.16. I was installing from the download .run file which threw error 'MIGRATE_PFN_LOCKED' undeclared in /var/lib/dkms/nvidia/495.46/build/make.log
I tried installing without enabling dkms but still couldn't install the drivers
systemctl set-default multi-user.target
then
systemctl reboot
as root user. On logging in, change directory to where you download .run installer for your Nvidia graphic card and run below
sh ./NVIDIA-Linux-x86_64-XXX.XX.run --extract-only
Above extract the installer file which will give us ability to edit the driver source code. Use your favorite editor to open the file uvm_migrate_pageable.c which is located in your extracted driver folder as below:
kernel/nvidia-uvm/uvm_migrate_pageable.c
My favorite editor is vim, so in my case, I will open it for editing as below:-
vim /NVIDIA-Linux-x86_64-XXX.XX/kernel/nvidia-uvm/uvm_migrate_pageable.c
Add below lines on declaration part of the source file or before where it is referenced in this c source file.
#ifndef MIGRATE_PFN_LOCKED
#define MIGRATE_PFN_LOCKED 0
#endif
save the file and now run your driver as below while inside the folder we extracted:
./nvidia-installer
Installation process should now complete without any errors and you can now revert to your X windowing system by running the command:
systemctl set-default desktop.target
References:
https://bbs.archlinux.org/viewtopic.php?id=271400
https://github.com/torvalds/linux/commit/ab09243aa95a72bac5c71e852773de34116f8d0f
Issue: The NVIDIA team do not yet have support for kernel 5.16.15 for the time being.
Solution: Patch the current installer yourself by running below, note that you must have x disabled probably by logging into your fedora via text mode which can be achieved by running the command

perf: Couldn't synthesize bpf events

I am trying to get perf tool running in one of our linux setups, which don't/can't have linux sources.
So, I downloaded the linux code in another machine and compiled perf (cd tools/perf; make).
I copied the perf binary to my target machine.
However, while starting to record, it says "couldn't synthesize bpf events".
root> perf record -a -g --call-graph dwarf -p 836
Warning:
PID/TID switch overriding SYSTEM
Couldn't synthesize bpf events.
[ perf record: Woken up 1 times to write data ]
Failed to read max cpus, using default of 4096
[ perf record: Captured and wrote 0.057 MB perf.data ]
Linux version running in our target machine: 5.4.66-rt38-intel-pk-preempt-rt
Code I used to compile perf: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git/log/?h=v5.4-rt
Because I get this 'couldn't synthesize bpf events', I think I am not getting the user-space stack in the perf report.
What should I do to get rid of this error to fetch the user-space stack of a running process using perf? Advice please!
CONFIG_BPF_SYSCALL was not enabled in kernel config.
After enabling it, I can see that 'couldn't synthesize bpf' was gone.
Marking it as answered.

Trying to port application to docker nanoserver container. Running exe fails with exit code -1073741515 (Dependency missing)

I'm currently trying to port my image optimizer application to a NanoServer docker image. One of the tools my image optimizer uses is truepng.exe. (Can be downloaded here: http://x128.ho.ua/clicks/clicks.php?uri=TruePNG_0625.zip)
I simply created a nanoserver container and mounted a folder that contained truepng.exe:
docker run --rm -it -v C:\data:C:\data mcr.microsoft.com/windows/nanoserver:2004-amd64
When I now run truepng.exe I expect some output regarding command line arguments missing:
C:\MyLocalWindowsMachine>truepng
TruePNG 0.6.2.5 : PNG Optimizer
by x128 (2010-2017)
x128#ua.fm
...
However when I call this from inside the nanoserver docker container I basically see no output:
C:\data>truepng
C:\data>echo %ERRORLEVEL%
-1073741515
As you can see above, the exit code is set to -1073741515. According to this it typically means that there's a dependency missing.
I then downloaded https://github.com/lucasg/Dependencies to see the dependencies of truepng:
It seems it has some dependencies on 5 DLL's. Looking these up I found that there's apparently something called 'Reverse Forwarders': https://cloudblogs.microsoft.com/windowsserver/2015/11/16/moving-to-nano-server-the-new-deployment-option-in-windows-server-2016/
According to the following post though they should already be included in nanoserver: https://social.technet.microsoft.com/Forums/en-US/5b36a6d3-84c9-4940-8b7a-9e2a38468291/reverse-forwarders-package-in-tp5?forum=NanoServer
After all this investigation I've also been playing around with manually copying over the DLL's from my local machine (system32) to the docker machine without any success (it just kept breaking other things like the copy command which required me to recreate the container). Next to that I've also copied the files from SysWOW64, but this didn't help either.
I'm currently quite stranded on how to proceed further as I'm not even sure if the tool is missing dependencies or if something else is going on. Is there a way to investigate what DLL's are missing once a tool is starting?
Kind regards,
Devedse
Edit 1: Idea from #CherryDT
I tried running gflags (https://social.msdn.microsoft.com/Forums/en-US/f004a7e5-9024-4555-9ada-e692fbc3160d/how-to-start-quotloader-snapsquot?forum=vcgeneral) which gave the following output:
C:\data>"C:\data\gflags.exe" /i TruePNG.exe +sls
Current Registry Settings for TruePNG.exe executable are: 00000000
After this I tried running Dbgview.exe, this however never resulted in a log file being written:
C:\data>"C:\data\DebugView\Dbgview.exe" /v /l debugview-log.txt /g /n
C:\data>
I also started TruePNG.exe again, but again, no log file was written.
I tried querying the EventLogs using a dotnet core application, but this resulted in the following exception:
Unhandled exception. System.InvalidOperationException: Cannot open log Application on computer '.'. This function is not supported on this system.
at System.Diagnostics.EventLogInternal.OpenForRead(String currentMachineName)
at System.Diagnostics.EventLogInternal.GetEntryAtNoThrow(Int32 index)
at System.Diagnostics.EventLogEntryCollection.GetEntryAtNoThrow(Int32 index)
at System.Diagnostics.EventLogEntryCollection.EntriesEnumerator.MoveNext()
at EventLogReaderTest.ConsoleApp.Program.Main(String[] args) in C:\data\EventLogReaderTest.ConsoleApp\Program.cs:line 22
Windows Nano Server is tiny and only supports 64-bit applications, tools, and agents. The missing dependency in this case is the entire x86 emulation layer (WoW64), as TruePNG is a 32-bit application.
Windows Server Core contains WoW64 and other components missing from Nano Server. Use a Windows Server Core image instead.
Example command:
docker run --rm -it -v C:\Temp:C:\Temp mcr.microsoft.com/windows/servercore:2004 C:\Temp\TruePNG.exe
Yields the expected output:
TruePNG 0.6.2.5 : PNG Optimizer
by x128 (2010-2017)
x128#ua.fm
TruePNG {options} files
options:
/f# PNG delta filters 0=None, 1=Sub, 2=Up, 3=Average, 4=Paeth, 5=Mixed
/fe PNG extra filters, overrides /f switch
/i# PNG interlace method 0=None, 1=Adam7 (default input)
/g# PNG gamma 0=Remove, 1=Apply & Remove, 2=Keep (default)
[...]

opencv - unable to capture frame from camera on raspberry pi

My pi camera is connected and enabled, raspistill takes photos successfully. In python, cv2.VideoCapture(-1).read() always returns (False, None). I'm stumped.
OpenCV relies on the V4L2 (Video for Linux) module, so try adding the following line at the bottom of the file /etc/modules and rebooting your Raspberry Pi.
bcm2835-v4l2
Mine now looks like this in toto:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
bcm2835-v4l2
This ensures that the Broadcom Video For Linux 2 (v4l2) driver is loaded at all subsequent reboots.

Where is my /etc/sysctl.conf file? Postgresql Fatal could not create shared memory segment

My goal is to install and fully setup Postgresql by following railscast video.
P.S I am on a Mountain Lion 10.8
$ brew install postgresql
seems okay.
$ initdb /usr/local/var/postgres
ok's ok's then...
FATAL: could not create shared memory segment: Cannot allocate memory
DETAIL: Failed system call was shmget(key=1, size=2072576, 03600).
HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter. You can either reduce the request size or reconfigure the kernel with larger SHMALL. To reduce the request size (currently 2072576 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
So like a good young SO grasshopper I start googling. and come to This SO post:
PostgreSQL installation error -- Cannot allocate memory
the suggested answer in this post lead me to this answer:http://willbryant.net/software/mac_os_x/postgres_initdb_fatal_shared_memory_error_on_leopard
$ sudo sysctl -w kern.sysv.shmall=65536
Password:
kern.sysv.shmall: 1024 -> 65536
$ sudo sysctl -w kern.sysv.shmmax=16777216
kern.sysv.shmmax: 4194304 -> 16777216
looks like everything worked so far, but in order to protect my changes from reboot, I need to update my /etc/sysctl.conf file. The problem is that I can't find it!
how do I locate this file? From my peanut sized understanding of computers, there is no filepath that exists, and if it did what is before the /etc ?? it certainly is not on my desktop. all I get is no such file exists, but I don't know how to find this file.
Embarrassing. I was trying to CD into my file. just do $ cd /etc

Resources