I am working on a Linux device driver for a piece of hardware that relies on some configuration specific to each implementation. On the first boot-up, we require a user-space application to generate this configuration data through a calibration process. Naturally, I would store this configuration data in a file and read this file when the driver is loaded or the hardware is configured. Reading from a file from inside kernel-space, however, is highly discouraged.
All user-space/kernel-space interaction should occur through the sysfs interface. This confuses me a little bit for two reasons:
- The sysfs file-system is virtual, so every time the kernel is booted, the user (or user-space application) would have to write the configuration data to the sysfs filesystem for the kernel to use it.
- The driver probe function is run long before a user-space application would have the the ability to write to sysfs.
Are my assumptions about sysfs correct? How would I be able to get this configuration data to the kernel without having to rely on a user-space application to write it to sysfs?