# Zerocat Coreboot Machines --- Create very satisfying free software devices.
#
# Copyright (C) 2019, 2020, 2021, 2022  Kai Mertens <kmx@posteo.net>
#
# This file is part of Zerocat Coreboot Machines.
#
# Zerocat Coreboot Machines is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Zerocat Coreboot Machines is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Zerocat Coreboot Machines.  If not, see <http://www.gnu.org/licenses/>.


# global constants
declare -r PROJECT_NUMBER=$(git describe --match v* | sed -r -e 's/(.*)(-g)([0-9a-f]*)/\1-\3/;' -)

declare -r -a TOOLCHAIN_SCRIPT=(
  [1]='setup-toolbox.sh'
  [2]='gen-payload-seabios.sh'
  [3]='gen-payload-grub.sh'
  [4]='gen-rom-zerocat.sh'
)

declare -r VS='@'   # Version Separator
declare -r FVS='~'  # Folder Version Separator; ${VS} might introduce trouble within folder names

declare -r TEMP_SUFFIX='XXXXXXXXXX'

declare -r TEMPLATE_SEABIOS_CONFIG="../templates/seabios@\${version_seabios}_config.template"
declare -r TEMPLATE_SEABIOS_BOOT_MENU_MESSAGE="../templates/seabios@\${version_seabios}_boot-menu-message.template"
declare -r TEMPLATE_SEABIOS_S3_RESUME_VGA_INIT="../templates/seabios@\${version_seabios}_s3-resume-vga-init.template"
declare -r SEABIOS_PAYLOAD="\${path_to_seabios}/out/bios.bin.elf"
declare -r SEABIOS_VGABIOS="\${path_to_seabios}/out/vgabios.bin"
declare -r SEABIOS_CONFIG="\${path_to_seabios}/.config"

declare -r TEMPLATE_GRUB_CONFIG="../templates/grub@\${version_grub}_zerocat.cfg"
declare -r TEMPLATE_GRUB_CONFIG_MORSE="../templates/grub@\${version_grub}_morse.cfg"
declare -r TEMPLATE_GRUB_CONFIG_MEMDISK="../templates/grub@\${version_grub}_coreboot.cfg"
declare -r GRUB_CONFIG="${TEMPLATE_GRUB_CONFIG##*\/}"
declare -r GRUB_CONFIG_MORSE="${TEMPLATE_GRUB_CONFIG_MORSE##*\/}"
declare -r GRUB_CONFIG_MEMDISK="${TEMPLATE_GRUB_CONFIG_MEMDISK##*\/}"
declare -r GRUB_PAYLOAD="grub@\${version_grub}_i386-coreboot.elf"
declare -r GRUB_PAYLOAD_EXTENDED="grub@\${version_grub}_extended_i386-coreboot.elf"
declare -r GRUB_BG="background_\${ibg}"

declare -r -a BACKGROUND_CBFS=(
  'background_0'
  'background_1'
  'background_2'
  'background_3'
)
