You can use objcopy to embed a resource, and then into regular file operations to create a file in / tmp.
If you compile this program:
#include <stdio.h> extern char _binary_resource_bin_start, _binary_resource_bin_end; int main() { FILE*out = fopen("/tmp/rsrc.bin","wb"); fwrite(&_binary_resource_bin_start, &_binary_resource_bin_end - &_binary_resource_bin_start, 1, out); fclose(out); }
with this make file:
program: program.o resource.o $(CC) -o program program.o resource.o resource.o: resource.bin objcopy -I binary -O elf32-i386 -B i386 resource.bin resource.o resource.bin: echo resource-file-contents > resource.bin
I believe that you will get what you want.
source share