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@40 | 9 | Usage: $PROGNAME [-q] <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@40 | 22 | |
paul@40 | 23 | The -q option silences warnings about the build directory and is used by the |
paul@40 | 24 | installation tool. |
paul@24 | 25 | EOF |
paul@24 | 26 | exit 1 |
paul@24 | 27 | fi |
paul@24 | 28 | |
paul@40 | 29 | if [ "$1" = '-q' ] ; then |
paul@40 | 30 | QUIET="$1" |
paul@40 | 31 | shift 1 |
paul@40 | 32 | else |
paul@40 | 33 | QUIET= |
paul@40 | 34 | fi |
paul@40 | 35 | |
paul@24 | 36 | # Check for a build directory and obtain a platform type. |
paul@24 | 37 | |
paul@28 | 38 | if [ -e "$1" ] ; then |
paul@28 | 39 | |
paul@28 | 40 | # Look for the configuration in a subdirectory. |
paul@28 | 41 | |
paul@28 | 42 | for FILENAME in "$1/"*"/.config.platform" ; do |
paul@28 | 43 | |
paul@28 | 44 | # Test for a valid file since the expansion will yield the pattern |
paul@28 | 45 | # itself if no files match. |
paul@28 | 46 | |
paul@28 | 47 | if [ -e "$FILENAME" ] ; then |
paul@28 | 48 | |
paul@28 | 49 | # Set the platform and the installation as target. |
paul@28 | 50 | |
paul@28 | 51 | PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$FILENAME" | sed 's/^.*"\(.*\)".*$/\1/'` |
paul@28 | 52 | TARGETDIR="$1" |
paul@28 | 53 | break |
paul@28 | 54 | else |
paul@40 | 55 | if [ ! "$QUIET" ] ; then |
paul@40 | 56 | cat 1>&2 <<EOF |
paul@28 | 57 | The specified directory does not contain an existing, configured build |
paul@28 | 58 | directory. Make sure that the configuration has been checked with the |
paul@28 | 59 | appropriate tool specifying a platform as argument: |
paul@28 | 60 | |
paul@28 | 61 | $DIRNAME/$PROGNAME <platform> |
paul@28 | 62 | EOF |
paul@40 | 63 | fi |
paul@28 | 64 | exit 1 |
paul@28 | 65 | fi |
paul@28 | 66 | done |
paul@24 | 67 | |
paul@24 | 68 | # Check for a recognised platform type. |
paul@24 | 69 | |
paul@24 | 70 | elif grep -q -F -e "$1" "$DIRNAME/conf/landfall-examples/platforms.txt" ; then |
paul@28 | 71 | |
paul@28 | 72 | # Set the platform and the distribution as target. |
paul@28 | 73 | |
paul@24 | 74 | PLATFORM="$1" |
paul@28 | 75 | TARGETDIR="$DIRNAME" |
paul@24 | 76 | |
paul@24 | 77 | # Show an error for anything else. |
paul@24 | 78 | |
paul@24 | 79 | else |
paul@24 | 80 | cat 1>&2 <<EOF |
paul@24 | 81 | Platform not recognised: $1 |
paul@24 | 82 | EOF |
paul@24 | 83 | exit 1 |
paul@24 | 84 | fi |
paul@24 | 85 | |
paul@40 | 86 | # Handle missing configuration files. This may happen when installing into an |
paul@40 | 87 | # existing directory hierarchy with build products. |
paul@40 | 88 | |
paul@40 | 89 | if [ ! -e "$TARGETDIR/conf/landfall-examples" ] ; then |
paul@40 | 90 | exit 0 |
paul@40 | 91 | fi |
paul@40 | 92 | |
paul@28 | 93 | # Panel configuration file in the target area. |
paul@24 | 94 | |
paul@28 | 95 | PANELCONF="$TARGETDIR/conf/landfall-examples/mips-jz4740-panel.txt" |
paul@24 | 96 | |
paul@24 | 97 | # Determine the required value of the panel configuration. |
paul@24 | 98 | |
paul@24 | 99 | PANELLIB="rom/libpanel_$PLATFORM.so" |
paul@24 | 100 | |
paul@24 | 101 | # Write it to the configuration file. |
paul@24 | 102 | |
paul@24 | 103 | echo -n "$PANELLIB" > "$PANELCONF" |
paul@38 | 104 | |
paul@38 | 105 | # Keypad configuration file in the target area. |
paul@38 | 106 | |
paul@38 | 107 | KEYPADCONF="$TARGETDIR/conf/landfall-examples/input-keypad.txt" |
paul@38 | 108 | |
paul@38 | 109 | # Determine the required value of the panel configuration. |
paul@38 | 110 | |
paul@38 | 111 | KEYPADLIB="rom/libkeypad_$PLATFORM.so" |
paul@38 | 112 | |
paul@38 | 113 | # Write it to the configuration file. |
paul@38 | 114 | |
paul@38 | 115 | echo -n "$KEYPADLIB" > "$KEYPADCONF" |