View Source grisp_update_packager (grisp_update_packager v1.0.0)

Summary

Functions

Creates a GRiSP software update package. The output path is either a directory where all the package files will be stored, or a tarball file name that will contain all the package files. In both cases the directory or the file must not already exist.

Types

-type gpt_partition() ::
          #{role := boot | system | data,
            type => linux | swap | home | efi | raid | llvm | bdp | binary() | string(),
            id := iodata(),
            start => non_neg_integer(),
            size := non_neg_integer()}.
-type gpt_partition_table() :: [gpt_partition()].
-type mbr_partition() ::
          #{role := boot | system | data,
            type => dos | fat | fat32 | undefined,
            start => non_neg_integer(),
            size := non_neg_integer()}.
-type mbr_partition_table() :: [mbr_partition()].
-type package_options() ::
          #{tarball => boolean(),
            name := iodata() | undefined,
            version := iodata() | undefined,
            description => iodata() | undefined,
            architecture => string() | binary() | undefined,
            block_size => pos_integer(),
            key_file => iodata() | undefined,
            key => public_key:pem_entry(),
            system => iodata() | undefined,
            bootloader => iodata() | undefined,
            files => [update_file()],
            mbr => mbr_partition_table(),
            gpt => gpt_partition_table()}.
-type update_file() ::
          #{name := iodata(), target := iodata(), local := iodata(), url => iodata() | undefined}.

Functions

Link to this function

package(OutputPath, Opts0)

View Source
-spec package(OutputPath :: iodata(), package_options()) -> ok | {error, Reason :: term()}.

Creates a GRiSP software update package. The output path is either a directory where all the package files will be stored, or a tarball file name that will contain all the package files. In both cases the directory or the file must not already exist.

Options:

  • tarball (optional boolean): If the package files should be stored in a tarball. if false the update manifest and files will be stored in the specified directory. Default: true.
  • name (required binary): The product name that will be specified in the manifest.
  • version (required binary): The product version that will be specified in the manifest.
  • description (optional binary): The product description that will be specified in the manifest.
  • architecture (optional binary): The target architecture of the update package. Default: arm-grisp2-rtems.
  • block_size (optional positive integer): The size in bytes of the update chunks before compression. Default: 4194304.
  • key_file (optional binary): The path to a PEM file containing the signing key to use to seal the manifest. Only one of key_file and key option can be specified at the same time.
  • key (optional private key record): A decoded private key to use to seal the manifest. Only one of key_file and key option can be specified at the same time.
  • system (optional binary): The uncompressed system firmware image to be written on the update system partition. It is optional, so it is possible to create a bootloader-only update package.
  • bootloader (optional binary): The uncompressed bootloader firmware image to be included in the software update package. If not specified, the package will not contain the bootloader.
  • files (optional list): A list of extra files to be installed during software update. The files will not be chuncked and will be included as a single compressed block. If a URL is specified, the file will not be included in the update package, instead it will be expected to be available at the given external URL, the file is still required locally though, as it is needed to compute the hashes. The format of the file specification is a map with the following fields:
    • name (required binary): The name of the system file as it will appear in the manifest.
    • local (required binary): The path to the local file to be included.
    • target (required binary): The path in the target filesystem where the file will be installed.
    • url (optional binary): The URL the data should be retrieved from instead of including the file in the update package.
  • mbr (optional list): Either the option mbr or gpt is required. Specify the MBR partition table of the target filesystem. It is a list of at most 4 MBR partition specifications as maps with the following fields:
    • role (required atom): The role of the partition, could be boot, system or data. The firmware can only be written to a system partition.
    • type (optional atom): The type of the partition, can be fat, fat32 or dos, all equivalent, fat being the default and dos being deprecated.
    • start (optional positive integer): The start position of the partition in bytes. Must be a multiple of the sector size (512). If not specified, it will be the end of the previous partition or 0.
    • size (required positive integer): The size of the partition in bytes. Must be a multiple of the sector size (512).
  • gpt (optional list): Either the option mbr or gpt is required. Specify GPT partition table of the target file-system. It is a list of GPT partition specifications as maps with the following fields:
    • role (required atom): The role of the partition, could be boot, system or data. The firmware can only be written to a system partition.
    • type (optional atom or binary): The type of the partition, can be one of the atoms linux, swap, home, efi,raid, llvm or bdp for standard GPT partition types or a binary UUID.
    • id (required binary): The binary UUID identifier of the partition.
    • start (optional positive integer): The start position of the partition in bytes. Must be a multiple of the sector size (512). If not specified, it will be the end of the previous partition or 0.
    • size (required positive integer): The size of the partition in bytes. Must be a multiple of the sector size (512).