diff --git a/recipes-bsp/fng-install/prepare-image.bb b/recipes-bsp/fng-install/prepare-image.bb index 182663e08a79c70c96e4d48bb1ff1a6dace2144c..07d8c279f3b3ae8c130d94cd8661565c8dc9fbbd 100644 --- a/recipes-bsp/fng-install/prepare-image.bb +++ b/recipes-bsp/fng-install/prepare-image.bb @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7ca RDEPENDS_${PN} = " \ fng-install-postinstallation \ sharedconf \ + i2c-tools \ " SRC_URI = " \ @@ -22,6 +23,10 @@ SRC_URI_append_mx6 = " \ file://gf-prepare-xml2dto.sh \ " +SRC_URI_append_mx8 = " \ + file://gf-prepare-rtc.sh \ +" + do_configure_append_fng () { # Exchange the bootpartitions for Flash-N-Go System sed -i ${WORKDIR}/gf-prepare-kernel.sh -e 's|^BOOTPARTITIONS=".*|BOOTPARTITIONS="/dev/disk/by-label/Flash-N-Go /dev/mmcblk0p1 /dev/mmcblk1p1"|' @@ -48,3 +53,8 @@ do_install_append_mx6() { ln -s ${sbindir}/gf-prepare-dt.sh ${D}${sysconfdir}/fng-postinstall/12-gf-prepare-dt ln -s ${sbindir}/gf-prepare-xml2dto.sh ${D}${sysconfdir}/fng-postinstall/13-gf-prepare-xml2dto } + +do_install_append_mx8() { + install -m 0755 ${WORKDIR}/gf-prepare-rtc.sh ${D}${sbindir} + ln -s ${sbindir}/gf-prepare-rtc.sh ${D}${sysconfdir}/fng-postinstall/14-gf-prepare-rtc +} diff --git a/recipes-bsp/fng-install/prepare-image/gf-prepare-rtc.sh b/recipes-bsp/fng-install/prepare-image/gf-prepare-rtc.sh new file mode 100644 index 0000000000000000000000000000000000000000..b73d042ddeec758c782da16f17b34c18d4721288 --- /dev/null +++ b/recipes-bsp/fng-install/prepare-image/gf-prepare-rtc.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# shellcheck source=../../../recipes-guf/sharedconf/sharedconf/gf-functions.sh +if ! . /usr/sbin/gf-functions.sh; then + echo "Unable to include gf-functions" +fi +# shellcheck source=./gf-prepare-common.sh +if ! . /usr/sbin/gf-prepare-common.sh; then + echo "Unable to include gf-prepare-common" +fi + +poll_rtc() { + if i2cget -y 2 "$1" 0x00 2>&1 | grep -E '.*0x.*|.*Device or resource busy.*'; then + echo "Device found at address $1" + return 0 + else + echo "No device found at address $1" + return 1 + fi +} + +# Get the directory containing the bootfiles +mount_bootpartition BOOTFILES_DIR + +# Change into the boot directory +cd "$BOOTFILES_DIR" || exit 1 + +# RX8803 +if poll_rtc 0x32; then + append_overlay "rx8803-overlay.dtb" +else + # PCF8563 + if poll_rtc 0x51; then + append_overlay "pcf8563-overlay.dtb" + else + echo "Error: Unable to find any valid device" + exit 1 + fi +fi + +exit 0 + +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4