General NAS-Central Forums

Welcome to the NAS community
It is currently Sun Jun 25, 2017 7:10 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Dec 30, 2014 12:32 am 
Offline

Joined: Tue Dec 30, 2014 12:17 am
Posts: 3
Hello,

Would someone help me to find out what would be the magic values to put into /etc/fw_env.config in order to have fw_printenv work ?
I've read many forums, tried to figure out by myself, but I must be a bit stupid.

Here are some tries I tested; after hours, I started to note and eliminate all non-working pairs, but I did not have luck.
Firmware version is: 3.2.8.30031
Linux version 2.6.31.8 (soho@bsoho172.iomegacorp.com) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #1 Wed Oct 15 14:54:06 EDT 2014


# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundand
# environment sector is assumed present.

#dev: size erasesize name
#mtd0: 000c0000 00020000 "uboot"
#mtd1: 00020000 00020000 "env"
#mtd2: 00300000 00020000 "zImage"
#mtd3: 00300000 00020000 "initrd"
#mtd4: 08000000 00020000 "flash"

# MTD device name Device offset Env. size Flash sector size
/dev/mtd1 0xa000 0x20000 0x20000
#/dev/mtd1 0x0000 0x20000 0x20000

It would be cool to be able to change the FanTempStart=58 to something more sensible easily, with just a fw_setenv FanTempStart=45, for example...


Top
 Profile  
 
PostPosted: Fri Feb 06, 2015 12:06 pm 
Offline

Joined: Fri Feb 06, 2015 11:05 am
Posts: 1
Hi!

The problem is in the utility itself. It does not need an external config file because everything is hardcoded in it.
But it is meesed up. The size of the mtd1 block is 0x4000 in the utility so it fails when checks the crc of the block which is calculated from 0 to 0x20000 (the real size of the block).

I patched it but I can't upload the files, so you have to do it manually.
In the fw_setenv an fw_printenv utility (they are the same) modify 0x01E9 to 0x20EA at the address 0x1368 (dec 4968).

Check if you have the same files as I had!
Code:
md5sum  /usr/bin/fw_printenv
md5sum  /usr/bin/fw_setenv

Both must have this MD5: 79791a52840b0ce80f7d5f3724b20173

copy them to a writeable file system!
Patch them:
Code:
echo -n -e '\x20\xEA' | dd of=fw_printenv bs=1 seek=4968 count=2 conv=notrunc
echo -n -e '\x20\xEA' | dd of=fw_setenv bs=1 seek=4968 count=2 conv=notrunc

Now test them!
Code:
./fw_setenv FanTempStart 45
./fw_printenv | grep Fan

Thats all!

Btw, here is my fan control script which controls the fan speed based on HDD temperature:
Code:
#!/bin/bash

#start:
#nohup /mnt/pools/A/A0/Data/control.sh &

BASEDIR=$(dirname $0)

counter=0
ref_temp=40
delta_temp=1
t_int=1800
t_period=5
duty_max=62
integrator=0
duty_reg=0
k_rec=10

#if [ -t 0 ]; then stty -echo -icanon time 0 min 0; fi   


echo -e "Time:\tTemp:\tDuty cycle:">$BASEDIR/control.log

while [[ true ]]

do

    max_temp=`smartctl -d marvell /dev/sda -A -s on | grep Temperature_Celsius |cut -f 2 -d - |cut -c 8-10`
    Temp_B=`smartctl -d marvell /dev/sdb -A -s on | grep Temperature_Celsius |cut -f 2 -d - |cut -c 8-10`
#    max_temp=`smartctl -d marvell /dev/sda -A -s on | grep Temperature_Celsius |tail -c3`
#    Temp_B=`smartctl -d marvell /dev/sdb -A -s on | grep Temperature_Celsius |tail -c3`

    if [[ "$Temp_B" -gt "$max_temp" ]]
    then
       max_temp=$Temp_B
    fi

    #stty -icanon time 0 min 0
    #read input
    #stty icanon
    #if [[ "$input" = "+" ]]
    #then
    #   max_temp=$(($max_temp+1))
    #   echo $max_temp
    #elif [[ "$input" = "-" ]]
    #then
    #   max_temp=$(($max_temp-1))
    #   echo $max_temp
    #fi

    error=$(($max_temp-$ref_temp))
    integrator=$(( $integrator+$error*$t_period*10000/$t_int/$delta_temp ))
    if [[ "$integrator" -lt "0" ]]
    then
        integrator=0
   elif [[ "$integrator" -gt "10000" ]]
   then
       integrator=10000
    fi   
   
    out=$(($error*10000/$k_rec + integrator))
    if [[ "$out" -lt "0" ]]
    then
        out=0
   elif [[ "$out" -gt "10000" ]]
   then
       out=10000
    fi   
   
    duty_reg=$(($out*$duty_max/10000))

    echo "manual $duty_reg"> /proc/mp_lm63_fan_speed

    echo $out

    counter=$(($counter+1))
   
    echo -e "$(($counter*$t_period)) s\t$max_temp 'C\t$(($out/100)) %">>$BASEDIR/control.log
   
    #>>control.log
   
 #   echo counter: $counter
    sleep "$t_period"s
#   clear
done


First check if
Code:
smartctl -d marvell /dev/sda -A -s on | grep Temperature_Celsius |cut -f 2 -d - |cut -c 8-10
returns the correct HDD temperature.
You possibly have to adjust the 'cut commands' and/or remove the logging function.

Regards,
Pál Bakula


Top
 Profile  
 
PostPosted: Sun Jun 14, 2015 1:56 pm 
Offline

Joined: Tue Dec 30, 2014 12:17 am
Posts: 3
Hey,

Great job! didn't think it was hardcoded into the binary :-(

Anyway, I plan to upgrade/enhance this system, seen the nice group working on marvel/feroceon card.
For this, I bought on ebay for 5$ a pll to usb converter, and as soon as I understood that I should connect tx to rx and rx to tx lines (:-)), I got the console and was able to lower the temp to 40 degrees and save FanTempStart in uboot.

Now the next thing would be to replace the old Uboot by a newer one, and as I'm afraid of bricking the unit with a bad test image, I tought the serial cable will serve in case of disaster.

Didier


Top
 Profile  
 
PostPosted: Fri Jun 17, 2016 11:00 am 
Offline

Joined: Fri Jun 17, 2016 10:57 am
Posts: 2
BTW, my ix2-200 prints the temperatura with this command:
smartctl -d ata /dev/sda -A -s on | grep Temperature_Celsius |cut -f 2 -d - |cut -c 8-10


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group