Skip to content

Commit 57c61e9

Browse files
nbuchwitztimg236
authored andcommitted
Makefile: add platform-specific default mass-storage-gadget directory
Move the default mass-storage-gadget64 directory path from a hardcoded value in main.c to a build-time configurable variable in the Makefile. On Windows, this defaults to the standard installation path used by the Windows installer. On Unix systems, the behavior remains unchanged. This allows rpiboot to be invoked without the -d parameter on Windows. Fixes: #342 Signed-off-by: Nicolai Buchwitz <[email protected]>
1 parent 6d692c9 commit 57c61e9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ PKG_VER=$(shell if [ -f debian/changelog ]; then grep rpiboot debian/changelog |
33
GIT_VER=$(shell git rev-parse HEAD 2>/dev/null | cut -c1-8 || echo "")
44
HAVE_XXD=$(shell xxd -v >/dev/null 2>/dev/null && echo y)
55
INSTALL_PREFIX?=/usr
6+
ifeq ($(OS),Windows_NT)
7+
DEFAULT_MSG_DIR ?= "C:/Program Files (x86)/Raspberry Pi/mass-storage-gadget64/"
8+
else
9+
DEFAULT_MSG_DIR ?= $(INSTALL_PREFIX)/share/rpiboot/mass-storage-gadget64/
10+
endif
611

712
rpiboot: main.c bootfiles.c decode_duid.c msd/bootcode.h msd/start.h msd/bootcode4.h
8-
$(CC) -Wall -Wextra -g $(CPPFLAGS) $(CFLAGS) -o $@ main.c bootfiles.c decode_duid.c `pkg-config --cflags --libs libusb-1.0` -DGIT_VER="\"$(GIT_VER)\"" -DPKG_VER="\"$(PKG_VER)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\" $(LDFLAGS)
13+
$(CC) -Wall -Wextra -g $(CPPFLAGS) $(CFLAGS) -o $@ main.c bootfiles.c decode_duid.c `pkg-config --cflags --libs libusb-1.0` -DGIT_VER="\"$(GIT_VER)\"" -DPKG_VER="\"$(PKG_VER)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DDEFAULT_MSG_DIR=\"$(DEFAULT_MSG_DIR)\" $(LDFLAGS)
914

1015
ifeq ($(HAVE_XXD),y)
1116
%.h: %.bin

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ libusb_device_handle * LIBUSB_CALL open_device_with_vid(
296296
second_stage = "bootcode.bin";
297297

298298
if ((bcm2711 || bcm2712) && !directory) {
299-
directory = INSTALL_PREFIX "/share/rpiboot/mass-storage-gadget64/";
299+
directory = DEFAULT_MSG_DIR;
300300
use_bootfiles = 1;
301301
snprintf(bootfiles_path, sizeof(bootfiles_path),"%s%s", directory, "bootfiles.bin");
302302
printf("Directory not specified - trying default %s\n", directory);

0 commit comments

Comments
 (0)