From a0bf4c1a5a40ce650a1665010ed1c5dd8093ee6d Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 30 Jun 2024 12:30:11 +0200 Subject: [PATCH] aml-s9xx-box: inline bsp-cli preinst function so it's hashed together with the hook; half fixes #6817 - this is technically cheating, but works - add TODO's ref the manual include'ing of files that are not hashed in the bsp-cli --- config/boards/aml-s9xx-box.tvb | 83 +++++++++++++++++----------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/config/boards/aml-s9xx-box.tvb b/config/boards/aml-s9xx-box.tvb index 97a805f929ce..f5771eb327ba 100644 --- a/config/boards/aml-s9xx-box.tvb +++ b/config/boards/aml-s9xx-box.tvb @@ -1,4 +1,4 @@ -# Amlogic S9xx based TVBox +# Amlogic S9xx based TVBox BOARD_NAME="aml-s9xx-box" BOARDFAMILY="meson-gxl" BOARD_MAINTAINER="SteeManMI" @@ -13,49 +13,48 @@ BOOT_LOGO="desktop" SRC_EXTLINUX="yes" SRC_CMDLINE='rootflags=data=writeback console=ttyAML0,115200n8 console=tty0' -function aml-s9xx-box-bsp-cli-preinst() { - #update of the board bsp-cli package fails because the filesystem type is - #fat and dpkg tries to create a hard link for the existing files as backup - #so rm the files instead in a preinst step - [ -f /boot/aml_autoscript ] && rm /boot/aml_autoscript - [ -f /boot/emmc_autoscript ] && rm /boot/emmc_autoscript - [ -f /boot/s905_autoscript ] && rm /boot/s905_autoscript - [ -f /boot/u-boot-s905 ] && rm /boot/u-boot-s905 - [ -f /boot/u-boot-s905x-s912 ] && rm /boot/u-boot-s905x-s912 - [ -f /boot/u-boot-s905x2-s922 ] && rm /boot/u-boot-s905x2-s922 - [ -f /boot/u-boot-s905x3 ] && rm /boot/u-boot-s905x3 - [ -f /boot/u-boot-s905x3-ugoosx3 ] && rm /boot/u-boot-s905x3-ugoosx3 - [ -f /boot/extlinux/extlinux.conf.template ] && rm /boot/extlinux/extlinux.conf.template - [ -f /boot/build-u-boot/readme.txt ] && rm /boot/build-u-boot/readme.txt - [ -f /boot/build-u-boot/u-boot-s905x-s912.patch ] && rm /boot/build-u-boot/u-boot-s905x-s912.patch - [ -f /boot/build-u-boot/u-boot-s905x2-s922.patch ] && rm /boot/build-u-boot/u-boot-s905x2-s922.patch - [ -f /boot/build-u-boot/u-boot-s905x3.patch ] && rm /boot/build-u-boot/u-boot-s905x3.patch - [ -f /boot/build-u-boot/u-boot-s905x3-ugoos-x3.patch ] && rm /boot/build-u-boot/u-boot-s905x3-ugoos-x3.patch - -} - function post_family_config__uboot_aml-s9xx-box() { - # This board type relies on the vendor installed u-boot on emmc to boot - - display_alert "$BOARD" "Configuring ($BOARD) non-u-boot" "info" - - unset BOOTSOURCE - declare -g BOOTCONFIG='none' + # This board type relies on the vendor installed u-boot on emmc to boot + display_alert "$BOARD" "Configuring ($BOARD) non-u-boot" "info" + unset BOOTSOURCE + declare -g BOOTCONFIG='none' } function post_family_tweaks_bsp__config_aml-s9xx-box_bsp() { - - display_alert "$BOARD" "Installing bsp files" "info" - - cp -r "${SRC}"/packages/bsp/aml-s9xx-box/boot "${destination}" - install -D -m 744 "${SRC}"/packages/bsp/aml-s9xx-box/root/install-aml.sh "${destination}"/root/install-aml.sh - install -m 644 "${SRC}"/packages/bsp/aml-s9xx-box/root/fstab.template "${destination}"/root/fstab.template - - display_alert "${BOARD}" "Removing armbian-install" "info" - - rm "${destination}"/usr/sbin/armbian-install - - display_alert "${BOARD}" "Adding bsp-cli preinst logic" "info" - - preinst_functions+=('aml-s9xx-box-bsp-cli-preinst') + : "${destination:?destination is not set}" + + display_alert "$BOARD" "Installing bsp files" "info" + + # @TODO: rpardini: these files are NOT hashed in the bsp-cli package hash! Anytime there's a change on any of those files, this hook needs to be changed/updated as well, otherwise changes will be ignored + run_host_command_logged cp -rv "${SRC}"/packages/bsp/aml-s9xx-box/boot "${destination}" + run_host_command_logged install -v -D -m 744 "${SRC}"/packages/bsp/aml-s9xx-box/root/install-aml.sh "${destination}"/root/install-aml.sh + run_host_command_logged install -v -m 644 "${SRC}"/packages/bsp/aml-s9xx-box/root/fstab.template "${destination}"/root/fstab.template + + display_alert "${BOARD}" "Removing armbian-install" "info" + rm "${destination}"/usr/sbin/armbian-install + + display_alert "${BOARD}" "Adding bsp-cli preinst logic" "info" + # Inline function! So this function is automatically hashed when this hook is hashed. + function aml-s9xx-box-bsp-cli-preinst() { + #update of the board bsp-cli package fails because the filesystem type is + #fat and dpkg tries to create a hard link for the existing files as backup + #so rm the files instead in a preinst step + [ -f /boot/aml_autoscript ] && rm /boot/aml_autoscript + [ -f /boot/emmc_autoscript ] && rm /boot/emmc_autoscript + [ -f /boot/s905_autoscript ] && rm /boot/s905_autoscript + [ -f /boot/u-boot-s905 ] && rm /boot/u-boot-s905 + [ -f /boot/u-boot-s905x-s912 ] && rm /boot/u-boot-s905x-s912 + [ -f /boot/u-boot-s905x2-s922 ] && rm /boot/u-boot-s905x2-s922 + [ -f /boot/u-boot-s905x3 ] && rm /boot/u-boot-s905x3 + [ -f /boot/u-boot-s905x3-ugoosx3 ] && rm /boot/u-boot-s905x3-ugoosx3 + [ -f /boot/extlinux/extlinux.conf.template ] && rm /boot/extlinux/extlinux.conf.template + [ -f /boot/build-u-boot/readme.txt ] && rm /boot/build-u-boot/readme.txt + [ -f /boot/build-u-boot/u-boot-s905x-s912.patch ] && rm /boot/build-u-boot/u-boot-s905x-s912.patch + [ -f /boot/build-u-boot/u-boot-s905x2-s922.patch ] && rm /boot/build-u-boot/u-boot-s905x2-s922.patch + [ -f /boot/build-u-boot/u-boot-s905x3.patch ] && rm /boot/build-u-boot/u-boot-s905x3.patch + [ -f /boot/build-u-boot/u-boot-s905x3-ugoos-x3.patch ] && rm /boot/build-u-boot/u-boot-s905x3-ugoos-x3.patch + return 0 # short-circuits above, avoid errors + } + preinst_functions+=('aml-s9xx-box-bsp-cli-preinst') + if false; then aml-s9xx-box-bsp-cli-preinst; fi # so shellcheck stops complaining the function is unused. sorry }