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