The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _RECOVERY_BOOTLOADER_H |
| 18 | #define _RECOVERY_BOOTLOADER_H |
| 19 | |
Doug Zongker | 28ce47c | 2011-10-28 10:33:05 -0700 | [diff] [blame] | 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 24 | /* Bootloader Message |
| 25 | * |
| 26 | * This structure describes the content of a block in flash |
| 27 | * that is used for recovery and the bootloader to talk to |
| 28 | * each other. |
| 29 | * |
| 30 | * The command field is updated by linux when it wants to |
| 31 | * reboot into recovery or to update radio or bootloader firmware. |
| 32 | * It is also updated by the bootloader when firmware update |
| 33 | * is complete (to boot into recovery for any final cleanup) |
| 34 | * |
| 35 | * The status field is written by the bootloader after the |
| 36 | * completion of an "update-radio" or "update-hboot" command. |
| 37 | * |
| 38 | * The recovery field is only written by linux and used |
| 39 | * for the system to send a message to recovery or the |
| 40 | * other way around. |
| 41 | */ |
| 42 | struct bootloader_message { |
| 43 | char command[32]; |
| 44 | char status[32]; |
| 45 | char recovery[1024]; |
| 46 | }; |
| 47 | |
| 48 | /* Read and write the bootloader command from the "misc" partition. |
| 49 | * These return zero on success. |
| 50 | */ |
| 51 | int get_bootloader_message(struct bootloader_message *out); |
| 52 | int set_bootloader_message(const struct bootloader_message *in); |
| 53 | |
Dees_Troy | 2673cec | 2013-04-02 20:22:16 +0000 | [diff] [blame] | 54 | int set_bootloader_message_mtd_name(const struct bootloader_message *in, const char* mtd_name); |
| 55 | int set_bootloader_message_block_name(const struct bootloader_message *in, const char* block_name); |
| 56 | |
Dees_Troy | a449a6f | 2013-04-07 17:50:11 -0500 | [diff] [blame] | 57 | void get_args(int *argc, char ***argv); |
| 58 | |
Doug Zongker | 28ce47c | 2011-10-28 10:33:05 -0700 | [diff] [blame] | 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 63 | #endif |