[BOARD] refactor options.cfg + add INVERT setting

This commit is contained in:
Apaczer
2023-05-30 00:44:11 +02:00
parent b65d52ae59
commit b430a7b54e
2 changed files with 28 additions and 31 deletions

View File

@@ -1,5 +1,8 @@
MODULES_CUSTOM=0
FAT_CHECK=1
BOOT_LOGO=1
FLIP= (put 0 or 1 to overwrite)
TVMODE=0
MODULES_CUSTOM=0
FAT_CHECK=1
BOOT_LOGO=1
FLIP= (put 0 or 1 to overwrite)
INVERT= (put 0 or 1 to overwrite)
TVMODE=0
Only "0" and "1" are accepted values

View File

@@ -45,12 +45,12 @@ gadget-ms /dev/mmcblk0p1 /dev/mmcblk0p4 >> "${LOGS}" 2>&1
# automatically in rootfs/lib/modules/VERSION
# (also because with custom kernels the VERSION will be different.
#
# the uEnv.txt is autogenerated by u-boot from HW which outputs
# environmental variables needed for ID of screen type
video=`cat ${BOOTDIR}/uEnv.txt |grep -a "CONSOLE_VIDEO" | cut -d "=" -f 2 | cut -d "." -f 1`
# the uEnv.txt is autogenerated by u-boot from HW which outputs
# environmental variables needed for ID of screen type
video=`cat ${BOOTDIR}/uEnv.txt |grep -a "CONSOLE_VIDEO" | cut -d "=" -f 2 | cut -d "." -f 1`
params=`cat ${BOOTDIR}/uEnv.txt |grep -a "CONSOLE_PARAMETERS" | cut -d "=" -f 2-`
# TVout scripting backend
# TVout scripting backend
tvout=`cat ${HOME}/tvout`
if ((test -r "${HOME}/tvout")); then
echo 0 > /sys/class/backlight/backlight/brightness
@@ -58,33 +58,27 @@ gadget-ms /dev/mmcblk0p1 /dev/mmcblk0p4 >> "${LOGS}" 2>&1
cp /mnt/.backlight.conf /mnt/.backlight.bak
echo 0 > ${HOME}/.backlight.conf
modprobe -r $video
if (grep -q TVMODE\=\1 "${HOME}/options.cfg"); then
modprobe miyoo-tvout tvmode=1
else
modprobe miyoo-tvout
fi
#TVMODE options.cfg setting
export tvmode=$(grep -o TVMODE=[0-1] "${HOME}/options.cfg" | tr '[:upper:]' '[:lower:]')
modprobe miyoo-tvout $tvmode
echo 1 > /sys/class/vtconsole/vtcon1/bind
modprobe -r $video
else
if ((test -r "${HOME}/.backlight.bak")); then
mv ${HOME}/.backlight.bak ${HOME}/.backlight.conf
fi
# MODULES_CUSTOM scripting
if (!(test -r "${BOOTDIR}/modules.custom.sh") || !(grep -q MODULES_CUSTOM\=\1 "${HOME}/options.cfg")); then
# Load video module read from uEnv.txt & defined by variant in console.cfg
if (grep -q FLIP\=\1 "${HOME}/options.cfg"); then
modprobe $video $params flip=1
elif (grep -q FLIP\=\0 "${HOME}/options.cfg"); then
modprobe $video $params flip=0
else
modprobe $video $params
fi
else
(cd "${BOOTDIR}" && sh modules.custom.sh ) >> "${LOGS}" 2>&1
fi
if ((test -r "${HOME}/.backlight.bak")); then
mv ${HOME}/.backlight.bak ${HOME}/.backlight.conf
fi
# MODULES_CUSTOM scripting
if (!(test -r "${BOOTDIR}/modules.custom.sh") || !(grep -q MODULES_CUSTOM\=\1 "${HOME}/options.cfg")); then
# Load video module read from uEnv.txt & defined by variant in console.cfg
#FLIP & INVERT options.cfg setting
export flip=$(grep -o FLIP=[0-1] "${HOME}/options.cfg" | tr '[:upper:]' '[:lower:]')
export invert=$(grep -o INVERT=[0-1] "${HOME}/options.cfg" | tr '[:upper:]' '[:lower:]')
modprobe $video $params $flip $invert
else
(cd "${BOOTDIR}" && sh modules.custom.sh ) >> "${LOGS}" 2>&1
fi
fi
# check if it's first boot and defer to the firstboot script if yes
if test -r "${BOOTDIR}/firstboot"; then
exec sh "${BOOTDIR}/firstboot"