This is a sub-page of LeapPad Explorer.
|
|
This page or section needs more images. |
|
|
To do: |
There is a test mode that can be accessed by holding down both volume buttons (Volume Up and Volume Down) while booting the LeapPad. Let go when you see the words "Test Mode" appear on-screen (after the LeapFrog sound is heard). It will then proceed to the test menu.
The menu itself has a rather unusual control style: you need to press certain buttons (or button combinations) to select an item, instead of the usual cursor-and-OK-button control style that you'd expect. The odd control style is likely because the test menu itself is essentially just a bash script, as well as the fact that the LeapPad lacks an "enter" or "OK" button (although the Home button could have worked just as well for this purpose.)
Each menu usually houses a sub-menu of some kind, which you can exit by pressing Home.
Powering off the system in this menu shows a placeholder image that says "Shuting down, Please Wait....." Interestingly, this image does not take up the full screen.
Watch on YouTubeWatch on YouTube
Tests
Button Test#
Accessible on the main menu by pressing Up on the D-Pad. It's basically what it says on the tin. Strangely, the text for "Volume Up" seems to change to "Volume UP" (with an uppercase P) after pressing it, although this is likely a mistake, as no other buttons have their text change after pressing them.
Audio test#
Accessible on the main menu by pressing Down on the D-Pad. Enters a sub-menu where you can test the speakers or headphones by playing white noise (D-Pad up), a 1 KHz sine wave (D-Pad down), left channel test (D-Pad left), and right channel test (D-Pad right). Pressing a button causes text to appear stating what sound is being played. Also visible at the bottom of the screen is text stating whether headphones are connected to the unit or not.
LCD & Touch Screen Tests#
|
|
To do: |
Accessible on the main menu by pressing Left on the D-Pad. Enters a sub-menu where you can test the LCD display (D-Pad up), calibrate the touch screen (D-Pad down), test touch screen linearity (D-Pad left), run an RMS test (Volume Up), or run every test except the first one, one after another (Volume Down).
The LCD Test lets you cycle through 6 tests. On all six, you can adjust the brightness between 4 different levels. The first 3 show the colors red, blue or green along with some text with the controls. The next test makes the screen go black, with no text on it. The 5th test is a purely white screen, presumably used for looking for dead pixels. The final test is the Backlight test, which when first shown flashes between a high brightness and the lowest brightness. The brightness test shows a screen with four different color gradients (those being white, blue, green then red) and the text from the first 3 tests.
Notably, the touch screen calibration seems to be more difficult and precise in the test mode, likely due to it being a manufacturing tool rather than a user-facing calibration tool. The user-facing one, accessible via the Parent Menu (Volume Up + Down on the sign-in screen, outside of Test Mode), seems to be much more lenient.
Power Circuit Tests#
|
|
To do: |
Accessible on the main menu by pressing Right on the D-Pad. Enters a sub-menu where you can test power-related functionality, such as the AC adapter and low-battery detection. The menu has info showing the current power source, the battery level in millivolts, and on LeapPad 2 units, whether the rechargeable battery packs are detected. From here, you can access an operating current test (D-Pad up), standby current test (D-Pad down), and a sleep current test (D-Pad left).
GPIO/Cartridge Tests#
Accessible on the main menu by pressing Volume Up and D-Pad up at the same time. Enters a sub-menu where you can validate the current inserted cartridge and display its info (D-Pad down), turn the power button LED on (Volume Up), or turn the power button LED off (Volume Down).
Backlight & ADC Calibration#
|
|
To do: |
Accessible on the main menu by pressing Volume Up and D-Pad down at the same time. Presumably brings you to a sub-menu where you can calibrate the backlight and whatever the "ADC" is.
Validate Base (NOR, Mfg & NAND)#
|
|
To do: |
Accessible on the main menu by pressing Volume Up and D-Pad left at the same time. Presumably validates base operating system data, the manufacturing test itself, and possibly the NAND chip.
Special Commands#
|
|
To do: |
Accessible on the main menu by pressing Volume Up and D-Pad right at the same time. Enters a sub-menu containing commands that perform actions such as resetting the unit (Volume Up + D-Pad up), toggling automatically entering the MFG test on boot (Volume Up + D-Pad down), removing the MFG test from the unit entirely (hold Volume Up + Home for 2 seconds), copying the MFG test to a cartridge (D-Pad up), testing button sensitivity (D-Pad down), a secondary touch screen "line drawing" test (D-Pad left), Wi-Fi test (D-Pad right; interesting because neither the LeapPad 1 nor 2 actually have WiFi functionality), and a touch screen raw data test (Volume Up + D-Pad right).
The line drawing test (which mentions a "Mr.Brush" in the menu, perhaps incorrectly referencing the LeapFrog character Mrs. Brush?) is a simple application that lets you draw on the screen with pressure sensitive inputs.
The WiFi test displays a screen which says "TEST WIFI" and then says the test failed, likely because the first and second-generation LeapPad models lack WiFi hardware (which wouldn't be added until the LeapPad3, which is different under the hood, and thus does not have this test). The presence of this test implies that WiFi capability was originally planned for the first and second-gen devices, but scrapped.
The button sensitivity screen lets you see if the arrows or home button being pressed, along with how many times they have been pressed since starting the test.
Accelerometer Calibration#
Accessible on the main menu by pressing Volume Down and D-Pad right at the same time. Enters a combined calibration and test where you need to hold the unit in certain positions, and press the D-Pad up button when the unit is in that position. The unit will briefly beep when calibration for that position is done, and will move onto the next position. If you hold it in the wrong position while calibrating, it will play a buzzer sound. Hold it the wrong way enough times and the test will fail.
Interestingly, the fact that it can validate these positions as you calibrate it suggests that it has some sort of baseline knowledge of what each position should be.
Accelerometer Test#
|
|
To do: |
Accessible on the main menu by pressing Volume Down and D-Pad up at the same time. Currently undocumented, but presumably tests the device's accelerometer.
Microphone Test#
Accessible on the main menu by pressing Volume Down and D-Pad down at the same time. Enters a test where it will record from the microphone for 3 seconds, and allow you to play back the recording with D-Pad down, or re-record with D-Pad up. The recording is stored in the file /LF/Base/MadridMfgTest/micRecord.wav.
Camera Test#
|
|
To do: |
Accessible on the main menu by pressing Volume Down and D-Pad left at the same time. Currently undocumented.
Files
Some interesting files located in the MfgTest folder, /LF/Base/MadridMfgTest/.
CameraConfig.txt#
' File: CameraAppConfig.txt June 07, 2010
'
' File format:
' o Labels begin with "_" character.
' o Only lines that begin with '_' are evaluated, all others ignored.
'
' Last Updated: 6/16/2011
'
'====================================================================
' These parameters are used by the script
'====================================================================
_Enable_Test_Menu = 1; ' non-zero will display a menu on startup to select tester type. 0 will run as configured below.
' These settings will be overridden by the menu selection if enabled above
' *************************************************************************
_Enable_Video_Test = 1; ' non-zero will enable the video test, 0 will skip the video test (default is enabled if missing)
_Enable_Audio_Test = 1; ' non-zero will enable the audio test, 0 will skip the audio test (default is enabled if missing)
'***************************************************************************
_Auto_Snapshot_Mode = 0; ' non-zero means will automatically take a snapshot Snapshot_Time seconds after starting the test, default enabled if missing
_Snapshot_Time = 7; ' Time after starting the video that it will take a snapshot, minimum 7 seconds, default 10 if missing
_Audio_Self_Test = 0; ' If non-zero, will play the 1KHz tone from speaker during test. Default enabled if missing
_Prompt_Audio_Test = 0; ' Non zero will wait for operator to press A button to start Audio Test. 0 is automatic start test.
' This is overridden by the Audio Only menu selection to always prompt if Audio ONLY test is selected
_Audio_Power_Max_Limit = 0.075; ' This is the maximum limit for the Audio Power Level
_Audio_Power_Min_Limit = 0.001; ' This is the minimum limit for the Audio Power Level
'====================================================================
' These parameters are used by the Camera App
'====================================================================
_DebugLevel= 5; ' kDbgLvlSilent = 0, kDbgLvlCritical = 1, kDbgLvlImportant = 2,
' ' kDbgLvlValuable = 3, kDbgLvlNoteable = 4, kDbgLvlVerbose = 5
_ImageHoldTime_Sec = 2;
_MaxNumEdges = 20; ' Max. number of edges to be recorded
_ExpectedNumVEdges = 14; ' Expected number of vertical edges
_MinNumHEdges = 10; ' min # of horizontal edges
_VEdgePeakThreshold = 250; ' Threshold for vertical edges- abs(gradx) in Log Report
_HEdgePeakThreshold = 250; ' Threshold for vertical edges- abs(grady) in Log Report
_EdgeWidthMax_Pixels = 5; ' pixels
_EdgeWidthValidation = 0; ' non-zero to enable
_EdgePeakSearchRange_Pixels = 5;
_LogFilePath = "/mfgdata"; ' Directory path for the test log files -- directory must exist
_OnePhotoMode = 0; ' if non-zero, program exits after capturing and analyzing 1 photo
' Default: true
_EngMode = 0; ' non-zero to enable all functions, zero to disable all but photo-capture & analysis mode
' Default: false
_ImageRowNum = 280; ' Image row # to be analyzed
' Offsets for the image alignment markers
_ImageAlignmentMarkerColOffset = 20;
_ImageAlignmentMarkerRowOffset = 15;
'-----------------------------------------------------
' Color content (PP Limits based on FEP data using LF Color Chart via WBG)
'-----------------------------------------------------
' Blue
_BlueColor_R_Min = 76;
_BlueColor_R_Expected = 117; // Expected Red component
_BlueColor_R_Max = 139;
_BlueColor_G_Min = 101;
_BlueColor_G_Expected = 177;
_BlueColor_G_Max = 229;
_BlueColor_B_Min = 230; // Primary detected color w/ tight limits
_BlueColor_B_Expected = 255;
_BlueColor_B_Max = 255;
' Green
_GreenColor_R_Min = 40;
_GreenColor_R_Expected = 124;
_GreenColor_R_Max = 186;
_GreenColor_G_Min = 230;
_GreenColor_G_Expected = 255; // Primary detected color w/ tight limits
_GreenColor_G_Max = 255;
_GreenColor_B_Min = 0;
_GreenColor_B_Expected = 72;
_GreenColor_B_Max = 164;
' Red
_RedColor_R_Min = 230;
_RedColor_R_Expected = 255; // Primary detected color w/ tight limits
_RedColor_R_Max = 255;
_RedColor_G_Min = 126;
_RedColor_G_Expected = 152;
_RedColor_G_Max = 180;
_RedColor_B_Min = 61;
_RedColor_B_Expected = 87;
_RedColor_B_Max = 120;
''-----------------------------------------------------
'' Color content (FEP Limits)
''-----------------------------------------------------
'' Blue
'_BlueColor_R_Min = 27;
'_BlueColor_R_Expected = 49; // Expected Red component
'_BlueColor_R_Max = 71;
'_BlueColor_G_Min = 43;
'_BlueColor_G_Expected = 67;
'_BlueColor_G_Max = 91;
'_BlueColor_B_Min = 112;
'_BlueColor_B_Expected = 160;
'_BlueColor_B_Max = 208;
'' Green
'_GreenColor_R_Min = 49;
'_GreenColor_R_Expected = 72;
'_GreenColor_R_Max = 95;
'_GreenColor_G_Min = 118;
'_GreenColor_G_Expected = 161;
'_GreenColor_G_Max = 205;
'_GreenColor_B_Min = 8;
'_GreenColor_B_Expected = 39;
'_GreenColor_B_Max = 70;
'' Red
'_RedColor_R_Min = 200;
'_RedColor_R_Expected = 254;
'_RedColor_R_Max = 255;
'_RedColor_G_Min = 35;
'_RedColor_G_Expected = 68;
'_RedColor_G_Max = 100;
'_RedColor_B_Min = 28;
'_RedColor_B_Expected = 49;
'_RedColor_B_Max = 71;
Flash Movies#
|
|
To do: |
Multiple .swfs are present in the folder, some of them going unused. Note that these have only been tested on Flash Player on Windows.
- buttonTester.swf: An unused button test. The final version of MfgTest uses a text-based one instead. Doesn't function in standard Flash Player.
- calibrate.swf: An unused touch screen calibration tool, with its theming more closely resembling the non-test-mode version of the tool, sporting a gradient background. Seems to loop infinitely when opened on standard Flash Player.
- LinearityTest.swf: A touch screen linearity test, likely what is launched when pressing D-Pad left twice. Works fine on Flash Player, aside from the quit button.
- RMSTest.swf: Another touch screen test. Works fine on Flash Player, including displaying results at the end, but the quit button doesn't do anything.
- RMSTestX.swf: Seemingly a duplicate of the previous file. The file size is different (10.7 KB as opposed to the previous file's 10.8 KB), but there doesn't seem to be any major changes.
Bash Scripts#
|
|
To do: |
These scripts are likely what power some of the special commands and tests. Some of them don't seem to be unused, so they're just documented here for completeness' sake.
BackLightCal.sh#
#!/bin/sh
#####################################################################
# BackLight.sh file for calibration of Backlight (manual and auto)
# Written by Nathan Durrin
#
# Function: This script will allow the user to automatically calibrate
# the backlight or alternately manually calibrate the minimum
# backlight setting.
#
# Revision Table..................................................
# Date Rev Author Change
# ----------------------------------------------------------------
# 05/20/09 001 N.Durrin Initial release with rev box
# 05/28/09 002 N.Durrin Added the ability to run from utility mode
# Added the switch to run in user mode or mfg mode
# 06/05/09 003 N.Durrin Made setting able to go to NOR.
# 08/04/09 004 N.Durrin COnverted to Manual ONLY for MadridMfgTest
# 09/18/09 005 N.Durrin Added error messages, fixed path bug.
# 11/25/09 006 N.Durrin Fixed bug in path that caused test to startup slow.
# 09/14/10 007 N.Durrin Added new support for frame buffer
# Changed monotext path to /var/fonts from /test
# 12/09/10 008 N.Durrin Update to support Emerald CIP with LF100 chip
# 02/23/10 009 W. Greger Change to Madrid Buttons
######################################################################
FILE_REV="009"
DEBUG_ON=1
echo "Starting BackLight Calibration revision $FILE_REV."
set -x
rm -f /tmp/BLCalResult
rm -f /tmp/BackLightCalResult
if [ -e /sys/class/graphics ]; then
IMAGER_CMD="imager-fb /dev/fb0"
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
BACKLIGHT_FILE="/sys/class/backlight/lf1000-pwm-bl/brightness"
BACKLIGHT_METHOD="1" # New method
MAX_BL_SETTING="`cat /sys/class/backlight/lf1000-pwm-bl/max_brightness`"
MIN_BL_SETTING="0"
else
IMAGER_CMD="imager /dev/layer0"
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
BACKLIGHT_FILE="/sys/devices/platform/lf1000-dpc/backlight"
BACKLIGHT_METHOD="0" # Original method
MAX_BL_SETTING="127"
MIN_BL_SETTING="-128"
fi
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
$DRAWTEXT_CMD " " $i 0 0
done
$DRAWTEXT_CMD " Starting the Manual Backlight Cal" 6 0 0
BL_ADDRESS="28" #decimal byte location of starting backlight value
BL_LENGHT="4" # number of bytes of the backlight.
MFG_PART="/dev/`cat /proc/mtd | grep MfgData0 | cut -d : -f 1`"
MFG_SCRATCH="/dev/`cat /proc/mtd | grep MfgData1 | cut -d : -f 1`"
USER_PART="/flags"
if [ $DEBUG_ON ] ; then
echo "Mfg0=$MFG_PART, Mfg1=$MFG_SCRATCH, User=$USER_PART"
fi
# this script can be called in customer mode (by default), which will directly go to manual mode and only write
# the customer settable settings on the NAND /flags partition.
# It can also be run in Mfg Mode which will write the settings to the NOR
# Invoke the script with the -m flag to run in mfg mode.
MODE="user"
while getopts "um" opt; do
case "$opt" in
"m")
MODE="mfg"
;;
"?")
echo "BackLight <mode>"
echo " m mfg mode sets FACTORY DEFAULTS in /mfgdata"
echo " u [default] sets user defaults in /flags"
echo " u is assumed if no <mode> is passed."
exit 0
;;
"u")
MODE="user"
;;
*)
MODE="user"
echo "Invalid option. Running but assuming user mode <-u>"
;;
esac
done
#Gets the path for the screens.
echo "getting path for screens"
$DRAWTEXT_CMD " finding path for test..please wait" 8 0 0
PROG_PATH="."
if [ "`ls | grep -c BackLightCal.sh`" -eq "0" ] ; then
if [ -e /LF/Base/MadridMfgTest/BackLightCal.sh ] ; then
PROG_PATH="/LF/Base/MadridMfgTest/"
elif [ -e /LF/Cart/MadridMfgTest/BackLightCal.sh ] ; then
PROG_PATH="/LF/Cart/MadridMfgTest/"
else
PROG_PATH="`find -name BackLightCal.sh -exec dirname {} \;`"
fi
fi
if [ $DEBUG_ON ] ; then
echo "Program Path: $PROG_PATH"
fi
#gets the current backlight calibration values
get_backlight_cal () {
if [ $MODE = "mfg" ] ; then
CUR_BL_CAL="`cat $MFG_PART | head -c 32 | tail -c 4`"
if [ "`echo $CUR_BL_CAL`" -le "128" ] ; then
#if [ -e /mfgdata/backlight.cal ] ; then
#CUR_BL_CAL="`cat /mfgdata/backlight.cal`"
echo "$CUR_BL_CAL"
else
echo "255"
fi
else
if [ -e /flags/backlight.cal ] ; then
CUR_BL_CAL="`cat /flags/backlight.cal`"
echo "$CUR_BL_CAL"
else
echo "255"
fi
fi
return 0
}
#writes the backlight calibration value to the correct place
set_backlight_cal () {
BACKLIGHT_CAL_VAL=$1
if [ "`echo $BACKLIGHT_CAL_VAL`" = "NONE" ] ; then
if [ $MODE = "mfg" ] ; then
#flashcp - /dev/mtd8
rm -rf /mfgdata/backlight.cal
else
rm -rf /flags/backlight.cal
fi
return 0
fi
if [ $MODE = "mfg" ] ; then
#echo $BACKLIGHT_CAL_VAL | flashcp - /dev/mtd8
echo $BACKLIGHT_CAL_VAL > /mfgdata/backlight.cal
echo "Setting the default setting to $BACKLIGHT_CAL_VAL in NOR"
else
echo $BACKLIGHT_CAL_VAL > /flags/backlight.cal
echo "Setting the default setting to $BACKLIGHT_CAL_VAL in /flags"
fi
return 0
}
#display's screen
set_screen () {
SCREEN_NAME=$1
if [ "$BACKLIGHT_METHOD" != "0" ] ; then
display_screen $PROG_PATH/rsrc/$SCREEN_NAME
else
layer-control /dev/layer0 s enable off
layer-control /dev/layer0 s format B8G8R8
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s position 0 0 480 272
layer-control /dev/layer0 s dirty
$IMAGER_CMD $PROG_PATH/rsrc/$SCREEN_NAME
layer-control /dev/layer0 s enable on
layer-control /dev/layer0 s dirty
fi
return 0
}
#reads the button requested to see if it is pressed or not
#returns "pressed" if button is pressed, returns "unpressed" if not.
#Returns 99 and prints help if something was wrong with function call.
read_button () {
BUTTON_NAME=$1
SUPPORTED_BUTTONS="up down right left home"
BUTTON_CONFIGS="up:2:4 down:0:29 right:2:3 left:0:28 home:2:6" #for Madrid including name, port, and bit
#BUTTON_CONFIGS="up:9 down:0 a:3 b:11 pause:4" #for Madrid
#BUTTON_CONFIGS="up:11 down:1 a:7 b:6 pause:12" #for Acorn
print_help() {
echo "Usage: $0 <button>"
echo "button can be any of:" $SUPPORTED_BUTTONS
echo "prints either pressed unpressed depending on button status."
}
if [ "$BUTTON_NAME" = "" ]; then
print_help
return 99
fi
BUTTON=""
for b in $BUTTON_CONFIGS; do
B=`echo $b | cut -d : -f 1`
if [ "$B" = "$BUTTON_NAME" ]; then
BUTTON=$B
PORT=`echo $b | cut -d : -f 2`
GPIO=`echo $b | cut -d : -f 3`
break
fi
done
if [ "$BUTTON" = "" ]; then
print_help
return 99
fi
NOT_PRESSED=`gpio-control /dev/gpio invalue $PORT $GPIO | grep value | cut -d = -f 2`
if [ "$NOT_PRESSED" = 1 ]; then
echo unpressed
return 0
elif [ "$NOT_PRESSED" = 0 ]; then
echo pressed
return 0
else
print_help
return 99
fi
}
# remount rootfs as read/write
mount -o remount,rw /
if [ -e gpio-control ] ; then
echo "Updating the gpio-control."
cp gpio-control /usr/bin
fi
original="`cat $BACKLIGHT_FILE`"
if [ $DEBUG_ON ] ; then
echo "Current Backlight Setting: $original"
fi
if [ "$BACKLIGHT_METHOD" = "0" ] ; then
BL_VALUE=-22
else
BL_VALUE=$(((-22+128)*2))
fi
echo $BL_VALUE > $BACKLIGHT_FILE
#CURRENT_BL_CAL_VALUE="255"
#CURRENT_BL_CAL_VALUE="`get_backlight_cal`"
#if [ $DEBUG_ON ] ; then
# echo "Current Backlight Calibration value returned: $CURRENT_BL_CAL_VALUE"
#fi
#set_backlight_cal "NONE"
rm -f /tmp/BLCalResult
rm -f /tmp/BackLightCalResult
#if [ -e /mfgdata/backlight.cal ] ; then
# CURRENT_BL_CAL_VALUE="`cat $WRITE_PATH/backlight.cal`"
# rm -f $WRITE_PATH/backlight.cal
#fi
#if [ $MODE = "mfg" ] ; then
# set_screen BLCal.png
# echo "Auto Calibration: Press LEFT to enter Manual Mode or HOME to exit"
#
# while [ "`read_button right`" != "pressed" ] ; do
# #set_screen BLCal.png
# if [ "`read_button home`" = "pressed" ] ; then
# echo "Backlight Calibration ABORTED! Restoring original if necessary..."
# if [ $CURRENT_BL_CAL_VALUE != "255" ] ; then
# set_backlight_cal "$CURRENT_BL_CAL_VALUE"
# fi
# set_screen BLCal_ABORT.png
# exit 0
# fi
# temp_value="`get_backlight_cal`"
#
# if [ "$temp_value" != "255" ] ; then
# set_screen "BLCal_PASS.png"
# echo "Calibration is set to $temp_value"
# exit 0
# fi
# done
#fi
# display Manual Backlight Calibration screen
#set_screen "ManBacklightCal_start.png"
#while [ "`read_button a`" = "pressed" ] ; do
# date > /tmp/NULL
#done
echo "Press the UP Arrow to increase the brightness,"
echo "Press the DOWN Arrow to decrease brightness,"
echo "Press the RIGHT button to accept the setting as the default."
echo "Press the HOME button to abort the test without saving."
echo "Adjust the screen to the first setting you can see the"
echo " grey box on the bottom."
echo "Press LEFT to switch screens "
echo " "
SCREEN="contrast_bw.png"
set_screen $SCREEN
while [ "`read_button home`" != "pressed" ] ; do
#set_screen $SCREEN
if [ "`read_button right`" = "pressed" ] ; then
set -x
#echo "$original" > $BACKLIGHT_FILE
#set_backlight_cal "$BL_VALUE"
#set_screen "BLCal_PASS.png"
if [ "$BACKLIGHT_METHOD" = "0" ] ; then
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
else
BL_VALUE=$(($BL_VALUE/2-128))
fi
echo "BL Cal Value: $BL_VALUE" > /tmp/BackLightCalResult
echo "PASS" > /tmp/BLCalResult
exit 0
elif [ "`read_button up`" = "pressed" ] ; then
#set_screen $SCREEN
set -x
BL_VALUE=`expr $BL_VALUE + 5`
if [ $BL_VALUE -gt "$MAX_BL_SETTING" ] ; then
BL_VALUE=$MAX_BL_SETTING
echo "Backlight is at its max setting ($BL_VALUE)."
fi
echo "Setting backlight setting to $BL_VALUE."
echo $BL_VALUE > $BACKLIGHT_FILE
elif [ "`read_button left`" = "pressed" ] ; then
set -x
if [ $SCREEN = "contrast_bw.png" ] ; then
SCREEN="contrast_colors.png"
set_screen $SCREEN
else
SCREEN="contrast_bw.png"
set_screen $SCREEN
fi
elif [ "`read_button down`" = "pressed" ] ; then
#set_screen $SCREEN
set -x
BL_VALUE=`expr $BL_VALUE - 15`
if [ $BL_VALUE -lt $MIN_BL_SETTING ] ; then
BL_VALUE=$MIN_BL_SETTING
echo "Backlight is at its minimum ($BL_VALUE)."
fi
echo "Setting backlight setting to $BL_VALUE."
echo $BL_VALUE > $BACKLIGHT_FILE
fi
set +x
done
set -x
#echo $original > $BACKLIGHT_FILE
#set_screen "BLCal_ABORT.png"
echo "Backlight calibration aborted!!"
#if [ "`echo $CURRENT_BL_CAL_VALUE`" != "255" ] ; then
# set_backlight_cal "$CURRENT_BL_CAL_VALUE"
#fi
echo "USER ABORTED" > /tmp/BackLightCalResult
echo "FAIL" > /tmp/BLCalResult
date
if [ "$BACKLIGHT_METHOD" = "0" ] ; then
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
fi
exit 1
;;
exit 0
DeleteMfg.sh#
#!/bin/sh
# This file will delete the Mfg Test from the unit ONLY. It will NOT delete it from the ATAP.
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ `cat /sys/devices/platform/lf1000-gpio/board_id` != 3 ]; then
ATAP=1
echo "Unable to run this test when booted from the ATAP. Must boot from the Device NAND"
echo "Booted from ATAP, Refuse to delete." > /tmp/DeleteMfgResult
exit 1
fi
fi
echo "Removing the flags main_app and no8sec"
rm -f /flags/main_app
rm -f /flags/no8sec
if [ -e /test/made_by_mfg_test ] ; then
rm -rf /test
elif [ -L /test/monotext8x16.rgb ] ; then
rm -f /test/monotext8x16.rgb
fi
echo "Removing the whole /LF/Base/MadridMfgTest directory"
rm -rf /LF/Base/MadridMfgTest
if [ -e /flags/main_app -o -e /flags/no8sec -o -d /LF/Base/EmeraldMfgTest ] ; then
echo "FAILED - the files were not removed successfully"
echo "FAILED - Could not remove mfg test" > /tmp/DeleteMfgResult
exit 1
fi
echo "Mfg Test removed SUCCESSFULLY" > /tmp/DeleteMfgResult
exit 0
DisableMfg.sh#
#!/bin/sh
# This file will enable/disable the Mfg Test from the unit ONLY. It will NOT delete it from the ATAP.
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ `cat /sys/devices/platform/lf1000-gpio/board_id` != 3 ]; then
ATAP=1
echo "Unable to run this test when booted from the ATAP. Must boot from the Device NAND"
echo "Booted from ATAP, Refuse to disable." > /tmp/DisableMfgResult
exit 1
fi
fi
if [ -e /flags/main_app ] ; then
if [ "`cat /flags/main_app | grep -c MfgTest`" -ge "1" ] ; then
rm -f /flags/main_app
rm -f /flags/no8sec
echo "Mfg Test disabled SUCCESSFULLY" > /tmp/DisableMfgResult
exit 0
else
echo "Mfg Test not enabled" > /tmp/DisableMfgResult
exit 0
fi
else
if [ -e /LF/Base/MadridMfgTest/LaunchMfgTest.sh ] ; then
echo "/LF/Base/MadridMfgTest/LaunchMfgTest.sh" > /flags/main_app
touch /flags/no8sec
echo "Re-enabled Mfg Test" > /tmp/DisableMfgResult
exit 0
else
echo "Mfg Test not installed on unit."
echo "Mfg Test not installed on unit" > /tmp/DisableMfgResult
exit 1
fi
fi
EmeraldTestMenu.sh#
This file is what seems to power the brunt of the test menu.
#!/bin/sh
set -x
#if [ ! -e /test/monotext8x16.rgb -a -e /var/fonts/monotext8x16.rgb ] ; then
# cp -s /var/fonts/monotext8x16.rgb /test
#fi
if [ ! -e /var/fonts/monotext8x16.rgb -a -e /test/monotext8x16.rgb ] ; then
mkdir -p /var/fonts
cp -s /test/monotext8x16.rgb /var/fonts
fi
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
LAYER_CONTROL="0" #"fbctrl /dev/fb0"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
LAYER_CONTROL="1" #"layer-control /dev/layer0"
fi
FW_VER="`cat /etc/version`"
SUPER_ATAP_VERSION="7.0 (FW:$FW_VER)"
if [ ! -d /test ] ; then
mkdir -p /test
touch /test/made_by_mfg_test
fi
mkdir -p /mfgdata
if [ "`ls /LF/Base/MadridMfgTest | grep -c Testmenu.png`" -ge "1" ] ; then
PROG_PATH="/LF/Base/MadridMfgTest"
else
PROG_PATH="`find -name Testmenu.png -exec dirname {} \;`"
fi
MFGTEST_VER="`cat $PROG_PATH/meta.inf | grep '^Version' | cut -d '"' -f2`"
display_screen $PROG_PATH/Testmenu.png
$DRAWTEXT_CMD "SuperATAP v.$SUPER_ATAP_VERSION" 0 0 0
$DRAWTEXT_CMD "LFT_SHLDR = Program NOR " 3 3 1
$DRAWTEXT_CMD "RT_SHLDR = Program NAND " 5 3 1
$DRAWTEXT_CMD "A = Run MfgTest v.$MFGTEST_VER " 7 3 1
$DRAWTEXT_CMD "B = Get frlog & core dumps " 9 3 1
$DRAWTEXT_CMD " " 10 3 0
$DRAWTEXT_CMD "PAUSE = Exit and power off " 11 3 1
TIME_START=`date +%s`
BULK_READY=0
( while [ "`mount | grep -c /LF/Bulk`" -lt "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "10" ] ; then
echo "Failed to mount /LF/Bulk. Unable to program device. You can still run Mfg Test."
$DRAWTEXT_CMD "ERROR: Unable to mount /LF/Bulk" 12 1 0
$DRAWTEXT_CMD "Unable to program device." 13 2 0
fi
done
NOR_VER="`get-bootstrap-version < /LF/Bulk/payload/emerald-boot.bin`"
if [ "X$NOR_VER" = "X" ] ; then
NOR_VER="`strings /LF/Bulk/payload/emerald-boot.bin | grep -m 1 VERSION: | cut -d: -f2-`"
if [ "X$NOR_VER" = "X" ] ; then
NOR_VER="`grep -m 1 EB[0-9] /LF/Bulk/payload/emerald-boot.bin`"
fi
fi
$DRAWTEXT_CMD "Contains NOR version: $NOR_VER" 12 1 0
if [ -f /LF/Bulk/payload/erootfs.ubi ] ; then
EROOT_FILE="erootfs.ubi"
elif [ -f /LF/Bulk/payload/erootfs-mfg.ubi ] ; then
EROOT_FILE="erootfs-mfg.ubi"
fi
if [ ! -e /LF/Bulk/payload/Version.txt ] ; then
$DRAWTEXT_CMD "Checking FW version...." 13 1 0
strings /LF/Bulk/payload/$EROOT_FILE | grep -m 1 "^[0-9]*\.[0-9]*\.[0-9]*-[0-9][0-9][0-9][0-9]*" > /LF/Bulk/payload/Version.txt
#grep -m 1 "[0-9]\.[0-9]\.[0-9]-[0-9][0-9][0-9][0-9]" /LF/Bulk/payload/$EROOT_FILE > /LF/Bulk/payload/Version.txt
fi
FW_VER="`cat /LF/Bulk/payload/Version.txt`"
$DRAWTEXT_CMD "Contains FW version: $FW_VER" 13 1 0
) &
#gpio-control /dev/gpio invalue 2 $GPIO | grep value | cut -d = -f 2
while [ "`gpio-control /dev/gpio invalue 2 4 | grep value | cut -d = -f 2`" -eq "1" ] ; do #PAUSE Button
if [ "`gpio-control /dev/gpio invalue 2 3 | grep value | cut -d = -f 2`" -eq "0" ] ; then # A button
set -x
$DRAWTEXT_CMD "Starting Mfg test........." 7 3 1
if [ "$LAYER_CONTROL" -eq "1" ] ; then
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
else
echo "Using new fbctrl......"
#$LAYER_CONTROL s hstride 4 #3 #4
#$LAYER_CONTROL s vstride 1280 #960
#$LAYER_CONTROL s dirty
fi
chmod -R +x $PROG_PATH
rm -f /flags/pointercal
/etc/init.d/touchscreen restart > /dev/NULL
if [ "`cat $PROG_PATH/rsrc/MadridMfgTestConfig.txt | grep ^_SkipBoardRevValidation | tr -s ' ' | tr -d ' ' | cut -d ';' -f1 | cut -d '=' -f2`" -ne "1" ] ; then
#if [ ! -e $PROG_PATH/rsrc/config.bak ] ; then
cp -f $PROG_PATH/rsrc/MadridMfgTestConfig.txt $PROG_PATH/rsrc/config.bak
cat $PROG_PATH/rsrc/config.bak | grep -v ^_SkipBoardRevValidation > $PROG_PATH/rsrc/MadridMfgTestConfig.txt
echo "_SkipBoardRevValidation=1;" >> $PROG_PATH/rsrc/MadridMfgTestConfig.txt
sync
fi
$PROG_PATH/LaunchMfgTest.sh &
exit 0
elif [ "`gpio-control /dev/gpio invalue 2 13 | grep value | cut -d = -f 2`" -eq "0" ] ; then # LFT-SHOULDER
set -x
#set_screen Testmenu.png
$DRAWTEXT_CMD " " 3 3 0
if [ ! "`mount | grep -c /LF/Bulk`" -eq "1" ] ; then
echo "BULK Partition not yet ready...please wait and try again"
$DRAWTEXT_CMD "Bulk not ready yet..try again" 3 3 1
continue
fi
$DRAWTEXT_CMD "Programming NOR........... " 3 3 1
NOR_DEV="/dev/`cat /proc/mtd | grep NOR_Boot | cut -d : -f1`"
if [ -e /LF/Bulk/payload/emerald-boot.bin ] ; then
mfgmode.sh 9
flashcp -v /LF/Bulk/payload/emerald-boot.bin $NOR_DEV
RESULT="`echo $?`"
mfgmode.sh 0
if [ $RESULT -eq "0" ] ; then
$DRAWTEXT_CMD "Programming NOR: SUCCESS " 3 3 1
else
echo "ERROR: Program to NOR failed"
$DRAWTEXT_CMD "FAILED: Programming failed " 3 3 1
fi
else
echo "ERROR: No payload found to program to NOR"
$DRAWTEXT_CMD "FAILED: No file to program " 3 3 1
fi
elif [ "`gpio-control /dev/gpio invalue 2 6 | grep value | cut -d = -f 2`" -eq "0" ] ; then #RIGHT SHOULDER
set -x
$DRAWTEXT_CMD " " 5 3 0
#set_screen Testmenu.png
if [ ! "`mount | grep -c /LF/Bulk`" -eq "1" ] ; then
echo "BULK Partition not yet ready...please wait and try again"
$DRAWTEXT_CMD "Bulk not ready yet..try again" 5 3 1
continue
fi
$DRAWTEXT_CMD "Programming NAND.......... " 5 3 1
echo "Verifying files exist in LF/Bulk/payload"
if [ -f /LF/Bulk/payload/erootfs.ubi ] ; then
EROOT_FILE="erootfs.ubi"
elif [ -f /LF/Bulk/payload/erootfs-mfg.ubi ] ; then
EROOT_FILE="erootfs-mfg.ubi"
fi
if [ ! -f /LF/Bulk/payload/emerald-boot.bin ] ; then
$DRAWTEXT_CMD "FAILED no boot image found " 5 3 1
echo "FAILED no boot image found"
continue
fi
if [ ! -f /LF/Bulk/payload/HEALTH_AND_SAFETY.32.rle -a ! -f /LF/Bulk/payload/FIRST.32.rle ] ; then
$DRAWTEXT_CMD "FAILED no screen files " 5 3 1
echo "FAILED no screen files "
continue
elif [ -f /LF/Bulk/payload/HEALTH_AND_SAFETY.32.rle ] ; then
HNS_SCREEN="HEALTH_AND_SAFETY.32.rle"
elif [ -f /LF/Bulk/payload/FIRST.32.rle ] ; then
HNS_SCREEN="FIRST.32.rle"
else
HSN_SCREEN="`ls /LF/Bulk/payload | grep .32.rle$`"
fi
if [ ! -f /LF/Bulk/payload/kernel.cbf ] ; then
$DRAWTEXT_CMD "FAILED no kernel found " 5 3 1
echo "FAILED no kernel found "
continue
fi
if [ ! -f /LF/Bulk/payload/$EROOT_FILE ] ; then
$DRAWTEXT_CMD "FAILED no root file found " 5 3 1
echo "FAILED no root file found "
continue
fi
if [ ! -f /LF/Bulk/payload/bulk.ubi ] ; then
$DRAWTEXT_CMD "FAILED no bulk file found " 5 3 1
echo "FAILED no bulk file found "
continue
fi
ERROR1=0
if [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; then
echo 1 > /sys/devices/platform/lf1000-nand/cart_hotswap
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "2" ] ; then
echo "Failed to set cartridge hotswap to 1. Unabel to mount base NAND."
$DRAWTEXT_CMD "FAILED: Unable to set Hotswap " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
ERROR1=1
#continue
break
fi
done
fi
if [ "$ERROR1" -eq "1" ] ; then
continue
fi
TIME_START=`date +%s`
while [ ! "`cat /proc/mtd | grep -c '"Cartridge"'`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
echo "Can not see NAND. Skipping NAND programming"
$DRAWTEXT_CMD "FAILED: No NAND detected " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
#continue
ERROR1=1
break
fi
done
if [ "$ERROR1" -eq "1" ] ; then
continue
fi
if [ "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "0" ] ; then
echo 1 > /sys/devices/platform/lf1000-nand/cart_ecc_mode
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "2" ] ; then
echo "Failed to set cartridge ecc mode to 1. Unabel to mount unit nand. Aborting Programming"
$DRAWTEXT_CMD "FAILED: Unable to set ECC mode" 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
#continue
ERROR1=1
break
fi
done
fi
if [ "$ERROR1" -eq "1" ] ; then
continue
fi
NAND_DEV="/dev/`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1`"
echo "Base NAND on $NAND_DEV"
echo "Erasing NAND...."
flash_eraseall $NAND_DEV 2> /dev/null
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
$DRAWTEXT_CMD "FAILED erasing flash ..... " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
fi
echo "Flashing boot image...."
$DRAWTEXT_CMD "Flashing boot image....... " 5 3 1
nandwrite -np $NAND_DEV /LF/Bulk/payload/emerald-boot.bin > /dev/null
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
$DRAWTEXT_CMD "FAILED flashing boot image " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
fi
echo "Validating boot image...."
$DRAWTEXT_CMD "Validating boot image..... " 5 3 1
FILE_SIZE="`ls -l /LF/Bulk/payload | grep emerald-boot.bin$ | tr -s ' ' | cut -d ' ' -f5`"
#TEMP="`nanddump -o -b -q -s 0x0000000 -l $FILE_SIZE $NAND_DEV | md5sum - | cut -d ' ' -f1`"
TEMP="`nanddump -nobq $NAND_DEV | head -c $FILE_SIZE - | md5sum - | cut -d ' ' -f1`"
#TEMP="`head -c $FILE_SIZE $NAND_DEV | md5sum - | cut -d ' ' -f1`"
MD5="`md5sum /LF/Bulk/payload/emerald-boot.bin | cut -d ' ' -f1`"
if [ "$TEMP" != "$MD5" ] ; then
echo "...FAIL: Writing emerald-boot.bin FAILED!!!!!!!!!!!!"
echo "MD5 of file = $MD5"
echo "MD5 of partition = $TEMP"
$DRAWTEXT_CMD "FAILED flashing boot image " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
else
echo "...PASS"
fi
echo "Flashing screens...."
$DRAWTEXT_CMD "Flashing screens.......... " 5 3 1
nandwrite -s 0x100000 -p $NAND_DEV /LF/Bulk/payload/$HNS_SCREEN > /dev/null
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
$DRAWTEXT_CMD "FAILED flashing screens " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
fi
echo "Validating screens image...."
$DRAWTEXT_CMD "Validating screens image.. " 5 3 1
FILE_SIZE="`ls -l /LF/Bulk/payload | grep $HNS_SCREEN$ | tr -s ' ' | cut -d ' ' -f5`"
#TEMP="`nanddump -o -b -q -s 0x100000 -l $FILE_SIZE $NAND_DEV | md5sum - | cut -d ' ' -f1`"
TEMP="`head -c $(($FILE_SIZE + 0x100000)) $NAND_DEV | tail -c $FILE_SIZE - | md5sum - | cut -d ' ' -f1`"
MD5="`md5sum /LF/Bulk/payload/$HNS_SCREEN | cut -d ' ' -f1`"
if [ "$TEMP" != "$MD5" ] ; then
echo "...FAIL: Writing $HNS_SCREEN FAILED!!!!!!!!!!!!"
echo "MD5 of file = $MD5"
echo "MD5 of partition = $TEMP"
$DRAWTEXT_CMD "FAILED flashing screens " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
else
echo "...PASS"
fi
echo "Flashing kernel image."
$DRAWTEXT_CMD "Flashing kernel image..... " 5 3 1
nandwrite -s 0x200000 -p $NAND_DEV /LF/Bulk/payload/kernel.cbf > /dev/null
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
$DRAWTEXT_CMD "FAILED flashing kernel " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
fi
echo "Validating kernel image...."
$DRAWTEXT_CMD "Validating kernel image... " 5 3 1
FILE_SIZE="`ls -l /LF/Bulk/payload | grep kernel.cbf$ | tr -s ' ' | cut -d ' ' -f5`"
#TEMP="`nanddump -o -b -q -s 0x200000 -l $FILE_SIZE $NAND_DEV | md5sum - | cut -d ' ' -f1`"
TEMP="`head -c $(($FILE_SIZE + 0x200000)) $NAND_DEV | tail -c $FILE_SIZE - | md5sum - | cut -d ' ' -f1`"
MD5="`md5sum /LF/Bulk/payload/kernel.cbf | cut -d ' ' -f1`"
if [ "$TEMP" != "$MD5" ] ; then
echo "...FAIL: Writing kernel.cbf FAILED!!!!!!!!!!!!"
echo "MD5 of file = $MD5"
echo "MD5 of partition = $TEMP"
$DRAWTEXT_CMD "FAILED flashing kernel " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
else
echo "...PASS"
fi
echo "Flashing root file system."
$DRAWTEXT_CMD "Flashing root file system. " 5 3 1
nandwrite -s 0xa00000 -p $NAND_DEV /LF/Bulk/payload/$EROOT_FILE > /dev/null
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
$DRAWTEXT_CMD "FAILED flashing root " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
fi
echo "Validating root file system image...."
$DRAWTEXT_CMD "Validating root image..... " 5 3 1
TEMP="`nanddump -o -b -q -s 0xa00000 $NAND_DEV | head -c $((0x1000000)) | md5sum - | cut -d ' ' -f1`"
MD5="`head -c $((0x1000000)) /LF/Bulk/payload/$EROOT_FILE | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$MD5" ] ; then
echo "...FAIL: Writing $EROOT_FILE FAILED!!!!!!!!!!!!"
echo "Partial MD5 of file = $MD5"
echo "Partial MD5 of partition = $TEMP"
$DRAWTEXT_CMD "FAILED flashing root " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
else
echo "...PASS"
fi
echo "Flashing bulk content."
$DRAWTEXT_CMD "Flashing Bulk content..... " 5 3 1
nandwrite -s 0x6000000 -p $NAND_DEV /LF/Bulk/payload/bulk.ubi > /dev/null
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
$DRAWTEXT_CMD "FAILED flashing Bulk " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
fi
echo "Validating bulk image...."
$DRAWTEXT_CMD "Validating Bulk image..... " 5 3 1
TEMP="`nanddump -o -b -q -s 0x6000000 $NAND_DEV | head -c $((0x1000000)) | md5sum - | cut -d ' ' -f1`"
MD5="`head -c $((0x1000000)) /LF/Bulk/payload/bulk.ubi | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$MD5" ] ; then
echo "...FAIL: Writing bulk.ubi FAILED!!!!!!!!!!!!"
echo "Partial MD5 of file = $MD5"
echo "Partial MD5 of partition = $TEMP"
$DRAWTEXT_CMD "FAILED flashing Bulk " 5 3 1
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
continue
else
echo "...PASS"
fi
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
$DRAWTEXT_CMD " " 5 3 0
echo " SUCCESS!!!"
$DRAWTEXT_CMD "Program NAND: SUCCESS " 5 3 1
elif [ "`gpio-control /dev/gpio invalue 2 11 | grep value | cut -d = -f 2`" -eq "0" ] ; then # B button
set -x
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD " " 10 3 0
$DRAWTEXT_CMD "Grabbing logs from unit... " 9 3 1
# Get the frlogs and core dumps and place them into /LF/Bulk/Dumps folder on the ATAP
mkdir -p /LF/Bulk/Dumps
chmod 755 /LF/Bulk/Dumps
##mount_base_nand
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ "$ID" != 3 ]; then
ATAP=1
echo "Booted from the ATAP...checking for mtd utilites support. "
#if [ "1" ] ; then
if [ ! -e /sys/devices/platform/lf1000-nand/new_mtd ] ; then
echo "Unable to run this due to unsupported mtd tools"
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "FAIL:mtd tools not found..." 9 3 1
continue
fi
echo "mtd utilities Support OK....starting verification......"
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "mounting unit's NAND... " 9 3 1
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh start
if [ "`cat /proc/mtd | grep -c Base_RFS`" -eq "0" ] ; then
# setup the bases RFS to mount onto /prg_RFS
echo "1 0x00a00000 0x05600000 Base_RFS" > /sys/devices/platform/lf1000-nand/new_mtd
fi
UBI_RFS="NONE"
if [ "`ubinfo -a | grep -c ubi_rfs`" -lt "2" ] ; then
UBI_RFS="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
RFS_MTD="`cat /proc/mtd | grep '"Base_RFS"' | cut -d : -f1 | cut -c 4-`"
ubiattach /dev/ubi_ctrl -d $UBI_RFS -m $RFS_MTD #attach Base_RFS to next ubi
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
mkdir -p /prg_RFS
mount -t ubifs ubi$UBI_RFS:ubi_rfs /prg_RFS
fi
if [ "$UBI_RFS" = "NONE" ] ; then
i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
while [ "$UBI_RFS" = "NONE" -a "$i" -gt "0" ] ; do
i="`echo $(($i-1))`"
if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_RFS" ] ; then
UBI_RFS=$i
fi
done
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
echo "Unable to see the device RFS partition"
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $UBI_RFS
echo "Can not see device's RFS"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "Base NAND not mountable... " 9 3 1
continue
fi
BASE_PATH="/prg_RFS"
VER="`cat $BASE_PATH/etc/version`"
# This stuff is for mounting BULK which is not needed in this case.
#if [ "`cat /proc/mtd | grep -c Base_Bulk`" -eq "0" ] ; then
# echo "1 0x06000000 0x1a000000 Base_Bulk" > /sys/devices/platform/lf1000-nand/new_mtd
#fi
#UBI_BULK="NONE"
#if [ "`ubinfo -a | grep -c ubi_bulk`" -lt "2" ] ; then
# UBI_BULK="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
# BULK_MTD="`cat /proc/mtd | grep '"Base_Bulk"' | cut -d : -f1 | cut -c 4-`"
# ubiattach /dev/ubi_ctrl -d $UBI_BULK -m $BULK_MTD #attach Base_Bulk to next ubi
#fi
#if [ "$UBI_BULK" = "NONE" ] ; then
# i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
# while [ "$UBI_BULK" = "NONE" -a "$i" -gt "0" ] ; do
# i="`echo $(($i-1))`"
# if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_Bulk" ] ; then
# UBI_BULK=$i
# fi
# done
#fi
#if [ "`mount | grep -c prg_RFS/LF/Bulk`" -lt "1" ] ; then
# mount -t ubifs ubi$(($UBI_BULK)):ubi_bulk /prg_RFS/LF/Bulk
#fi
#if [ "`mount | grep -c prg_RFS/LF/Bulk`" -ne "1" ] ; then
# echo "Unable to see the device Bulk partition"
# umount -f /prg_RFS/LF/Bulk
# ubidetach /dev/ubi_ctrl -d $UBIS_BULK
# umount -f /prg_RFS
# ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
# /LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
# echo "Can not see device's Bulk" > /tmp/NANDResult
# exit 1
#fi
# get the frlogs and zip them up into a file name with the SN in it.
CUR_DIR="`pwd`"
FILE_NAME="`mfgdata get sn | tail -c 9`_frlogs.zip"
cd $BASE_PATH/LF/Base/FR
if [ "`ls | grep -c frlog`" -gt "0" ] ; then
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "creating zip file... " 9 3 1
zip -r /LF/Bulk/Dumps/$FILE_NAME .
else
cd $CUR_DIR
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "No logs found on unit " 9 3 1
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
continue
fi
cd $CUR_DIR
# Bulk unmounting not needed here
#if [ "`mount | grep -c prg_RFS/LF/Bulk`" -ge "1" ] ; then
# echo "Unmounting the device's Bulk partition"
# umount -f /prg_RFS/LF/Bulk
# ubidetach /dev/ubi_ctrl -d $UBI_BULK
#fi
if [ "`mount | grep -c prg_RFS`" -ge "1" ] ; then
echo "Unmounting the device's RFS partition"
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "unmounting file system... " 9 3 1
rm -f $BASE_PATH/Firmware/relativefiles.md5
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
echo "All ubi devices created are now cleaned up...."
fi
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
$DRAWTEXT_CMD " " 9 3 1
$DRAWTEXT_CMD "$FILE_NAME created" 9 3 1
$DRAWTEXT_CMD "available in /LF/Bulk/Dumps" 10 4 1
fi
fi
fi
set +x
done
set -x
echo "Exit requested, powering off."
$DRAWTEXT_CMD " POWERING OFF " 14 3 1
poweroff
exit 0
GetLocale.sh#
#!/bin/sh
# This file will get the locale from the NOR
set -x
US_LOCALE="en-us"
ES_LOCALE="es-es"
FR_LOCALE="fr-fr"
STATUS="0"
mfgdata get locale > /tmp/locale
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "Unable to retrieve locale from NOR"
exit $STATUS
fi
LOCALE="`cat /tmp/locale`"
if [ "$LOCALE" != "$US_LOCALE" -a "$LOCALE" != "$FR_LOCALE" -a "$LOCALE" != "$ES_LOCALE" ] ; then
echo "Invalid locale."
exit 5
fi
exit 0
LaunchMfgTest.sh#
#!/bin/sh
set -x
# This script sets executable permissions and launches the Mfg test from /LF/Base/MadridMfgTest
if [ ! -d /test ] ; then
mkdir -p /test
touch /test/made_by_mfg_test
fi
mkdir -p /mfgdata
#if [ ! -e /test/monotext8x16.rgb -a -e /var/fonts/monotext8x16.rgb ] ; then
# cp -s /var/fonts/monotext8x16.rgb /test
#fi
if [ ! -e /var/fonts/monotext8x16.rgb -a -e /test/monotext8x16.rgb ] ; then
mkdir -p /var/fonts
cp -s /test/monotext8x16.rgb /var/fonts
fi
TIME_START=`date +%s`
PROG_PATH=""
if [ -e /LF/Base/MadridMfgTest/MadridMfgTest ] ; then
chmod -R +x /LF/Base/MadridMfgTest #this is a work around for not being able to install with executable permissions.
PROG_PATH="/LF/Base/MadridMfgTest"
elif [ -e /LF/Cart/MadridMfgTest/MadridMfgTest ] ; then
chmod -R +x /LF/Cart/MadridMfgTest #this is a work around for not being able to install with executable permissions.
PROG_PATH="/LF/Cart/MadridMfgTest"
else
PROG_PATH="`find -name MadridMfgTest -exec dirname {} \;`"
if [ "X$PROG_PATH" -eq "X" ] ; then
echo "No Mfg Test found, aborting test mode"
exit 1
fi
chmod -R +x $PROG_PATH
fi
#SZSZ setup display to fix Camera Test and/or new-calib problems
# Test showed that it is difficult if not impossible to just
# change settings one time and be done with it, since some
# frame buffer configurations happened inside the code of
# the new-calib (disabled fb0 blending).
# Decided to change the settings inside C++ code.
# $PROG_PATH/setupdisplay.sh
#fbctrl /dev/fb0 set blank 0
#fbctrl /dev/fb0 set blend 1 255
#fbctrl /dev/fb0 set priority 0
#fbctrl /dev/fb1 set blank 1
#fbctrl /dev/fb2 set blank 0
#fbctrl /dev/fb2 set priority 2
#fbctrl /dev/fb2 set blend 0 255
# Dave - disable top RGB layer from bootloader
#fbctrl /dev/fb0 set blank 1
( $PROG_PATH/MadridMfgTest; fbctrl /dev/fb0 set blank 0; imager-fb /dev/fb0 $PROG_PATH/rsrc/shutdown.png; poweroff ) &
if [ -e /flags/main_app ] ; then
if [ "`cat /flags/main_app | grep -c MfgTest`" -ge "1" ] ; then
touch /flags/no8sec
fi
fi
if [ ! -e /dev/input/event4 ] ; then
mknod /dev/input/event4 c 13 68
chmod 666 /dev/input/event4
fi
#Update the trapdoor and edit the validation file with new trapdoor md5sum
cur_dir="`pwd`"
if [ -f /Firmware/packagefiles.md5 ] ; then
cd /Firmware
VAL_FILE="packagefiles.md5"
elif [ -f /erootfs.md5 ] ; then
cd /
VAL_FILE="erootfs.md5"
fi
if [ -e /LF/Base/MadridMfgTest/trapdoor ] ; then
echo "Updating your trapdoor script from /LF/Base!!!!!!!!!!!!"
cp -f /usr/bin/trapdoor /usr/bin/trapdoor_orig
cp -f /LF/Base/MadridMfgTest/trapdoor /usr/bin
cp $VAL_FILE _orig
cat _orig | grep -v trapdoor > $VAL_FILE
i=0
while [ "`diff _orig $VAL_FILE | grep ^- | grep -c -v trapdoor`" -gt "1" ] ; do
echo "Updating the $VAL_FILE file"
cat _orig | grep -v trapdoor > $VAL_FILE
if [ $i -gt 5 ] ; then
echo "Unable to update the $VAL_FILE file. Restoring to original."
mv _orig $VAL_FILE
mv /usr/bin/trapdoor_orig /usr/bin/trapdoor
exit 1
fi
i="`expr $i + 1`"
done
md5sum /usr/bin/trapdoor >> $VAL_FILE
rm _orig
rm /usr/bin/trapdoor_orig
rm /LF/Base/MadridMfgTest/trapdoor
rm -f /Firmware/packagefiles_no_meta.md5
cat /LF/Base/MadridMfgTest/packagefiles.md5 | grep -v trapdoor > /LF/Base/MadridMfgTest/packagefiles.md5_new
mv /LF/Base/MadridMfgTest/packagefiles.md5_new /LF/Base/MadridMfgTest/packagefiles.md5
cd $cur_dir
elif [ -e /LF/Cart/MadridMfgTest/trapdoor ] ; then
echo "Updating your trapdoor script from /LF/Cart!!!!!!!!!!!!"
cp -f /usr/bin/trapdoor /usr/bin/trapdoor_orig
cp -f /LF/Cart/Madrid/trapdoor /usr/bin
cp $VAL_FILE _orig
cat _orig | grep -v trapdoor > $VAL_FILE
i=0
while [ "`diff _orig $VAL_FILE | grep ^- | grep -c -v trapdoor`" -gt "1" ] ; do
echo "Updating the $VAL_FILE file"
cat $VAL_FILE_orig | grep -v trapdoor > $VAL_FILE
if [ $i -gt 5 ] ; then
echo "Unable to update the $VAL_FILE file. Restoring to original."
mv _orig $VAL_FILE
mv /usr/bin/trapdoor_orig /usr/bin/trapdoor
exit 1
fi
i="`expr $i + 1`"
done
md5sum /usr/bin/trapdoor >> $VAL_FILE
rm _orig
rm /usr/bin/trapdoor_orig
rm -f /Firmware/packagefiles_no_meta.md5
#rm /LF/Cart/MadridMfgTest/trapdoor
cd $cur_dir
fi
exit 0
ManADCCal.sh#
#!/bin/sh
#####################################################################
# ManADCCal.sh file for manual calibration of ADC
# Written by Nathan Durrin
#
# Function: This script will allow the user to manually calibrate
# the ADC Reference Voltage by setting the input voltage
# to 4.6V +- 0.1V and pressing the button to save the offset.
#
# Revision Table..................................................
# Date Rev Author Change
# ----------------------------------------------------------------
# 02/22/10 001 N.Durrin Initial release with rev box
# 02/24/10 002 N.Durrin Accept parameters from the MadridMfgTestConfig.txt
# 02/26/10 003 N.Durrin Made sure that when reading from the MadridMfgTestConfig.xml file that they are not commented out
# 09/14/10 004 N.Durrin Added new support for frame buffer
# 02/22/11 005 B. Greger Changed Button mapping for Madrid
# Changed monotext path to /var/fonts from /test
######################################################################
FILE_REV="004"
DEBUG_ON=1
echo "Starting Manual ADC Calibration revision $FILE_REV."
set -x
rm -f /tmp/ManADCCalResult
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
fi
if [ -e /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt ] ; then
CONFIG_FILE="/LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt"
elif [ -e /LF/Cart/MadridMfgTest/rsrc/MadridMfgTestConfig.txt ] ; then
CONFIG_FILE="/LF/Cart/MadridMfgTest/rsrc/MadridMfgTestConfig.txt"
fi
if [ "`cat $CONFIG_FILE | grep -c ^_ADC_SLOPE_256_DEFAULT`" -ne "1" ] ; then
ADC_SLOPE_256_DEFAULT="2026"
echo "ADC_SLOPE_256_DEFAULT=$ADC_SLOPE_256_DEFAULT"
else
ADC_SLOPE_256_DEFAULT="`cat $CONFIG_FILE | grep ^_ADC_SLOPE_256_DEFAULT |cut -d = -f2 | cut -d ';' -f1`"
echo "Parameter read from $CONFIG_FILE: ADC_SLOPE_256_DEFAULT=$ADC_SLOPE_256_DEFAULT"
fi
if [ "`cat $CONFIG_FILE | grep -c ^_ADC_CONSTANT_DEFAULT`" -ne "1" ] ; then
ADC_CONSTANT_DEFAULT="0"
echo " ADC_CONSTANT_DEFAULT=$ADC_CONSTANT_DEFAULT"
else
ADC_CONSTANT_DEFAULT="`cat $CONFIG_FILE | grep ^_ADC_CONSTANT_DEFAULT | cut -d = -f2 | cut -d ';' -f1`"
echo "Parameter read from $CONFIG_FILE: ADC_CONSTANT_DEFAULT=$ADC_CONSTANT_DEFAULT"
fi
if [ "`cat $CONFIG_FILE | grep -c ^_DEFAULT_INPUT_VOLTAGE`" -ne "1" ] ; then
DEFAULT_INPUT_VOLTAGE="4600"
echo "DEFAULT_INPUT_VOLTAGE=$DEFAULT_INPUT_VOLTAGE"
else
DEFAULT_INPUT_VOLTAGE="`cat $CONFIG_FILE | grep ^_DEFAULT_INPUT_VOLTAGE | cut -d = -f2 | cut -d ';' -f1`"
echo "Parameter read from $CONFIG_FILE: DEFAULT_INPUT_VOLTAGE=$DEFAULT_INPUT_VOLTAGE"
fi
if [ "`cat $CONFIG_FILE | grep -c ^_ERROR_MARGIN`" -ne "1" ] ; then
ERROR_MARGIN="36"
echo "ERROR_MARGIN=$ERROR_MARGIN"
else
ERROR_MARGIN="`cat $CONFIG_FILE | grep ^_ERROR_MARGIN | cut -d = -f2 | cut -d ';' -f1`"
echo "Parameter read from $CONFIG_FILE: ERROR_MARGIN=$ERROR_MARGIN"
fi
if [ "`cat $CONFIG_FILE | grep -c ^_MAX_CONSTANT`" -ne "1" ] ; then
MAX_CONSTANT="500"
echo "MAX_CONSTANT=$MAX_CONSTANT"
else
MAX_CONSTANT="`cat $CONFIG_FILE | grep ^_MAX_CONSTANT | cut -d = -f2 | cut -d ';' -f1`"
echo "Parameter read from $CONFIG_FILE: MAX_CONSTANT=$MAX_CONSTANT"
fi
# Clears the screen
clear_screen () {
for i in `seq 0 15` ; do
$DRAWTEXT_CMD " " $i 0 0
done
}
clear_screen
$DRAWTEXT_CMD " Starting the Manual ADC Cal" 6 0 0
#Gets the path for the screens.
echo "getting path for screens"
$DRAWTEXT_CMD " finding path for test..please wait" 8 0 0
PROG_PATH="."
if [ "`ls | grep -c ManADCCal.sh`" -eq "0" ] ; then
if [ -e /LF/Base/MadridMfgTest/ManADCCal.sh ] ; then
PROG_PATH="/LF/Base/MadridMfgTest/"
elif [ -e /LF/Cart/MadridMfgTest/ManADCCal.sh ] ; then
PROG_PATH="/LF/Cart/MadridMfgTest/"
else
PROG_PATH="`find -name ManADCCal.sh -exec dirname {} \;`"
fi
fi
if [ $DEBUG_ON ] ; then
echo "Program Path: $PROG_PATH"
fi
# remount rootfs as read/write
mount -o remount,rw /
#if [ -e $PROG_PATH/gpio-control ] ; then
# echo "Updating the gpio-control."
# cp $PROG_PATH/gpio-control /usr/bin
#fi
original_ADC_Offset="`cat /sys/devices/platform/lf1000-power/adc_constant`"
original_ADC_Slope="`cat /sys/devices/platform/lf1000-power/adc_slope_256`"
if [ $DEBUG_ON ] ; then
echo "Current ADC Setting: adc_constant=$original_ADC_Offset, adc_slope_256=$original_ADC_Slope"
fi
CUR_ADC_CONSTANT="`echo $ADC_CONSTANT_DEFAULT`"
CUR_ADC_SLOPE="`echo $ADC_SLOPE_256_DEFAULT`"
echo $CUR_ADC_SLOPE > /sys/devices/platform/lf1000-power/adc_slope_256
echo $CUR_ADC_CONSTANT > /sys/devices/platform/lf1000-power/adc_constant
INPUT_VOLTAGE=$DEFAULT_INPUT_VOLTAGE
MODE=1
#1 = Mfg Mode, 2 = User Mode, 3 = Init Mode
echo "This test can be run in 3 modes"
echo " [DEFAULT] 1) Mfg Mode = set battery input to $INPUT_VOLTAGE mV and press the B button"
echo " 2) User Mode = enter the current battery voltage and press the button"
echo " 3) Init mode = Set all values to a default [Constant:slope] = [0:2026]"
echo " Press <Vol-Up> button to cycle through the modes."
echo " Press <Home> to abort."
clear_screen
echo "Set the input voltage to $INPUT_VOLTAGE +- 10mV"
echo "Press B when ready..."
$DRAWTEXT_CMD " Manual ADC Calibration version $FILE_REV" 0 0 0
$DRAWTEXT_CMD " Mode $MODE" 5 0 0
$DRAWTEXT_CMD " Set the input voltage to $INPUT_VOLTAGE +- 10mV" 6 0 0
$DRAWTEXT_CMD " Press <Vol-Down> when ready..." 8 0 0
$DRAWTEXT_CMD " Press <Vol-Up> to enter an input voltage." 12 0 0
$DRAWTEXT_CMD " Press <Home> to abort." 13 0 0
while [ "`gpio-control /dev/gpio invalue 2 6 | grep value | cut -d = -f 2`" = "1" ] ; do #home "`read_button home`" != "pressed" ] ; do
if [ "$MODE" = "2" ] ; then
if [ "`gpio-control /dev/gpio invalue 2 4 | grep value | cut -d = -f 2`" = "0" ] ; then # up "`read_button up`" = "pressed" ] ; then
set -x
INPUT_VOLTAGE=$(($INPUT_VOLTAGE+100))
$DRAWTEXT_CMD " " 8 0 0
$DRAWTEXT_CMD "$INPUT_VOLTAGE mV" 8 5 1
echo "Setting input voltage to $INPUT_VOLTAGE."
elif [ "`gpio-control /dev/gpio invalue 0 29 | grep value | cut -d = -f 2`" = "0" ] ; then # down "`read_button down`" = "pressed" ] ; then
set -x
INPUT_VOLTAGE=$(($INPUT_VOLTAGE-100))
$DRAWTEXT_CMD " " 8 0 0
$DRAWTEXT_CMD "$INPUT_VOLTAGE mV" 8 5 1
echo "Setting input voltage to $INPUT_VOLTAGE."
elif [ "`gpio-control /dev/gpio invalue 0 28 | grep value | cut -d = -f 2`" = "0" ] ; then #left
set -x
INPUT_VOLTAGE=$(($INPUT_VOLTAGE+1))
$DRAWTEXT_CMD " " 8 0 0
$DRAWTEXT_CMD "$INPUT_VOLTAGE mV" 8 5 1
echo "Setting input voltage to $INPUT_VOLTAGE."
elif [ "`gpio-control /dev/gpio invalue 2 3 | grep value | cut -d = -f 2`" = "0" ] ; then #right
set -x
INPUT_VOLTAGE=$(($INPUT_VOLTAGE-1))
$DRAWTEXT_CMD " " 8 0 0
$DRAWTEXT_CMD "$INPUT_VOLTAGE mV" 8 5 1
echo "Setting input voltage to $INPUT_VOLTAGE."
fi
fi
if [ "`gpio-control /dev/gpio invalue 2 14 | grep value | cut -d = -f 2`" = "0" ] ; then #vol down button "`read_button vol down`" = "pressed" ] ; then
set -x
if [ "$MODE" -ne "3" ] ; then
VOLTAGE="`cat /sys/devices/platform/lf1000-power/voltage`"
CUR_ADC_CONSTANT=$(($INPUT_VOLTAGE - $VOLTAGE))
echo "Calculated offset: $CUR_ADC_CONSTANT"
if [ "$CUR_ADC_CONSTANT" -lt "-$MAX_CONSTANT" -o "$CUR_ADC_CONSTANT" -gt "$MAX_CONSTANT" ] ; then
echo "FAIL: Offset $CUR_ADC_CONSTANT mV exceeds limit of +-$MAX_CONSTANT mV. Please check input voltage."
echo "Offset $CUR_ADC_CONSTANT exceeds limit +-$MAX_CONSTANT" > /tmp/ManADCCalResult
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
echo $original_ADC_Offset > /sys/devices/platform/lf1000-power/adc_constant
echo $original_ADC_Slope > /sys/devices/platform/lf1000-power/adc_slope_256
exit 1
fi
echo $CUR_ADC_CONSTANT > /sys/devices/platform/lf1000-power/adc_constant
VOLTAGE="`cat /sys/devices/platform/lf1000-power/voltage`"
VOLTAGE_DIF=$(($VOLTAGE - $INPUT_VOLTAGE))
if [ "$VOLTAGE_DIF" -lt "-$ERROR_MARGIN" -o "$VOLTAGE_DIF" -gt "$ERROR_MARGIN" ] ; then
echo "FAIL: Voltage read does not match the input voltage within +-$ERROR_MARGIN mV. Please check input voltage."
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
echo "Read Voltage: $VOLTAGE Input Voltage:$INPUT_VOLTAGE" > /tmp/ManADCCalResult
echo $original_ADC_Offset > /sys/devices/platform/lf1000-power/adc_constant
echo $original_ADC_Slope > /sys/devices/platform/lf1000-power/adc_slope_256
exit 1
fi
mfgdata set adc $CUR_ADC_CONSTANT $CUR_ADC_SLOPE
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
echo "Unable to write to NOR"
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
echo "Unable to write to NOR" > /tmp/ManADCCalResult
echo $original_ADC_Offset > /sys/devices/platform/lf1000-power/adc_constant
echo $original_ADC_Slope > /sys/devices/platform/lf1000-power/adc_slope_256
exit 1
fi
echo "Voltage read after calibration: $VOLTAGE"
echo "CONSTANT=$CUR_ADC_CONSTANT SLOPE=$CUR_ADC_SLOPE"
echo "PASS"
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
echo "CONSTANT=$CUR_ADC_CONSTANT SLOPE=$CUR_ADC_SLOPE" > /tmp/ManADCCalResult
#echo "Read Voltage: $VOLTAGE " > /tmp/ManADCCalResult
exit 0
else
mfgdata set adc $ADC_CONSTANT_DEFAULT $ADC_SLOPE_256_DEFAULT
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
echo "Unable to write to NOR"
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
echo "Unable to write to NOR" > /tmp/ManADCCalResult
echo $original_ADC_Offset > /sys/devices/platform/lf1000-power/adc_constant
echo $original_ADC_Slope > /sys/devices/platform/lf1000-power/adc_slope_256
exit 1
fi
echo $ADC_CONSTANT_DEFAULT > /sys/devices/platform/lf1000-power/adc_constant
echo $ADC_SLOPE_256_DEFAULT > /sys/devices/platform/lf1000-power/adc_slope_256
VOLTAGE="`cat /sys/devices/platform/lf1000-power/voltage`"
echo "ADC Calibrated to default settings: $ADC_CONSTANT_DEFAULT $ADC_SLOPE_256_DEFAULT"
echo "Voltage read after calibration: $VOLTAGE"
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
echo "ADC set to defaults: $ADC_CONSTANT_DEFAULT $ADC_SLOPE_256_DEFAULT " > /tmp/ManADCCalResult
exit 0
fi
elif [ "`gpio-control /dev/gpio invalue 2 2 | grep value | cut -d = -f 2`" = "0" ] ; then #Button vol up "`read_button vol up`" = "pressed" ] ; then
set -x
MODE=$(($MODE + 1))
if [ "$MODE" -gt "3" ] ; then
MODE=1
fi
clear_screen
case "$MODE" in
"1")
INPUT_VOLTAGE=$DEFAULT_INPUT_VOLTAGE
echo "Set the input voltage to $INPUT_VOLTAGE +- 10mV"
echo "Press B when ready..."
$DRAWTEXT_CMD " Mode $MODE" 5 0 0
$DRAWTEXT_CMD " Set the input voltage to $INPUT_VOLTAGE +- 10mV" 6 0 0
$DRAWTEXT_CMD " Press <Vol-Down> when ready..." 8 0 0
$DRAWTEXT_CMD " Press <Vol-Up> to enter an input voltage." 12 0 0
$DRAWTEXT_CMD " Press <Home> to abort." 13 0 0
;;
"2")
$DRAWTEXT_CMD " Mode $MODE" 5 0 0
$DRAWTEXT_CMD " What is the current input volatge?" 6 0 0
$DRAWTEXT_CMD "$INPUT_VOLTAGE mV" 8 5 1
$DRAWTEXT_CMD "Use <Up> or <Down> to course adjust" 10 0 0
$DRAWTEXT_CMD "Use <Left> or <Right> to fine adjust" 11 0 0
$DRAWTEXT_CMD "Press <Vol-Up> button to load ADC defaults." 12 0 0
$DRAWTEXT_CMD " Press <Home> to abort." 13 0 0
;;
"3")
echo "Press B to set ADC to default: $ADC_CONSTANT_DEFAULT $ADC_SLOPE_256_DEFAULT"
$DRAWTEXT_CMD " Mode $MODE" 5 0 0
$DRAWTEXT_CMD "Press <Vol-Down> to confirm set ADC defaults." 6 0 0
$DRAWTEXT_CMD " Defaults: $ADC_CONSTANT_DEFAULT $ADC_SLOPE_256_DEFAULT" 7 0 0
$DRAWTEXT_CMD "Press <Vol-Up> button to return to $INPUT_VOLTAGE input." 12 0 0
$DRAWTEXT_CMD " Press <Home> to abort." 13 0 0
;;
esac
fi
set +x
done
set -x
echo "Manual ADC calibration aborted!!"
echo $original_ADC_Offset > /sys/devices/platform/lf1000-power/adc_constant
echo $original_ADC_Slope > /sys/devices/platform/lf1000-power/adc_slope_256
echo "USER ABORTED" > /tmp/ManADCCalResult
date
layer-control /dev/layer0 s hstride 4 #3 #4
layer-control /dev/layer0 s vstride 1280 #960
layer-control /dev/layer0 s dirty
exit 1
mkMfgCart.sh#
#/bin/sh
set -x
echo "Starting the mkMfgCart.sh script version 003"
rm -f /tmp/mkMfgCartResult
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
fi
if [ -d /LF/Bulk ] ; then
CART_DIR="/LF/Cart"
DIR="/LF/Bulk"
MADRID="1"
if [ -e /LF/Base/MadridMfgTest/rsrc/mkfs.vfat ] ; then
VFAT_FILE="/LF/Base/MadridMfgTest/rsrc/mkfs.vfat"
elif [ -e /LF/Cart/MadridMfgTest/rsrc/mkfs.vfat ] ; then
VFAT_FILE="/LF/Cart/MadridMfgTest/rsrc/mkfs.vfat"
else
VFAT_FILE="`find -name mkfs.vfat`"
fi
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ `cat /sys/devices/platform/lf1000-gpio/board_id` != 3 ]; then
ATAP=1
echo "Booted from the ATAP...checking for mtd utilites support. "
if [ ! -e /sys/devices/platform/lf1000-nand/new_mtd ] ; then
echo "Unable to do this when booted from the ATAP."
echo "Can not run from ATAP" > /tmp/mkMfgCartResult
exit 1
fi
echo "mtd utilities Support OK....starting verification......"
$DRAWTEXT_CMD "Installing Mfg Test into unit from ATAP " 6 0 0
$DRAWTEXT_CMD " " 7 0 0
$DRAWTEXT_CMD " Mounting the unit's NAND " 8 2 0
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh start
if [ "`cat /proc/mtd | grep -c Base_RFS`" -eq "0" ] ; then
# setup the bases RFS to mount onto /prg_RFS
echo "1 0x00a00000 0x05600000 Base_RFS" > /sys/devices/platform/lf1000-nand/new_mtd
fi
UBI_RFS="NONE"
if [ "`ubinfo -a | grep -c ubi_rfs`" -lt "2" ] ; then
UBI_RFS="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
RFS_MTD="`cat /proc/mtd | grep '"Base_RFS"' | cut -d : -f1 | cut -c 4-`"
ubiattach /dev/ubi_ctrl -d $UBI_RFS -m $RFS_MTD #attach Base_RFS to next ubi
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
mkdir -p /prg_RFS
mount -t ubifs ubi$UBI_RFS:ubi_rfs /prg_RFS
fi
if [ "$UBI_RFS" = "NONE" ] ; then
i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
while [ "$UBI_RFS" = "NONE" -a "$i" -gt "0" ] ; do
i="`echo $(($i-1))`"
if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_RFS" ] ; then
UBI_RFS=$i
fi
done
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
echo "Unable to see the device RFS partition"
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $UBI_RFS
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Can not see device's RFS" > /tmp/mkMfgCartResult
exit 1
fi
BASE_PATH="/prg_RFS"
CART_DIR="$BASE_PATH/LF/Base/"
echo "Copying MadridMfgTest from ATAP to unit"
$DRAWTEXT_CMD "Copying MfgTest from ATAP to unit " 8 2 0
rm -rf $CART_DIR/MadridMfgTest
cp -rf /LF/Base/MadridMfgTest $CART_DIR
echo "Verifying file copy"
$DRAWTEXT_CMD "Verifying file copy " 8 2 0
if [ "`diff -r -q /LF/Base/MadridMfgTest $CART_DIR/MadridMfgTest | grep -c MadridMfgTest`" -gt "0" ] ; then
umount $BASE_PATH
ubidetach /dev/ubi_ctrl -d $UBI_RFS
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Copy operation failed" > /tmp/mkMfgCartResult
echo "!!!!!!!!!!!!!!!FAILED!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
echo "Copy operation complete and verified"
umount $BASE_PATH
ubidetach /dev/ubi_ctrl -d $UBI_RFS
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Installed Mfg Test on unit" > /tmp/mkMfgCartResult
echo "*************************"
echo " Done"
echo "*************************"
exit 0
fi
fi
#Setup the cartridge to mount and set ECC mode
if [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; then
echo "Setting Cartridge Hotswap"
echo 1 > /sys/devices/platform/lf1000-nand/cart_hotswap
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "2" ] ; then
echo "Failed to set cartridge hotswap to 1. Unabel to mount cartridge NAND."
echo "Unable to set cart hotswap" > /tmp/mkMfgCartResult
exit 1
fi
done
fi
TIME_START=`date +%s`
while [ ! "`cat /proc/mtd | grep -c \\"Cartridge\\"`" -eq "1" ] ; do
echo "Waiting for cartridge to be recognized"
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
echo "Error: Can not find a cartridge."
echo "Can not find cartridge" > /tmp/mkMfgCartResult
exit 1
fi
done
#DEV="/dev/`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1`"
DEV_NUM="`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1 | cut -d d -f2`"
if [ "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "0" ] ; then
echo "Setting Cartridge ECC mode"
echo 1 > /sys/devices/platform/lf1000-nand/cart_ecc_mode
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
echo "Failed to set cartridge ecc mode to 1. Unabel to mount cartridge. Aborting Programming"
echo "Unable to set ECC mode" > /tmp/mkMfgCartResult
exit 1
fi
done
fi
echo "ECC mode =`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`"
if [ "`mount | grep -c /LF/Cart`" -lt "1" ] ; then
/etc/init.d/cartridge restart
sleep 4
fi
if [ "`mount | grep -c Cart`" -ne "1" ] ; then
if [ ! "`cat /proc/mtd | grep -c ubi_Cartridge`" -eq "1" ] ; then
echo "***********************************************************"
echo "Starting to create a vfat file system on the NAND cartridge"
echo "***********************************************************"
echo "Erasing Cartridge at /dev/mtd$DEV_NUM"
echo "***********************************************************"
$DRAWTEXT_CMD "Erasing Cartridge at /dev/mtd$DEV_NUM " 8 2 0
UBI_NODE="NULL"
for UBI in `ls /sys/class/ubi | grep ubi.$ | cut -d i -f2` ; do
if [ "`cat /sys/class/ubi/ubi$UBI/mtd_num`" -eq "$DEV_NUM" ] ; then
UBI_NODE="$UBI"
break
fi
done
if [ ! "$UBI_NODE" = "NULL" ] ; then
echo "Detatching previously attached UBI $UBI_NODE"
ubidetach /dev/ubi_ctrl -d $UBI_NODE
fi
flash_eraseall /dev/mtd$DEV_NUM 2> /dev/null
if [ "`echo $?`" -ne "0" ] ; then
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "Unable to erase cartridge" > /tmp/mkMfgCartResult
exit 1
fi
#echo "***********************************************************"
#echo "Formatting Cartridge UBI volume"
#echo "***********************************************************"
$DRAWTEXT_CMD "Formatting Cartridge UBI volume " 8 2 0
#ubiformat -y /dev/mtd$DEV_NUM -O 256
#if [ "`echo $?`" -ne "0" ] ; then
# echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
# echo "Unable to format cartridge" > /tmp/mkMfgCartResult
# exit 1
#fi
echo "***********************************************************"
echo "Attaching cartridge to a UBI volume"
echo "***********************************************************"
$DRAWTEXT_CMD "Attaching cartridge to a UBI volume " 8 2 0
ubiattach /dev/ubi_ctrl -m $DEV_NUM > /tmp/UBI
if [ "`echo $?`" -ne "0" ] ; then
cat /tmp/UBI
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "Unable to attach UBI" > /tmp/mkMfgCartResult
exit 1
fi
cat /tmp/UBI
UBI_NODE="`cat /tmp/UBI | cut -d ' ' -f4 | cut -d , -f1`"
if [ ! -e /dev/ubi$UBI_NODE ] ; then
echo "***********************************************************"
echo "Creating a device node for /dev/ubi$UBI_NODE"
echo "***********************************************************"
$DRAWTEXT_CMD "Creating a device node for /dev/ubi$UBI_NODE" 8 2 0
mknod -m 666 /dev/ubi$UBI_NODE c 250 0
if [ "`echo $?`" -ne "0" ] ; then
rm -f /dev/ubi$UBI_NODE
ubidetach /dev/ubi_ctrl -d $UBI_NODE
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "Unable to make UBI device node /dev/ubi$UBI_NODE" > /tmp/mkMfgCartResult
exit 1
fi
fi
echo "***********************************************************"
echo "Creating a UBI volume on /dev/ubi$UBI_NODE"
echo "***********************************************************"
$DRAWTEXT_CMD "Creating a UBI volume on /dev/ubi$UBI_NODE" 8 2 0
ubimkvol /dev/ubi$UBI_NODE -n 0 -m --name="ubi_Cartridge"
if [ "`echo $?`" -ne "0" ] ; then
ubidetach /dev/ubi_ctrl -d $UBI_NODE
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "Unable to make UBI volume" > /tmp/mkMfgCartResult
exit 1
fi
#echo "***********************************************************"
#echo "Reattaching the UBI volume"
#echo "***********************************************************"
#$DRAWTEXT_CMD "Reattaching the UBI volume " 8 2 0
#ubidetach /dev/ubi_ctrl -d 2
#if [ "`echo $?`" -ne "0" ] ; then
# echo "Unable to dettach UBI" > /tmp/mkMfgCartResult
# exit 1
#fi
#ubiattach /dev/ubi_ctrl -m $DEV_NUM
#if [ "`echo $?`" -ne "0" ] ; then
# echo "Unable to re-attach UBI" > /tmp/mkMfgCartResult
# exit 1
#fi
echo "***********************************************************"
echo "Formatting a vfat file system"
echo "***********************************************************"
$DRAWTEXT_CMD "Formatting a vfat file system " 8 2 0
UBI_NUM="`cat /proc/mtd | grep ubi_Cartridge | cut -d: -f1 | cut -d d -f2`"
$VFAT_FILE -n ubi_Cartridge -S 512 /dev/mtdblock$UBI_NUM #> /dev/null
if [ "`echo $?`" -ne "0" ] ; then
ubidetach /dev/ubi_ctrl -d $UBI_NODE
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "Unable to make fat file system" > /tmp/mkMfgCartResult
exit 1
fi
fi
echo "***********************************************************"
echo "Mounting the cartridge on /LF/Cart"
echo "***********************************************************"
$DRAWTEXT_CMD "Mounting the cartridge on /LF/Cart " 8 2 0
mount -t vfat -o async,noatime /dev/mtdblock$UBI_NUM /LF/Cart
if [ "`echo $?`" -ne "0" ] ; then
echo "Unable to mount cartridge. Erasing to try again"
#ubidetach /dev/ubi_ctrl -d $UBI_NODE
flash_eraseall /dev/mtd$DEV_NUM
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
#echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "ERASE complete. Remove and reinsert your cartridge and try again."
echo "Mount failed, please try again" > /tmp/mkMfgCartResult
exit 1
fi
fi
fi
DEV_NUM="`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1 | cut -d d -f2`"
for UBI in `ls /sys/class/ubi | grep ubi.$ | cut -d i -f2` ; do
if [ "`cat /sys/class/ubi/ubi$UBI/mtd_num`" -eq "$DEV_NUM" ] ; then
UBI_NODE="$UBI"
break
fi
done
if [ "`mount | grep Cart | grep -c rw`" -lt "1" ] ; then
mount -o remount,rw $CART_DIR
fi
if [ "`mount | grep -c $CART_DIR`" -ne "1" ] ; then
echo "Unable to mount cartridge. Erasing to try again"
if [ $MADRID ] ; then
$DRAWTEXT_CMD "Can't mount cart. Erase now... " 8 2 0
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
# ubidetach /dev/ubi_ctrl -d $UBI_NODE
fi
flash_eraseall /dev/mtd$DEV_NUM 2> /dev/null
if [ $MADRID ] ; then
$DRAWTEXT_CMD "Erase complete. Please try again " 8 2 0
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
# echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
fi
echo "ERASE complete. Remove and reinsert your cartridge and try again."
echo "Mount failed, please try again" > /tmp/mkMfgCartResult
echo "ERROR: No cartidge mounted"
exit 1
fi
if [ ! "`ls $DIR | grep MadridMfgTest | grep -c lfp`" -eq "0" ] ; then
$DRAWTEXT_CMD "Installing test from /LF/Bulk package " 8 2 0
rm -rf $CART_DIR/*
lfpkg -a install -b $CART_DIR -d / $DIR/MadridMfgTest*.lfp
$DRAWTEXT_CMD "Validating install at /LF/Cart " 8 2 0
lfpkg -a validate -b $CART_DIR -d / $DIR/MadridMfgTest*.lfp
RESULT="`echo $?`"
if [ $RESULT != 0 ] ; then
if [ $MADRID ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
# umount $CART_DIR
# if [ "X$UBI_NODE" -ne "X" ] ; then
# ubidetach /dev/ubi_ctrl -d $UBI_NODE
# fi
# echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
fi
echo "Copy validation failed" > /tmp/mkMfgCartResult
echo "!!!!!!!!!!!!!!!FAILED!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
elif [ -e /LF/Base/MadridMfgTest/LaunchMfgTest.sh ] ; then
echo "Copying MadridMfgTest from Base to unit"
$DRAWTEXT_CMD "Copying MfgTest from Base to cart " 8 2 0
rm -rf $CART_DIR/*
cp -rf /LF/Base/MadridMfgTest $CART_DIR
echo "Verifying file copy"
$DRAWTEXT_CMD "Verifying file copy " 8 2 0
if [ "`diff -r -q /LF/Base/MadridMfgTest $CART_DIR/MadridMfgTest | grep -c MadridMfgTest`" -gt "0" ] ; then
if [ $MADRID ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
# umount $CART_DIR
# if [ "X$UBI_NODE" -ne "X" ] ; then
# ubidetach /dev/ubi_ctrl -d $UBI_NODE
# fi
# echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
fi
echo "Copy operation failed" > /tmp/mkMfgCartResult
echo "!!!!!!!!!!!!!!!FAILED!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
echo "Copy operation complete and verified"
else
echo "No MadridMfgTest package found in $DIR"
echo "Please place the file in $DIR and try again."
if [ $MADRID ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
# umount $CART_DIR
# if [ "X$UBI_NODE" -ne "X" ] ; then
# ubidetach /dev/ubi_ctrl -d $UBI_NODE
# fi
# echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
fi
echo "No package in $DIR" > /tmp/mkMfgCartResult
echo "!!!!!!!!!!!!!!!FAILED!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
if [ $MADRID ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
#umount $CART_DIR
#if [ "X$UBI_NODE" -ne "X" ] ; then
# ubidetach /dev/ubi_ctrl -d $UBI_NODE
#fi
#echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
echo "Made Mfg Test Cart successfully" > /tmp/mkMfgCartResult
else
echo "Power Off to complete" > /tmp/mkMfgCartResult
echo "Power Off to complete"
fi
echo "*************************"
echo " Done"
echo "*************************"
exit 0
mkSuperATAP.sh#
Interestingly, this one references the Didj, so it probably uses a similar backend to the Leapster/LeapPad Explorer, or is left over from it.
#! /bin/sh
date
# set -x
RMOK=0
if [ ! -e /flags/poweron ] ; then
echo "Adding the /flags/poweron flag"
touch /flags/poweron
RMOK=1
fi
if [ -d /Didj ] ; then # this means we are using a Didj
EMERALD=0
DIR="/Didj"
echo "Looking for files in $DIR...."
DIR="`find $DIR -name mkSuperATAP.sh -exec dirname {} \;`"
echo "Found program files in $DIR"
if [ "`cat /proc/mtd | grep -c Cartridge`" -lt "1" ] ; then
echo "You must erase your cartridge partition manually first"
exit 1
fi
mount -o remount,rw /
else # this means we using an Madrid.
EMERALD=1
DIR="/LF/Bulk"
echo "Looking for files in $DIR...."
if [ -e /LF/Bulk/Super_ATAP/mkSuperATAP.sh ] ; then
DIR="/LF/Bulk/Super_ATAP"
else
DIR="`find $DIR -name mkSuperATAP.sh -exec dirname {} \;`"
fi
echo "Found program files in $DIR"
fi
echo "Checking for all files..."
if [ ! -e $DIR/files.md5 ] ; then
if [ -e $DIR/emerald-boot.bin ] ; then
echo -e "found emerald-boot.bin - \c"
FILE1_SIZE="`ls -l $DIR | grep emerald-boot.bin$ | tr -s ' ' | cut -d ' ' -f5`"
echo -e "SIZE: $FILE1_SIZE bytes \c"
FILE1_MD5="`md5sum $DIR/emerald-boot.bin | cut -d ' ' -f1`"
echo "MD5: $FILE1_MD5"
else
echo "******************************************************"
echo "ERROR: PLEASE PUT THE emerald-boot.bin in $DIR!!"
echo "******************************************************"
exit 1
fi
if [ -e $DIR/HEALTH_AND_SAFETY.32.rle ] ; then
FILE2="HEALTH_AND_SAFETY.32.rle"
echo -e "found HEALTH_AND_SAFETY.32.rle - \c"
FILE2_SIZE="`ls -l $DIR | grep HEALTH_AND_SAFETY.32.rle$ | tr -s ' ' | cut -d ' ' -f5`"
echo -e "SIZE: $FILE2_SIZE bytes \c"
FILE2_MD5="`md5sum $DIR/HEALTH_AND_SAFETY.32.rle | cut -d ' ' -f1`"
echo "MD5: $FILE2_MD5"
elif [ -e $DIR/FIRST.32.rle ] ; then
FILE2="FIRST.32.rle"
echo -e "found FIRST.32.rle - \c"
FILE2_SIZE="`ls -l $DIR | grep FIRST.32.rle$ | tr -s ' ' | cut -d ' ' -f5`"
echo -e "SIZE: $FILE2_SIZE bytes \c"
FILE2_MD5="`md5sum $DIR/FIRST.32.rle | cut -d ' ' -f1`"
echo "MD5: $FILE2_MD5"
else
echo "******************************************************************************"
echo "ERROR: PLEASE PUT THE HEALTH_AND_SAFETY.32.rle or FIRST.32.rle in $DIR!!"
echo "******************************************************************************"
exit 1
fi
if [ -e $DIR/kernel_ATAP.cbf ] ; then
echo -e "found kernel_ATAP.cbf - \c"
FILE3_SIZE="`ls -l $DIR | grep kernel_ATAP.cbf$ | tr -s ' ' | cut -d ' ' -f5`"
echo -e "SIZE: $FILE3_SIZE bytes \c"
FILE3_MD5="`md5sum $DIR/kernel_ATAP.cbf | cut -d ' ' -f1`"
echo "MD5: $FILE3_MD5"
else
echo "******************************************************"
echo "ERROR: PLEASE PUT THE kernel_ATAP.cbf in $DIR!!"
echo "******************************************************"
exit 1
fi
if [ -e $DIR/erootfs_ATAP.ubi ] ; then
echo -e "found erootfs_ATAP.ubi - \c"
FILE4_SIZE="`ls -l $DIR | grep erootfs_ATAP.ubi$ | tr -s ' ' | cut -d ' ' -f5`"
echo -e "SIZE: $FILE4_SIZE bytes \c"
FILE4_MD5="`head -c $((0x1000000)) $DIR/erootfs_ATAP.ubi | md5sum - | cut -d ' ' -f1`"
echo "Partial MD5: $FILE4_MD5"
else
echo "******************************************************"
echo "ERROR: PLEASE PUT THE erootfs_ATAP.ubi in $DIR!!"
echo "******************************************************"
exit 1
fi
if [ -e $DIR/bulk_ATAP.ubi ] ; then
echo -e "found bulk_ATAP.ubi - \c"
FILE5_SIZE="`ls -l $DIR | grep bulk_ATAP.ubi$ | tr -s ' ' | cut -d ' ' -f5`"
echo -e "SIZE: $FILE5_SIZE bytes \c"
FILE5_MD5="`head -c $((0x1000000)) $DIR/bulk_ATAP.ubi | md5sum - | cut -d ' ' -f1`"
echo "Partial MD5: $FILE5_MD5"
else
echo "******************************************************"
echo "ERROR: PLEASE PUT THE bulk_ATAP.ubi in $DIR!!"
echo "******************************************************"
exit 1
fi
fi
if [ "$EMERALD" -eq "1" ] ; then
#Setup the cartridge to mount and set ECC mode
SETUP_SCRIPT=0
if [ -e $DIR/SetupNANDCartridge.sh ] ; then
SETUP_SCRIPT=1
chmod +x $DIR/SetupNANDCartridge.sh
$DIR/SetupNANDCartridge.sh start
else
if [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; then
echo 1 > /sys/devices/platform/lf1000-nand/cart_hotswap
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "2" ] ; then
echo "Failed to set cartridge hotswap to 1. Unabel to mount base NAND."
drawtext /dev/layer0 /test/monotext8x16.rgb "FAILED: Unable to set Hotswap mode" 5 3 1
#/usr/bin/app &
exit 1
fi
done
fi
TIME_START=`date +%s`
while [ ! "`cat /proc/mtd | grep -c '"Cartridge"'`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
echo "Can not see NAND. Skipping NAND programming"
drawtext /dev/layer0 /test/monotext8x16.rgb "FAILED: No NAND detetced" 5 3 1
#/usr/bin/app &
exit 1
fi
done
if [ "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "0" ] ; then
echo 1 > /sys/devices/platform/lf1000-nand/cart_ecc_mode
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "2" ] ; then
echo "Failed to set cartridge ecc mode to 1. Unabel to mount cartridge. Aborting Programming"
drawtext /dev/layer0 /test/monotext8x16.rgb "FAILED: Unable to set ECC mode" 5 3 1
#/usr/bin/app &
exit 1
fi
done
fi
fi
fi
if [ "`mount | grep -c LF/Cart`" -ge "1" ] ; then
umount LF/Cart
elif [ "`mount | grep -c /Cart`" -ge "1" ] ; then
umount /Cart
fi
DEV="/dev/`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1`"
echo "erasing ATAP on $DEV"
flash_eraseall $DEV 2> /dev/null
echo -e "Writing Boot Image.....\c"
nandwrite -n -p $DEV $DIR/emerald-boot.bin > /dev/null
echo -e "VALIDATING\c"
#TEMP="`head -c $FILE1_SIZE $DEV | md5sum - | cut -d ' ' -f1`"
TEMP="`nanddump -n -o -b -q $DEV | head -c $FILE1_SIZE | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$FILE1_MD5" ] ; then
if [ "$EMERALD" -eq "1" -a -e $DIR/SetupNANDCartridge.sh ] ; then
$DIR/SetupNANDCartridge.sh stop
fi
echo "...FAIL: Writing emerald-boot.bin FAILED!!!!!!!!!!!!"
echo "MD5 of file = $FILE1_MD5"
echo "MD5 of partition = $TEMP"
exit 1
else
echo "...PASS"
fi
echo -e "Writing screens.....\c"
nandwrite -s 0x100000 -p $DEV $DIR/$FILE2 > /dev/null
echo -e "VALIDATING\c"
TEMP="`head -c $(($FILE2_SIZE + 0x100000)) $DEV | tail -c $FILE2_SIZE - | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$FILE2_MD5" ] ; then
if [ "$EMERALD" -eq "1" -a -e $DIR/SetupNANDCartridge.sh ] ; then
$DIR/SetupNANDCartridge.sh stop
fi
echo "...FAIL: Writing $FILE2 FAILED!!!!!!!!!!!!"
echo "MD5 of file = $FILE2_MD5"
echo "MD5 of partition = $TEMP"
exit 1
else
echo "...PASS"
fi
echo -e "Writing Kernel Image.....\c"
nandwrite -s 0x200000 -p $DEV $DIR/kernel_ATAP.cbf > /dev/null
echo -e "VALIDATING\c"
TEMP="`head -c $(($FILE3_SIZE + 0x200000)) $DEV | tail -c $FILE3_SIZE - | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$FILE3_MD5" ] ; then
if [ "$EMERALD" -eq "1" -a -e $DIR/SetupNANDCartridge.sh ] ; then
$DIR/SetupNANDCartridge.sh stop
fi
echo "...FAIL: Writing kernel_ATAP.cbf FAILED!!!!!!!!!!!!"
echo "MD5 of file = $FILE3_MD5"
echo "MD5 of partition = $TEMP"
exit 1
else
echo "...PASS"
fi
echo -e "Writing Root File System.....\c"
nandwrite -s 0xa00000 -p $DEV $DIR/erootfs_ATAP.ubi > /dev/null
echo -e "VALIDATING\c"
#TEMP="`head -c $((0x100000 + 0xa00000)) $DEV | tail -c $((0x100000)) - | md5sum - | cut -d ' ' -f1`"
#TEMP="`dd if=$DEV bs=1 skip=$((0xa00000)) | head -c $((0x100000)) - | md5sum - | cut -d ' ' -f1`"
TEMP="`nanddump -o -b -q -s 0xa00000 $DEV | head -c $((0x1000000)) | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$FILE4_MD5" ] ; then
if [ "$EMERALD" -eq "1" -a -e $DIR/SetupNANDCartridge.sh ] ; then
$DIR/SetupNANDCartridge.sh stop
fi
echo "...FAIL: Writing erootfs_ATAP.ubi FAILED!!!!!!!!!!!!"
echo "Partial MD5 of file = $FILE4_MD5"
echo "Partial MD5 of partition = $TEMP"
exit 1
else
echo "...PASS"
fi
echo -e "Writing Bulk Image.....\c"
nandwrite -s 0x6000000 -p $DEV $DIR/bulk_ATAP.ubi > /dev/null
echo -e "VALIDATING\c"
#TEMP="`head -c $((0x100000 + 0x6000000)) $DEV | tail -c $((0x100000)) - | md5sum - | cut -d ' ' -f1`"
#TEMP="`dd if=$DEV bs=1 skip=$((0x6000000)) count=$((0x100000)) 2> /dev/null | head -c $((0x100000)) - | md5sum - | cut -d ' ' -f1`"
TEMP="`nanddump -o -b -q -s 0x6000000 $DEV | head -c $((0x1000000)) | md5sum - | cut -d ' ' -f1`"
if [ "$TEMP" != "$FILE5_MD5" ] ; then
if [ "$EMERALD" -eq "1" -a -e $DIR/SetupNANDCartridge.sh ] ; then
$DIR/SetupNANDCartridge.sh stop
fi
echo "...FAIL: Writing bulk_ATAP.ubi FAILED!!!!!!!!!!!!"
echo "Partial MD5 of file = $FILE5_MD5"
echo "Partial MD5 of partition = $TEMP"
exit 1
else
echo "...PASS"
fi
if [ "$RMOK" -eq "1" ] ; then
echo "Removing the /flags/poweron flag"
rm -f /flags/poweron
fi
if [ "$EMERALD" -eq "1" -a -e $DIR/SetupNANDCartridge.sh ] ; then
$DIR/SetupNANDCartridge.sh stop
fi
date
echo "***********************************"
echo " SUPER ATAP CREATED SUCCESSFULLY!!!"
echo "***********************************"
exit 0
ParseLogsMadrid.sh#
#!/bin/sh
set -x
rm *.csv
echo "Blue RGB Data" > Blue.csv
echo "#points, avrR, avrG, avrB" >> Blue.csv
echo "Green RGB Data" > Green.csv
echo "#points, avrR, avrG, avrB" >> Green.csv
echo "Red RGB Data" > Red.csv
echo "#points, avrR, avrG, avrB" >> Red.csv
for log_files in `ls -1 */LFCameraPic*.log` ; do
grep -R -A 4 "0, Blue" $log_files | tail -1 >> Blue.csv
grep -R -A 4 "1, Green" $log_files | tail -1 >> Green.csv
grep -R -A 4 "2, Red" $log_files | tail -1 >> Red.csv
done
ResetUnit.sh#
#!/bin/sh
# This file will clear all user profiles, special flags and logs from unit only.
set -x
BASE_PATH="/"
rm -f /tmp/ResetUnitResult
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ `cat /sys/devices/platform/lf1000-gpio/board_id` != 3 ]; then
ATAP=1
echo "Booted from the ATAP...checking for mtd utilites support. "
if [ ! -e /sys/devices/platform/lf1000-nand/new_mtd ] ; then
echo "Unable to run this test when booted from the ATAP. Must boot from the Device NAND"
echo "Cannot do this while booted from ATAP." > /tmp/ResetUnitResult
exit 1
fi
echo "mtd utilities Support OK....starting verification......"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh start
if [ "`cat /proc/mtd | grep -c Base_RFS`" -eq "0" ] ; then
# setup the bases RFS to mount onto /prg_RFS
echo "1 0x00a00000 0x05600000 Base_RFS" > /sys/devices/platform/lf1000-nand/new_mtd
fi
UBI_RFS="NONE"
if [ "`ubinfo -a | grep -c ubi_rfs`" -lt "2" ] ; then
UBI_RFS="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
RFS_MTD="`cat /proc/mtd | grep '"Base_RFS"' | cut -d : -f1 | cut -c 4-`"
ubiattach /dev/ubi_ctrl -d $UBI_RFS -m $RFS_MTD #attach Base_RFS to next ubi
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
mkdir -p /prg_RFS
mount -t ubifs ubi$UBI_RFS:ubi_rfs /prg_RFS
fi
if [ "$UBI_RFS" = "NONE" ] ; then
i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
while [ "$UBI_RFS" = "NONE" -a "$i" -gt "0" ] ; do
i="`echo $(($i-1))`"
if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_RFS" ] ; then
UBI_RFS=$i
fi
done
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
echo "Unable to see the device RFS partition"
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $UBI_RFS
echo "Can not see device's RFS" > /tmp/ResetUnitResult
exit 1
fi
BASE_PATH="/prg_RFS"
VER="`cat $BASE_PATH/etc/version`"
if [ "`cat /proc/mtd | grep -c Base_Bulk`" -eq "0" ] ; then
echo "1 0x06000000 0x1a000000 Base_Bulk" > /sys/devices/platform/lf1000-nand/new_mtd
fi
UBI_BULK="NONE"
if [ "`ubinfo -a | grep -c ubi_bulk`" -lt "2" ] ; then
UBI_BULK="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
BULK_MTD="`cat /proc/mtd | grep '"Base_Bulk"' | cut -d : -f1 | cut -c 4-`"
ubiattach /dev/ubi_ctrl -d $UBI_BULK -m $BULK_MTD #attach Base_Bulk to next ubi
fi
if [ "$UBI_BULK" = "NONE" ] ; then
i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
while [ "$UBI_BULK" = "NONE" -a "$i" -gt "0" ] ; do
i="`echo $(($i-1))`"
if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_Bulk" ] ; then
UBI_BULK=$i
fi
done
fi
if [ "`mount | grep -c prg_RFS/LF/Bulk`" -lt "1" ] ; then
mount -t ubifs ubi$(($UBI_BULK)):ubi_bulk /prg_RFS/LF/Bulk
fi
if [ "`mount | grep -c prg_RFS/LF/Bulk`" -ne "1" ] ; then
echo "Unable to see the device Bulk partition"
umount -f /prg_RFS/LF/Bulk
ubidetach /dev/ubi_ctrl -d $UBIS_BULK
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
echo "Can not see device's Bulk" > /tmp/ResetUnitResult
exit 1
fi
fi
fi
echo "Removing any flight recorder logs & core dumps"
rm -f $BASE_PATH/LF/Base/FR/*
logger -s -t "Emearld App" -p local4.notice "MadridMfgTest has cleared flight recorder log and core dumps"
logger -s -t "Emearld App" -p local4.notice "MadridMfgTest has cleared the profiles and settings"
logger -s -t "Emearld App" -p local4.notice "Leapster Explorer unit information:"
logger -s -t "Emearld App" -p local4.notice " Serial Number: `mfgdata get sn`"
logger -s -t "Emearld App" -p local4.notice " NOR Touch Cal Data: `mfgdata get ts`"
logger -s -t "Emearld App" -p local4.notice " NOR ADC Cal Data: `mfgdata get adc`"
logger -s -t "Emearld App" -p local4.notice " NOR Backligth Cal Data: `mfgdata get bl`"
echo "This will clear all profiles, pets and logs".
rm -rf $BASE_PATH/LF/Bulk/Data/Shared/0/*
rm -rf $BASE_PATH/LF/Bulk/Data/Shared/1/*
rm -rf $BASE_PATH/LF/Bulk/Data/Shared/2/*
rm -rf $BASE_PATH/LF/Bulk/Data/Shared/3/*
rm -rf $BASE_PATH/LF/Bulk/Data/Shared/All/*
rm -rf $BASE_PATH/LF/Bulk/Data/Local/0/*
rm -rf $BASE_PATH/LF/Bulk/Data/Local/1/*
rm -rf $BASE_PATH/LF/Bulk/Data/Local/2/*
rm -rf $BASE_PATH/LF/Bulk/Data/Local/3/*
rm -rf $BASE_PATH/LF/Bulk/Data/Local/All/*
rm -rf $BASE_PATH/LF/Bulk/Data/Uploads/0/*
rm -rf $BASE_PATH/LF/Bulk/Data/Uploads/1/*
rm -rf $BASE_PATH/LF/Bulk/Data/Uploads/2/*
rm -rf $BASE_PATH/LF/Bulk/Data/Uploads/3/*
rm -rf $BASE_PATH/LF/Bulk/Data/Uploads/All/*
rm -rf $BASE_PATH/LF/Bulk/Data/photos/*
rm -rf $BASE_PATH/LF/Bulk/Data/videos/*
rm -f $BASE_PATH/LF/Base/settings.cfg
rm -f $BASE_PATH/LF/Bulk/settings.cfg
rm -f $BASE_PATH/flags/no8sec
rm -f $BASE_PATH/flags/developer
rm -f $BASE_PATH/flags/avahi
rm -f $BASE_PATH/flags/poweron
rm -f $BASE_PATH/flags/main_app
rm -f $BASE_PATH/flags/pointercal
rm -f $BASE_PATH/flags/volume
if [ -d $BASE_PATH/LF/Bulk/Downloads/LFConnectMessage ] ; then
rm -rf $BASE_PATH/LF/Bulk/Downloads/LFConnectMessage
fi
RESET_DIR="X"
if [ "`ls /LF/Base/MadridMfgTest/ResetFiles | grep -c .lfp`" -gt "0" ] ; then
RESET_DIR="/LF/Base/MadridMfgTest/ResetFiles"
elif [ "`ls /LF/Cart/MadridMfgTest/ResetFiles | grep -c .lfp`" -gt "0" ] ; then
RESET_DIR="/LF/Cart/MadridMfgTest/ResetFiles"
fi
if [ "`echo $RESET_DIR`" != "X" ] ; then
for lfp in `ls $RESET_DIR | grep .lfp` ; do
lfpkg -a install -b $BASE_PATH/LF $RESET_DIR/$lfp
lfpkg -a validate -b $BASE_PATH/LF $RESET_DIR/$lfp
RESULT="`echo $?`"
if [ $RESULT -ne "0" ] ; then
echo "Resetting $lfp failed."
echo "Resetting $lfp failed." > /tmp/ResetUnitResult
exit 1
fi
done
else
echo "No reset files found to reset the unit to default configuration!"
fi
sync
if [ "$ATAP" -eq "1" ] ; then
if [ "`mount | grep -c prg_RFS/LF/Bulk`" -ge "1" ] ; then
echo "Unmounting the device's Bulk partition"
umount -f /prg_RFS/LF/Bulk
ubidetach /dev/ubi_ctrl -d $UBI_BULK
fi
if [ "`mount | grep -c prg_RFS`" -ge "1" ] ; then
echo "Unmounting the device's RFS partition"
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
echo "All ubi devices created are now cleaned up...."
fi
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "Unit RESET DONE" > /tmp/ResetUnitResult
exit 0
SetLocale_ES.sh#
#!/bin/sh
# This file will write the Spanish (ES) locale to the NOR
set -x
LOCALE="es-es"
STATUS="0"
mfgdata set locale $LOCALE
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "mfgdata command failed to write locale to NOR"
exit $STATUS
fi
mfgdata get locale > /tmp/locale
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "Unable to retrieve locale from NOR"
exit $STATUS
fi
if [ "`cat /tmp/locale`" != "$LOCALE" ] ; then
echo "Locale does not match what was written."
exit 5
fi
exit 0
SetLocale_FR.sh#
#!/bin/sh
# This file will write the FR locale to the NOR
set -x
LOCALE="fr-fr"
STATUS="0"
mfgdata set locale $LOCALE
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "mfgdata command failed to write locale to NOR"
exit $STATUS
fi
mfgdata get locale > /tmp/locale
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "Unable to retrieve locale from NOR"
exit $STATUS
fi
if [ "`cat /tmp/locale`" != "$LOCALE" ] ; then
echo "Locale does not match what was written."
exit 5
fi
exit 0
SetLocale_US.sh#
#!/bin/sh
# This file will write the US locale to the NOR
set -x
LOCALE="en-us"
STATUS="0"
mfgdata set locale $LOCALE
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "mfgdata command failed to write locale to NOR"
exit $STATUS
fi
mfgdata get locale > /tmp/locale
STATUS="`echo $?`"
if [ "$STATUS" -ne "0" ] ; then
echo "Unable to retrieve locale from NOR"
exit $STATUS
fi
if [ "`cat /tmp/locale`" != "$LOCALE" ] ; then
echo "Locale does not match what was written."
exit 5
fi
exit 0
setupdisplay.sh#
#!/bin/sh
#SZSZ setup display
fbctrl /dev/fb0 set blank 0
fbctrl /dev/fb0 set blend 1 255
fbctrl /dev/fb0 set priority 0
fbctrl /dev/fb1 set blank 0
fbctrl /dev/fb1 set blend 1 255
fbctrl /dev/fb1 set priority 1
fbctrl /dev/fb2 set blank 0
fbctrl /dev/fb2 set priority 2
fbctrl /dev/fb2 set blend 0 255
SetupNANDCartridge.sh#
#/bin/sh
set -x
rm -f /tmp/SetupNANDCartridgeResult
if [ -d /LF/Bulk ] ; then
CART_DIR="/LF/Cart"
DIR="/LF/Bulk"
MADRID="1"
else
echo "This script is only needed and supported on an Madrid Device"
exit 0
fi
#CART_ID=0
#CART_ID=$((`gpio-control /dev/gpio invalue 1 5` * 8))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 4` * 4)))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 3` * 2)))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 2`)))
# Set cardID signal path
gpio-control /dev/gpio outenable 2 1 0
gpio-control /dev/gpio outenable 2 8 0
gpio-control /dev/gpio outenable 2 9 0
gpio-control /dev/gpio outenable 2 11 0
CART_ID=0
CART_ID=$((`gpio-control /dev/gpio invalue 2 9` * 8))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 11` * 4)))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 1` * 2)))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 8`)))
echo "Cart ID: $CART_ID"
case "$1" in
start)
echo "Starting the cartridge insertion setup"
#Setup the cartridge to mount and set ECC mode
if [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; then
echo "Setting Cartridge Hotswap"
echo 1 > /sys/devices/platform/lf1000-nand/cart_hotswap
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "2" ] ; then
echo "Failed to set cartridge hotswap to 1. Unabel to mount cartridge NAND."
echo "Unable to set cart hotswap" > /tmp/SetupNANDCartridgeResult
exit 1
fi
done
fi
TIME_START=`date +%s`
while [ ! "`cat /proc/mtd | grep -c \\"Cartridge\\"`" -eq "1" ] ; do
echo "Waiting for cartridge to be recognized"
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
echo "Error: Can not find a cartridge."
echo "Can not find cartridge" > /tmp/SetupNANDCartridgeResult
exit 1
fi
done
DEV_NUM="`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1 | cut -d d -f2`"
if [ "$CART_ID" = "11" -o "$CART_ID" = "6" -o "$CART_ID" = "15" ] ; then
#if [ ! "`dmesg | tail -n 14 | grep 'NAND device' | grep -c 64MiB`" -eq "1" ] ; then
# This is a NAND device, checking ECC mode
if [ "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "0" ] ; then
echo "Setting Cartridge ECC mode"
echo 1 > /sys/devices/platform/lf1000-nand/cart_ecc_mode
TIME_START=`date +%s`
while [ ! "`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`" -eq "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
echo "Failed to set cartridge ecc mode to 1. Unabel to mount cartridge."
echo "Unable to set ECC mode" > /tmp/SetupNANDCartridgeResult
exit 1
fi
done
fi
else
echo "Skipping enable ECC due to OTP cart"
fi
echo "Cartridge should now be visible in proc/mtd"
cat /proc/mtd | grep '"Cartridge"'
echo "ECC mode =`cat /sys/devices/platform/lf1000-nand/cart_ecc_mode`"
if [ "`mount | grep -c /LF/Cart`" -lt "1" ] ; then
echo "restarting the cartridge startup script to enable the mounts...if any"
TIME_START=`date +%s`
echo "Waiting for cartridge to be mounted"
if [ -e /etc/init.d/cartridge ] ; then
/etc/init.d/cartridge restart
elif [ -e /LF/Base/MadridMfgTest/cartridge ] ; then
/LF/Base/MadridMfgTest/cartridge restart
elif [ -e /LF/Cart/MadridMfgTest/cartridge ] ; then
/LF/Cart/MadridMfgTest/cartridge restart
fi
RETRY=0
while [ "`mount | grep -c $CART_DIR`" -ne "1" ] ; do
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "4" ] ; then
if [ "$RETRY" = "0" ] ; then
RETRY=1
if [ -e /etc/init.d/cartridge ] ; then
/etc/init.d/cartridge restart
elif [ -e /LF/Base/MadridMfgTest/cartridge ] ; then
/LF/Base/MadridMfgTest/cartridge restart
elif [ -e /LF/Cart/MadridMfgTest/cartridge ] ; then
/LF/Cart/MadridMfgTest/cartridge restart
fi
TIME_START=`date +%s`
else
echo "Mount failed. Cart must be empty or not have a file system yet."
echo "Unable to mount cart" > /tmp/SetupNANDCartridgeResult
exit 1
fi
fi
done
fi
echo "DONE"
exit 0
;;
stop)
echo "Ejecting the Madrid Cartridge"
if [ "$MADRID" -eq "1" ] ; then # this path means we are running from an Madrid
#unmount the cartridge if it is mounted
if [ "`mount | grep -c $CART_DIR`" -ge "1" ] ; then
echo "Unmounting the Madrid Cartridge"
sudo umount $CART_DIR
fi
#detach the ubi volume if it is attached
DEV_NUM="`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1 | cut -d d -f2`"
if [ "`cat /proc/mtd | grep -c ubi_Cartridge`" -ge "1" ] ; then
# search for the ubi device node number
for UBI in `ls /sys/class/ubi | grep ubi.$ | cut -d i -f2` ; do
if [ "`cat /sys/class/ubi/ubi$UBI/mtd_num`" -eq "$DEV_NUM" ] ; then
UBI_NODE="$UBI"
break
fi
done
echo "Detaching the Madrid ubi device on node $UBI_NODE"
sudo ubidetach /dev/ubi_ctrl -d $UBI_NODE
fi
#kill the mtd driver for this device
if [ "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -eq "1" ] ; then
echo "Ejecting the cartridge"
echo 0 > /sys/devices/platform/lf1000-nand/cart_hotswap
fi
echo "It is safe to remove the cartridge now."
return 0
else
# this path means we are not running on an Madrid
echo "Power Off to complete" > /tmp/SetupNANDCartridgeResult
echo "Power Off to complete"
exit 0
fi
;;
restart)
logger -s -t "Madrid Base" -p local4.notice "Restarting Cartridge !"
$0 stop
$0 start
;;
*)
echo "Recommended Usage: $0 {start|stop|restart}"
$0 start
;;
esac
Validate.sh#
#!/bin/sh
# NOTES:
# 1. Make sure copy this file into Validate.sh
# 2. Run only on recovery mounts, not std mounts.
# 3. No combined (partition) md5 for Bulk and efroot any more. Will use .md5 on each sub dir to do checking
ENABLE_FULL_VALIDATE=1 # Non-zero will add checksum rootfs and bulk to validation in addition to mounting them
# 0 will just try to mount the partitions and error if mount fails
set -x
chmod +x /tmp/recovery-mounts-new.sh
killall recovery
killall flipbook-fb
#exit 1
# This file will validate the madrid-boot, kernel, and Health & Safety partitions.
# Then mount the file system from Surgeon Mode to put the validation files on the unit.
FILES_PATH="/LF/Bulk/Downloads/Firmware-Mfg"
#RECOVEY_MOUNT_SCRIPT_PATH="/etc/init.d"
RECOVEY_MOUNT_SCRIPT_PATH="/tmp"
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
else
if [ -e /test/monotext8x16.rgb ] ; then
DRAWTEXT_CMD="drawtext /dev/layer0 /test/monotext8x16.rgb"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
fi
fi
#if [ 0 -ne 0 ] ; then
MBR_SUM="`cat /tmp/checksums.txt | grep mbr2G | tr -s ' ' | cut -d ' ' -f1`"
MBR_PART_SUM="`cat /dev/mmcblk0 | head -c 512 - | md5sum - | cut -d ' ' -f1`"
if [ "$MBR_SUM" != "$MBR_PART_SUM" ] ; then
echo "MBR bad:"
echo " File MD5: $MBR_SUM"
echo " MBR MD5: $MBR_PART_SUM"
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "MBR failed verification... " 3 1 1
$DRAWTEXT_CMD " File:$MBR_SUM " 4 1 1
$DRAWTEXT_CMD " MBR: $MBR_PART_SUM " 5 1 1
echo "Error code: -1 - NOR validation failed" > /tmp/error
echo "MBR checksum does not match:" >> /tmp/error
echo " MBR File MD5: $MBR_SUM" >> /tmp/error
echo " MBR contents MD5: $MBR_PART_SUM" >> /tmp/error
exit 11
fi
#fi
#if [ "`cat /tmp/files.txt | grep -c FIRST_Lpad.32.rle`" -ge "1" ] ; then
#SCREEN_SIZE="`cat /tmp/files.txt | grep FIRST_Lpad.32.rle$ | tr -s ' ' | cut -d ' ' -f6`"
#SCREEN_SUM="`cat /tmp/checksums.txt | grep FIRST_Lpad.32.rle | cut -d ' ' -f1`"
SCREEN_SIZE="`cat /tmp/files.txt | grep FIRST_Lpad.cbf$ | tr -s ' ' | cut -d ' ' -f6`"
SCREEN_SUM="`cat /tmp/checksums.txt | grep FIRST_Lpad.cbf | cut -d ' ' -f1`"
#fi
BOOT_SIZE="`cat /tmp/files.txt | grep madrid-boot.bin$ | tr -s ' ' | cut -d ' ' -f6`"
#KERNEL_SIZE="`ls -l /tmp | grep kernel.cbf$ | tr -s ' ' | cut -d ' ' -f6`"
KERNEL_SIZE="`cat /tmp/files.txt | grep kernel.cbf$ | tr -s ' ' | cut -d ' ' -f6`"
EROOT_SIZE=0
BULK_SIZE=0
if [ $ENABLE_FULL_VALIDATE -ne "0" ] ; then
#if [ "`cat /tmp/files.txt | grep -c rfs`" -ge "1" ] ; then
#EROOT_SIZE="`cat /tmp/files.txt | grep rfs$ | tr -s ' ' | cut -d ' ' -f6`"
EROOT_SIZE="`cat /tmp/files.txt | grep erootfs-lpd.ubi$ | tr -s ' ' | cut -d ' ' -f6`"
#fi
#if [ "`cat /tmp/files.txt | grep -c Bulk`" -ge "1" ] ; then
#BULK_SIZE="`cat /tmp/files.txt | grep Bulk$ | tr -s ' ' | cut -d ' ' -f6`"
BULK_SIZE="`cat /tmp/files.txt | grep bulk_lpad.ubi$ | tr -s ' ' | cut -d ' ' -f6`"
#fi
fi
#BOOT_SUM="`cat $FILES_PATH/packagefiles.md5 | grep NORBoot/madrid-boot.bin | cut -d ' ' -f1`"
#KERNEL_SUM="`cat $FILES_PATH/packagefiles.md5 | grep kernel.cbf | cut -d ' ' -f1`"
#EROOT_SUM="`cat $FILES_PATH/packagefiles.md5 | grep rfs | cut -d ' ' -f1`"
#BULK_SUM="`cat $FILES_PATH/packagefiles.md5 | grep Bulk | cut -d ' ' -f1`"
BOOT_SUM="`cat /tmp/checksums.txt | grep madrid-boot.bin | cut -d ' ' -f1`"
KERNEL_SUM="`cat /tmp/checksums.txt | grep kernel.cbf | cut -d ' ' -f1`"
#EROOT_SUM="`cat /tmp/checksums.txt | grep rfs | cut -d ' ' -f1`"
#BULK_SUM="`cat /tmp/checksums.txt | grep Bulk | cut -d ' ' -f1`"
EROOT_SUM="`cat /tmp/checksums.txt | grep erootfs-lpd.ubi | cut -d ' ' -f1`"
BULK_SUM="`cat /tmp/checksums.txt | grep bulk_lpad.ubi | cut -d ' ' -f1`"
NOR_PRT="/dev/`cat /proc/mtd | grep NOR_Boot | cut -d : -f1`"
NOR_SUM="`head -c $BOOT_SIZE $NOR_PRT | md5sum - | cut -d ' ' -f1`"
if [ "$NOR_SUM" != "$BOOT_SUM" ] ; then
echo "NOR Boot does not match:"
echo " File MD5: $BOOT_SUM"
echo " NOR MD5: $NOR_SUM"
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "NOR Boot failed verification... " 3 1 1
$DRAWTEXT_CMD " File:$BOOT_SUM " 4 1 1
$DRAWTEXT_CMD " NOR: $NOR_SUM " 5 1 1
echo "Error code: 1 - NOR validation failed" > /tmp/error
echo "NOR checksum does not match:" >> /tmp/error
echo " NOR Boot File MD5: $BOOT_SUM" >> /tmp/error
echo " NOR Boot partition MD5: $NOR_SUM" >> /tmp/error
exit 1
fi
#NAND_DEV="/dev/`cat /proc/mtd | grep '"Base"' | cut -d : -f1`"
#SCREEN_PART_SUM="`nanddump -o -b -q -l $((0x100000)) -s 0x100000 $NAND_DEV | head -c $SCREEN_SIZE - | md5sum - | cut -d ' ' -f1`"
SCREEN_PART_SUM="`cat /dev/mmcblk0p1 | head -c $SCREEN_SIZE - | md5sum - | cut -d ' ' -f1`"
if [ "$SCREEN_SUM" != "$SCREEN_PART_SUM" ] ; then
echo "Screen Partition does not match:"
echo " File MD5: $SCREEN_SUM"
echo " Screen MD5: $SCREEN_PART_SUM"
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "Screen write failed..." 3 1 1
$DRAWTEXT_CMD "File: $SCREEN_SUM" 4 1 1
$DRAWTEXT_CMD "Screen:$SCREEN_PART_SUM" 5 1 1
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg > /tmp/page_errors
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 6 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
fi
echo "Error code: 2 - Screen write failed" > /tmp/error
echo "Screen Partition does not match:" >> /tmp/error
echo " Screen File MD5: $SCREEN_SUM" >> /tmp/error
echo " Screen partition MD5: $SCREEN_PART_SUM" >> /tmp/error
echo " " >> /tmp/error
echo "PAGE_ERRORS: " >> /tmp/error
cat /tmp/page_errors >> /tmp/error
echo " " >> /tmp/error
if [ -e /tmp/nanddump ] ; then
echo "NAND DUMP: " >> /tmp/error
cat /tmp/nanddump >> /tmp/error
else
echo "!!!UNABLE TO RETRIEVE NAND DUMP DATA!!!" >> /tmp/error
fi
exit 2
fi
#KERNEL_PART_SUM="`nanddump -o -b -q -l $((0x800000)) -s 0x200000 $NAND_DEV | head -c $KERNEL_SIZE - | md5sum - | cut -d ' ' -f1`"
KERNEL_PART_SUM="`cat /dev/mmcblk0p2 | head -c $KERNEL_SIZE - | md5sum - | cut -d ' ' -f1`"
if [ "$KERNEL_PART_SUM" != "$KERNEL_SUM" ] ; then
echo "Kernel Partition does not match:"
echo " File MD5: $KERNEL_SUM"
echo " Kernel MD5: $KERNEL_PART_SUM"
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "Kernel failed verification..." 3 1 1
$DRAWTEXT_CMD " File:$KERNEL_SUM" 4 1 1
$DRAWTEXT_CMD " NAND:$KERNEL_PART_SUM" 5 1 1
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f8-`"
dmesg > /tmp/page_errors
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 6 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
fi
echo "Error code: 3 - Kernel write failed" > /tmp/error
echo "Kernel Partition does not match:" >> /tmp/error
echo " Kernel File MD5: $KERNEL_SUM" >> /tmp/error
echo " Kernel partition MD5: $KERNEL_PART_SUM" >> /tmp/error
echo " " >> /tmp/error
echo "PAGE_ERRORS: " >> /tmp/error
cat /tmp/page_errors >> /tmp/error
echo " " >> /tmp/error
if [ -e /tmp/nanddump ] ; then
echo "NAND DUMP: " >> /tmp/error
cat /tmp/nanddump >> /tmp/error
else
echo "!!!UNABLE TO RETRIEVE NAND DUMP DATA!!!" >> /tmp/error
fi
exit 3
fi
rm -f /tmp/NANDResult
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
cd "/patient-rfs/"
if [ "$EROOT_SIZE" -ne "0" ] ; then
if [ ! -f erootfs.md5 ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
echo "!!!!!!!!Root file system check sum not present!!!!!"
FAILED_FILES="`cat /tmp/NANDResult | grep -c ' FAIL'`"
echo "$FAILED_FILES file(s) failed validation" > /tmp/ValidateNANDResult
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "EROOTFS failed verification... " 3 1 1
$DRAWTEXT_CMD " File: erootfs.md5 not present " 4 1 1
# $DRAWTEXT_CMD " NAND:$EROOT_PART_SUM" 5 1 1
echo "Error code: 12 - erootfs.md5 not present " > /tmp/error
echo " " >> /tmp/error
exit 12
else
md5sum -c erootfs.md5 >> /tmp/NANDResult
RESULT="`echo $?`"
if [ $RESULT != "0" ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
echo "!!!!!!!!!!!!!!Base Verification failed!!!!!!!!!!!!!"
FAILED_FILES="`cat /tmp/NANDResult | grep -c ' FAIL'`"
echo "$FAILED_FILES file(s) failed validation" > /tmp/ValidateNANDResult
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "EROOTFS failed verification..." 3 1 1
# $DRAWTEXT_CMD " File:$EROOT_SUM" 4 1 1
# $DRAWTEXT_CMD " NAND:$EROOT_PART_SUM" 5 1 1
##$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg > /tmp/page_errors
##$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 6 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
fi
echo "Error code: 4 - erootfs write failed" > /tmp/error
echo "erootfs Partition does not match:" >> /tmp/error
# echo " erootfs File MD5: $EROOT_SUM" >> /tmp/error
# echo " erootfs partition MD5: $EROOT_PART_SUM" >> /tmp/error
echo " " >> /tmp/error
echo "PAGE_ERRORS: " >> /tmp/error
cat /tmp/page_errors >> /tmp/error
echo " " >> /tmp/error
if [ -e /tmp/nanddump ] ; then
echo "NAND DUMP: " >> /tmp/error
cat /tmp/nanddump >> /tmp/error
else
echo "!!!UNABLE TO RETRIEVE NAND DUMP DATA!!!" >> /tmp/error
fi
exit 4
fi
fi
fi
#exit 100
cd "/patient-bulk/"
if [ 0 -ne 0 -a ! -f /tmp/Bulk.md5 ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
echo "!!!!!!!!Bulk folder check sum not present!!!!!!!!!!"
FAILED_FILES="`cat /tmp/NANDResult | grep -c ' FAIL'`"
echo "$FAILED_FILES file(s) failed validation" > /tmp/ValidateNANDResult
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "EROOTFS failed verification... " 3 1 1
$DRAWTEXT_CMD " File: erootfs.md5 not present " 4 1 1
# $DRAWTEXT_CMD " NAND:$EROOT_PART_SUM" 5 1 1
echo "Error code: 12 - erootfs.md5 not present " > /tmp/error
echo " " >> /tmp/error
exit 13
fi
if [ -f /tmp/Bulk.md5 ] ; then
cp -f /tmp/Bulk.md5 /patient-bulk/
fi
if [ "$BULK_SIZE" -ne "0" ] ; then
#BULK_PART_SUM="`nanddump -o -b -q -l $((0x7a000000)) -s 0x6000000 $NAND_DEV | head -c $BULK_SIZE - | md5sum - | cut -d ' ' -f1`"
#if [ "$BULK_PART_SUM" != "$BULK_SUM" ] ; then
# We can choose either downloaded Bulk.md5 to perform one shot checksum or
# search for each individual packagefiles.md5 file to checksum. So far
# only /LF/Bulk/Data/Local/0|1|2/ProfilePictures/profilePicture01|2|3.png
# has no corresponding checksum.
# WORRY ABOUT IT AFTER FEP
if [ -f /tmp/Bulk.md5 ] ; then
md5sum -c /tmp/Bulk.md5 >> /tmp/NANDResult
RESULT="`echo $?`"
if [ $RESULT != "0" ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
echo "!!!!!!!!!!!!!!Bulk Verification failed!!!!!!!!!!!!!"
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "BULK failed verification... " 3 1 1
#$DRAWTEXT_CMD " File:$BULK_SUM" 4 1 1
#$DRAWTEXT_CMD " NAND:$BULK_PART_SUM" 5 1 1
$DRAWTEXT_CMD " " 4 1 1
$DRAWTEXT_CMD " " 5 1 1
## $RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg > /tmp/page_errors
## $RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 6 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
fi
echo "Error code: 5 - Bulk write failed" > /tmp/error
echo "Bulk md5 checksum does not match:" >> /tmp/error
#echo " Bulk File MD5: $BULK_SUM" >> /tmp/error
#echo " Bulk partition MD5: $BULK_PART_SUM" >> /tmp/error
echo " " >> /tmp/error
echo "PAGE_ERRORS: " >> /tmp/error
cat /tmp/page_errors >> /tmp/error
echo " " >> /tmp/error
if [ -e /tmp/nanddump ] ; then
echo "NAND DUMP: " >> /tmp/error
cat /tmp/nanddump >> /tmp/error
else
echo "!!!UNABLE TO RETRIEVE NAND DUMP DATA!!!" >> /tmp/error
fi
exit 5
fi
else
CUR_PATH=`pwd`
for file in `find -name packagefiles.md5 -exec dirname {} \; ` ; do
if [ "`echo $file | grep -c MadridMfgTest`" -lt "1" ] ; then
echo "Checking files in $file"
$DRAWTEXT_CMD " " 5 1 0
$DRAWTEXT_CMD "Checking files in... " 5 1 0
$DRAWTEXT_CMD " " 6 1 0
#$DRAWTEXT_CMD "$line" 7 1 0
$DRAWTEXT_CMD "`echo $file | cut -c -49`" 6 1 0
cd $file
cat packagefiles.md5 | grep -v meta.inf > /tmp/packagefiles_no_meta.md5
#sync
pwd >> /tmp/NANDResult
md5sum -c /tmp/packagefiles_no_meta.md5 >> /tmp/NANDResult
RESULT="`echo $?`"
rm -f packagefiles_no_meta.md5
cd $CUR_PATH
if [ $RESULT != "0" ] ; then
echo "Failed system verification in $file....."
line13=$line12
line12=$line11
line11="`echo $file..FAIL | tail -c 49`"
$DRAWTEXT_CMD " " 11 1 0
$DRAWTEXT_CMD "$line11" 11 1 0
$DRAWTEXT_CMD " " 12 1 0
$DRAWTEXT_CMD "$line12" 12 1 0
$DRAWTEXT_CMD " " 13 1 0
$DRAWTEXT_CMD "$line13" 13 1 0
FAIL_TEST=1
fi
fi
done
fi
fi
cd
# exit 200
# Mount the unit's nand partitions
###
# Wait for the mount points to arrive (max 5 seconds)
TIME_START=`date +%s`
MOUNTS="`mount | grep -c patient-rfs`"
while [ "$MOUNTS" -eq "0" ] ; do
MOUNTS="`mount | grep -c patient-rfs`"
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -ge "5" ] ; then
# Mounts never showed up, exit and return error
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg | grep "Error reading" > /tmp/page_errors
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "Root Mount failed... " 3 1 1
$DRAWTEXT_CMD " Unable to mount root file system " 4 1 1
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 5 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
else
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg > /tmp/page_errors
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 6 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
fi
fi
echo "Error code: 6 - Mounting root file system failed" > /tmp/error
echo " " >> /tmp/error
echo "PAGE_ERRORS: " >> /tmp/error
cat /tmp/page_errors >> /tmp/error
echo " " >> /tmp/error
if [ -e /tmp/nanddump ] ; then
echo "NAND DUMP: " >> /tmp/error
cat /tmp/nanddump >> /tmp/error
else
echo "!!!UNABLE TO RETRIEVE NAND DUMP DATA!!!" >> /tmp/error
fi
exit 6
fi
done
MOUNT_BULK="`mount | grep -c patient-bulk`"
if [ "$MOUNT_BULK" -eq "0" ] ; then
# Bulk Mount failed, exit and return error
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg | grep "Error reading" > /tmp/page_errors
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "Bulk Mount failed... " 3 1 1
$DRAWTEXT_CMD " Unable to mount unit's Bulk... " 4 1 1
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 5 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
else
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh start
DERROR="`dmesg | grep "Error reading" | tail -1 | cut -d ' ' -f9-`"
dmesg > /tmp/page_errors
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
if [ "X$DERROR" != "X" ] ; then
$DRAWTEXT_CMD " Error on page $DERROR" 6 1 1
nanddump -l 512 -n -i -p -s $(($DERROR*2048)) /dev/mtd0 > /tmp/nanddump
fi
fi
echo "Error code: 7 - Mounting Bulk file system failed" > /tmp/error
echo " " >> /tmp/error
echo "PAGE_ERRORS: " >> /tmp/error
cat /tmp/page_errors >> /tmp/error
echo " " >> /tmp/error
if [ -e /tmp/nanddump ] ; then
echo "NAND DUMP: " >> /tmp/error
cat /tmp/nanddump >> /tmp/error
else
echo "!!!UNABLE TO RETRIEVE NAND DUMP DATA!!!" >> /tmp/error
fi
exit 7
fi
# Put the validation files on the unit.
#NOR_VER="`get-bootstrap-version < $NOR_PRT`"
NOR_VER="`grep -m1 VERSION: $NOR_PRT | cut -d : -f2`"
md5sum $NOR_PRT | cut -d ' ' -f1 > /patient-rfs/mfgdata/NOR_$NOR_VER.md5
echo "$BOOT_SIZE,$NOR_SUM" > /patient-rfs/mfgdata/NOR.md5
echo "$SCREEN_SIZE,$SCREEN_SUM" > /patient-rfs/mfgdata/SCREEN.md5
echo "$KERNEL_SIZE,$KERNEL_SUM" > /patient-rfs/mfgdata/KERNEL.md5
echo "512, $MBR_PART_SUM" > /patient-rfs/mfgdata/MBR.md5
sync
UPDATE="0"
# Install the Mfg test
if [ "`ls | grep MadridMfgTest | grep -c lfp`" -ge "1" ] ; then
lfpkg -a install -b /patient-rfs/LF MadridMfgTest*.lfp
sync
## Validate the Mfg Test
lfpkg -a validate -b /patient-rfs/LF MadridMfgTest*.lfp
UPDATE="`echo $?`"
fi
# SZSZ Update libEvent.so to cover the calib screen lockup error
#cd /tmp
#cp -f /tmp/libEvent.so /patient-rfs/LF/Base/Brio/Module/
#cat /patient-rfs/LF/Base/Brio/packagefiles.md5 | grep -v libEvent.so > /patient-rfs/LF/Base/Brio/packagefiles.tmp
#mv /patient-rfs/LF/Base/Brio/packagefiles.tmp /patient-rfs/LF/Base/Brio/packagefiles.md5
#echo "be92a7528ebdba37fd340363eb02b440 ./Module/libEvent.so" >> /patient-rfs/LF/Base/Brio/packagefiles.md5
#cd /
#sync
cd /
sync
# Unmount the unit's nand partitions
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
# Wait for the mount points to leave (max 5 seconds)
TIME_START=`date +%s`
MOUNTS="`mount | grep -c patient-rfs`"
while [ "$MOUNTS" -gt "0" ] ; do
MOUNTS="`mount | grep -c patient-rfs`"
TIME_STAMP=`date +%s`
if [ "`expr $TIME_STAMP - $TIME_START`" -gt "5" ] ; then
$RECOVEY_MOUNT_SCRIPT_PATH/recovery-mounts-new.sh stop
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "Unmount failed... " 3 1 1
$DRAWTEXT_CMD " Unable to dismount unit's file system " 4 1 1
echo "Error code: 8 - Un-Mounting units file system failed" > /tmp/error
echo " " >> /tmp/error
exit 8
fi
done
if [ "$UPDATE" -ne "0" ] ; then
killall recovery
killall flipbook-fb
$DRAWTEXT_CMD "MadridMfgTest install failed..." 3 1 1
$DRAWTEXT_CMD " MadridMfgTest failed verification." 4 1 1
echo "Error code: 9 - Updating the MadridMfgTest failed." > /tmp/error
echo " " >> /tmp/error
exit 9
else
#echo "Nothing, this is a test." > /tmp/error
exit 0
fi
ValidateBase.sh#
#!/bin/sh
#####################################################################
# ValidateBase.sh file for validating Base NAND files
# Written by Nathan Durrin
#
# Function: This file will check the Base NAND files using the
# packagefiles.md5 and erootfs.md5 files. It
# searches the base NAND for all packagefiles.md5
# files and will verify all files listed in those files.
#
# Revision Table..................................................
# Date Rev Author Change
# ----------------------------------------------------------------
# 08/05/09 001 N.Durrin Initial release
# 09/08/09 002 N.Durrin Added checking booted from ATAP (fail if so)
# Continued checking all files even on failure
# Display more debug output
# 09/27/09 003 N.Durrin Displays NOR boot on PASS
# 09/30/09 004 N.Durrin Added live status of testing by drawtext
# 10/13/09 005 N.Durrin Added checking for Firmware/packagefiles.md5 before erootfs.md5
# 10/19/09 006 N.Durrin Fixed wording on the display for clarification
# 10/20/09 007 N.Durrin Added validating the NAND and NOR boot
# 10/27/09 008 N.Durrin Added checking that both mfg sectors have same md5sums
# 11/10/09 009 N.Durrin Added the ability to verify the NAND from ATAP
# 12/09/09 010 N.Durrin Write NOR.md5 file to proper NAND for future reference
# 02/17/10 011 N.Durrin Fixed so uses SetupNANDCartridge.sh properly and unmounts Cart at end from ATAP.
# 03/01/10 012 N.Durrin Nor checksum now stored in a file with the name which includes the version.
# 03/29/10 013 N.Durrin Checks version of FW based on EmeraldMfgTestConfig.txt
# 07/01/10 014 N.Durrin Fixed NOR version display. Was grepping wrong value.
# 07/23/10 015 N.Durrin Uses get-bootstrap-version function to get the version info
# 08/19/10 016 N.Durrin Checks format of read NOR_VER to see if it includes EB or not to read the version from the config file when tested
# 09/22/10 017 N.Durrin Uses files from NAND programmer if present to verify
# 10/14/10 018 N.Durrin If the NAND is the new Micron NAND, it will ensure the NOR has the minimum FW version on it
#
# 03/xx/10 016.5 Shelby First ported version for Madrid.
# 04/20/10 017 Shelby Fixing Base FW valiation script to fully validate all the files.
# 09/19/11 020 Shelby Use RAM space to store temporary md5 files for md5sum, to avoid NAND access.
#
#
# ERROR CODES:
# 0 PASS
# 1 FAIL - FAILED BASE VALIDATE FROM ATAP
# 2 FAIL - FILE MISMATCH
# 3 FAIL - NO VALIDATION FILES FOUND
######################################################################
#set -e
set -x
date
FILE_REV="020"
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
fi
CUR_PATH=`pwd`
BASE_PATH="/"
VAL_FILE="NONE"
rm -f /tmp/NANDResult
rm -f /tmp/ValidateNANDResult
echo "Starting ValidateBase rev $FILE_REV........."
ID="`cat /sys/devices/platform/lf1000-gpio/board_id`"
VER="`cat /etc/version`"
NOR_PRT="`cat /proc/mtd | grep NOR_Boot | cut -d : -f1`"
NOR_VER="`get-bootstrap-version < /dev/$NOR_PRT`"
if [ "X$NOR_VER" = "X" ] ; then
NOR_VER="`grep -m 1 EB[0-9] /dev/$NOR_PRT`"
fi
MFG0="`cat /proc/mtd | grep MfgData0 | cut -d : -f1`"
MFG1="`cat /proc/mtd | grep MfgData1 | cut -d : -f1`"
CONFIG_FILE="X"
if [ -e /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt ] ; then
CONFIG_FILE="/LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt"
elif [ -e /LF/Cart/MadridMfgTest/rsrc/MadridMfgTestConfig.txt ] ; then
CONFIG_FILE="/LF/Cart/MadridMfgTest/rsrc/MadridMfgTestConfig.txt"
fi
# Check if the NAND is supposed to have the new ECC enabled. If so, it MUST check the NOR version for minimum supported version or higher
if [ -e /sys/devices/platform/lf1000-nand/base_nand_internal_ecc_support -a -e /sys/devices/platform/lf1000-nand/base_nand_internal_ecc_enabled ] ; then
if [ "`cat /sys/devices/platform/lf1000-nand/base_nand_internal_ecc_enabled`" -ne "1" ] ; then
if [ "$CONFIG_FILE" = "X" ] ; then
echo "Unable to find test config file" > /tmp/ValidateNANDResult
exit 1
fi
if [ "`cat $CONFIG_FILE | grep -c ^_MINIMUM_NOR_VER`" -ne "1" ] ; then
echo "Config doesn't include Min NOR ver." > /tmp/ValidateNANDResult
exit 1
fi
MIN_NOR_VER="`cat $CONFIG_FILE | grep ^_MINIMUM_NOR_VER | cut -d '"' -f2 | tr -d ' ' | tr - .`"
if [ "`echo $MIN_NOR_VER | cut -d '.' -f1`" -gt "`echo $NOR_VER | cut -d '.' -f1`" ] ; then
echo "NOR version NOT >= $MIN_NOR_VER." > /tmp/ValidateNANDResult
exit 1
elif [ "`echo $MIN_NOR_VER | cut -d '.' -f1`" -eq "`echo $NOR_VER | cut -d '.' -f1`" ] ; then
if [ "`echo $MIN_NOR_VER | cut -d '.' -f2`" -gt "`echo $NOR_VER | cut -d '.' -f2`" ] ; then
echo "NOR version NOT >= $MIN_NOR_VER." > /tmp/ValidateNANDResult
exit 1
elif [ "`echo $MIN_NOR_VER | cut -d '.' -f2`" -eq "`echo $NOR_VER | cut -d '.' -f2`" ] ; then
if [ "`echo $MIN_NOR_VER | cut -d '.' -f3`" -gt "`echo $NOR_VER | cut -d '.' -f3`" ] ; then
echo "NOR version NOT >= $MIN_NOR_VER." > /tmp/ValidateNANDResult
exit 1
elif [ "`echo $MIN_NOR_VER | cut -d '.' -f3`" -eq "`echo $NOR_VER | cut -d '.' -f3`" ] ; then
if [ "`echo $MIN_NOR_VER | cut -d '.' -f4`" -gt "`echo $NOR_VER | cut -d '.' -f4`" ] ; then
echo "NOR version NOT >= $MIN_NOR_VER." > /tmp/ValidateNANDResult
exit 1
fi
fi
fi
fi
echo "NOR Version $NOR_VER meets the minimum requirements."
echo "NOR should be >= $MIN_NOR_VER."
fi
fi
TEST_FW_VERS="0"
if [ "$CONFIG_FILE" != "X" ] ; then
if [ "`cat $CONFIG_FILE | grep -c ^_TEST_FW_VERSIONS`" -eq "1" -a "`cat $CONFIG_FILE | grep ^_TEST_FW_VERSIONS | cut -d '"' -f2 | tr -d ' '`" -ne "0" ] ; then
if [ "`cat $CONFIG_FILE | grep -c ^_FW_VER`" -eq "1" ] ; then
TEST_FW_VERS="1"
TEST_FW_VER="`cat $CONFIG_FILE | grep ^_FW_VERSION | cut -d '"' -f2 | tr -d ' '`"
else
echo "Firmware versions enabled but NOT listed in the MadridMfgTestConfig.txt file"
echo "Skipping Firmware Versions checking"
fi
if [ "`cat $CONFIG_FILE | grep -c ^_NOR_VERSION`" -lt "1" ] ; then
if [ "`echo $NOR_VER | grep -c EB`" -ge "1" ] ; then
TEST_NOR_VER="EB`echo $TEST_FW_VER | cut -d '-' -f1`"
else
TEST_NOR_VER="`echo $TEST_FW_VER | tr - .`"
fi
else
TEST_NOR_VER="`cat $CONFIG_FILE | grep ^_NOR_VERSION | cut -d '"' -f2 | tr -d ' '`"
fi
fi
fi
$DRAWTEXT_CMD " " 6 0 0
$DRAWTEXT_CMD " " 7 0 0
$DRAWTEXT_CMD "Unit Information...." 0 1 0
$DRAWTEXT_CMD "FW Version:" 1 1 0
$DRAWTEXT_CMD "NOR Version:$NOR_VER" 2 1 0
$DRAWTEXT_CMD "Board ID:$ID" 3 1 0
FAIL_TEST=0
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ "$ID" != 3 ]; then
ATAP=1
echo "Booted from the ATAP...checking for mtd utilites support. "
if [ ! -e /sys/devices/platform/lf1000-nand/new_mtd ] ; then
echo "Unable to run this test when booted from the ATAP. Must boot from the Device NAND"
echo "Unable to run this test when booted from the ATAP. Must boot from the Device NAND" > /tmp/NANDResult
echo "Can not run from ATAP" > /tmp/ValidateNANDResult
exit 1
fi
echo "mtd utilities Support OK....starting verification......"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh start
if [ "`cat /proc/mtd | grep -c Base_RFS`" -eq "0" ] ; then
# setup the bases RFS to mount onto /prg_RFS
echo "1 0x00a00000 0x05600000 Base_RFS" > /sys/devices/platform/lf1000-nand/new_mtd
fi
UBI_RFS="NONE"
if [ "`ubinfo -a | grep -c ubi_rfs`" -lt "2" ] ; then
UBI_RFS="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
RFS_MTD="`cat /proc/mtd | grep '"Base_RFS"' | cut -d : -f1 | cut -c 4-`"
ubiattach /dev/ubi_ctrl -d $UBI_RFS -m $RFS_MTD #attach Base_RFS to next ubi
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
mkdir -p /prg_RFS
mount -t ubifs ubi$UBI_RFS:ubi_rfs /prg_RFS
fi
if [ "$UBI_RFS" = "NONE" ] ; then
i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
while [ "$UBI_RFS" = "NONE" -a "$i" -gt "0" ] ; do
i="`echo $(($i-1))`"
if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_RFS" ] ; then
UBI_RFS=$i
fi
done
fi
if [ "`mount | grep -c prg_RFS`" -lt "1" ] ; then
echo "Unable to see the device RFS partition"
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $UBI_RFS
echo "Can not see device's RFS" > /tmp/NANDResult
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
exit 1
fi
BASE_PATH="/prg_RFS"
VER="`cat $BASE_PATH/etc/version`"
if [ "`cat /proc/mtd | grep -c Base_Bulk`" -eq "0" ] ; then
echo "1 0x06000000 0x1a000000 Base_Bulk" > /sys/devices/platform/lf1000-nand/new_mtd
fi
UBI_BULK="NONE"
if [ "`ubinfo -a | grep -c ubi_bulk`" -lt "2" ] ; then
UBI_BULK="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
BULK_MTD="`cat /proc/mtd | grep '"Base_Bulk"' | cut -d : -f1 | cut -c 4-`"
ubiattach /dev/ubi_ctrl -d $UBI_BULK -m $BULK_MTD #attach Base_Bulk to next ubi
fi
if [ "$UBI_BULK" = "NONE" ] ; then
i="`ubinfo | grep Count | tr -s ' ' | cut -d ' ' -f5`"
while [ "$UBI_BULK" = "NONE" -a "$i" -gt "0" ] ; do
i="`echo $(($i-1))`"
if [ "`cat /sys/class/ubi/ubi$i/mtd_name`" = "Base_Bulk" ] ; then
UBI_BULK=$i
fi
done
fi
if [ "`mount | grep -c prg_RFS/LF/Bulk`" -lt "1" ] ; then
mount -t ubifs ubi$(($UBI_BULK)):ubi_bulk /prg_RFS/LF/Bulk
fi
if [ "`mount | grep -c prg_RFS/LF/Bulk`" -ne "1" ] ; then
echo "Unable to see the device Bulk partition"
umount -f /prg_RFS/LF/Bulk
ubidetach /dev/ubi_ctrl -d $UBIS_BULK
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Can not see device's Bulk" > /tmp/NANDResult
exit 1
fi
if [ -f $BASE_PATH/Firmware/packagefiles.md5 ] ; then
cd $BASE_PATH/Firmware
# sed 's/\//..\//1' packagefiles.md5 > relativefiles.md5
sed 's/\//..\//1' packagefiles.md5 > /tmp/relativefiles.md5
# VAL_FILE="$BASE_PATH/Firmware/relativefiles.md5"
VAL_FILE="/tmp/relativefiles.md5"
elif [ -f $BASE_PATH/erootfs.md5 ] ; then
VAL_FILE="$BASE_PATH/erootfs.md5"
fi
fi
fi
$DRAWTEXT_CMD "FW Version:$VER" 1 1 0
#Check the NOR
if [ ! -e $BASE_PATH/mfgdata/NOR_$NOR_VER.md5 ] ; then
cat /dev/$NOR_PRT | md5sum - > $BASE_PATH/mfgdata/NOR_$NOR_VER.md5
fi
# I can't get SIZE info anymore. I have to fail if no saved SCREEN.md5
if [ ! -e $BASE_PATH/mfgdata/SCREEN.md5 ] ; then
#SZSZ I18n_Screens no longer belongs to mtd device and showed zero length in /proc/mtd
#SZSZ and not listed in /dev/mtd1 catalog
##SCREEN_PART="/dev/`cat /proc/mtd | grep I18n_Screens | cut -d : -f1`"
##SCREEN_SIZE="`cat /proc/mtd | grep I18n_Screens | cut -d ' ' -f2`"
##echo "$(($SCREEN_SIZE)),`head -c $(($SCREEN_SIZE)) $SCREEN_PART | md5sum - | cut -d ' ' -f1`" > $BASE_PATH/mfgdata/SCREEN.md5
# Need to use: SCREEN_PART_SUM="`cat /dev/mmcblk0p1 | head -c $SCREEN_SIZE - | md5sum - | cut -d ' ' -f1`"
echo "SCREEN.md5 not found - use NMP." > /tmp/ValidateNANDResult
exit 10
fi
rm -f /tmp/NORResult
if [ "$TEST_FW_VERS" -eq "1" -a "$NOR_VER" != "$TEST_NOR_VER" ] ; then
FAIL_TEST=1
echo "NOR Version" > /tmp/NORResult
$DRAWTEXT_CMD "Version FAIL" 2 26 1
$DRAWTEXT_CMD "NOR Boot version..FAILED" 8 1 1
echo "NOR boot version FAILED [expected: $TEST_NOR_VER, Read: $NOR_VER]"
else
NOR_STORED_MD5="`cat $BASE_PATH/mfgdata/NOR_$NOR_VER.md5 | cut -d ' ' -f1`"
NOR_MD5="`cat /dev/$NOR_PRT | md5sum - | cut -d ' ' -f1`"
echo "Nor stored md5sum = $NOR_STORED_MD5"
echo "Nor actual md5sum = $NOR_MD5"
if [ $NOR_STORED_MD5 != $NOR_MD5 ] ; then
FAIL_TEST=1
echo "NOR Boot" > /tmp/NORResult
$DRAWTEXT_CMD "md5sum FAIL" 2 26 1
$DRAWTEXT_CMD "NOR Boot checksum..FAILED " 8 1 1
echo "NOR boot checksum FAILED"
else
$DRAWTEXT_CMD "md5sum PASS" 2 26 0
$DRAWTEXT_CMD "NOR Boot checksum..PASSED " 8 1 0
echo "NOR Boot checksum PASSED"
fi
fi
rm -f /mfgdata/NorStatus
#Verify that the MfgData all have expected values
#ADC="`mfgdata get adc`"
#SerialNum="`mfgdata get sn`"
#Snv="`mfgdata get snv`"
#Backlight="`mfgdata get bl`"
#TouchScreen="`mfgdata get ts`"
if [ "`mfgdata get adc | cut -d ' ' -f2`" -eq "0" ] ; then
echo "WARNING: ADC Calibration not set"
echo "WARNING: ADC Calibration not set" >> /mfgdata/NorStatus
fi
if [ "`mfgdata get bl`" -eq "0" ] ; then
echo "WARNING: BackLight Calibration not set"
echo "WARNING: BackLight Cal not set" >> /mfgdata/NorStatus
fi
if [ "`mfgdata get sn | cut -d 1 -f1`" = "0000" -a "`mfgdata get sn | cut -b13-`" = "00000000" ] ; then
echo "WARNING: Serial Number not set"
echo "WARNING: Serial Number not set" >> /mfgdata/NorStatus
fi
if [ "`mfgdata get snv`" -eq "0" ] ; then
echo "WARNING: Serial Number has not been validated"
echo "WARNING: Serial Number not validated" >> /mfgdata/NorStatus
fi
if [ "`mfgdata get ts | cut -d ' ' -f7`" -ne "65536" ] ; then
echo "WARNING: Touch Screen has not been calibrated"
echo "WARNING: Touch Screen not calibrated" >> /mfgdata/NorStatus
fi
#Verify that the MfgData sectors match
MFG0_MD5="`md5sum /dev/$MFG0 | cut -d ' ' -f1`"
MFG1_MD5="`md5sum /dev/$MFG1 | cut -d ' ' -f1`"
echo "MfgData0 (/dev/$MFG0) md5sum = $MFG0_MD5"
echo "MfgData1 (/dev/$MFG1) md5sum = $MFG1_MD5"
if [ $MFG0_MD5 != $MFG1_MD5 ] ; then
FAIL_TEST=1
echo "Mfg Data" > /tmp/NORResult
$DRAWTEXT_CMD "Mfg Data checksum..FAILED " 9 1 1
echo "Mfg Data checksum FAILED"
else
$DRAWTEXT_CMD "Mfg Data checksum..PASSED " 9 1 0
echo "Mfg Data checksum PASSED"
fi
#Verify the screen partition
if [ -e $BASE_PATH/mfgdata/SCREEN.md5 ] ; then
SCREEN_SIZE="`cat $BASE_PATH/mfgdata/SCREEN.md5 | cut -d , -f1`"
SCREEN_MD5="`cat $BASE_PATH/mfgdata/SCREEN.md5 | cut -d , -f2`"
#SCREEN_PART="/dev/`cat /proc/mtd | grep Screens | cut -d : -f1`"
#SCREEN_PART_SUM="`nanddump -o -b -q $SCREEN_PART | head -c $SCREEN_SIZE - | md5sum - | cut -d ' ' -f1`"
SCREEN_PART_SUM="`cat /dev/mmcblk0p1 | head -c $SCREEN_SIZE - | md5sum - | cut -d ' ' -f1`"
if [ "$SCREEN_MD5" != "$SCREEN_PART_SUM" ] ; then
FAIL_TEST=1
echo "H&S Screen" > /tmp/NORResult
$DRAWTEXT_CMD "H&S Screen checksum..FAILED" 7 1 1
echo "Screen partition validation FAILED"
else
echo "Screen partition validaiton PASSED"
$DRAWTEXT_CMD "H&S Screen checksum..PASSED" 7 1 0
fi
else
echo "No screen validation file present."
fi
if [ "$ATAP" -ne "1" ] ; then
# Validate the NAND Boot partition
# Bypassed until we figure out if it is downloaded at all
if [1 -ne 1] ; then
if [ "`hexdump -v -n 128 /dev/mtd0 | grep -c ffff`" -eq "8" ] ; then
echo "NAND Boot is NOT programmed. Skipping NAND Boot validation."
echo "Programming now..."
$DRAWTEXT_CMD "NAND Boot not programmed." 5 1 0
$DRAWTEXT_CMD "Programming now..." 6 1 0
cat /dev/$NOR_PRT | nandwrite -n -p /dev/mtd0 -
$DRAWTEXT_CMD "NAND Programming complete." 5 1 0
$DRAWTEXT_CMD " " 6 1 0
fi
if [ "`grep -m 1 EB /dev/mtd0`" != $NOR_VER ] ; then
NAND_VER="`grep -m 1 EB /dev/mtd0`"
echo "NOR boot version ($NOR_VER) and NAND boot version ($NAND_VER) are different. Skipping NAND boot validation"
else
NAND_MD5="`head -c $(((512*1024) - 8192)) /dev/mtd0 | md5sum - | cut -d ' ' -f1`"
echo "NAND Boot md5sum = $NAND_MD5"
if [ $NOR_STORED_MD5 != $NAND_MD5 ] ; then
echo "WARNING: NAND Boot checksum is different than NOR Boot."
echo " This may not be a failure as they may not be the same exact versions."
fi
fi
fi
FULL_VAL_FILE="`cat /etc/version`.md5"
if [ -f /LF/Base/MadridMfgTest/$FULL_VAL_FILE ] ; then
echo "Checking files against /LF/Base/MadridMfgTest/$FULL_VAL_FILE"
$DRAWTEXT_CMD " " 5 1 0
$DRAWTEXT_CMD "Checking file against $FULL_VAL_FILE" 5 1 0
md5sum -c /LF/Base/MadridMfgTest/$FULL_VAL_FILE >> /tmp/NANDResult
RESULT="`echo $?`"
if [ $RESULT != "0" ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
echo "!!!!!!!!!!!!!!Base Verification failed!!!!!!!!!!!!!"
FAILED_FILES="`cat /tmp/NANDResult | grep -c ' FAIL'`"
echo "$FAILED_FILES file(s) failed validation" > /tmp/ValidateNANDResult
exit 2
else
echo "FW:$VER NOR:$NOR_VER Brd ID:$ID" > /tmp/ValidateNANDResult
echo "BASE NAND VALIDATION PASSED"
if [ -e /mfgdata/NorStatus ] ; then
(sleep 1
i="`cat /mfgdata/NorStatus | grep -nFc :`"
while [ $i -gt 0 ] ; do
line="`cat /mfgdata/NorStatus | grep -n ' ' | grep $i | cut -d : -f2-`"
$DRAWTEXT_CMD "$line" $i 1 1
i=$(($i-1))
done ) &
fi
exit 0
date
fi
elif [ -f /LF/Cart/MadridMfgTest/$FULL_VAL_FILE ] ; then
echo "Checking files against /LF/Cart/EmerldMfgTest/$FULL_VAL_FILE"
$DRAWTEXT_CMD " " 5 1 0
$DRAWTEXT_CMD "Checking file against $FULL_VAL_FILE" 5 1 0
md5sum -c /LF/Cart/MadridMfgTest/$FULL_VAL_FILE >> /tmp/NANDResult
RESULT="`echo $?`"
if [ $RESULT != "0" ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
echo "!!!!!!!!!!!!!!Base Verification failed!!!!!!!!!!!!!"
FAILED_FILES="`cat /tmp/NANDResult | grep -c ' FAIL'`"
echo "$FAILED_FILES file(s) failed validation" > /tmp/ValidateNANDResult
exit 2
else
echo "FW:$VER NOR:$NOR_VER Brd ID:$ID" > /tmp/ValidateNANDResult
echo "BASE NAND VALIDATION PASSED"
if [ -e /mfgdata/NorStatus ] ; then
(sleep 1
i="`cat /mfgdata/NorStatus | grep -nFc :`"
while [ $i -gt 0 ] ; do
line="`cat /mfgdata/NorStatus | grep -n ' ' | grep $i | cut -d : -f2-`"
$DRAWTEXT_CMD "$line" $i 1 1
i=$(($i-1))
done ) &
fi
exit 0
date
fi
fi
fi
rm -f /tmp/firmware_ver_failed
if [ "$TEST_FW_VERS" -eq "1" -a "$VER" != "$TEST_FW_VER" ] ; then
echo "Firmware version does not match expected value. [Expected: $TEST_FW_VER, Read: $VER]"
$DRAWTEXT_CMD "version FAIL" 1 26 1
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD "Firmware version..FAILED" 10 1 1
FAIL_TEST=1
touch /tmp/firmware_ver_failed
else
cur_path="`pwd`"
cd $BASE_PATH
if [ -f $BASE_PATH/Firmware/packagefiles.md5 ] ; then
if [ "$VAL_FILE" = "NONE" ] ; then
# cat $BASE_PATH/Firmware/packagefiles.md5 | grep -v meta.inf > $BASE_PATH/Firmware/packagefiles_no_meta.md5
cat $BASE_PATH/Firmware/packagefiles.md5 | grep -v meta.inf > /tmp/packagefiles_no_meta.md5
sync
# VAL_FILE="$BASE_PATH/Firmware/packagefiles_no_meta.md5"
VAL_FILE="/tmp/packagefiles_no_meta.md5"
fi
cd $BASE_PATH/Firmware
elif [ -f $BASE_PATH/erootfs.md5 ] ; then
VAL_FILE="$BASE_PATH/erootfs.md5"
fi
echo "Checking root file system against $VAL_FILE"
$DRAWTEXT_CMD "Checking files in... " 5 1 0
$DRAWTEXT_CMD "$VAL_FILE" 6 1 0
md5sum -c $VAL_FILE > /tmp/NANDResult
RESULT="`echo $?`"
if [ "`echo $VAL_FILE | grep -c packagefiles_no_meta.inf`" -ge "0" ] ; then
rm -f $VAL_FILE
fi
if [ $RESULT != "0" ] ; then
#echo "FAILED" > /tmp/ValidateNANDResult
echo "root file system does not match $VAL_FILE"
$DRAWTEXT_CMD "md5sum FAIL" 1 26 1
$DRAWTEXT_CMD "Firmware files..FAILED " 10 1 1
cat /tmp/NANDResult | grep " FAIL"
FAIL_TEST=1
else
echo "root file system validation passed against $VAL_FILE"
$DRAWTEXT_CMD "md5sum PASS" 1 26 0
$DRAWTEXT_CMD "Firmware files..PASSED " 10 1 0
fi
cd $cur_path
echo "Checking remaining installed packages...."
$DRAWTEXT_CMD "Searching for additional files... " 5 1 0
$DRAWTEXT_CMD " " 6 1 0
line11=" "
line12=" "
line13=" "
for file in `find $BASE_PATH/LF -name packagefiles.md5 -exec dirname {} \; | grep -v /LF/Cart | grep -v ./proc/` ; do
if [ "`echo $file | grep -c MadridMfgTest`" -lt "1" ] ; then
echo "Checking files in $file"
$DRAWTEXT_CMD "Checking files in... " 5 1 0
#$DRAWTEXT_CMD "$line" 7 1 0
$DRAWTEXT_CMD "`echo "$file " | cut -c -49`" 6 1 0
cd $file
# cat packagefiles.md5 | grep -v meta.inf > packagefiles_no_meta.md5
cat packagefiles.md5 | grep -v meta.inf > /tmp/packagefiles_no_meta.md5
sync
pwd >> /tmp/NANDResult
# md5sum -c packagefiles_no_meta.md5 >> /tmp/NANDResult
md5sum -c /tmp/packagefiles_no_meta.md5 >> /tmp/NANDResult
RESULT="`echo $?`"
# rm -f packagefiles_no_meta.md5
rm -f /tmp/packagefiles_no_meta.md5
cd $CUR_PATH
if [ $RESULT != "0" ] ; then
echo "Failed system verification in $file....."
line13=$line12
line12=$line11
line11="`echo $file..FAIL | tail -c 39`"
$DRAWTEXT_CMD "$line11" 11 1 0
$DRAWTEXT_CMD "$line12" 12 1 0
$DRAWTEXT_CMD "$line13" 13 1 0
FAIL_TEST=1
fi
fi
done
fi
if [ "$ATAP" -eq "1" ] ; then
if [ "`mount | grep -c prg_RFS/LF/Bulk`" -ge "1" ] ; then
echo "Unmounting the device's Bulk partition"
umount -f /prg_RFS/LF/Bulk
ubidetach /dev/ubi_ctrl -d $UBI_BULK
fi
if [ "`mount | grep -c prg_RFS`" -ge "1" ] ; then
echo "Unmounting the device's RFS partition"
# rm -f $BASE_PATH/Firmware/relativefiles.md5
rm -f /tmp/relativefiles.md5
umount -f /prg_RFS
ubidetach /dev/ubi_ctrl -d $(($UBI_RFS))
echo "All ubi devices created are now cleaned up...."
fi
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
if [ $FAIL_TEST != 0 ] ; then
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
cat /tmp/NANDResult | grep " FAIL"
if [ -e /tmp/NORResult ] ; then
echo "`cat /tmp/NORResult` FAILED"
fi
echo "!!!!!!!!!!!!!!Base Verification failed!!!!!!!!!!!!!"
FAILED_FILES="`cat /tmp/NANDResult | grep -c ' FAIL'`"
if [ $FAILED_FILES -gt "0" ] ; then
FILES_RESULT=" $FAILED_FILES Base files"
else
FILES_RESULT=""
fi
if [ -e /tmp/NORResult ] ; then
if [ $FAILED_FILES -ne "0" ] ; then
NOR_RESULT="`cat /tmp/NORResult` &"
else
NOR_RESULT="`cat /tmp/NORResult` "
fi
else
NOR_RESULT=""
fi
if [ -e /tmp/firmware_ver_failed ] ; then
if [ $FAILED_FILES -gt "0" -o -e /tmp/NORResult ] ; then
VER_RESULT="FW Version & "
else
VER_RESULT="FW Version"
fi
else
VER_RESULT=""
fi
echo "$VER_RESULT$NOR_RESULT$FILES_RESULT failed" > /tmp/ValidateNANDResult
exit 2
fi
echo "FW:$VER NOR:$NOR_VER Brd ID:$ID" > /tmp/ValidateNANDResult
echo "BASE NAND VALIDATION PASSED"
if [ -e /mfgdata/NorStatus ] ; then
(sleep 1
i="`cat /mfgdata/NorStatus | grep -nFc :`"
while [ $i -gt 0 ] ; do
line="`cat /mfgdata/NorStatus | grep -n ' ' | grep $i | cut -d : -f2-`"
$DRAWTEXT_CMD "$line" $i 1 1
i=$(($i-1))
done ) &
fi
exit 0
date
ValidateCart.sh#
#!/bin/sh
#####################################################################
# ValidateCart will search the cartridge for proper validation files
# and (packages.md5) and check all fileslisted in that file.
# Written by Nathan Durrin
#
# Function: This file will test a consumer cartridge using the
# base unit.
#
# Revision Table..................................................
# Date Rev Author Change
# ----------------------------------------------------------------
# 09/08/09 001 N.Durrin Initial release
# 10/07/09 002 N.Durrin Updated to check cart ID
# 10/13/09 003 N.Durrin Added more status on the screen
# 10/30/09 004 N.Durrin Added ability to program carts.
# 11/03/09 005 N.Durrin Fixed cart programming issue
# 11/10/09 006 N.Durrin Removed OTP Cart programming by default.
# Add /mfgdata/prog-cart to enable.
# 11/13/09 007 N.Durrin Fixed recognize the cartridge and umount
# it after done.
# 11/25/09 008 N.Durrin Fixed validate by bin file to ignore last
# 512 bytes due to FW change to write then
# SN in there.
# 12/03/09 009 N.Durrin Cart ID can be tested against the _Cart_ID
# listed in the rsrc/EmeraldMfgTestConfig.txt
# file
# 02/11/10 010 N.Durrin Fixed bug where full checksum not being
# calculated for binary file method.
# 03/25/10 011 N.Durrin Change umount_cart to use SetupNANDCart-
# ridge.sh stop. Fixed bug where test version
# was not being displayed when run from a
# cartridge
# 06/01/10 012 N.Durrin Fixed so that it will only search for one
# meta.inf (ignore lib directory)
# 06/04/10 013 N.Durrin Added test mode used displayed on screen
# after test
# 07/15/10 014 N.Durrin Added checking EmeraldMfgTestConfig.txt
# filefor determiing to test all of OTP ot
# all but last page of OTP
# 07/16/10 015 N.Durrin Full cart test still uses the file size to
# test against rather than whole OTP in case
# they ever change the size of the OTP
# 09/14/10 016 N.Durrin Changing to drawtext-fb and looking for
# monotext in /var/fonts
#
# 03/xx/10 016.5 Shelby First ported version for Madrid.
# 04/20/10 017 Shelby Set GPIO C bit 1, 8, 9, 11 to input. It is
# necessary now since FW changed
# it to do some LED display driving.
# 04/26/10 018 Shelby CardID still fail sometimes. Move config
# code to the
# beginning to help settle the signal
#
# 01/13/12 019 Shelby Search and use checksum files only on the
# first directory level.
# 05/11/12 020 Shelby Specila handling for Magic School Bus. md5
# file is broken. Perform partition checksum
# after verifying the PN.
#
#
# ERROR CODES:
# 0 PASS
# 1 FAIL - NO CARTRIDGE FOUND
# 2 FAIL - FILE MISMATCH
# 3 FAIL - NO VALIDATION FILES FOUND
# 4 FAIL - CARTRIDGE IS EMPTY
# 5 FAIL - TOO MANY BIN FILES TO COMPARE AGAINST
#
#
#
#
######################################################################
FILE_REV="020"
START_TIME="`date +%s`"
echo "Starting Madrid Cart script revision $FILE_REV."
set -x
# Set cardID signal path
gpio-control /dev/gpio outenable 2 1 0
gpio-control /dev/gpio outenable 2 8 0
gpio-control /dev/gpio outenable 2 9 0
gpio-control /dev/gpio outenable 2 11 0
CUR_PATH=`pwd`
BASE_PATH="/LF/Bulk/Cart" #this is where you would put the validation file(s)
rm -f /tmp/CartResult
rm -f /tmp/ValidateCartResult
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
fi
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ `cat /sys/devices/platform/lf1000-gpio/board_id` != 3 ]; then
ATAP=1
if [ -e /LF/Base/MadridMfgTest/packagefiles.md5 ] ; then
cd /LF/Base/MadridMfgTest
md5sum -c packagefiles.md5 > /tmp/CartResult
RESULT="`echo $?`"
cd $CUR_PATH
if [ $RESULT != "0" ] ; then
echo "Failed file verification....."
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
$DRAWTEXT_CMD " " 9 1 0
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD " " 11 1 0
cat /tmp/CartResult | grep " FAIL"
FAILED_FILES="`cat /tmp/CartResult | grep -c ' FAIL'`"
echo "!!!!!!!!!!!!!!Cart Verification failed!!!!!!!!!!!!!"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "$FAILED_FILES file(s) failed in /LF/Base/MadridMfgTest" > /tmp/ValidateCartResult
exit 2
fi
else
echo "No file to use for validation."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No validation file found." > /tmp/ValidateCartResult
exit 3
fi
echo "Cartridge connector verification PASSED file validation!"
echo "MadridMfgTest Version: `cat /LF/Base/MadridMfgTest/meta.inf | grep ^Version | cut -d '"' -f2`" > /tmp/ValidateCartResult
exit 0
fi
else
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh start
SETUP_RESULT="`echo $?`"
if [ ! -e /mfgdata/prog-cart ] ; then
if [ "`echo $SETUP_RESULT`" -ne "0" ] ; then
echo "ERROR: Unable to mount cartridge for testing"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Unable to mount cartridge." > /tmp/ValidateCartResult
exit 1
fi
fi
fi
fi
if [ -e /LF/Cart/MadridMfgTest/packagefiles.md5 ] ; then
cd /LF/Cart/MadridMfgTest
TEST_VERSION="`cat /LF/Cart/MadridMfgTest/meta.inf | grep ^Version | cut -d '"' -f2`"
$DRAWTEXT_CMD "Checking MadridMfgTest in /LF/Cart" 5 1 0
$DRAWTEXT_CMD " " 6 1 0
$DRAWTEXT_CMD " " 7 1 0
md5sum -c packagefiles.md5 | grep " FAILED" > /tmp/CartResult
if [ "X`cat /tmp/CartResult`" = "X" ] ; then
rm /tmp/CartResult
fi
cd $CUR_PATH
if [ -e /tmp/CartResult ] ; then
echo "ERROR: Cart validation failed."
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "Validation failed on MfgTest Cart" > /tmp/ValidateCartResult
exit 2
fi
echo "Cartridge connector verification PASSED file validation!"
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "MadridMfgTest Version: $TEST_VERSION" > /tmp/ValidateCartResult
exit 0
fi
if [ "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -ne "1" ] ; then
echo "ERROR: No cartridge found"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No cartridge found." > /tmp/ValidateCartResult
exit 1
fi
#for i in 2 3 4 5 ; do
# gpio-control /dev/gpio func 1 $i 0
#done
# CART_ID="`cat /sys/devices/platform/lf1000-gpio/cart_id`"
#CART_ID=0
#CART_ID=$((`gpio-control /dev/gpio invalue 1 5` * 8))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 4` * 4)))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 3` * 2)))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 2`)))
# Move to earlier spot to help settle the signal
#gpio-control /dev/gpio outenable 2 1 0
#gpio-control /dev/gpio outenable 2 8 0
#gpio-control /dev/gpio outenable 2 9 0
#gpio-control /dev/gpio outenable 2 11 0
CART_ID=0
CART_ID=$((`gpio-control /dev/gpio invalue 2 9` * 8))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 11` * 4)))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 1` * 2)))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 8`)))
if [ ! -e /LF/Cart/MadridMfgTest/MadridMfgTest ] ; then
if [ -e /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt ] ; then
TEST_ID="`cat /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt | grep ^_Test_Cart_ID | cut -d ';' -f1 | tr -d ' ' | cut -d = -f2`"
TESTED_CART_ID="`cat /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt | grep ^_Cart_ID | cut -d ';' -f1 | tr -d ' ' | cut -d = -f2`"
FULL_TEST="`cat /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt | grep ^_Test_Full_Cart | cut -d ';' -f1 | tr -d ' ' | cut -d = -f2`"
fi
if [ "X$TEST_ID" = "X" ] ; then
TEST_ID=0
fi
if [ "X$TESTED_CART_ID" = "X" ] ; then
TESTED_CART_ID=3
fi
if [ "X$FULL_TEST" = "X" ] ; then
FULL_TEST=1
fi
$DRAWTEXT_CMD "Checking Madrid Cart ID... " 5 1 0
if [ ! $CART_ID -eq $TESTED_CART_ID ] ; then
if [ "$TEST_ID" -ne "0" ] ; then
$DRAWTEXT_CMD "FAIL: Cart ID incorrect..." 5 1 0
$DRAWTEXT_CMD "CartID: $CART_ID Expected Cart ID=$TESTED_CART_ID" 6 1 0
$DRAWTEXT_CMD " " 7 1 0
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "CartID: $CART_ID Expected Cart ID=$TESTED_CART_ID" > /tmp/ValidateCartResult
exit 1
else
$DRAWTEXT_CMD "WARNING: Cart ID incorrect..." 5 1 0
$DRAWTEXT_CMD "CartID: $CART_ID Expected Cart ID=$TESTED_CART_ID" 6 1 0
$DRAWTEXT_CMD " " 7 1 0
fi
else
$DRAWTEXT_CMD "Checking Madrid Cart ID...PASS" 5 1 0
$DRAWTEXT_CMD "CartID: $CART_ID " 6 1 0
$DRAWTEXT_CMD " " 7 1 0
fi
fi
echo "Looking for a cartridge..."
if [ `ls -l /LF/Cart/ | grep -c r` -eq 0 -a `cat /proc/mtd | grep -c \\"Cartridge\\"` -gt "0" ] ; then #Cartridge is empty
$DRAWTEXT_CMD "CART IS EMPTY" 8 1 1
if [ -d $BASE_PATH -a -e /mfgdata/prog-cart -a -e /usr/bin/otp_program.sh ] ; then
if [ "`ls $BASE_PATH | grep -c .bin$`" -eq "1" ] ; then
WAIT_TIME=5
WAITING=$WAIT_TIME
echo "Cart is empty. May program by pressing A+B within $WAITING second"
$DRAWTEXT_CMD "Press A+B within 5 seconds to program" 9 1 0
$DRAWTEXT_CMD "Press Home to skip programming" 10 1 0
$DRAWTEXT_CMD "Press Hint to disable programming" 11 1 0
TIME_START=`date +%s`
while [ "$WAITING" -gt "0" ] ; do
TIME_STAMP=`date +%s`
TEMP="`expr $TIME_STAMP - $TIME_START`"
#TEMP="`expr $TEMP / 1000`"
WAITING="`expr $WAIT_TIME - $TEMP`"
$DRAWTEXT_CMD "$WAITING" 9 20 0
if [ "`gpio-control /dev/gpio invalue 2 3 | grep value | cut -d = -f 2`" = "0" -a \
"`gpio-control /dev/gpio invalue 2 11 | grep value | cut -d = -f 2`" = "0" ] ; then
BINARY="`ls $BASE_PATH | grep .bin$`"
echo "Programming $BINARY"
WAITING="0"
$DRAWTEXT_CMD " " 8 1 0
$DRAWTEXT_CMD " " 9 1 0
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD " " 11 1 0
$DRAWTEXT_CMD "Programming $BINARY" 8 1 0
otp_program.sh $BASE_PATH/$BINARY
if [ "`echo $?`" -ne "0" ] ; then
echo "Failed cartridge programming."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Failed Cart Program" > /tmp/ValidateCartResult
exit 1
else
echo "Cartridge programming succeeded."
/etc/init.d/cartridge restart
sleep 4
#INFO_PATH="`ls /LF/Bulk/Cart/*.bin | cut -d '/' -f5 | cut -c 1-3`"
#INFO_PATH="`find /LF/Cart -iname $INFO_PATH`"
META_FILE="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
if [ ! "X$META_FILE" = "X" ] ; then
VERSION="`grep -e '\<Version=' "$META_FILE" | cut -d = -f 2- | cut -d '"' -s -f 2`"
PACKAGE="`cat $META_FILE | grep ^Name | cut -d '"' -f 2`"
#3LD="`cat $META_FILE | grep ^3LD | cut -d '"' -f 2`"
PKG_PN="`cat $META_FILE | grep ^PartNumber | cut -d '"' -f2`"
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in `echo $META_FILE | cut -d / -f-4`."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$VERSION" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "BINARY COMPARE" 2 1 0
sleep 1
$DRAWTEXT_CMD "BINARY COMPARE" 2 1 0 ) &
exit 0
else
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart Program Succeeded" > /tmp/ValidateCartResult
exit 0
fi
fi
elif [ "`gpio-control /dev/gpio invalue 2 5 | grep value | cut -d = -f 2`" = "0" ] ; then
rm -f /mfgdata/prog-cart
WAITING="0"
elif [ "`gpio-control /dev/gpio invalue 2 12 | grep value | cut -d = -f 2`" = "0" ] ; then
WAITING="0"
fi
done
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD " " 11 1 0
$DRAWTEXT_CMD " " 12 1 0
else
echo "No binary file in $BASE_PATH to program onto the cartridge"
fi
fi
echo "Cartridge is empty."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cartridge is empty" > /tmp/ValidateCartResult
exit 4
fi
if [ "`mount | grep -c /LF/Cart`" != "1" ] ; then
if [ `cat /proc/mtd | grep -c \\"Cartridge\\"` -gt "0" ] ; then
/etc/init.d/cartridge restart
if [ "`mount | grep -c /LF/Cart`" != "1" ] ; then
echo "Unable to mount cartridge for testing"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Unable to mount cartridge for testing" > /tmp/ValidateCartResult
exit 1
fi
else
echo "No cartridge found, aborting cartridge test process."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No cartridge found" > /tmp/ValidateCartResult
exit 1
fi
fi
CART_PART="`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1`"
if [ "X$CART_PART" = "X" ] ; then
echo "No cartridge found, aborting cartridge test process."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No cartridge found" > /tmp/ValidateCartResult
exit 1
fi
echo "looking for cartridge content to validate against in $BASE_PATH"
TEST_MODE=""
if [ -d $BASE_PATH ] ; then
if [ "`ls $BASE_PATH/ | grep -c .bin$`" -gt "1" ] ; then
TEST_MODE="BINARY COMPARE"
echo "ERROR: Too many .bin files in $BASE_PATH. Only place the one you want to compare to the cartridge in $BASE_PATH."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Only one .bin file supported for test" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 5
elif [ "`ls $BASE_PATH/ | grep -c .bin$`" -eq "1" ] ; then
BINARY="`ls $BASE_PATH | grep .bin$`"
TEST_MODE="BINARY COMPARE"
echo "validating content based on $BASE_PATH/$BINARY."
$DRAWTEXT_CMD "Validating against $BINARY" 8 1 0
FILE_SIZE="`ls -al $BASE_PATH/$BINARY | cut -d ' ' -f5`"
#INFO_PATH="`ls /LF/Bulk/Cart/*.bin | cut -d '/' -f5 | cut -c 1-3`"
#INFO_PATH="`find /LF/Cart -iname $INFO_PATH`"
META_FILE="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
if [ ! "X$META_FILE" = "X" ] ; then
VERSION="`grep -e '\<Version=' "$META_FILE" | cut -d = -f 2- | cut -d '"' -s -f 2`"
PACKAGE="`cat $META_FILE | grep ^Name | cut -d '"' -f 2`"
#3LD="`cat $META_FILE | grep ^3LD | cut -d '"' -f 2`"
PKG_PN="`cat $META_FILE | grep ^PartNumber | cut -d '"' -f2`"
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in `echo $META_FILE | cut -d / -f-4`."
$DRAWTEXT_CMD "Cartridge Info..." 11 1 0
$DRAWTEXT_CMD "$PACKAGE" 12 1 0
$DRAWTEXT_CMD "Version $VERSION" 13 1 0
$DRAWTEXT_CMD "Part Number $PKG_PN" 14 1 0
fi
if [ ! -e $BASE_PATH/$BINARY.md5 ] ; then
#set +x
if [ "`echo $FULL_TEST`" -eq "0" ] ; then
echo "PARTIAL CHECKSUM OF FILE BEING CALCULATED NOW..."
# echo "head -c $(($FILE_SIZE-512)) $BASE_PATH/$BINARY > $BASE_PATH/$BINARY.md5"
head -c $(($FILE_SIZE-512)) $BASE_PATH/$BINARY | md5sum > $BASE_PATH/$BINARY.md5
set -x
else
echo "FULL CHECKSUM OF FILE BEING CALCULATED NOW..."
$DRAWTEXT_CMD "FILE CHECKSUM BEING CALCULATED..." 9 1 0
md5sum $BASE_PATH/$BINARY > $BASE_PATH/$BINARY.md5
fi
fi
FILE_MD5="`cat $BASE_PATH/$BINARY.md5 | cut -d ' ' -f1`"
echo "Validating $BINARY is installed on cartridge"
#set +x
if [ "`echo $FULL_TEST`" -eq "0" ] ; then
echo "PARTIAL CHECKSUM OF CARTRIDGE BEING CALCULATED NOW..."
# $DRAWTEXT_CMD "md5: $FILE_MD5" 9 1 0
# echo "CART_MD5=\"head -c $(($FILE_SIZE-512)) /dev/$CART_PART | md5sum | cut -d ' ' -f1\""
CART_MD5="`head -c $(($FILE_SIZE-512)) /dev/$CART_PART | md5sum | cut -d ' ' -f1`"
else
echo "FULL CHECKSUM OF CARTRIDGE BEING CALCULATED NOW..."
$DRAWTEXT_CMD "md5: $FILE_MD5" 9 1 0
#CART_MD5="`md5sum /dev/$CART_PART | cut -d ' ' -f1`"
CART_MD5="`head -c $(($FILE_SIZE)) /dev/$CART_PART | md5sum | cut -d ' ' -f1`"
fi
set -x
#CART_MD5="`md5sum /dev/$CART_PART | cut -d" " -f1`"
if [ "$FILE_MD5" != "$CART_MD5" ] ; then
echo "ERROR: bin checksum ($FILE_MD5) did not match cartridge checksum ($CART_MD5)."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart:($CART_MD5)" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
echo "Cart checksum ($CART_MD5) passed validation!"
#echo "md5sum:$CART_MD5" > /tmp/ValidateCartResult
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$VERSION" > /tmp/ValidateCartResult
END_TIME="`date +%s`"
echo "Test Time:$(($END_TIME - $START_TIME)) seconds"
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
elif [ "1" -le "` ls $BASE_PATH | grep -c .lfp `" ] ; then
echo "validating content based on packages."
TEST_MODE="PACKAGE COMPARE"
for LFP in `find $BASE_PATH -name "*.lfp"` ; do
$DRAWTEXT_CMD "Validating `echo $LFP | cut -d / -f5`" 9 0 0
echo "Validating $LFP"
lfpkg -a validate -b /LF/Cart -d / $LFP > /tmp/CartResult
RESULT=$?
cat /tmp/CartResult
if [ "0" = "$RESULT" ] ; then
rm /tmp/CartResult
fi
if [ -e /tmp/CartResult ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "`echo $LFP | cut -d / -f5` failed" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
done
CART_PATH="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
PKG_VERSION="`cat $CART_PATH | grep ^Version | cut -d '"' -f2`"
PKG_PN="`cat $CART_PATH | grep ^PartNumber | cut -d '"' -f2`"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$PKG_VERSION" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
fi
fi
# See 020. Magic School Bus special handling
# If PN == "152-12772" perform parition check
if [ -e /LF/Base/MadridMfgTest/cartchecksum.md5 ] ; then
SPEC_PN="`cat /LF/Base/MadridMfgTest/cartchecksum.md5 | cut -d ' ' -f 3`"
SPEC_MD5="`cat /LF/Base/MadridMfgTest/cartchecksum.md5 | cut -d ' ' -f 1`"
FILE_SIZE="`cat /LF/Base/MadridMfgTest/cartchecksum.md5 | cut -d ' ' -f 5`"
if [ -f /LF/Cart/smsb/meta.inf ] ; then
cd /LF/Cart/smsb/
VERSION=`grep -e '\<Version=' meta.inf | cut -d = -f 2- | cut -d '"' -s -f 2`
PACKAGE=`cat meta.inf | grep ^Name | cut -d '"' -f 2`
PKG_PN="`cat meta.inf | grep ^PartNumber | cut -d '"' -f2`"
if [ "$PKG_PN" = "$SPEC_PN" ] ; then
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in $pkg."
$DRAWTEXT_CMD "Cartridge Info..." 11 1 0
$DRAWTEXT_CMD "$PACKAGE" 12 1 0
$DRAWTEXT_CMD "Version $VERSION" 13 1 0
$DRAWTEXT_CMD "Part Number $PKG_PN" 14 1 0
CART_MD5="`head -c $(($FILE_SIZE)) /dev/$CART_PART | md5sum | cut -d ' ' -f1`"
if [ "$SPEC_MD5" != "$CART_MD5" ] ; then
echo "ERROR: bin checksum ($FILE_MD5) did not match cartridge checksum ($CART_MD5)."
# /LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart:($CART_MD5)" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
echo "Cart checksum ($CART_MD5) passed validation!"
#echo "md5sum:$CART_MD5" > /tmp/ValidateCartResult
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$VERSION" > /tmp/ValidateCartResult
END_TIME="`date +%s`"
echo "Test Time:$(($END_TIME - $START_TIME)) seconds"
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
fi
fi
fi
echo "No package to validate against in /LF/Bulk/Cart. Will only do file checksum validation..."
$DRAWTEXT_CMD "WARNING: No file in $BASE_PATH" 8 1 0
PACKAGES=`find /LF/Cart -maxdepth 2 -name packagefiles.md5 -exec dirname {} \;`
if [ "`echo $PACKAGES | grep -c /LF/Cart`" = "0" ] ; then
echo "ERROR: No valid packages found installed on cartridge. Could not find any packagefiles.md5 file on cartridge."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No validation files on cartridge." > /tmp/ValidateCartResult
exit 3
fi
for pkg in $PACKAGES ; do
echo "No package to validate against in $BASE_PATH. Only verifying files in $pkg are not corrupt..."
TEST_MODE="File Checksum ONLY"
cd $pkg
if [ -e meta.inf ] ; then
VERSION=`grep -e '\<Version=' meta.inf | cut -d = -f 2- | cut -d '"' -s -f 2`
PACKAGE=`cat $pkg/meta.inf | grep ^Name | cut -d '"' -f 2`
PKG_PN="`cat $pkg/meta.inf | grep ^PartNumber | cut -d '"' -f2`"
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in $pkg."
$DRAWTEXT_CMD "Cartridge Info..." 11 1 0
$DRAWTEXT_CMD "$PACKAGE" 12 1 0
$DRAWTEXT_CMD "Version $VERSION" 13 1 0
$DRAWTEXT_CMD "Part Number $PKG_PN" 14 1 0
fi
if [ ! -e packagefiles.md5 ] ; then
cd $CUR_PATH
echo "ERROR: No packagefiles.md5 file found in $pkg to validate with. Impossible to validate cartridge files."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Invalid package. Missing verification file" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 3
fi
md5sum -c packagefiles.md5 | grep " FAILED" > /tmp/CartResult
if [ "X`cat /tmp/CartResult`" = "X" ] ; then
rm /tmp/CartResult
fi
if [ -e /tmp/CartResult ] ; then
cd $CUR_PATH
echo "ERROR: Installed content did not pass validation. Error validating $pkg."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "$pkg failed validation" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
cd $CUR_PATH
done
echo "CARTRIDGE VALIDATION PASSED"
CART_PATH="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
PKG_VERSION="`cat $CART_PATH | grep ^Version | cut -d '"' -f2`"
PKG_PN="`cat $CART_PATH | grep ^PartNumber | cut -d '"' -f2`"
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
elif [ -e /LF/Cart/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Cart/MadridMfgTest/SetupNANDCartridge.sh
else
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$PKG_VERSION" > /tmp/ValidateCartResult
END_TIME="`date +%s`"
echo "Test Time:$(($END_TIME - $START_TIME)) seconds"
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
ValidateCart-mount.sh#
#!/bin/sh
#####################################################################
# ValidateCart will search the cartridge for proper validation files and (packages.md5)
# and check all fileslisted in that file.
# Written by Nathan Durrin
#
# Function: This file will test a consumer cartridge using the
# base unit.
#
# Revision Table..................................................
# Date Rev Author Change
# ----------------------------------------------------------------
# 09/08/09 001 N.Durrin Initial release
# 10/07/09 002 N.Durrin Updated to check cart ID
# 10/13/09 003 N.Durrin Added more status on the screen
# 10/30/09 004 N.Durrin Added ability to program carts.
# 11/03/09 005 N.Durrin Fixed cart programming issue
# 11/10/09 006 N.Durrin Removed OTP Cart programming by default. Add /mfgdata/prog-cart to enable.
# 11/13/09 007 N.Durrin Fixed recognize the cartridge and umount it after done.
# 11/25/09 008 N.Durrin Fixed validate by bin file to ignore last 512 bytes due to FW change to write then SN in there.
# 12/03/09 009 N.Durrin Cart ID can be tested against the _Cart_ID listed in the rsrc/EmeraldMfgTestConfig.txt file
# 02/11/10 010 N.Durrin Fixed bug where full checksum not being calculated for binary file method.
# 03/25/10 011 N.Durrin Change umount_cart to use SetupNANDCartridge.sh stop
# Fixed bug where test version was not being displayed when run from a cartridge
# 06/01/10 012 N.Durrin Fixed so that it will only search for one meta.inf (ignore lib directory)
# 06/04/10 013 N.Durrin Added test mode used displayed on screen after test
# 07/15/10 014 N.Durrin Added checking EmeraldMfgTestConfig.txt file for determiing to test all of OTP ot all but last page of OTP
# 07/16/10 015 N.Durrin Full cart test still uses the file size to test against rather than whole OTP in case they ever change the size of the OTP
# 09/14/10 016 N.Durrin Changing to drawtext-fb and looking for monotext in /var/fonts
#
#
# 03/xx/10 016.5 Shelby First ported version for Madrid.
# 04/20/10 017 Shelby Set GPIO C bit 1, 8, 9, 11 to input. It is necessary now since FW changed
# it to do some LED display driving.
# 04/26/10 017 Shelby CardID still fail sometimes. Move config code to the
# beginning to help settle the signal
#
# ERROR CODES:
# 0 PASS
# 1 FAIL - NO CARTRIDGE FOUND
# 2 FAIL - FILE MISMATCH
# 3 FAIL - NO VALIDATION FILES FOUND
# 4 FAIL - CARTRIDGE IS EMPTY
# 5 FAIL - TOO MANY BIN FILES TO COMPARE AGAINST
#
#
#
#
######################################################################
FILE_REV="018"
START_TIME="`date +%s`"
echo "Starting Madrid Cart script revision $FILE_REV."
set -x
# Set cardID signal path
gpio-control /dev/gpio outenable 2 1 0
gpio-control /dev/gpio outenable 2 8 0
gpio-control /dev/gpio outenable 2 9 0
gpio-control /dev/gpio outenable 2 11 0
CUR_PATH=`pwd`
BASE_PATH="/LF/Bulk/Cart" #this is where you would put the validation file(s)
rm -f /tmp/CartResult
rm -f /tmp/ValidateCartResult
if [ -e /sys/class/graphics ]; then
DRAWTEXT_CMD="drawtext-fb /dev/fb0 /var/fonts/monotext8x16.rgb"
else
DRAWTEXT_CMD="drawtext /dev/layer0 /var/fonts/monotext8x16.rgb"
fi
# Ensure we booted from the Base NAND, not the ATAP
if [ `grep lf1000-nor /proc/iomem | cut -d '-' -f 1` = "84000000" ]; then
if [ `cat /sys/devices/platform/lf1000-gpio/board_id` != 3 ]; then
ATAP=1
if [ -e /LF/Base/MadridMfgTest/packagefiles.md5 ] ; then
cd /LF/Base/MadridMfgTest
md5sum -c packagefiles.md5 > /tmp/CartResult
RESULT="`echo $?`"
cd $CUR_PATH
if [ $RESULT != "0" ] ; then
echo "Failed file verification....."
echo "!!!!!!!!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!!!!!!!!!"
$DRAWTEXT_CMD " " 9 1 0
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD " " 11 1 0
cat /tmp/CartResult | grep " FAIL"
FAILED_FILES="`cat /tmp/CartResult | grep -c ' FAIL'`"
echo "!!!!!!!!!!!!!!Cart Verification failed!!!!!!!!!!!!!"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "$FAILED_FILES file(s) failed in /LF/Base/MadridMfgTest" > /tmp/ValidateCartResult
exit 2
fi
else
echo "No file to use for validation."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No validation file found." > /tmp/ValidateCartResult
exit 3
fi
echo "Cartridge connector verification PASSED file validation!"
echo "MadridMfgTest Version: `cat /LF/Base/MadridMfgTest/meta.inf | grep ^Version | cut -d '"' -f2`" > /tmp/ValidateCartResult
exit 0
fi
else
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh start
exit 100
SETUP_RESULT="`echo $?`"
if [ ! -e /mfgdata/prog-cart ] ; then
if [ "`echo $SETUP_RESULT`" -ne "0" ] ; then
echo "ERROR: Unable to mount cartridge for testing"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Unable to mount cartridge." > /tmp/ValidateCartResult
exit 1
fi
fi
fi
fi
if [ -e /LF/Cart/MadridMfgTest/packagefiles.md5 ] ; then
cd /LF/Cart/MadridMfgTest
TEST_VERSION="`cat /LF/Cart/MadridMfgTest/meta.inf | grep ^Version | cut -d '"' -f2`"
$DRAWTEXT_CMD "Checking MadridMfgTest in /LF/Cart" 5 1 0
$DRAWTEXT_CMD " " 6 1 0
$DRAWTEXT_CMD " " 7 1 0
md5sum -c packagefiles.md5 | grep " FAILED" > /tmp/CartResult
if [ "X`cat /tmp/CartResult`" = "X" ] ; then
rm /tmp/CartResult
fi
cd $CUR_PATH
if [ -e /tmp/CartResult ] ; then
echo "ERROR: Cart validation failed."
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "Validation failed on MfgTest Cart" > /tmp/ValidateCartResult
exit 2
fi
echo "Cartridge connector verification PASSED file validation!"
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "MadridMfgTest Version: $TEST_VERSION" > /tmp/ValidateCartResult
exit 0
fi
if [ "`cat /sys/devices/platform/lf1000-nand/cart_hotswap | cut -f1`" -ne "1" ] ; then
echo "ERROR: No cartridge found"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No cartridge found." > /tmp/ValidateCartResult
exit 1
fi
#for i in 2 3 4 5 ; do
# gpio-control /dev/gpio func 1 $i 0
#done
# CART_ID="`cat /sys/devices/platform/lf1000-gpio/cart_id`"
#CART_ID=0
#CART_ID=$((`gpio-control /dev/gpio invalue 1 5` * 8))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 4` * 4)))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 3` * 2)))
#CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 1 2`)))
# Move to earlier spot to help settle the signal
#gpio-control /dev/gpio outenable 2 1 0
#gpio-control /dev/gpio outenable 2 8 0
#gpio-control /dev/gpio outenable 2 9 0
#gpio-control /dev/gpio outenable 2 11 0
CART_ID=0
CART_ID=$((`gpio-control /dev/gpio invalue 2 9` * 8))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 11` * 4)))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 1` * 2)))
CART_ID=$(($CART_ID + (`gpio-control /dev/gpio invalue 2 8`)))
if [ ! -e /LF/Cart/MadridMfgTest/MadridMfgTest ] ; then
if [ -e /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt ] ; then
TEST_ID="`cat /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt | grep ^_Test_Cart_ID | cut -d ';' -f1 | tr -d ' ' | cut -d = -f2`"
TESTED_CART_ID="`cat /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt | grep ^_Cart_ID | cut -d ';' -f1 | tr -d ' ' | cut -d = -f2`"
FULL_TEST="`cat /LF/Base/MadridMfgTest/rsrc/MadridMfgTestConfig.txt | grep ^_Test_Full_Cart | cut -d ';' -f1 | tr -d ' ' | cut -d = -f2`"
fi
if [ "X$TEST_ID" = "X" ] ; then
TEST_ID=0
fi
if [ "X$TESTED_CART_ID" = "X" ] ; then
TESTED_CART_ID=3
fi
if [ "X$FULL_TEST" = "X" ] ; then
FULL_TEST=1
fi
$DRAWTEXT_CMD "Checking Madrid Cart ID... " 5 1 0
if [ ! $CART_ID -eq $TESTED_CART_ID ] ; then
if [ "$TEST_ID" -ne "0" ] ; then
$DRAWTEXT_CMD "FAIL: Cart ID incorrect..." 5 1 0
$DRAWTEXT_CMD "CartID: $CART_ID Expected Cart ID=$TESTED_CART_ID" 6 1 0
$DRAWTEXT_CMD " " 7 1 0
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "CartID: $CART_ID Expected Cart ID=$TESTED_CART_ID" > /tmp/ValidateCartResult
exit 1
else
$DRAWTEXT_CMD "WARNING: Cart ID incorrect..." 5 1 0
$DRAWTEXT_CMD "CartID: $CART_ID Expected Cart ID=$TESTED_CART_ID" 6 1 0
$DRAWTEXT_CMD " " 7 1 0
fi
else
$DRAWTEXT_CMD "Checking Madrid Cart ID...PASS" 5 1 0
$DRAWTEXT_CMD "CartID: $CART_ID " 6 1 0
$DRAWTEXT_CMD " " 7 1 0
fi
fi
echo "Looking for a cartridge..."
if [ `ls -l /LF/Cart/ | grep -c r` -eq 0 -a `cat /proc/mtd | grep -c \\"Cartridge\\"` -gt "0" ] ; then #Cartridge is empty
$DRAWTEXT_CMD "CART IS EMPTY" 8 1 1
if [ -d $BASE_PATH -a -e /mfgdata/prog-cart -a -e /usr/bin/otp_program.sh ] ; then
if [ "`ls $BASE_PATH | grep -c .bin$`" -eq "1" ] ; then
WAIT_TIME=5
WAITING=$WAIT_TIME
echo "Cart is empty. May program by pressing A+B within $WAITING second"
$DRAWTEXT_CMD "Press A+B within 5 seconds to program" 9 1 0
$DRAWTEXT_CMD "Press Home to skip programming" 10 1 0
$DRAWTEXT_CMD "Press Hint to disable programming" 11 1 0
TIME_START=`date +%s`
while [ "$WAITING" -gt "0" ] ; do
TIME_STAMP=`date +%s`
TEMP="`expr $TIME_STAMP - $TIME_START`"
#TEMP="`expr $TEMP / 1000`"
WAITING="`expr $WAIT_TIME - $TEMP`"
$DRAWTEXT_CMD "$WAITING" 9 20 0
if [ "`gpio-control /dev/gpio invalue 2 3 | grep value | cut -d = -f 2`" = "0" -a "`gpio-control /dev/gpio invalue 2 11 | grep value | cut -d = -f 2`" = "0" ] ; then
BINARY="`ls $BASE_PATH | grep .bin$`"
echo "Programming $BINARY"
WAITING="0"
$DRAWTEXT_CMD " " 8 1 0
$DRAWTEXT_CMD " " 9 1 0
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD " " 11 1 0
$DRAWTEXT_CMD "Programming $BINARY" 8 1 0
otp_program.sh $BASE_PATH/$BINARY
if [ "`echo $?`" -ne "0" ] ; then
echo "Failed cartridge programming."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Failed Cart Program" > /tmp/ValidateCartResult
exit 1
else
echo "Cartridge programming succeeded."
/etc/init.d/cartridge restart
sleep 4
#INFO_PATH="`ls /LF/Bulk/Cart/*.bin | cut -d '/' -f5 | cut -c 1-3`"
#INFO_PATH="`find /LF/Cart -iname $INFO_PATH`"
META_FILE="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
if [ ! "X$META_FILE" = "X" ] ; then
VERSION="`grep -e '\<Version=' "$META_FILE" | cut -d = -f 2- | cut -d '"' -s -f 2`"
PACKAGE="`cat $META_FILE | grep ^Name | cut -d '"' -f 2`"
#3LD="`cat $META_FILE | grep ^3LD | cut -d '"' -f 2`"
PKG_PN="`cat $META_FILE | grep ^PartNumber | cut -d '"' -f2`"
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in `echo $META_FILE | cut -d / -f-4`."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$VERSION" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "BINARY COMPARE" 2 1 0
sleep 1
$DRAWTEXT_CMD "BINARY COMPARE" 2 1 0 ) &
exit 0
else
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart Program Succeeded" > /tmp/ValidateCartResult
exit 0
fi
fi
elif [ "`gpio-control /dev/gpio invalue 2 5 | grep value | cut -d = -f 2`" = "0" ] ; then
rm -f /mfgdata/prog-cart
WAITING="0"
elif [ "`gpio-control /dev/gpio invalue 2 12 | grep value | cut -d = -f 2`" = "0" ] ; then
WAITING="0"
fi
done
$DRAWTEXT_CMD " " 10 1 0
$DRAWTEXT_CMD " " 11 1 0
$DRAWTEXT_CMD " " 12 1 0
else
echo "No binary file in $BASE_PATH to program onto the cartridge"
fi
fi
echo "Cartridge is empty."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cartridge is empty" > /tmp/ValidateCartResult
exit 4
fi
if [ "`mount | grep -c /LF/Cart`" != "1" ] ; then
if [ `cat /proc/mtd | grep -c \\"Cartridge\\"` -gt "0" ] ; then
/etc/init.d/cartridge restart
if [ "`mount | grep -c /LF/Cart`" != "1" ] ; then
echo "Unable to mount cartridge for testing"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Unable to mount cartridge for testing" > /tmp/ValidateCartResult
exit 1
fi
else
echo "No cartridge found, aborting cartridge test process."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No cartridge found" > /tmp/ValidateCartResult
exit 1
fi
fi
CART_PART="`cat /proc/mtd | grep \\"Cartridge\\" | cut -d : -f1`"
if [ "X$CART_PART" = "X" ] ; then
echo "No cartridge found, aborting cartridge test process."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No cartridge found" > /tmp/ValidateCartResult
exit 1
fi
echo "looking for cartridge content to validate against in $BASE_PATH"
TEST_MODE=""
if [ -d $BASE_PATH ] ; then
if [ "`ls $BASE_PATH/ | grep -c .bin$`" -gt "1" ] ; then
TEST_MODE="BINARY COMPARE"
echo "ERROR: Too many .bin files in $BASE_PATH. Only place the one you want to compare to the cartridge in $BASE_PATH."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Only one .bin file supported for test" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 5
elif [ "`ls $BASE_PATH/ | grep -c .bin$`" -eq "1" ] ; then
BINARY="`ls $BASE_PATH | grep .bin$`"
TEST_MODE="BINARY COMPARE"
echo "validating content based on $BASE_PATH/$BINARY."
$DRAWTEXT_CMD "Validating against $BINARY" 8 1 0
FILE_SIZE="`ls -al $BASE_PATH/$BINARY | cut -d ' ' -f5`"
#INFO_PATH="`ls /LF/Bulk/Cart/*.bin | cut -d '/' -f5 | cut -c 1-3`"
#INFO_PATH="`find /LF/Cart -iname $INFO_PATH`"
META_FILE="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
if [ ! "X$META_FILE" = "X" ] ; then
VERSION="`grep -e '\<Version=' "$META_FILE" | cut -d = -f 2- | cut -d '"' -s -f 2`"
PACKAGE="`cat $META_FILE | grep ^Name | cut -d '"' -f 2`"
#3LD="`cat $META_FILE | grep ^3LD | cut -d '"' -f 2`"
PKG_PN="`cat $META_FILE | grep ^PartNumber | cut -d '"' -f2`"
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in `echo $META_FILE | cut -d / -f-4`."
$DRAWTEXT_CMD "Cartridge Info..." 11 1 0
$DRAWTEXT_CMD "$PACKAGE" 12 1 0
$DRAWTEXT_CMD "Version $VERSION" 13 1 0
$DRAWTEXT_CMD "Part Number $PKG_PN" 14 1 0
fi
if [ ! -e $BASE_PATH/$BINARY.md5 ] ; then
#set +x
if [ "`echo $FULL_TEST`" -eq "0" ] ; then
echo "PARTIAL CHECKSUM OF FILE BEING CALCULATED NOW..."
# echo "head -c $(($FILE_SIZE-512)) $BASE_PATH/$BINARY > $BASE_PATH/$BINARY.md5"
head -c $(($FILE_SIZE-512)) $BASE_PATH/$BINARY | md5sum > $BASE_PATH/$BINARY.md5
set -x
else
echo "FULL CHECKSUM OF FILE BEING CALCULATED NOW..."
$DRAWTEXT_CMD "FILE CHECKSUM BEING CALCULATED..." 9 1 0
md5sum $BASE_PATH/$BINARY > $BASE_PATH/$BINARY.md5
fi
fi
FILE_MD5="`cat $BASE_PATH/$BINARY.md5 | cut -d ' ' -f1`"
echo "Validating $BINARY is installed on cartridge"
#set +x
if [ "`echo $FULL_TEST`" -eq "0" ] ; then
echo "PARTIAL CHECKSUM OF CARTRIDGE BEING CALCULATED NOW..."
# $DRAWTEXT_CMD "md5: $FILE_MD5" 9 1 0
# echo "CART_MD5=\"head -c $(($FILE_SIZE-512)) /dev/$CART_PART | md5sum | cut -d ' ' -f1\""
CART_MD5="`head -c $(($FILE_SIZE-512)) /dev/$CART_PART | md5sum | cut -d ' ' -f1`"
else
echo "FULL CHECKSUM OF CARTRIDGE BEING CALCULATED NOW..."
$DRAWTEXT_CMD "md5: $FILE_MD5" 9 1 0
#CART_MD5="`md5sum /dev/$CART_PART | cut -d ' ' -f1`"
CART_MD5="`head -c $(($FILE_SIZE)) /dev/$CART_PART | md5sum | cut -d ' ' -f1`"
fi
set -x
#CART_MD5="`md5sum /dev/$CART_PART | cut -d" " -f1`"
if [ "$FILE_MD5" != "$CART_MD5" ] ; then
echo "ERROR: bin checksum ($FILE_MD5) did not match cartridge checksum ($CART_MD5)."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart:($CART_MD5)" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
echo "Cart checksum ($CART_MD5) passed validation!"
#echo "md5sum:$CART_MD5" > /tmp/ValidateCartResult
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$VERSION" > /tmp/ValidateCartResult
END_TIME="`date +%s`"
echo "Test Time:$(($END_TIME - $START_TIME)) seconds"
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
elif [ "1" -le "` ls $BASE_PATH | grep -c .lfp `" ] ; then
echo "validating content based on packages."
TEST_MODE="PACKAGE COMPARE"
for LFP in `find $BASE_PATH -name "*.lfp"` ; do
$DRAWTEXT_CMD "Validating `echo $LFP | cut -d / -f5`" 9 0 0
echo "Validating $LFP"
lfpkg -a validate -b /LF/Cart -d / $LFP > /tmp/CartResult
RESULT=$?
cat /tmp/CartResult
if [ "0" = "$RESULT" ] ; then
rm /tmp/CartResult
fi
if [ -e /tmp/CartResult ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "`echo $LFP | cut -d / -f5` failed" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
done
CART_PATH="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
PKG_VERSION="`cat $CART_PATH | grep ^Version | cut -d '"' -f2`"
PKG_PN="`cat $CART_PATH | grep ^PartNumber | cut -d '"' -f2`"
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$PKG_VERSION" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
fi
fi
echo "No package to validate against in /LF/Bulk/Cart. Will only do file checksum validation..."
$DRAWTEXT_CMD "WARNING: No file in $BASE_PATH" 8 1 0
PACKAGES=`find /LF/Cart -name packagefiles.md5 -exec dirname {} \;`
if [ "`echo $PACKAGES | grep -c /LF/Cart`" = "0" ] ; then
echo "ERROR: No valid packages found installed on cartridge. Could not find any packagefiles.md5 file on cartridge."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "No validation files on cartridge." > /tmp/ValidateCartResult
exit 3
fi
for pkg in $PACKAGES ; do
echo "No package to validate against in $BASE_PATH. Only verifying files in $pkg are not corrupt..."
TEST_MODE="File Checksum ONLY"
cd $pkg
if [ -e meta.inf ] ; then
VERSION=`grep -e '\<Version=' meta.inf | cut -d = -f 2- | cut -d '"' -s -f 2`
PACKAGE=`cat $pkg/meta.inf | grep ^Name | cut -d '"' -f 2`
PKG_PN="`cat $pkg/meta.inf | grep ^PartNumber | cut -d '"' -f2`"
echo "$PACKAGE (PN:$PKG_PN) version $VERSION installed on cartridge in $pkg."
$DRAWTEXT_CMD "Cartridge Info..." 11 1 0
$DRAWTEXT_CMD "$PACKAGE" 12 1 0
$DRAWTEXT_CMD "Version $VERSION" 13 1 0
$DRAWTEXT_CMD "Part Number $PKG_PN" 14 1 0
fi
if [ ! -e packagefiles.md5 ] ; then
cd $CUR_PATH
echo "ERROR: No packagefiles.md5 file found in $pkg to validate with. Impossible to validate cartridge files."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "Invalid package. Missing verification file" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 3
fi
md5sum -c packagefiles.md5 | grep " FAILED" > /tmp/CartResult
if [ "X`cat /tmp/CartResult`" = "X" ] ; then
rm /tmp/CartResult
fi
if [ -e /tmp/CartResult ] ; then
cd $CUR_PATH
echo "ERROR: Installed content did not pass validation. Error validating $pkg."
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
echo "$pkg failed validation" > /tmp/ValidateCartResult
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 2
fi
cd $CUR_PATH
done
echo "CARTRIDGE VALIDATION PASSED"
CART_PATH="`find /LF/Cart -maxdepth 2 -name meta.inf | grep -v lib`"
PKG_VERSION="`cat $CART_PATH | grep ^Version | cut -d '"' -f2`"
PKG_PN="`cat $CART_PATH | grep ^PartNumber | cut -d '"' -f2`"
if [ -e /LF/Base/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
elif [ -e /LF/Cart/MadridMfgTest/SetupNANDCartridge.sh ] ; then
/LF/Cart/MadridMfgTest/SetupNANDCartridge.sh
else
/LF/Base/MadridMfgTest/SetupNANDCartridge.sh stop
fi
echo "Cart ID:$CART_ID PN:$PKG_PN Ver:$PKG_VERSION" > /tmp/ValidateCartResult
END_TIME="`date +%s`"
echo "Test Time:$(($END_TIME - $START_TIME)) seconds"
( sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0
sleep 1
$DRAWTEXT_CMD "$TEST_MODE" 2 1 0 ) &
exit 0
Release Notes Document#
Present in the MfgTest folder is a release notes text document, MadridMfgTest_ReleaseNotes.txt. Its contents are as follows:
NOTE: Do not open any script files in Windows. This will corrupt the file.
If you want to view them, make a copy and then open them.
Special Mfg Mode Flags:
/mfgdata/prog-cart = allow programming OTP with a binary file located in /LF/Bulk/Cart
/mfgdata/hwqa = Will not fail button test on multiple button presses, retains button counts over power cycles
Enables USB Keyboard Test for shake/drop test expecting continuous Number Pad "3" being pressed
Validate cartridge test loops until failure
Special Optional Actions:
Place any lfp package in the EmeraldMfgTest/ResetFiles folder and it will be installed during reset unit.
Place the EmeraldMfgTest.lfp in /LF/Bulk and the Make Mfg Test Cart will program that version on the cartridge.
Place the cartridge .bin file, .lfp file, or .md5 file in /LF/Bulk/Cart and the cartridge test will test against
those files (if the cartridge is not an EmeraldMfgTest Cartridge).
----
REVISION NOTES:
----
NOTE: The version string represents the Main Base code and extra files versions.
The main base code is the first two numbers, the extra files (which don't require
re-compiling the main code) version is represented by the last number for that main version.
Example: Version 1.18.03 means Main code 1.18 (which will be displayed on the screen when the test is running).
The other files' (the entire package) version is 03.
Note: This does not apply to pre-release versions with alphabits version string.
----
REVOSION HISTORY
----
Version 1.13.01 - 1/13/2012
Modified Validate Cart function to search check sum files only
on the fisrst level of directory on Cart.
Version 1.13.00 - 10/19/2011
1. With 1.12.00X2, camera test may fail on multiple entering.
Also Accerlerometer seemed less stable, "segmentation
fault" after (sometimes even before) camera or other tests
were done. Decided to undo the changes made for 1.12.00.
2. Test showed that the Camera gots more stable after
removing the poweron and delay ops.
Version 1.12.00X2 - 10/7/2011
1. Experimentation version.
Added selection of combined test of two or three in
LCD Test, controlled by entry _LCD_combined_test in
config file (rsrc/MadridMfgTestConfig.txt):
if the value is 2, run TP calib and RMS;
else if 3, run TP calib, RMS and Linearity;
else no combined test is provided.
Version 1.12.00X - 10/7/2011
1. Experimentation version.
Added combined TP test to see if we can improve worker
efficency. In "LCD & Touch Screen Tests", added an entry
to do combined TP calibration, RMS and Linearity tests,
in that order. When fail, show error screen and exit the
the test; otherwise continue the next test step without
showing FAIL/PASS screen.
Version 1.12.00 - 10/4/2011
1. Work-around on "Camera Not Detected" problem after Flash
based test is run.
2. Test showed that the fix worked more then 90% of times.
But it may still fail once a while. Still need FW fix.
Version 1.11.00 - 10/3/2011
1. Fixed “shutting down” image display problem (after Camera
Test is run).
2. Fixed RGB Test, RMS Test, etc, color display error (blue
become red, and red blue) after returning from Camera Test.
3. Create temporary checksum files under /tmp folder, instead
of where the original checksum files were located.
4. Report error if partition checksums created during FW
programming were not found.
Version 1.10.00 - 9/28/2011
Change the setting of display before and after Camera Test
and new-calib to fix display problems in those test.
Test showed that it is difficult if not impossible to just
change settings one time when the MfgTest starts, since some
frame buffer configurations happened inside the code of
the new-calib (disabled fb0 blending).
Decided to change the settings inside C++ code.
Version 1.09.01 - 9/27/2011
Changed LaunchMfgTest.sh to setup display to match FW's.
This will fix the Camera Test no video problem.
Test showed new-calib showed black circle instead of blue
for touch point prompt.
Version 1.09.00 - 9/09/2011
1. To prevent accidental removal of MfgTest code, following
changes are made:
(a) Changed key combination from
vol-up + Left
to
vol-up + Home
for calling MfgTest deletion function.
(b) Operator needs to hold the button combination for more
than two seconds before the function is executed.
2. Disabled hidden AccelerometerTest() when pressing Right
button in Special Commands Menu.
Version 1.08.00 - 8/30/2011
1. Cleanup Camera Widget power control code to make it more
logical and avoid vibration motor issue in future. Since
kHigh/kLow are shared constants, decided to change CameraPwr()
instead of the constants, by reversing param logic value.
2. Removed "-c" parameter when calling new-calib, to avoid high
failure rate with GW panels. May consider adding it back when
we have enough data to setup new test criteria.
3. Change RMS test to access separate MaxAbsErrX and MaxAbsErrY,
(currently 9 and 6 respectively). Output test summary to
console window.
4. Minor code clean up.
Version 1.07.00 - 8/16/2011
1. Set backlight to level 3 using lfd-ctrl when entering Power Test
Menu and when perform Operating Current Test.
2. Fixed a bug that turning Camera Widget power on/off incorrectly.
3. Minor code clean up on PowerTest.cpp.
Version 1.06.01 - 8/10/2011
Changed calibration parameters for new GW panel FEP run.
Version 1.06.00 - 6/27/2011
1. Added new CameraTest config file. It will be used with new and
smaller test target.
2. Fixed Camera Test crashing when enterring it more than once.
Version 1.05.00f - 06/02/2011
Merging Brian's RGB fix...
Version 1.05.00e - 06/02/2011
Added CPowerTest::stInit static var to avoid unwanted screen update
before menu is drawn, which may crash the app.
Now you can get in and out of PowerTest as many times as you want
without crashing app. But it may still crash if you try batt/ext
switching after that.
Version 1.05.00 - 06/01/2011
Added configuration entry for backlight "dim" setting. Default is 50.
It is used in Power Test, Standby Current test.
Version 1.04.00 - 05/27/2011
1. Added extra option "-c" to panel calibration routine (new-calib),
to detect "bad" screens (that would not work well with our code).
2. Removed panel type string attached to MfgTest version number on
main menu.
3. Changed Manual ADC Calibration slope from 2026 to 2072, to match
Auto Calib's value.
Version 1.03.00 - 05/20/2011
1. Adding power button shutdown function. It works on all levels of
menu structure.
Version 1.02.02 - 05/18/2011
1. Updated config files, so that the commmand line for TP calib will be:
new-calib -m -w -x -S -5
which cause it to add center calib point.
Version 1.02.01 - 05/17/2011
1. Update config files.
Version 1.02.00 - 05/17/2011
1. Adding sync before powering off, to fix occasionally truncating
TP calibratoin log file.
2. Some mods for old TP Calib code, in case we still need it.
Further test/work will be needed.
Version 1.01.00 - 05/13/2011
1. Adding/restore Manual ADC Calib. Need to inc ADC offset limit.
(from 50 to 150). I have seen one EP has error as large as
180 (mV).
2. Use "new-calib -m -w -x -S" for TP calibration, the last two
options of which are from config file.
3. Moved CameraTestRGBData.csv from root to /mfgdata and save the
result before exit.
Version 1.00.00 - 05/10/2011
1. Make RGB been able to run off cartridge.
2. Add 1 sec delay after turn USB cam power to make sure
device/drive are fully activated.
Version A.AA.CQ - 05/6/2011
1. Use long sine wave file. The short one stopped working
with FW 1.9.10-2310.
Version A.AA.CP - 05/6/2011
1. Call old saplayer withCalibrate.swf for TP calibration.
Version A.AA.CN - 04/29/2011
1. Added RGB test that replaces Camera pic taking test.
2. Cosmetic changes on all menu screens
3. On Standby Current Test, dim the backlight aftetr drawing
and delay so the tester will see the bright screen image
before dimming.
Version A.AA.CM - 04/26/2011
1. In order to fixed over-sensitive panel that might register
extra touches (and fails RMS test), added back touch point
offset checking in RMS. The limit is set to 30 pix, just to
filter out wrong seq or false sense.
2. Fixed PowerTest code that did not dim down LCD on Standby
test.
3. Fixed SetupNANDCartridge script to handle cardID correctly.
Version A.AA.CL - 04/25/2011
1. Turnning off speaker at mic recording exit.
Version A.AA.CK - 04/25/2011
1. Added speacial handling to make sure mic recording will be
able to function.
Version A.AA.CJ - 04/24/2011
1. Hide HW volume putty out.
Version A.AA.CI - 04/24/2011
1. Added code the turn off speaker out when not performing audio
test or output audio, by turn HW volume to the minimum.
Partially working but not stable yet.
2. Fixed the Cartridge script to setup the CardID pins to input
so CardID can be read correctly.
3. Fixing Base FW valiation script to fully validate all the
files.
Version A.AA.CF - 04/15/2011
1. Ported Power Event Msg handling additions from Emerald 4.08.02.
Works for future Madrid build rev. 2013 or newer.
2. Added enhanced RMS test summary screen that shows the deviation
of each touch point.
Version A.AA.CE - 04/01/2011
1. Added board validate in config file.
2. Added recoding length selection, read from config file
3. Added paths to handle MfgTest running off the cartridge correctly
4. Added read-write option when mounting cartridge so the base will be
protected from any test data/file.
NOTE: Needs FW 1.9.6-2148 or newer to get cartridge test function
correctly.
Version A.AA.CC - 03/20/2011
Default to GW panel and cosmetic change.
Version A.AA.CB - 03/20/2011
Added basic Camera Test.
Version A.AA.CA - 03/16/2011
1. Added PASS/FAIL screen for touch panel calibration
2. Fixed cartridge validation scripts (cardID reading error)
3. Relaxed RMS passing threshold
4. Added BLACK and WHITE screen for LCD test
5. Added Configuration file for GOWORLD touch panel. The panel type will be appended to
test code version string on display
Version A.AA.BU - 03/11/2011
1. Added microphone recording and playback test.
2. Added optional screenshot functions.
Version A.AA.BS - 03/11/2011
Use new calibration routine for touch panel calibration.
Version A.AA.BQ - 03/09/2011
1. Replaced all references of "Emerald" to "Madrid" in script files.
2. Added Button Sensitivity Test.
3. Fixed RMS test.
4. Added brightness control for LCD test.
5. Cosmetic changes.
Version A.AA.BM - 03/03/2011
Update touch panel param. SConstruct lib inclusion.
Version A.AA.BL - 03/03/2011
Release for Madrid to China - Pre-EP
Version A.AA.BJ - 02/28/2011
First creation for Madrid.
meta.inf#
|
|
To do: |
A metadata info file that seems to go unused, as the MfgTest is booted directly into rather than launched as an app.
MetaVersion="1.0"
Device="LeapPadExplorer"
Type="System"
ProductID="00180013"
PackageID="LSTR-00180013-000000"
Locale="en-us"
Name="Madrid Manufacturing Test"
ShortName="MadridMfgTest"
3LD="EMT"
Publisher="LeapFrog"," Inc."
Developer="US Mfg Team"
Hidden=0
Description="Madrid Manufacturing Test"
PreviewImage="Description.png"
Icon="IconNormal.png"
PartNumber="857-10034???"
BuildDate="05/11/2012"
Version="1.13.02"
Testmenu.png#
|
|
To do: |
A blank 320x240 PNG image file filled entirely with just the color black. Likely used as the background for the test menu. It can also be found in the LeapTV.