Skip to content
Snippets Groups Projects
Commit 32b8f0c2 authored by Tobias Kahlki's avatar Tobias Kahlki
Browse files

fng-install:rtc: Added RTC detection for the TANARO

The TANARO will be produced with one of two RTC variants.
We detect the RTC by querying the first register during the
post-install and activate one of two devicetree overlays.

BCS 746-000877
parent 3a397d44
No related branches found
No related tags found
1 merge request!391Add RTC detection for TANARO
......@@ -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
}
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment