forked from len0rd/rockbox
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:
parent
078753395d
commit
b69be10d98
5 changed files with 12 additions and 9 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
/* TODO: Other bootloaders need to be adjusted to set this variable to true
|
/* 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. */
|
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;
|
int i;
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
|
|
||||||
snprintf(filename,sizeof(filename),"/.rockbox/%s",firmware);
|
snprintf(filename,sizeof(filename), BOOTDIR "/%s",firmware);
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -266,8 +266,8 @@ static void handle_untar(void)
|
||||||
{
|
{
|
||||||
printf("Found rockbox binary. Moving...");
|
printf("Found rockbox binary. Moving...");
|
||||||
close(fd);
|
close(fd);
|
||||||
remove("/.rockbox/rockbox.gigabeat");
|
remove( BOOTDIR "/" BOOTFILE);
|
||||||
int ret = rename(buf, "/.rockbox/rockbox.gigabeat");
|
int ret = rename(buf, BOOTDIR "/" BOOTFILE);
|
||||||
printf("returned %d", ret);
|
printf("returned %d", ret);
|
||||||
sleep(HZ);
|
sleep(HZ);
|
||||||
break;
|
break;
|
||||||
|
@ -299,7 +299,7 @@ static void handle_untar(void)
|
||||||
/* Try to load the firmware and run it */
|
/* Try to load the firmware and run it */
|
||||||
static void __attribute__((noreturn)) handle_firmware_load(void)
|
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);
|
load_buf_size);
|
||||||
|
|
||||||
if(rc < 0)
|
if(rc < 0)
|
||||||
|
|
|
@ -216,7 +216,7 @@ void main(void)
|
||||||
|
|
||||||
if (i < EOK) {
|
if (i < EOK) {
|
||||||
printf("Error!");
|
printf("Error!");
|
||||||
printf("Can't load rockbox.iaudio:");
|
printf("Can't load " BOOTFILE ": ");
|
||||||
printf(strerror(rc));
|
printf(strerror(rc));
|
||||||
sleep(HZ*3);
|
sleep(HZ*3);
|
||||||
power_off();
|
power_off();
|
||||||
|
|
|
@ -348,7 +348,7 @@ void* main(void)
|
||||||
rc=load_firmware(loadbuffer, BOOTFILE, MAX_LOADSIZE);
|
rc=load_firmware(loadbuffer, BOOTFILE, MAX_LOADSIZE);
|
||||||
if (rc < EOK) {
|
if (rc < EOK) {
|
||||||
printf("Error!");
|
printf("Error!");
|
||||||
printf("Can't load rockbox.ipod:");
|
printf("Can't load " BOOTFILE ": ");
|
||||||
printf(strerror(rc));
|
printf(strerror(rc));
|
||||||
} else {
|
} else {
|
||||||
printf("Rockbox loaded.");
|
printf("Rockbox loaded.");
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
@ -292,7 +294,7 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size)
|
||||||
unsigned long sum;
|
unsigned long sum;
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
|
|
||||||
snprintf(filename,sizeof(filename),"/.rockbox/%s",firmware);
|
snprintf(filename,sizeof(filename), BOOTDIR "/%s",firmware);
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
{
|
{
|
||||||
|
@ -610,14 +612,14 @@ void* main(void)
|
||||||
printf("Loading Rockbox...");
|
printf("Loading Rockbox...");
|
||||||
rc=load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
|
rc=load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
|
||||||
if (rc < EOK) {
|
if (rc < EOK) {
|
||||||
printf("Can't load %s:", BOOTFILE);
|
printf("Can't load " BOOTFILE ": ");
|
||||||
printf(strerror(rc));
|
printf(strerror(rc));
|
||||||
|
|
||||||
#ifdef OLD_BOOTFILE
|
#ifdef OLD_BOOTFILE
|
||||||
/* Try loading rockbox from old rockbox.e200/rockbox.h10 format */
|
/* Try loading rockbox from old rockbox.e200/rockbox.h10 format */
|
||||||
rc=load_firmware(loadbuffer, OLD_BOOTFILE, MAX_LOADSIZE);
|
rc=load_firmware(loadbuffer, OLD_BOOTFILE, MAX_LOADSIZE);
|
||||||
if (rc < EOK) {
|
if (rc < EOK) {
|
||||||
printf("Can't load %s:", OLD_BOOTFILE);
|
printf("Can't load " OLD_BOOTFILE" : ");
|
||||||
error(EBOOTFILE, rc);
|
error(EBOOTFILE, rc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue