On Tue, May 04, 2010 at 12:13:50PM +0300, Aggelos Economopoulos wrote: > Johannes Hofmann wrote: > > Matthew Dillon <dil...@apollo.backplane.com> wrote: > >> Well, the DFly kernel has some very easy-to-use file access functions > >> ala fp_open() and friends (see kern_checkpoint.c for a use case), so > >> accessing the firmware file directly is easy enough. > > > > I thought about writing a generic firmware module using the new > > FreeBSD API which reads firmware files from a certain directory > > using fp_open(). > > However, it seems that available firmware images need to be announced > > with firmware_register() to make them available, so I would need some > > sort of opendir() in kernel to scan the firmware directory and > > register the available files with firmware_register(). > > ... and also to monitor the directory for changes :) > > > Alternatively we could adjust subr_firmware.c to trigger a file read > > attempt in case the requested image has not yet been registered. > > Yah, in firmware_get(), it already handles the case where the module > containing the firmware isn't loaded yet. You can add the directory > search in loadimage() or better yet in a separate function (i.e. have > loadimage() call load_image_module() and load_image_blob()). This makes > much more sense IMO. >
I think this is a good idea with the one caveat that I don't fully understand the security implications of arbitrarily loading blobs into kernel memory. I was thinking of something along the lines of /etc/firmware.conf that maps a short name as used by the FreeBSD API to a filename in /etc/firmware. Johannes, feel free to implement this if you'd like. I am pretty busy with real life at the moment. Thanks, Joe