paul@24 | 1 | #!/bin/sh |
paul@24 | 2 | |
paul@24 | 3 | THISDIR=`dirname "$0"` |
paul@28 | 4 | DIRNAME=`readlink -f "$THISDIR/.."` |
paul@24 | 5 | PROGNAME=`basename "$0"` |
paul@24 | 6 | |
paul@24 | 7 | if [ "$1" = '--help' ] || [ ! "$1" ] ; then |
paul@24 | 8 | cat 1>&2 <<EOF |
paul@28 | 9 | Usage: $PROGNAME <platform> | <l4 directory> |
paul@24 | 10 | |
paul@28 | 11 | Update platform-specific files for the indicated platform type. If a directory |
paul@28 | 12 | is specified instead, try and obtain a configured platform type and use that |
paul@24 | 13 | to update the files. |
paul@24 | 14 | |
paul@28 | 15 | If a platform type is explicitly indicated, this program will update files in |
paul@28 | 16 | the distribution. They must then be installed using the install program: |
paul@24 | 17 | |
paul@24 | 18 | $THISDIR/install.sh |
paul@28 | 19 | |
paul@28 | 20 | If a directory is specified instead, this program will update installed files, |
paul@28 | 21 | leaving the distribution alone. |
paul@24 | 22 | EOF |
paul@24 | 23 | exit 1 |
paul@24 | 24 | fi |
paul@24 | 25 | |
paul@24 | 26 | # Check for a build directory and obtain a platform type. |
paul@24 | 27 | |
paul@28 | 28 | if [ -e "$1" ] ; then |
paul@28 | 29 | |
paul@28 | 30 | # Look for the configuration in a subdirectory. |
paul@28 | 31 | |
paul@28 | 32 | for FILENAME in "$1/"*"/.config.platform" ; do |
paul@28 | 33 | |
paul@28 | 34 | # Test for a valid file since the expansion will yield the pattern |
paul@28 | 35 | # itself if no files match. |
paul@28 | 36 | |
paul@28 | 37 | if [ -e "$FILENAME" ] ; then |
paul@28 | 38 | |
paul@28 | 39 | # Set the platform and the installation as target. |
paul@28 | 40 | |
paul@28 | 41 | PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$FILENAME" | sed 's/^.*"\(.*\)".*$/\1/'` |
paul@28 | 42 | TARGETDIR="$1" |
paul@28 | 43 | break |
paul@28 | 44 | else |
paul@28 | 45 | cat 1>&2 <<EOF |
paul@28 | 46 | The specified directory does not contain an existing, configured build |
paul@28 | 47 | directory. Make sure that the configuration has been checked with the |
paul@28 | 48 | appropriate tool specifying a platform as argument: |
paul@28 | 49 | |
paul@28 | 50 | $DIRNAME/$PROGNAME <platform> |
paul@28 | 51 | EOF |
paul@28 | 52 | exit 1 |
paul@28 | 53 | fi |
paul@28 | 54 | done |
paul@24 | 55 | |
paul@24 | 56 | # Check for a recognised platform type. |
paul@24 | 57 | |
paul@24 | 58 | elif grep -q -F -e "$1" "$DIRNAME/conf/landfall-examples/platforms.txt" ; then |
paul@28 | 59 | |
paul@28 | 60 | # Set the platform and the distribution as target. |
paul@28 | 61 | |
paul@24 | 62 | PLATFORM="$1" |
paul@28 | 63 | TARGETDIR="$DIRNAME" |
paul@24 | 64 | |
paul@24 | 65 | # Show an error for anything else. |
paul@24 | 66 | |
paul@24 | 67 | else |
paul@24 | 68 | cat 1>&2 <<EOF |
paul@24 | 69 | Platform not recognised: $1 |
paul@24 | 70 | EOF |
paul@24 | 71 | exit 1 |
paul@24 | 72 | fi |
paul@24 | 73 | |
paul@28 | 74 | # Panel configuration file in the target area. |
paul@24 | 75 | |
paul@28 | 76 | PANELCONF="$TARGETDIR/conf/landfall-examples/mips-jz4740-panel.txt" |
paul@24 | 77 | |
paul@24 | 78 | # Determine the required value of the panel configuration. |
paul@24 | 79 | |
paul@24 | 80 | PANELLIB="rom/libpanel_$PLATFORM.so" |
paul@24 | 81 | |
paul@24 | 82 | # Write it to the configuration file. |
paul@24 | 83 | |
paul@24 | 84 | echo -n "$PANELLIB" > "$PANELCONF" |