Commit 612840f5 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/snmpd: add wrsBootLoadLM32 to wrsBootStatusGroup

-- change script userspace/rootfs_override/wr/sbin/startup-mb.sh to save
   lm32 load result in file /tmp/load_lm32_status
-- update wrsBootStatusGroup.c and wrsBootStatusGroup.h
-- update MIB
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent b379e439
#!/bin/ash
export WR_HOME="/wr"
LOAD_FPGA_STATUS_FILE="/tmp/load_fpga_status"
LOAD_LM32_STATUS_FILE="/tmp/load_lm32_status"
# Get parameter from kernel commandline
for arg in $(cat /proc/cmdline); do
......@@ -32,6 +33,7 @@ if ! [ -f "$FP_FILE" ]; then
fi
if ! [ -f "$LM_FILE" ]; then
echo "Fatal: can't find \"$LM_FILE\"" >& 2
echo "load_file_not_found" > $LOAD_LM32_STATUS_FILE
exit 1;
fi
......@@ -45,6 +47,14 @@ else
fi
$WR_HOME/bin/load-lm32 $LM_FILE scb_ver=${scb_ver}
if [ $? -eq 0 ];
then
echo "load_ok" > $LOAD_LM32_STATUS_FILE
else
echo "Fatal: load LM32 failed" >& 2
echo "load_error" > $LOAD_LM32_STATUS_FILE
fi
insmod $WR_HOME/lib/modules/at91_softpwm.ko
insmod $WR_HOME/lib/modules/wr_vic.ko
insmod $WR_HOME/lib/modules/wr-nic.ko macaddr=$val
......
......@@ -352,6 +352,23 @@ wrsBootLoadFPGA OBJECT-TYPE
fileNotFound - file to be loaded not found"
::= { wrsBootStatusGroup 11 }
wrsBootLoadLM32 OBJECT-TYPE
SYNTAX INTEGER {
na(0),
ok(1),
error(2),
errorMinor(3),
fileNotFound(4)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Result of loading LM32
error - loading failed
errorMinor - cannot read status file, problem is probably somewhere else
fileNotFound - file to be loaded not found"
::= { wrsBootStatusGroup 12 }
-- wrsTemperatureGroup (.7.1.3)
wrsTemperatureGroup OBJECT IDENTIFIER ::= { wrsOperationStatus 3 }
......
......@@ -12,6 +12,7 @@
#define HWINFO_FILE "/tmp/hwinfo_read_status"
#define LOAD_FPGA_STATUS_FILE "/tmp/load_fpga_status"
#define LOAD_LM32_STATUS_FILE "/tmp/load_lm32_status"
/* Macros for fscanf function to read line with maximum of "x" characters
* without new line. Macro expands to something like: "%10[^\n]" */
......@@ -34,6 +35,7 @@ static struct pickinfo wrsBootStatus_pickinfo[] = {
FIELD(wrsBootStatus_s, ASN_INTEGER, wrsBootConfigStatus),
FIELD(wrsBootStatus_s, ASN_INTEGER, wrsBootHwinfoReadout),
FIELD(wrsBootStatus_s, ASN_INTEGER, wrsBootLoadFPGA),
FIELD(wrsBootStatus_s, ASN_INTEGER, wrsBootLoadLM32),
};
struct wrsBootStatus_s wrsBootStatus_s;
......@@ -197,7 +199,7 @@ static void get_dotconfig_source(void)
/* get status of execution of following scripts:
* /etc/init.d/S90hwinfo
* /wr/sbin/startup-mb.sh
* /wr/sbin/startup-mb.sh (load FPGA and LM32)
* */
static void get_boot_scripts_status(void){
static int run_once = 0;
......@@ -253,6 +255,28 @@ static void get_boot_scripts_status(void){
wrsBootStatus_s.wrsBootLoadFPGA =
WRS_BOOT_LOAD_FPGA_ERROR_MINOR;
}
/* result of loading LM32 */
f = fopen(LOAD_LM32_STATUS_FILE, "r");
if (f) {
/* readline without newline */
fscanf(f, LINE_READ_LEN(20), buff);
fclose(f);
if (!strncmp(buff, "load_ok", 20))
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_OK;
else if (!strncmp(buff, "load_file_not_found", 20))
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_FILE_NOT_FOUND;
else /* */
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_ERROR;
} else {
/* status file not found, probably something else caused
* a problem */
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_ERROR_MINOR;
}
}
......
......@@ -32,6 +32,11 @@
#define WRS_BOOT_LOAD_FPGA_ERROR_MINOR 3 /* warning */
#define WRS_BOOT_LOAD_FPGA_FILE_NOT_FOUND 4 /* error */
#define WRS_BOOT_LOAD_LM32_OK 1 /* ok */
#define WRS_BOOT_LOAD_LM32_ERROR 2 /* error */
#define WRS_BOOT_LOAD_LM32_ERROR_MINOR 3 /* warning */
#define WRS_BOOT_LOAD_LM32_FILE_NOT_FOUND 4 /* error */
struct wrsBootStatus_s {
uint32_t wrsBootCnt; /* boots since power-on must be != 0 */
uint32_t wrsRebootCnt; /* soft reboots since hard reboot
......@@ -45,6 +50,7 @@ struct wrsBootStatus_s {
int32_t wrsBootConfigStatus;
int32_t wrsBootHwinfoReadout;
int32_t wrsBootLoadFPGA;
int32_t wrsBootLoadLM32;
};
extern struct wrsBootStatus_s wrsBootStatus_s;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment