distribution/packages/sysutils/busybox/scripts/dtfile
2022-02-05 09:23:32 -05:00

20 lines
678 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
COMPATIBLE=$(cat /proc/device-tree/compatible 2>/dev/null | tr -d '\000' | sed -n -e 's/.*\(allwinner\|amlogic\|rockchip\).*/\1/p')
if [ -n "$COMPATIBLE" ]; then
if [ -e /flash/extlinux/extlinux.conf ]; then
DTFILE=$(grep FDT /flash/extlinux/extlinux.conf | sed 's, *FDT /dtb/,,g')
elif [ -e /flash/boot.ini ]; then
DTFILE=$(grep -m 1 dtb_name /flash/boot.ini | cut -d \" -f2 | sed 's,/dtb/,,g')
elif [ -e /flash/uEnv.ini ]; then
DTFILE=$(grep dtb_name /flash/uEnv.ini | sed 's,dtb_name=/dtb/,,g')
else
DTFILE=""
fi
fi
echo "$DTFILE"