A method for generating a device driver is described comprising the steps of accepting (S1) a source file comprising at least two functional modules accepting (S2) configuration data indicating at least one module, creating (S3) a scaled source file by selecting one or more modules from the accepted source file indicated by the configuration data, compiling (S4) the scaled source file. In this way a significant reduction of memory usage is obtained in those cases where not the full functionality of the driver is required.