diff options
| author | Marcin Bukat <marcin.bukat@gmail.com> | 2012-03-02 16:29:42 +0100 |
|---|---|---|
| committer | Marcin Bukat <marcin.bukat@gmail.com> | 2012-03-04 00:34:26 +0100 |
| commit | 2f8b44aae2827a7280dc0a8e5b46a9f33e5eea60 (patch) | |
| tree | e14606096fa23091db5568d5312e2bda1ba176f3 /firmware/export | |
| parent | f35e300304388c30fdeb6493ec5e5e5bd52e3aab (diff) | |
| download | rockbox-2f8b44aae2827a7280dc0a8e5b46a9f33e5eea60.zip rockbox-2f8b44aae2827a7280dc0a8e5b46a9f33e5eea60.tar.gz rockbox-2f8b44aae2827a7280dc0a8e5b46a9f33e5eea60.tar.bz2 rockbox-2f8b44aae2827a7280dc0a8e5b46a9f33e5eea60.tar.xz | |
Add RKW firmware file format loader
Change-Id: I5283fdcdb8d263fd9375a6d29396f82650aeb686
Diffstat (limited to 'firmware/export')
| -rw-r--r-- | firmware/export/rkw.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/firmware/export/rkw.h b/firmware/export/rkw.h new file mode 100644 index 0000000..2101bd0 --- /dev/null +++ b/firmware/export/rkw.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2012 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 1 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include <stdint.h> + +#define RKLD_MAGIC 0x4c44524b +#define RKW_HEADER_CRC 0x40000000 +#define RKW_IMAGE_CRC 0x20000000 + +struct rkw_header_t { + uint32_t magic_number; /* Magic number. 0x4C44524B */ + uint32_t header_size; /* Size of the header */ + uint32_t image_base; /* Base address of the firmware image */ + uint32_t load_address; /* Load address */ + uint32_t load_limit; /* End of the firmware image */ + uint32_t bss_start; /* This is the start of .bss section of the firmware I suppose */ + uint32_t reserved0; /* reserved - I've seen only zeros in this field so far */ + uint32_t reserved1; /* reserved - I've seen only zeros in this field so far */ + uint32_t entry_point; /* Entry point address */ + uint32_t load_options; /* 0x80000000 - setup flag (I don't know what it means + * but is present in every RKW I saw), + * 0x40000000 - check header crc, + * 0x20000000 - check firmware crc + */ + uint32_t crc; /* crc32 of the header (excluding crc32 field itself) */ +}; + +const char *rkw_strerror(int8_t errno); +int load_rkw(unsigned char* buf, const char* filename, int buffer_size); |