blob: 4e9fb0a0d7b075d83b566998218136686c2cc4cf [file] [log] [blame]
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -08001/*
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
20/* Bootloader Message
21 *
22 * This structure describes the content of a block in flash
23 * that is used for recovery and the bootloader to talk to
24 * each other.
25 *
26 * The command field is updated by linux when it wants to
27 * reboot into recovery or to update radio or bootloader firmware.
28 * It is also updated by the bootloader when firmware update
29 * is complete (to boot into recovery for any final cleanup)
30 *
31 * The status field is written by the bootloader after the
32 * completion of an "update-radio" or "update-hboot" command.
33 *
34 * The recovery field is only written by linux and used
35 * for the system to send a message to recovery or the
36 * other way around.
Doug Zongkerc87bab12013-11-25 13:53:25 -080037 *
38 * The stage field is written by packages which restart themselves
39 * multiple times, so that the UI can reflect which invocation of the
40 * package it is. If the value is of the format "#/#" (eg, "1/3"),
41 * the UI will add a simple indicator of that status.
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080042 */
43struct bootloader_message {
44 char command[32];
45 char status[32];
Doug Zongkerc87bab12013-11-25 13:53:25 -080046 char recovery[768];
47
48 // The 'recovery' field used to be 1024 bytes. It has only ever
49 // been used to store the recovery command line, so 768 bytes
50 // should be plenty. We carve off the last 256 bytes to store the
51 // stage string (for multistage packages) and possible future
52 // expansion.
53 char stage[32];
54 char reserved[224];
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080055};
56
57/* Read and write the bootloader command from the "misc" partition.
58 * These return zero on success.
59 */
60int get_bootloader_message(struct bootloader_message *out);
61int set_bootloader_message(const struct bootloader_message *in);
62
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080063#endif