Tema: Re: kinietis BLY-806 , VIA 8650
Autorius: Levas
Data: 2012-04-25 22:32:13
Ar uzmusei kerneli? Ar uzmusei bootloaderi? Ar nors kiek reaguoja?

Jei boot loaderis dar gyvas (t.y. rodos bent lempute uzsidega po power nuspaudimo), tai sita via turetu moketi uzsikurti is SD korteles. Netgi is kokio "generic" kernelio, tekstiniam rezime.

Reikia pasidaryti SD kortele su FAT (nepamenu kokia16 ar 32), irasyti viena direktorija ir ten sukelti failus...

rodos /script direktorija. ten linuxo kernelis ir skriptis shell failas. o ten shell faile jau bandai sukelti failus ar formatuoti/tikrinti flash roma. Galima ir sistema is SD korteles pasileisti.

As tokiu metodu pasidariau viso aparato backupa ir poto sekmingai atgaivinau kai uzsirootines sisteminius failus perredagavau ir jis jau nebesikure visiskai.



scriptas pvz toks. jis ikelia visa sistema, jei ji SD korteleje:

height=20
pointX=30
pointY=50

if [ -f /mnt/mmcblk0p1/script/android_fs.tgz ] ; then
    string="Update filesystem Start ......"
    echo $string
    gui-echo $pointX $pointY "$string"
else
    string="--> Not find script/android_fs.tgz in SD Card"
    echo $string
    gui-echo $pointX $pointY "$string"
    pointY=$(($pointY + $height + $height))
    string="Fail to update filesystem. Exit!"
    echo $string
    gui-echo $pointX $pointY "$string"
    exit 0
fi

# -----> Begin Operate File-System Partition <---- #

pointY=$(($pointY + $height + $height))
string="Erase File-System partition ......"
echo $string
gui-echo $pointX $pointY "$string"
#pointY=$(($pointY + $height))

flash_eraseall /dev/mtd7
if [ $? -ne 0 ] ; then
#   pointY=$(($pointY + $height))
    pointY=$(($pointY + $height + $height))
    string="--> Erase File-System partition Fail! Exit!"
    echo $string
    gui-echo $pointX $pointY "$string"
    pointY=$(($pointY + $height))
    string="Maybe the kernel don't support this NAND Flash"
    echo $string
    gui-echo $pointX $pointY "$string"
    exit 0
else
   string="Erase File-System partition OK"
   echo $string
   gui-echo $pointX $pointY "$string"
fi
#pointY=$(($pointY + $height))

mount -t yaffs2 /dev/mtdblock7 /mnt/mtd
if [ $? -ne 0 ] ; then
    #pointY=$(($pointY + $height))
    pointY=$(($pointY + $height + $height))
    string="--> Mount File-System partition Fail! Exit!"
    echo $string
    gui-echo $pointX $pointY "$string"
    exit 0
else
    string="Mount File-System partition OK"
    echo $string
    gui-echo $pointX $pointY "$string"
fi

pointY=$(($pointY + $height))
string="Now Copy System Files, Pleas wait ......"
echo $string
gui-echo $pointX $pointY "$string"
#pointY=$(($pointY + $height))

tar zxvf /mnt/mmcblk0p1/script/android_fs.tgz -C /mnt/mtd

string="Copy System Files to File-System partition OK"
echo $string
gui-echo $pointX $pointY "$string"
pointY=$(($pointY + $height))

if [ -d /mnt/mmcblk0p1/script/driver ] ; then
    echo "Now Copy Drivers to File-System partition ......"
    cp -a /mnt/mmcblk0p1/script/driver/* /mnt/mtd

    string="Copy Drivers to File-System partition OK"
    echo $string
    gui-echo $pointX $pointY "$string"
    pointY=$(($pointY + $height))
fi

if [ -f /mnt/mmcblk0p1/script/busybox_1.16.tgz ] ; then
    string="Now Copy busybox to File-System partition ......"
    echo $string
    gui-echo $pointX $pointY "$string"
#    pointY=$(($pointY + $height))
    tar zxvf /mnt/mmcblk0p1/script/busybox_1.16.tgz -C /mnt/mtd
    string="Copy busybox to File-System partition OK"
    echo $string
    gui-echo $pointX $pointY "$string"
    pointY=$(($pointY + $height))    
    
    if [ -x /mnt/mtd/busybox/bin/ash ] ; then
        mv /mnt/mtd/system/bin/sh /mnt/mtd/system/bin/sh-org
        ln -s /busybox/bin/busybox /mnt/mtd/system/bin/sh
    fi
fi

chmod 777 -R /mnt/mtd
sync
umount /mnt/mtd

if [ $? -ne 0 ] ; then
    pointY=$(($pointY + $height))
    string="Unmount File-System partition Fail! Exit!"
    echo $string
    gui-echo $pointX $pointY "$string"
    exit 0
fi

# -----> End Operate File-System Partition <---- #


# -----> Begin Operate Data Partition <---- #

if [ -d /mnt/mmcblk0p1/script/etc ] || [ -f /mnt/mmcblk0p1/script/data.tgz ] ; then
    string="Erase Data partition ......"
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))

    flash_eraseall /dev/mtd8
    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Erase Data partition Fail!. Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        pointY=$(($pointY + $height))
        string="Maybe the kernel don't support this NAND Flash"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
       string="Erase Data partition OK"
       echo $string
       gui-echo $pointX $pointY "$string"
    fi
    #pointY=$(($pointY + $height))

    mount -t yaffs2 /dev/mtdblock8 /mnt/mtd
    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Mount Data partition Fail!. Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
        string="Mount Data partition OK"
        echo $string
        gui-echo $pointX $pointY "$string"
    fi
    pointY=$(($pointY + $height))

    string="Now Copy Files to Data partition, Please wait ......"
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))
    
    if [ -f /mnt/mmcblk0p1/script/data.tgz ] ; then
        tar zxvf /mnt/mmcblk0p1/script/data.tgz -C /mnt/mtd
    fi
    
    if [ -d /mnt/mmcblk0p1/script/etc ] ; then
        if [ -d /mnt/mtd/wmtpref ] ; then
            cp -a /mnt/mmcblk0p1/script/etc/* /mnt/mtd/wmtpref
        else
            mkdir /mnt/mtd/wmtpref
            cp -a /mnt/mmcblk0p1/script/etc/* /mnt/mtd/wmtpref
        fi
    fi

    string="Copy Files to Data partition OK"
    echo $string
    gui-echo $pointX $pointY "$string"
    pointY=$(($pointY + $height))

    chmod 777 -R /mnt/mtd
    sync
    umount /mnt/mtd

    if [ $? -ne 0 ] ; then
        pointY=$(($pointY + $height))
        string="Unmount Data partition Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    fi
fi
# -----> End Operate Data Partition <---- #

# -----> Begin Operate Cache Partition <---- #

if [ -f /mnt/mmcblk0p1/script/cache.tgz ] ; then
    string="Erase Cache partition ......"
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))

    flash_eraseall /dev/mtd9
    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Erase Cache partition Fail!. Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        pointY=$(($pointY + $height))
        string="Maybe the kernel don't support this NAND Flash"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
       string="Erase Cache partition OK"
       echo $string
       gui-echo $pointX $pointY "$string"
    fi
    #pointY=$(($pointY + $height))
    
    mount -t yaffs2 /dev/mtdblock9 /mnt/mtd
    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Mount Data partition Fail!. Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
        string="Mount Cache partition OK"
        echo $string
        gui-echo $pointX $pointY "$string"
    fi
    pointY=$(($pointY + $height))
    
    string="Now Copy Files to Cache partition, Please wait ......"
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))
    tar zxvf /mnt/mmcblk0p1/script/chache.tgz -C /mnt/mtd
    
    string="Copy Files to Cache partition OK"
    echo $string
    gui-echo $pointX $pointY "$string"
    pointY=$(($pointY + $height))

    chmod 777 -R /mnt/mtd
    sync
    umount /mnt/mtd

    if [ $? -ne 0 ] ; then
        pointY=$(($pointY + $height))
        string="Unmount Cache partition Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    fi 
fi

# -----> End Operate Cache Partition <---- #

string="Update filesystem successful!"
echo $string
gui-echo $pointX $pointY "$string"
pointY=$(($pointY + $height + $height))

# -----> Begin Operate User Space <---- #

if [ -f /mnt/mmcblk0p1/script/driver/g_file_storage.ko ] ; then
    string="Erase User Space......"
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))

    flash_eraseall /dev/mtd11

    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Erase User Space Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
        string="Erase User Space OK"
        echo $string
        gui-echo $pointX $pointY "$string"
    fi
    #pointY=$(($pointY + $height))
    mount -t yaffs2 /dev/mtdblock11 /mnt/mtd

    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Mount User Space Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
        string="Mount User Space OK"
        echo $string
        gui-echo $pointX $pointY "$string"
    fi

    pointY=$(($pointY + $height))
    string="Create Loop File ..."
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))

    create_loopfile mtd11 /mnt/mtd/UserFile bs=1024

    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Create Loop File Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
        if [ -f /mnt/mtd/UserFile ] ; then
            string="Create Loop File Successful"
            echo $string
            gui-echo $pointX $pointY "$string"
        else
            #pointY=$(($pointY + $height))
            pointY=$(($pointY + $height + $height))
            string="--> Create Loop File Fail! Exit!"
            echo $string
            gui-echo $pointX $pointY "$string"
            exit 0
        fi
    fi
    pointY=$(($pointY + $height))

    string="Format Loop File ..."
    echo $string
    gui-echo $pointX $pointY "$string"
    #pointY=$(($pointY + $height))

    mkdosfs /mnt/mtd/UserFile

    if [ $? -ne 0 ] ; then
        #pointY=$(($pointY + $height))
        pointY=$(($pointY + $height + $height))
        string="--> Format Loop File Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    else
        string="Format Loop File Successful"
        echo $string
        gui-echo $pointX $pointY "$string"
    fi
    
    chmod 777 -R /mnt/mtd
    sync
    umount /mnt/mtd

    if [ $? -ne 0 ] ; then
        pointY=$(($pointY + $height + $height))
        string="Unmount User Space Fail! Exit!"
        echo $string
        gui-echo $pointX $pointY "$string"
        exit 0
    fi

    pointY=$(($pointY + $height + $height))
fi

# -----> End Operate User Space <---- #

echo 0 > /proc/boot-splash
string="All Update successful... waiting for remove SD Card"
echo $string
gui-echo $pointX $pointY "$string"
pointY=$(($pointY + $height))

string="Please remove SD Card ......"
while [ -x /bin/ls ]
do
    if [ -x /mnt/mmcblk0p1/script/update.sh ] ; then
        echo $string
        gui-echo $pointX $pointY "$string"
        sleep 1       
    else
        break
    fi
done

pointY=$(($pointY + $height))

string="Reboot now..."
echo $string
gui-echo $pointX $pointY "$string"
reboot


-- 
Bye, Levas
--
http://www.vabolis.lt


"Andrius" <netu@go.myla> wrote in message news:jn8at8$p2d$1@trimpas.omnitel.net...
> karoce ymeciau y korta nauja rom
> pakrove-suinstalino , liepe isimt msd , uzgiso ir psio su viskam lavonas
> 
> ar yr kokia 3-4 pirstu kombinacija garazinem salygom prikelt?
> ar palikt kaip gykine lentute lasiakam ant kapoto pjaustyt ?
> 
> aciu
> 
> 
> 
>