github.com/meulengracht/snapd@v0.0.0-20210719210640-8bde69bcc84e/include/lk/snappy_boot_common.h (about)

     1  /**
     2   * Copyright (C) 2020 Canonical Ltd
     3   *
     4   * This program is free software: you can redistribute it and/or modify
     5   * it under the terms of the GNU General Public License version 3 as
     6   * published by the Free Software Foundation.
     7   *
     8   * This program is distributed in the hope that it will be useful,
     9   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11   * GNU General Public License for more details.
    12   *
    13   * You should have received a copy of the GNU General Public License
    14   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15   *
    16   */
    17  
    18  #include <stdint.h>
    19  
    20  #ifndef _BOOTLOADER_SNAP_BOOT_COMMON_H
    21  #define _BOOTLOADER_SNAP_BOOT_COMMON_H
    22  
    23  #define SNAP_BOOTSELECT_SIGNATURE ('S' | ('B' << 8) | ('s' << 16) | ('e' << 24))
    24  // SNAP_BOOTSELECT_SIGNATURE_RUN is the same as SNAP_BOOTSELECT_SIGNATURE
    25  #define SNAP_BOOTSELECT_SIGNATURE_RUN ('S' | ('B' << 8) | ('s' << 16) | ('e' << 24))
    26  
    27  // note SNAP_NAME_MAX_LEN also defines the max length of a recovery system label
    28  #define SNAP_NAME_MAX_LEN (256)
    29  #define HASH_LENGTH (32)
    30  #define SNAP_MODE_TRY "try"
    31  #define SNAP_MODE_TRYING "trying"
    32  #define FACTORY_RESET "factory-reset"
    33  
    34  #define SNAP_RECOVERY_MODE_INSTALL "install"
    35  #define SNAP_RECOVERY_MODE_RUN "run"
    36  #define SNAP_RECOVERY_MODE_RECOVER "recover"
    37  
    38  /* partition label where boot select structure is stored, for uc20 this is just
    39   * used for run mode
    40   */
    41  #define SNAP_BOOTSELECT_PARTITION "snapbootsel"
    42  
    43  /* partition label where recovery boot select structure is stored */
    44  #define SNAP_RECOVERYSELECT_PARTITION "snaprecoverysel"
    45  
    46  /** maximum number of available bootimg partitions for recovery systems, min 5
    47   *  NOTE: the number of actual bootimg partitions usable is determined by the
    48   *  gadget, this just sets the upper bound of maximum number of recovery systems
    49   *  a gadget could define without needing changes here
    50   */
    51  #define SNAP_RECOVERY_BOOTIMG_PART_NUM 10
    52  
    53  /* number of available bootimg partitions for run mode, min 2 */
    54  #define SNAP_RUN_BOOTIMG_PART_NUM 2
    55  
    56  #endif  // _BOOTLOADER_SNAP_BOOT_COMMON_H