1#!/usr/bin/bash
2
3if [ $# -eq 0 ]
4then
5    echo "usage: setpcode [0|4]"
6    echo "Sets the pcode for disc application."
7    exit 0
8fi
9
10if [ $1 != "0" -a $1 != "4" ]
11then
12    echo "Illegal argument. Do nothing and exit."
13    exit 1
14fi
15
16if   [ $1 = "0" ]
17then
18    PPARA=0x0
19elif [ $1 = "4" ]
20then
21    PPARA=0x4
22fi
23
24for i in "$REVOLUTION_SDK_ROOT"/X86/bin/rvl*.bin
25do
26    if [ -e $i ]
27    then
28        if ! $REVOLUTION_SDK_ROOT/x86/bin/rvlbinconv -f "$i" -pc $PPARA
29        then
30            echo "Failed to set the pcode for disc application."
31            exit 1
32        fi
33    fi
34done
35echo "Successfully done. Set the pcode for disc application to $1."
36
37echo
38echo "**********************************************************************"
39echo "* If you make master data, you must execute ndrun before you do so!! *"
40echo "**********************************************************************"
41echo
42