1#!/usr/bin/env bash
2# Version 8/28/2012
3
4###############################################################################
5#
6# Copyright (C) 2009-2013 Nintendo.  All rights reserved.
7#
8# These coded instructions, statements, and computer programs contain
9# proprietary information of Nintendo of America Inc. and/or Nintendo
10# Company Ltd., and are protected by Federal copyright law.  They may
11# not be disclosed to third parties or copied or duplicated in any form,
12# in whole or in part, without the prior written consent of Nintendo.
13#
14###############################################################################
15
16#######################################################################
17# File: MionHddDelete.sh
18#
19# Purpose:  This script will "format" the HostBridge Hard Drive,
20#           by uploading a HelloWorld WUM image to all the banks in MION
21#
22# NOTE:     Please treat it as reference code and feel free to edit it to
23#           match/blend into your existing automation
24########################################################################
25
26
27
28#######################################
29# Script variables
30#######################################
31OUT_PATH=$CAFE_ROOT/discimages
32MAKEMASTER=$CAFE_ROOT/system/bin/tool/mastering/makemaster.exe
33MION_HDD_BANK_START=0
34MION_HDD_BANK_END=10
35RUN_TIME=25
36MASTER_RPX="$CAFE_ROOT/system/bin/ghs/cafe/demo/helloworld/NDEBUG/helloworld.rpx"
37WUM_FILE_NAME=$(basename $MASTER_RPX .rpx)
38
39#######################################
40# Disc Image Out Path Directory check
41#######################################
42if [ ! -d $OUT_PATH ]; then
43	mkdir $CAFE_ROOT/discimages
44fi
45
46#######################################
47# Demo Application Prep
48#######################################
49cd $OUT_PATH
50caferun $MASTER_RPX &
51	sleep $RUN_TIME
52	kill $!
53cafestop
54
55#######################################
56# Mastering & Padding
57#######################################
58makecfmaster.sh -r $MASTER_RPX -o $WUM_FILE_NAME
59makecfdiscimage.sh -i $WUM_FILE_NAME.wumad
60
61#######################################
62# Main Deletion Process
63#######################################
64while [[ $MION_HDD_BANK_START -le $MION_HDD_BANK_END ]]; do
65	echo "Currently deleting MION Bank Number: $MION_HDD_BANK_START"
66    echo "Please be patient... this operation takes roughly 30 minutes, and needs to be done 11 times"
67	uploadimg.sh $MION_HDD_BANK_START $WUM_FILE_NAME.wum $BRIDGE_CURRENT_IP_ADDRESS
68	let "MION_HDD_BANK_START+=1"
69done
70echo "Done"
71exit 0
72
73