Rev 20 | Rev 26 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 20 | Rev 22 | ||
|---|---|---|---|
| Line 50... | Line 50... | ||
| 50 | #define STARTUP_HDR_FLAGS1_VIRTUAL (1 << 0) |
50 | #define STARTUP_HDR_FLAGS1_VIRTUAL (1 << 0) |
| 51 | #define STARTUP_HDR_FLAGS1_BIGENDIAN (1 << 1) |
51 | #define STARTUP_HDR_FLAGS1_BIGENDIAN (1 << 1) |
| 52 | //#define STARTUP_HDR_FLAGS1_COMPRESS_MASK 0x1c |
52 | //#define STARTUP_HDR_FLAGS1_COMPRESS_MASK 0x1c |
| 53 | //#define STARTUP_HDR_FLAGS1_COMPRESS_SHIFT 0x02 |
53 | //#define STARTUP_HDR_FLAGS1_COMPRESS_SHIFT 0x02 |
| 54 | //#define STARTUP_HDR_FLAGS1_COMPRESS_NONE 0x00 |
54 | //#define STARTUP_HDR_FLAGS1_COMPRESS_NONE 0x00 |
| 55 | //#define STARTUP_HDR_FLAGS1_COMPRESS_ZLIB 0x04 |
55 | //#define STARTUP_HDR_FLAGS1_COMPRESS_ZLIB 0x04 // TODO: add this compression scheme with libz |
| 56 | //#define STARTUP_HDR_FLAGS1_COMPRESS_LZO 0x08 |
56 | //#define STARTUP_HDR_FLAGS1_COMPRESS_LZO 0x08 // TODO: add this compression scheme with liblzo |
| 57 | //#define STARTUP_HDR_FLAGS1_COMPRESS_UCL 0x0c |
57 | //#define STARTUP_HDR_FLAGS1_COMPRESS_UCL 0x0c // TODO: add this compression scheme |
| 58 | #define STARTUP_HDR_FLAGS1_TRAILER_V2 (1 << 5) // if set, then a struct startup_trailer_v2 follows the startup. If the image is compressed, then the compressed imagefs is followed by a struct image_trailer_v2 |
58 | #define STARTUP_HDR_FLAGS1_TRAILER_V2 (1 << 5) // if set, then a struct startup_trailer_v2 follows the startup. If the image is compressed, then the compressed imagefs is followed by a struct image_trailer_v2 |
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | // bitmapped flags used in the flags member of the image header |
61 | // bitmapped flags used in the flags member of the image header |
| 62 | #define IMAGE_FLAGS_BIGENDIAN (1 << 0) // header, trailer, dirents in big-endian format |
62 | #define IMAGE_FLAGS_BIGENDIAN (1 << 0) // header, trailer, dirents in big-endian format |
| Line 65... | Line 65... | ||
| 65 | #define IMAGE_FLAGS_SORTED (1 << 3) // dirent section is sorted (by pathname) |
65 | #define IMAGE_FLAGS_SORTED (1 << 3) // dirent section is sorted (by pathname) |
| 66 | #define IMAGE_FLAGS_TRAILER_V2 (1 << 4) // image uses struct image_trailer_v2 |
66 | #define IMAGE_FLAGS_TRAILER_V2 (1 << 4) // image uses struct image_trailer_v2 |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | // bitmapped flags superposed to a filesystem entry's inode number |
69 | // bitmapped flags superposed to a filesystem entry's inode number |
| 70 | #define IFS_INO_PROCESSED_ELF |
70 | #define IFS_INO_PROCESSED_ELF (1 << 31) |
| 71 | #define IFS_INO_RUNONCE_ELF |
71 | #define IFS_INO_RUNONCE_ELF (1 << 30) |
| 72 | #define IFS_INO_BOOTSTRAP_EXE |
72 | #define IFS_INO_BOOTSTRAP_EXE (1 << 29) |
| 73 | 73 | ||
| 74 | 74 | ||
| 75 |
|
75 | // compiled boot script command types |
| 76 | #define |
76 | #define SCRIPTCMD_TYPE_EXTERNAL "\x00" |
| 77 | #define |
77 | #define SCRIPTCMD_TYPE_WAITFOR "\x01" |
| 78 | #define |
78 | #define SCRIPTCMD_TYPE_REOPEN "\x02" |
| 79 | #define |
79 | #define SCRIPTCMD_TYPE_DISPLAY_MSG "\x03" |
| 80 | #define |
80 | #define SCRIPTCMD_TYPE_PROCMGR_SYMLINK "\x04" |
| 81 | #define |
81 | #define SCRIPTCMD_TYPE_EXTSCHED_APS "\x05" |
| 82 | 82 | ||
| 83 | #define SCRIPT_POLICY_NOCHANGE 0 |
- | |
| 84 | #define SCRIPT_POLICY_FIFO 1 |
- | |
| 85 | #define SCRIPT_POLICY_RR 2 |
- | |
| 86 | #define SCRIPT_POLICY_OTHER 3 |
- | |
| 87 | 83 | ||
| - | 84 | // compiled boot script external command flags |
|
| 88 | #define |
85 | #define SCRIPTCMD_FLAG_EXTSCHED (1 << 0) |
| 89 | #define |
86 | #define SCRIPTCMD_FLAG_SESSION (1 << 1) |
| 90 | #define |
87 | #define SCRIPTCMD_FLAG_SCHED_SET (1 << 2) |
| 91 | #define |
88 | #define SCRIPTCMD_FLAG_CPU_SET (1 << 3) |
| - | 89 | #define SCRIPTCMD_FLAG_UNKNOWN1 (1 << 4) // ??? |
|
| 92 | #define |
90 | #define SCRIPTCMD_FLAG_BACKGROUND (1 << 5) |
| 93 | #define |
91 | #define SCRIPTCMD_FLAG_KDEBUG (1 << 6) |
| - | 92 | #define SCRIPTCMD_FLAG_UNKNOWN2 (1 << 7) // ??? |
|
| 94 | 93 | ||
| 95 | #define SCRIPT_CHECKS_MS 100 |
- | |
| 96 | 94 | ||
| 97 |
|
95 | // compiled boot script external command scheduling policies |
| 98 | #define |
96 | #define SCRIPTCMD_SCHEDULERPOLICY_FIFO 1 |
| 99 | - | ||
| 100 | #define |
97 | #define SCRIPTCMD_SCHEDULERPOLICY_RR 2 |
| 101 | #define SCRIPT_APS_SYSTEM_PARTITION_NAME "System" |
- | |
| 102 | #define SCRIPT_APS_PARTITION_NAME_LENGTH 15 |
- | |
| 103 | #define SCRIPT_APS_MAX_PARTITIONS 8 |
- | |
| 104 | - | ||
| 105 | - | ||
| 106 | START_OF_PACKED_STRUCT () // we need byte-alignment for this struct |
- | |
| 107 | typedef PACKED (struct) bootscriptcmd_header_s |
- | |
| 108 | { |
- | |
| 109 | uint16_t size; // size of cmd entry |
- | |
| 110 | uint8_t type; |
- | |
| 111 | uint8_t spare; |
- | |
| 112 | } bootscriptcmd_header_t; |
- | |
| 113 | END_OF_PACKED_STRUCT () // restore default alignment |
- | |
| 114 | - | ||
| 115 | - | ||
| 116 | START_OF_PACKED_STRUCT () // we need byte-alignment for this struct |
- | |
| 117 | typedef union bootscriptcmd_s |
- | |
| 118 | { |
- | |
| 119 | PACKED (struct) script_external |
- | |
| 120 | { |
- | |
| 121 | bootscriptcmd_header_t hdr; |
- | |
| 122 | uint8_t cpu; // CPU (turn into runmask) |
- | |
| 123 | uint8_t flags; |
- | |
| 124 | union script_external_extsched |
- | |
| 125 | { |
- | |
| 126 | uint8_t reserved[2]; |
- | |
| 127 | PACKED (struct) |
- | |
| 128 | { |
- | |
| 129 | uint8_t id; |
- | |
| 130 | uint8_t reserved[1]; |
- | |
| 131 | } aps; |
- | |
| 132 | } extsched; // extended scheduler |
- | |
| 133 | uint8_t policy; // POLICY_FIFO, POLICY_RR, ... |
- | |
| 134 | uint8_t priority; // priority to run cmd at |
- | |
| 135 | uint8_t argc; // # of args |
- | |
| 136 | uint8_t envc; // # of environment entries |
- | |
| 137 | char args[0]; // executable, argv, envp (null padded to 32-bit align) |
- | |
| 138 | } external; |
- | |
| 139 | PACKED (struct) script_waitfor_reopen |
- | |
| 140 | { |
- | |
| 141 | bootscriptcmd_header_t hdr; |
- | |
| 142 | uint16_t checks; |
- | |
| 143 | char fname[0]; // char fname[] (null padded to 32-bit align) |
- | |
| 144 | } waitfor_reopen; |
- | |
| 145 | PACKED (struct) script_display_msg |
- | |
| 146 | { |
- | |
| 147 | bootscriptcmd_header_t hdr; |
- | |
| 148 | char msg[0]; // char msg[] (null padded to 32-bit align) |
- | |
| 149 | } display_msg; |
- | |
| 150 | PACKED (struct) script_procmgr_symlink |
- | |
| 151 | { |
- | |
| 152 | bootscriptcmd_header_t hdr; |
- | |
| 153 | char src_dest[0]; // <src_name>, '\0', <dest_name> '\0' (null padded to 32-bit align) |
- | |
| 154 | } procmgr_symlink; |
- | |
| 155 | PACKED (struct) script_extsched_aps |
- | |
| 156 | { |
- | |
| 157 | bootscriptcmd_header_t hdr; |
- | |
| 158 | uint8_t parent; |
- | |
| 159 | uint8_t budget; |
- | |
| 160 | uint16_t critical; |
- | |
| 161 | uint8_t id; |
- | |
| 162 | char pname[0]; // char pname[] (null padded to 32-bit align) |
- | |
| 163 | } extsched_aps; |
- | |
| 164 | } bootscriptcmd_t; |
- | |
| 165 | END_OF_PACKED_STRUCT () // restore default alignment |
- | |
| 166 | #endif // 0 |
- | |
| 167 | 98 | ||
| 168 | 99 | ||
| 169 | START_OF_PACKED_STRUCT () // we need byte-alignment for this struct |
100 | START_OF_PACKED_STRUCT () // we need byte-alignment for this struct |
| 170 | typedef PACKED (struct) fsentry_s |
101 | typedef PACKED (struct) fsentry_s |
| 171 | { |
102 | { |