Use BOOTDIR and BOOTFILE defines instead of hardcoded path and file. FS#9559

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19190 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2008-11-23 22:07:48 +00:00
parent 078753395d
commit b69be10d98
5 changed files with 12 additions and 9 deletions

View file

@ -29,6 +29,7 @@
#include "common.h"
#include "power.h"
#include "kernel.h"
#include "config.h"
/* TODO: Other bootloaders need to be adjusted to set this variable to true
on a button press - currently only the ipod, H10 and Sansa versions do. */
@ -141,7 +142,7 @@ int load_firmware(unsigned char* buf, char* firmware, int buffer_size)
int i;
char filename[MAX_PATH];
snprintf(filename,sizeof(filename),"/.rockbox/%s",firmware);
snprintf(filename,sizeof(filename), BOOTDIR "/%s",firmware);
fd = open(filename, O_RDONLY);
if(fd < 0)
{

View file

@ -266,8 +266,8 @@ static void handle_untar(void)
{
printf("Found rockbox binary. Moving...");
close(fd);
remove("/.rockbox/rockbox.gigabeat");
int ret = rename(buf, "/.rockbox/rockbox.gigabeat");
remove( BOOTDIR "/" BOOTFILE);
int ret = rename(buf, BOOTDIR "/" BOOTFILE);
printf("returned %d", ret);
sleep(HZ);
break;
@ -299,7 +299,7 @@ static void handle_untar(void)
/* Try to load the firmware and run it */
static void __attribute__((noreturn)) handle_firmware_load(void)
{
int rc = load_firmware(load_buf, "/.rockbox/rockbox.gigabeat",
int rc = load_firmware(load_buf, BOOTFILE,
load_buf_size);
if(rc < 0)

View file

@ -216,7 +216,7 @@ void main(void)
if (i < EOK) {
printf("Error!");
printf("Can't load rockbox.iaudio:");
printf("Can't load " BOOTFILE ": ");
printf(strerror(rc));
sleep(HZ*3);
power_off();

View file

@ -348,7 +348,7 @@ void* main(void)
rc=load_firmware(loadbuffer, BOOTFILE, MAX_LOADSIZE);
if (rc < EOK) {
printf("Error!");
printf("Can't load rockbox.ipod:");
printf("Can't load " BOOTFILE ": ");
printf(strerror(rc));
} else {
printf("Rockbox loaded.");

View file

@ -23,6 +23,8 @@
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "cpu.h"
#include "file.h"
@ -292,7 +294,7 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size)
unsigned long sum;
char filename[MAX_PATH];
snprintf(filename,sizeof(filename),"/.rockbox/%s",firmware);
snprintf(filename,sizeof(filename), BOOTDIR "/%s",firmware);
fd = open(filename, O_RDONLY);
if(fd < 0)
{
@ -610,14 +612,14 @@ void* main(void)
printf("Loading Rockbox...");
rc=load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
if (rc < EOK) {
printf("Can't load %s:", BOOTFILE);
printf("Can't load " BOOTFILE ": ");
printf(strerror(rc));
#ifdef OLD_BOOTFILE
/* Try loading rockbox from old rockbox.e200/rockbox.h10 format */
rc=load_firmware(loadbuffer, OLD_BOOTFILE, MAX_LOADSIZE);
if (rc < EOK) {
printf("Can't load %s:", OLD_BOOTFILE);
printf("Can't load " OLD_BOOTFILE" : ");
error(EBOOTFILE, rc);
}
#endif