Files
operating-system/buildroot-external/board/raspberrypi/hassos-hook.sh
Stefan Agner 45d6d287e8 Copy the Raspberry Pi 4 EEPROM only if we deploy the package (#1104)
Fix build by only copy the EEPROM update to the boot partition if we
actually enable the EEPROM package.
2020-12-18 19:30:18 +01:00

45 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# shellcheck disable=SC2155
function hassos_pre_image() {
local BOOT_DATA="$(path_boot_dir)"
cp -t "${BOOT_DATA}" \
"${BINARIES_DIR}/u-boot.bin" \
"${BINARIES_DIR}/boot.scr"
cp "${BINARIES_DIR}"/*.dtb "${BOOT_DATA}/"
cp -r "${BINARIES_DIR}/rpi-firmware/overlays" "${BOOT_DATA}/"
cp "${BOARD_DIR}/../boot-env.txt" "${BOOT_DATA}/config.txt"
# Firmware
if [[ "${BOARD_ID}" =~ "rpi4" ]]; then
cp "${BINARIES_DIR}/rpi-firmware/fixup.dat" "${BOOT_DATA}/fixup4.dat"
cp "${BINARIES_DIR}/rpi-firmware/start.elf" "${BOOT_DATA}/start4.elf"
else
cp -t "${BOOT_DATA}" \
"${BINARIES_DIR}/rpi-firmware/fixup.dat" \
"${BINARIES_DIR}/rpi-firmware/start.elf" \
"${BINARIES_DIR}/rpi-firmware/bootcode.bin"
fi
# EEPROM update for Raspberry Pi 4/Compute Module 4
if grep -Eq "^BR2_PACKAGE_RPI_EEPROM=y$" "${BR2_CONFIG}"; then
cp "${BINARIES_DIR}/rpi-eeprom/pieeprom.sig" "${BOOT_DATA}/pieeprom.sig"
cp "${BINARIES_DIR}/rpi-eeprom/pieeprom.upd" "${BOOT_DATA}/pieeprom.upd"
fi
# Set cmd options
echo "dwc_otg.lpm_enable=0 console=tty1" > "${BOOT_DATA}/cmdline.txt"
# Enable 64bit support
if [[ "${BOARD_ID}" =~ "64" ]]; then
sed -i "s|#arm_64bit|arm_64bit|g" "${BOOT_DATA}/config.txt"
fi
}
function hassos_post_image() {
convert_disk_image_xz
}