Skip to content

Commit

Permalink
aml-s9xx-box: inline bsp-cli preinst function so it's hashed together…
Browse files Browse the repository at this point in the history
… with the hook; half fixes armbian#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
  • Loading branch information
rpardini committed Jun 30, 2024
1 parent b91a040 commit 5932c8e
Showing 1 changed file with 41 additions and 42 deletions.
83 changes: 41 additions & 42 deletions config/boards/aml-s9xx-box.tvb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Amlogic S9xx based TVBox
# Amlogic S9xx based TVBox
BOARD_NAME="aml-s9xx-box"
BOARDFAMILY="meson-gxl"
BOARD_MAINTAINER="SteeManMI"
Expand All @@ -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
}

0 comments on commit 5932c8e

Please sign in to comment.