carl9170 firmware build: automatically apply miniboot.fw
[carl9170fw.git] / autogen.sh
1 #!/bin/sh
2
3 set -e
4
5 case "$1" in
6         config)
7                 echo "Configuring..."
8                 make -C config
9                 config/conf Kconfig
10                 cmake .
11         ;;
12
13         compile)
14                 echo "Compile time..."
15                 make
16
17         ;;
18
19         install)
20                 if [ ! -e .config ]; then
21                         exit 1
22                 fi
23
24                 . ./.config
25
26
27                 if [ "$CONFIG_CARL9170FW_MAKE_RELEASE" = "y" ]; then
28                         echo -n "Installing firmware..."
29                         tmpfwfile=`mktemp`
30                         cat carlfw/carl9170.fw carlfw/carl9170.dsc > $tmpfwfile
31                         if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ] &&
32                            [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then
33                                 echo -n "Apply miniboot..."
34                                 tools/src/miniboot a $tmpfwfile minifw/miniboot.fw
35                         fi
36
37                         sudo install $tmpfwfile /lib/firmware/carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw
38                         rm $tmpfwfile
39                         echo "done."
40                 fi
41         ;;
42
43         *)
44                 $0 config
45                 $0 compile
46         ;;
47
48
49 esac