View previous topic :: View next topic |
Author |
Message |
hotgly
Joined: 22 Apr 2007 Posts: 130
小企鹅: 4504
|
Posted: 2007-Jun-12 Tue, pm10:51 |
|
Post subject: 各位老大,请教u-boot里面做系统备份的方法,如zback |
|
如题,准备装r197了,准备好了uboot+r197+sp6,但备份这一块还不明白。那位老大给点指点吧。千恩万谢!!
_________________ sl-7500c pdaxrom1.1.0beta1wellswang汉化
extremeIII CF,SD Roku Agere Hermes II CF Wifi with ccpaging driver for 7500c
Ubuntu Hardy box |
|
Back to top |
|
ccpaging
Joined: 07 Dec 2006 Posts: 757
小企鹅: 16604
|
Posted: 2007-Jun-13 Wed, pm12:43 |
|
Post subject: |
|
到oesf的论坛上搜索zbackup,下载最新版本。
安装,使用前可以阅读一下zbackup,理解的尽量多一点。
1、备份最好退出X系统,在纯console界面上进行
2、命令:zbackup
3、要接上外接电源
4、备份数据放在SD卡上,要保证剩余空间
Description: |
|
 Download |
Filename: |
zbackup_0.16_armv5tel.ipk |
Filesize: |
27.34 KB |
Downloaded: |
49 Time(s) |
_________________ SL-C1000, 1G CF, 1G SD
pdaxrom 1.1beta3
Roku Wifi Card(Used in Cacko 1.23 & pdaXrom 1.1 Beta3)
http://ccpaging.blog.ubuntu.org.cn/
http://ccpaging.osall.com/
http://blog.sina.com.cn/zaurus/
Last edited by ccpaging on 2007-Jun-13 Wed, pm1:02; edited 1 time in total |
|
Back to top |
|
ccpaging
Joined: 07 Dec 2006 Posts: 757
小企鹅: 16604
|
Posted: 2007-Jun-13 Wed, pm12:52 |
|
Post subject: |
|
#!/bin/bash
#
# This script is written 2006 by Hd Luc
# zbackup creates a flashable archive from the current system
#
#########################################################################
设置变量,检查机器型号
version=0.16
MODEL=`cat /proc/deviceinfo/product`
VERSION="pdaXii13 for $MODEL"
DATESTAMP=`date +%Y%m%d%H%M`
STATUS_SUSPEND=`xset q | grep Standby | awk '{print $6;}'`
STATUS_STANDBY=`xset q | grep Standby | awk '{print $2;}'`
STATUS_DPMS=`xset q | grep "DPMS is" | awk '{print $3}'`
STATUS_XSCRSV=`pidof xscreensaver`
取消系统休眠,设置屏幕等
function set_dpms
{
/usr/X11R6/bin/xset dpms 60 0 0
/usr/X11R6/bin/xset -dpms
/usr/X11R6/bin/xset s blank
/usr/X11R6/bin/xset s 60
/usr/X11R6/bin/xset s on
if [ "`pidof xscreensaver`" != "" ]; then
/usr/local/bin/xscreensaver-command -exit 2>/dev/null
fi
}
恢复设置
function reset_dpms
{
/usr/X11R6/bin/xset dpms $STATUS_STANDBY 0 $STATUS_SUSPEND
if [ $STATUS_DPMS = "Disabled" ]; then
/usr/X11R6/bin/xset -dpms
else
/usr/X11R6/bin/xset +dpms
fi
if [ ! -z "$STATUS_XSCRSV" ]; then
sudo -u zaurus xscreensaver -nosplash 2>/dev/null &
fi
if [ "$STATUS_STANDBY" = "0" ]; then
/usr/X11R6/bin/xset s noblank
/usr/X11R6/bin/xset s 0
/usr/X11R6/bin/xset s off
else
/usr/X11R6/bin/xset s blank
/usr/X11R6/bin/xset s $STATUS_STANDBY
/usr/X11R6/bin/xset s on
fi
}
### begin
if [ "$1" = "-v" ] || [ "$1" = "-version" ] || [ "$1" = "--version" ]; then
echo "`basename $0` v$version ($VERSION)"
exit 0
fi
设置文件名和路径
if [ -f /media/realroot/sbin/init ] || [ -f /media/fakeroot/usr/sbin/cfdisk ]; then
if [ "`mount|grep data`" != "" ]; then
LOC=/data
else
LOC=/mnt/card
fi
NAME=pdaXrom-C3K-backup-$DATESTAMP.tgz
else
LOC=/mnt/card
NAME=initrd.bin
fi
if [ "$1" != "" ] && [ -d $1 ]; then
LOC=$1
fi
检查SD卡的剩余空间
if [ "`echo $LOC|grep /mnt/card`" != "" ]; then
mount|grep "/mnt/card" > /dev/null
if [ $? -eq 1 ]; then
echo "SD card not mounted! Exiting."
exit 1
fi
FREE_SD=`df | grep /mnt/card | awk '{print $4;}'`
if [ 100000 -gt $FREE_SD ]; then
echo "There is only $[FREE_SD/1024] MB available on /mnt/card!"
exit 1
fi
fi
检查硬盘的剩余空间
if [ "`echo $LOC|grep /data`" != "" ]; then
FREE_HDD=`df | grep /data | awk '{print $4;}'`
if [ 200000 -gt $FREE_HDD ]; then
echo "There is only $[FREE_HDD/1024] MB available on /data!"
exit 1
fi
fi
if [ ! -d $LOC ]; then
echo "$LOC does not exists! Exiting."
fi
开始备份了
echo "backing up $VERSION..."
if [ ! -f /etc/directories ]; then
touch /etc/directories
fi
for i in `ls -1 --color=never /mnt/`
do
if [ "`grep /mnt/$i /etc/directories`" = "" ]; then
echo /mnt/$i >> /etc/directories
fi
done
/etc/rc.d/init.d/mntloop stop 2>/dev/null
if [ "`pidof X`" != "" ]; then
set_dpms
fi
检查是否接上了外接电源
apm|grep "On-line" &> /dev/null
if [ $? -eq 0 ]; then
echo ""
echo " AC adapter is connected."
echo ""
else
echo ""
echo " AC adapter is NOT connected!"
echo "Please plug in to power source as backup may take over an hour..."
echo ""
fi
开始备份
echo ""
echo "Started backup at `date`"
echo "... please wait ..."
if [ -f /media/realroot/sbin/init ]; then
tar czf $LOC/$NAME /bin /etc /home /lib /root /sbin /usr 2>/dev/null
else
if [ -f /media/fakeroot/usr/sbin/cfdisk ]; then
cd /media/fakeroot
tar czf $LOC/$NAME /bin /etc /home /lib /root /sbin usr 2>/dev/null
cd -
fi
if [ ! -d /mnt/backup ]; then
mkdir -p /mnt/backup
fi
if [ "`mount|grep usr`" != "" ]; then
umount /usr 2>/dev/null
fi
建议loop文件
mount -t squashfs -o loop /home/.rootfs.squashfs /mnt/backup
装载loop文件
for i in bin home root etc lib sbin usr
do
mount --bind /$i /mnt/backup/$i
done
tar cf $LOC/home_custom.tar /home/root/ 2>/dev/null
mount --bind $LOC/home_custom.tar /mnt/backup/root/.home_default.tar
建立jffs2文件系统
mkfs.jffs2 -n -e 16 -o $LOC/$NAME.jffs2 -d /mnt/backup
umount /mnt/backup/root/.home_default.tar
rm $LOC/home_custom.tar
for i in bin home root etc lib sbin usr
do
umount /mnt/backup/$i
done
if [ -d /media/fakeroot/usr/bin ]; then
mount --bind /media/fakeroot/usr /usr 2>/dev/null
fi
加initrd的文件头
cat /mnt/backup/.initrdheader $LOC/$NAME.jffs2 > $LOC/$NAME
rm $LOC/$NAME.jffs2
umount /mnt/backup
echo ""
echo "Warning: the generated initrd.bin file may not work if the size of your root partition is less than 100MB."
echo ""
fi
备份完毕
echo "Done! - backup finished at `date`"
echo " - backup file is $LOC/$NAME"
echo " "
恢复设置
/etc/rc.d/init.d/mntloop start 2>/dev/null
if [ "`pidof X`" != "" ]; then
reset_dpms
fi
_________________ SL-C1000, 1G CF, 1G SD
pdaxrom 1.1beta3
Roku Wifi Card(Used in Cacko 1.23 & pdaXrom 1.1 Beta3)
http://ccpaging.blog.ubuntu.org.cn/
http://ccpaging.osall.com/
http://blog.sina.com.cn/zaurus/ |
|
Back to top |
|
hotgly
Joined: 22 Apr 2007 Posts: 130
小企鹅: 4504
|
Posted: 2007-Jun-13 Wed, pm1:22 |
|
Post subject: |
|
ccpaging
谢谢cc老大,感激涕零,呵呵呵。我roku的无线网卡到手了,帮忙编译一个beta1的驱动吧,谢谢谢谢谢谢谢
_________________ sl-7500c pdaxrom1.1.0beta1wellswang汉化
extremeIII CF,SD Roku Agere Hermes II CF Wifi with ccpaging driver for 7500c
Ubuntu Hardy box |
|
Back to top |
|
hotgly
Joined: 22 Apr 2007 Posts: 130
小企鹅: 4504
|
Posted: 2007-Jun-13 Wed, pm1:30 |
|
Post subject: |
|
ccpaging
cc老大,我用你这片贴子 Quote: | [发布]roku for pdaxrom beta3驱动程序编译成功 | http://www.zaurus.cn/viewtopic.php?t=1617&highlight=roku
的驱动,Roku的灯不亮,没有反映,是不是要敲什么命令?求助啊,谢谢谢谢
_________________ sl-7500c pdaxrom1.1.0beta1wellswang汉化
extremeIII CF,SD Roku Agere Hermes II CF Wifi with ccpaging driver for 7500c
Ubuntu Hardy box |
|
Back to top |
|
hotgly
Joined: 22 Apr 2007 Posts: 130
小企鹅: 4504
|
Posted: 2007-Jun-13 Wed, pm11:25 |
|
Post subject: |
|
ccpaging
关于zbackup还有个问题,zbackup生成的是initrd.bin文件,是在sharp原厂的OK模式下用的,在uboot的emergency模式下也能用吗,emergency模式下不是用的rootfs.img吗,initrd.bin怎么用呢?
请老大指点?
那要分析rootfs.img是什么格式?
_________________ sl-7500c pdaxrom1.1.0beta1wellswang汉化
extremeIII CF,SD Roku Agere Hermes II CF Wifi with ccpaging driver for 7500c
Ubuntu Hardy box |
|
Back to top |
|
ccpaging
Joined: 07 Dec 2006 Posts: 757
小企鹅: 16604
|
|
Back to top |
|
hotgly
Joined: 22 Apr 2007 Posts: 130
小企鹅: 4504
|
Posted: 2007-Jun-17 Sun, pm9:55 |
|
Post subject: |
|
ccpaging
Quote: |
那要分析rootfs.img是什么格式? |
这个我完全不懂啊,怎么分析呢?分析完了又该怎么做呢?用zbackup做的initrd.bin怎么能在u-boot中刷机呢?愿闻其详,多谢指导!!!
_________________ sl-7500c pdaxrom1.1.0beta1wellswang汉化
extremeIII CF,SD Roku Agere Hermes II CF Wifi with ccpaging driver for 7500c
Ubuntu Hardy box |
|
Back to top |
|
|