atjboottool: add missing copyright headers
[maemo-rb.git] / firmware / export / rkw-loader.h
blob2101bd03b7bc7ae18872207b8cc27cf4a5c8b406
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2012 Marcin Bukat
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 1
14 * of the License, or (at your option) any later version.
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
19 ****************************************************************************/
21 #include <stdint.h>
23 #define RKLD_MAGIC 0x4c44524b
24 #define RKW_HEADER_CRC 0x40000000
25 #define RKW_IMAGE_CRC 0x20000000
27 struct rkw_header_t {
28 uint32_t magic_number; /* Magic number. 0x4C44524B */
29 uint32_t header_size; /* Size of the header */
30 uint32_t image_base; /* Base address of the firmware image */
31 uint32_t load_address; /* Load address */
32 uint32_t load_limit; /* End of the firmware image */
33 uint32_t bss_start; /* This is the start of .bss section of the firmware I suppose */
34 uint32_t reserved0; /* reserved - I've seen only zeros in this field so far */
35 uint32_t reserved1; /* reserved - I've seen only zeros in this field so far */
36 uint32_t entry_point; /* Entry point address */
37 uint32_t load_options; /* 0x80000000 - setup flag (I don't know what it means
38 * but is present in every RKW I saw),
39 * 0x40000000 - check header crc,
40 * 0x20000000 - check firmware crc
42 uint32_t crc; /* crc32 of the header (excluding crc32 field itself) */
45 const char *rkw_strerror(int8_t errno);
46 int load_rkw(unsigned char* buf, const char* filename, int buffer_size);