# (c) 2014-2015 Sam Nazarko
# email@samnazarko.co.uk

#!/bin/bash

. ../common.sh

echo -e "Building package rbp-bootloader-osmc"

BOOT="files/boot"
FWFILES=( "LICENCE.broadcom" "start_x.elf" "fixup_x.dat" "bootcode.bin" "start4x.elf" "fixup4x.dat" )
REV="b1afbd0cf0e511dffeaaeeaee54e2af938bcbc7c"

make clean

mkdir -p "${BOOT}"

for file in ${FWFILES[@]}
do
    pull_bin "https://raw.githubusercontent.com/raspberrypi/firmware/${REV}/boot/${file}" "${BOOT}/${file}"
done

echo -e "# Warning: do not edit this file, or it could prevent your OSMC system from starting.
# If you wish to make changes, you should do so via My OSMC or edit the config-user.txt file in this directory

# Any changes that you make here will be overwritten as this file is managed by the OSMC via the update system

[pi4]
dtoverlay=rpivid-v4l2
arm_64bit=1
kernel=kernel.img

[all]
dtoverlay=vc4-kms-v3d,cma-512
disable_overscan=1
start_x=1
disable_splash=1
disable_fw_kms_setup=1
hdmi_ignore_cec_init=1
include config-user.txt

[pi02]
dtoverlay=vc4-kms-v3d,cma-256

[board-type=0x0e]
dtoverlay=vc4-kms-v3d,cma-256

" > $BOOT/config.txt

dpkg_build files/ rbp-bootloader-osmc.deb
