diff options
author | William Wilgus <me.theuser@yahoo.com> | 2017-02-05 21:07:20 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-10-29 17:50:59 +0100 |
commit | 41869a6534400090ce61111aa79398513462b24f (patch) | |
tree | 08a69dfeaf7cb8cf9e64c903616240c43770df0c /firmware/export | |
parent | 60e5cd72766ace0d35f2cf7a3d4798d8c2e848bd (diff) | |
download | rockbox-41869a6534400090ce61111aa79398513462b24f.tar.gz rockbox-41869a6534400090ce61111aa79398513462b24f.zip |
Add boot data support to rockbox.
Bootdata is a special location in the Firmware marked by a magic header
The bootloader is able to copy information to the firmware by locating
this struct and passing data to the firmware when it is loaded but
before it is actually executed
Data is verified by a crc of the bootdata
Change-Id: Ib3d78cc0c3a9d47d6fe73be4747a11b7ad6f0a9e
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/bootdata.h | 84 | ||||
-rw-r--r-- | firmware/export/config/creativezen.h | 2 | ||||
-rw-r--r-- | firmware/export/config/creativezenxfi2.h | 2 | ||||
-rw-r--r-- | firmware/export/config/creativezenxfi3.h | 2 | ||||
-rw-r--r-- | firmware/export/config/samsungypz5.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sansafuzeplus.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sonynwze360.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sonynwze370.h | 2 |
8 files changed, 98 insertions, 0 deletions
diff --git a/firmware/export/bootdata.h b/firmware/export/bootdata.h new file mode 100644 index 0000000000..322d50c20d --- /dev/null +++ b/firmware/export/bootdata.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2017 by Amaury Pouly | ||
10 | * | ||
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 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #ifndef __RB_BOOTDATA__ | ||
21 | #define __RB_BOOTDATA__ | ||
22 | |||
23 | #ifndef __ASSEMBLER__ | ||
24 | #include <stdint.h> | ||
25 | #endif | ||
26 | |||
27 | /* /!\ This file can be included in assembly files /!\ */ | ||
28 | |||
29 | /** The boot data will be filled by the bootloader with information that might | ||
30 | * be relevant for Rockbox. The bootloader will search for the structure using | ||
31 | * the magic header within the first BOOT_DATA_SEARCH_SIZE bytes of the binary. | ||
32 | * Typically, this structure should be as close as possible to the entry point */ | ||
33 | |||
34 | /* Search size for the data structure after entry point */ | ||
35 | #define BOOT_DATA_SEARCH_SIZE 1024 | ||
36 | |||
37 | #define BOOT_DATA_MAGIC0 ('r' | 'b' << 8 | 'm' << 16 | 'a' << 24) | ||
38 | #define BOOT_DATA_MAGIC1 ('g' | 'i' << 8 | 'c' << 16 | '!' << 24) | ||
39 | |||
40 | /* maximum size of payload */ | ||
41 | #define BOOT_DATA_PAYLOAD_SIZE 4 | ||
42 | |||
43 | #ifndef __ASSEMBLER__ | ||
44 | /* This is the C structure */ | ||
45 | struct boot_data_t | ||
46 | { | ||
47 | union | ||
48 | { | ||
49 | uint32_t crc; /* crc of payload data (CRC32 with 0xffffffff for initial value) */ | ||
50 | uint32_t magic[2]; /* BOOT_DATA_MAGIC0/1 */ | ||
51 | }; | ||
52 | |||
53 | uint32_t length; /* length of the payload */ | ||
54 | |||
55 | /* add fields here */ | ||
56 | union | ||
57 | { | ||
58 | struct | ||
59 | { | ||
60 | uint8_t boot_volume; | ||
61 | }; | ||
62 | uint8_t payload[BOOT_DATA_PAYLOAD_SIZE]; | ||
63 | }; | ||
64 | } __attribute__((packed)); | ||
65 | |||
66 | #if !defined(BOOTLOADER) | ||
67 | extern struct boot_data_t boot_data; | ||
68 | #endif | ||
69 | #else /* __ASSEMBLER__ */ | ||
70 | |||
71 | /* This assembler macro implements an empty boot structure with just the magic | ||
72 | * string */ | ||
73 | .macro put_boot_data_here | ||
74 | .global boot_data | ||
75 | boot_data: | ||
76 | .word BOOT_DATA_MAGIC0 | ||
77 | .word BOOT_DATA_MAGIC1 | ||
78 | .word BOOT_DATA_PAYLOAD_SIZE | ||
79 | .space BOOT_DATA_PAYLOAD_SIZE, 0xff /* payload, initialised with value 0xff */ | ||
80 | .endm | ||
81 | |||
82 | #endif | ||
83 | |||
84 | #endif /* __RB_BOOTDATA__ */ | ||
diff --git a/firmware/export/config/creativezen.h b/firmware/export/config/creativezen.h index 3667142791..0033b7d4eb 100644 --- a/firmware/export/config/creativezen.h +++ b/firmware/export/config/creativezen.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 90 | 9 | #define MODEL_NUMBER 90 |
10 | #define MODEL_NAME "Creative Zen" | 10 | #define MODEL_NAME "Creative Zen" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||
diff --git a/firmware/export/config/creativezenxfi2.h b/firmware/export/config/creativezenxfi2.h index 5b275b1de8..3945311e29 100644 --- a/firmware/export/config/creativezenxfi2.h +++ b/firmware/export/config/creativezenxfi2.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 82 | 9 | #define MODEL_NUMBER 82 |
10 | #define MODEL_NAME "Creative Zen X-Fi2" | 10 | #define MODEL_NAME "Creative Zen X-Fi2" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||
diff --git a/firmware/export/config/creativezenxfi3.h b/firmware/export/config/creativezenxfi3.h index 0503035914..d72b41d608 100644 --- a/firmware/export/config/creativezenxfi3.h +++ b/firmware/export/config/creativezenxfi3.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 83 | 9 | #define MODEL_NUMBER 83 |
10 | #define MODEL_NAME "Creative Zen X-Fi3" | 10 | #define MODEL_NAME "Creative Zen X-Fi3" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||
diff --git a/firmware/export/config/samsungypz5.h b/firmware/export/config/samsungypz5.h index 08b607741c..882acc2a6c 100644 --- a/firmware/export/config/samsungypz5.h +++ b/firmware/export/config/samsungypz5.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 84 | 9 | #define MODEL_NUMBER 84 |
10 | #define MODEL_NAME "Samsung YP-Z5" | 10 | #define MODEL_NAME "Samsung YP-Z5" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||
diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h index 03d6c00b2e..af5235a6c3 100644 --- a/firmware/export/config/sansafuzeplus.h +++ b/firmware/export/config/sansafuzeplus.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 72 | 9 | #define MODEL_NUMBER 72 |
10 | #define MODEL_NAME "Sandisk Sansa Fuze+" | 10 | #define MODEL_NAME "Sandisk Sansa Fuze+" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||
diff --git a/firmware/export/config/sonynwze360.h b/firmware/export/config/sonynwze360.h index dc466ec797..a25e95d274 100644 --- a/firmware/export/config/sonynwze360.h +++ b/firmware/export/config/sonynwze360.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 89 | 9 | #define MODEL_NUMBER 89 |
10 | #define MODEL_NAME "Sony NWZ-E360 series" | 10 | #define MODEL_NAME "Sony NWZ-E360 series" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||
diff --git a/firmware/export/config/sonynwze370.h b/firmware/export/config/sonynwze370.h index 0f88d98b58..2ed87f2f1b 100644 --- a/firmware/export/config/sonynwze370.h +++ b/firmware/export/config/sonynwze370.h | |||
@@ -8,6 +8,8 @@ | |||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 88 | 9 | #define MODEL_NUMBER 88 |
10 | #define MODEL_NAME "Sony NWZ-E370/E380 series" | 10 | #define MODEL_NAME "Sony NWZ-E370/E380 series" |
11 | /* Define if boot data from bootloader has been enabled for the target */ | ||
12 | #define HAVE_BOOTDATA | ||
11 | 13 | ||
12 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL | 14 | #define HW_SAMPR_CAPS SAMPR_CAP_ALL |
13 | 15 | ||