diff --git a/Makefile b/Makefile index 6cd4d05..a365392 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,12 @@ -rpiboot: main.c +rpiboot: main.c msd/bootcode.h msd/start.h $(CC) -Wall -Wextra -g -o $@ $< -lusb-1.0 +%.h: %.bin + xxd -i $< > $@ + +%.h: %.elf + xxd -i $< > $@ + uninstall: rm -f /usr/bin/rpiboot rm -f /usr/share/rpiboot/usbbootcode.bin diff --git a/main.c b/main.c index aff2ac1..eed0e41 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,9 @@ #include +#include "msd/bootcode.h" +#include "msd/start.h" + int signed_boot = 0; int verbose = 0; int loop = 0; @@ -410,9 +413,11 @@ FILE * check_file(char * dir, char *fname) if(fp == NULL) { - strcpy(path, "/usr/share/rpiboot/msd/"); - strcat(path, fname); - fp = fopen(path, "rb"); + if(strcmp(fname, "bootcode.bin") == 0) + fp = fmemopen(msd_bootcode_bin, msd_bootcode_bin_len, "r"); + else + if(strcmp(fname, "start.elf") == 0) + fp = fmemopen(msd_start_elf, msd_start_elf_len, "r"); } return fp; @@ -563,10 +568,6 @@ int main(int argc, char *argv[]) #endif - // Default to standard msd directory - if(directory == NULL) - directory = "msd"; - second_stage = check_file(directory, "bootcode.bin"); if(second_stage == NULL) {