From 4b8ea97fa99bbb5f9111cf55fb870380a4e22725 Mon Sep 17 00:00:00 2001 From: neofright Date: Thu, 3 Sep 2026 22:54:54 +0100 Subject: [PATCH] Support ROCKBOX_DIR in HibyOS hosted bootloader Currently if you want to compile a bootloader like so: $ ../tools/configure --rbdir=/.rockbox.aigoerosq --target=aigoerosq --type=b This won't work because the bootloader is hard coded to look for the rockbox Linux binary in /.rockbox/rockbox.erosq regardless of what is specified by '--rbdir'. This commit adds support for ROCKBOX_DIR in the hosted HibyOS bootloaders. After compiling, they can be installed with adb via (for example): adb push build/bootloader.erosq /usr/bin/bootloader.erosq Change-Id: Ic4ceb75107f608beacfd497998a11a5874e87ac1 --- bootloader/hibyos_linux.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bootloader/hibyos_linux.c b/bootloader/hibyos_linux.c index d05259536e..f42070d001 100644 --- a/bootloader/hibyos_linux.c +++ b/bootloader/hibyos_linux.c @@ -36,6 +36,7 @@ #include "lcd.h" #include "font.h" #include "power.h" +#include "rbpaths.h" #include #include #include @@ -143,11 +144,6 @@ #endif #define BASE_DIR PIVOT_ROOT -//#ifdef FIIO_M3K_LINUX -//#define BASE_DIR "/mnt" -//#else -//#define BASE_DIR "/mnt/sd_0" -//#endif /* images */ #include "bitmaps/rockboxicon.h" @@ -258,7 +254,7 @@ static void mount_storage(int enable) static enum boot_mode load_boot_mode(enum boot_mode mode) { mount_storage(true); - int fd = open(BASE_DIR "/.rockbox/rb_bl_mode.txt", O_RDONLY); + int fd = open(BASE_DIR ROCKBOX_DIR "/rb_bl_mode.txt", O_RDONLY); if(fd >= 0) { read(fd, &mode, sizeof(mode)); @@ -270,7 +266,7 @@ static enum boot_mode load_boot_mode(enum boot_mode mode) static void save_boot_mode(enum boot_mode mode) { mount_storage(true); - int fd = open(BASE_DIR "/.rockbox/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC); + int fd = open(BASE_DIR ROCKBOX_DIR "/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC); if(fd >= 0) { write(fd, &mode, sizeof(mode)); @@ -720,14 +716,14 @@ int main(int argc, char **argv) #endif fflush(stdout); mount_storage(true); - system("/bin/cp " BASE_DIR "/.rockbox/" BOOTFILE " /tmp"); + system("/bin/cp " BASE_DIR ROCKBOX_DIR "/" BOOTFILE " /tmp"); system("/bin/chmod +x /tmp/" BOOTFILE); #ifdef HIBY_R1 /* Load libasound from Rockbox directory */ char *argvr1[] = { "/tmp/" BOOTFILE, 0 }; char *envpr1[] = { - "LD_LIBRARY_PATH=/data/mnt/sd_0/.rockbox", + "LD_LIBRARY_PATH=" BASE_DIR "/" ROCKBOX_DIR, 0 }; execve(argvr1[0], &argvr1[0], envpr1);