paul@24 | 1 | #!/bin/sh |
paul@24 | 2 | |
paul@24 | 3 | if ! which realpath > /dev/null ; then |
paul@24 | 4 | echo "Please install the realpath program." 1>&2 |
paul@24 | 5 | exit 1 |
paul@24 | 6 | fi |
paul@24 | 7 | |
paul@24 | 8 | THISDIR=`dirname "$0"` |
paul@24 | 9 | DIRNAME=`realpath "$THISDIR/.."` |
paul@24 | 10 | PROGNAME=`basename "$0"` |
paul@24 | 11 | |
paul@24 | 12 | if [ "$1" = '--help' ] || [ ! "$1" ] ; then |
paul@24 | 13 | cat 1>&2 <<EOF |
paul@24 | 14 | Usage: $PROGNAME <platform> | <build directory> |
paul@24 | 15 | |
paul@24 | 16 | Update platform-specific files for the indicated platform type. If a build |
paul@24 | 17 | directory is specified, try and obtain a configured platform type and use that |
paul@24 | 18 | to update the files. |
paul@24 | 19 | |
paul@24 | 20 | This program updates files in the distribution. They must then be installed |
paul@24 | 21 | using the install program: |
paul@24 | 22 | |
paul@24 | 23 | $THISDIR/install.sh |
paul@24 | 24 | EOF |
paul@24 | 25 | exit 1 |
paul@24 | 26 | fi |
paul@24 | 27 | |
paul@24 | 28 | # Check for a build directory and obtain a platform type. |
paul@24 | 29 | |
paul@24 | 30 | if [ -e "$1" ] && [ -e "$1/.config.platform" ] ; then |
paul@24 | 31 | PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$1/.config.platform" | sed 's/^.*"\(.*\)".*$/\1/'` |
paul@24 | 32 | |
paul@24 | 33 | # Check for a recognised platform type. |
paul@24 | 34 | |
paul@24 | 35 | elif grep -q -F -e "$1" "$DIRNAME/conf/landfall-examples/platforms.txt" ; then |
paul@24 | 36 | PLATFORM="$1" |
paul@24 | 37 | |
paul@24 | 38 | # Show an error for anything else. |
paul@24 | 39 | |
paul@24 | 40 | else |
paul@24 | 41 | cat 1>&2 <<EOF |
paul@24 | 42 | Platform not recognised: $1 |
paul@24 | 43 | EOF |
paul@24 | 44 | exit 1 |
paul@24 | 45 | fi |
paul@24 | 46 | |
paul@24 | 47 | # Panel configuration file in this distribution. |
paul@24 | 48 | |
paul@24 | 49 | PANELCONF="$DIRNAME/conf/landfall-examples/mips-jz4740-panel.txt" |
paul@24 | 50 | |
paul@24 | 51 | # Determine the required value of the panel configuration. |
paul@24 | 52 | |
paul@24 | 53 | PANELLIB="rom/libpanel_$PLATFORM.so" |
paul@24 | 54 | |
paul@24 | 55 | # Write it to the configuration file. |
paul@24 | 56 | |
paul@24 | 57 | echo -n "$PANELLIB" > "$PANELCONF" |