- /*
- * Map the file and make the mapped buffer writable.
- * NOTE: Using writable=TRUE does _NOT_ mean that file that is mapped
- * will be modified. It will not be modified until someone uses
- * g_file_set_contents() on it.
- */
- error = NULL;
- file = g_mapped_file_new(filename, TRUE, &error);
- g_assert_no_error(error);
-
- file_size = g_mapped_file_get_length(file);
- firmware = g_mapped_file_get_contents(file);
- g_assert(firmware);
+ firmware = sr_resource_load(ctx, SR_RESOURCE_FIRMWARE,
+ name, &file_size, 256 * 1024);
+ if (!firmware)
+ return SR_ERR;