I'd like to write a statement to dmesg. [How] can I do this?
%logger -p kern.crit MESSAGE
(courtesy Ian, freebsd-questions mailing list)
su root -c 'echo MESSAGE > /dev/kmsg'
Assuming nobody else comes up with an official way to do this ...
You can write a kernel module that calls the
printk function. There's an example here that might just do the job for you.
If I understood man dmesg correctly, you should be able to write to /proc/kmsg.