1#!/usr/bin/bash
2
3if [ $# -eq 0 ]
4then
5    echo "usage: setcountrycode [jp|us|eu]"
6    echo " Sets the country code on disc."
7    exit 0
8fi
9
10if [ $1 != "jp" -a $1 != "us" -a $1 != "eu" ]
11then
12    echo "Illegal argument. Do nothing and exit."
13    exit 1
14fi
15
16if [ "$NDEV" = "" ]
17then
18    echo "NDEV is not found. Do nothing and exit."
19    exit 0
20fi
21
22if [ "$NDEV" != "" ]
23then
24    echo "NDEV detected"
25
26    #
27    # change NDEV configuration
28    #
29    if   [ $1 = "jp" ]
30    then
31        CPARA=0
32        CNAME=Japan
33    elif [ $1 = "us" ]
34    then
35        CPARA=1
36        CNAME=US
37    elif [ $1 = "eu" ]
38    then
39        CPARA=2
40        CNAME=Europe
41    fi
42#     echo ${CPARA}
43#     echo ${CNAME}
44
45    for i in "$REVOLUTION_SDK_ROOT"/X86/bin/rvl*.bin
46    do
47#         echo "$i"
48        if ! $REVOLUTION_SDK_ROOT/x86/bin/tickleBI3 -o "$i" 0x0 ${CPARA}
49        then
50            echo "Failed to set the country code on disc."
51            exit 1
52
53        fi
54    done
55    if [ -e $REVOLUTION_SDK_ROOT/x86/bin/wbi.bin ]
56    then
57        if ! $REVOLUTION_SDK_ROOT/x86/bin/tickleWBI "$REVOLUTION_SDK_ROOT/X86/bin/wbi.bin" -c ${CPARA}
58        then
59            echo "Failed to set the contry code for nand application."
60            exit 1
61	fi
62    fi
63    echo "Successfully done. Set the country code for the disc to ${CNAME}."
64fi
65
66echo
67echo "**********************************************************************"
68echo "* If you make master data, you must execute ndrun before you do so!! *"
69echo "**********************************************************************"
70echo
71