horst/teil2/root# cat upgrade.sh
#!/bin/sh
#set -x
#cd /tmp
# Create the passwd file
#echo "root::0:0:root:/:/bin/sh" > /ramdisk/flash/passwd
mkdir -p /tmp/newroot/bin
mkdir -p /tmp/newroot/lib
mkdir -p /tmp/newroot/dev
cp /lib/libc.so.0 /tmp/newroot/lib
cp /lib/ld-uClibc.so.0 /tmp/newroot/lib
cp /lib/libIFXAPIs.so /tmp/newroot/lib
cp /lib/libdl.so.0 /tmp/newroot/lib
cp /lib/liboamapi.so /tmp/newroot/lib
cp /lib/libm.so.0 /tmp/newroot/lib/
cp /lib/libcrypt.so.0 /tmp/newroot/lib
cp /lib/libCommonmips-linux.so /tmp/newroot/lib/
cp /lib/libObjAPImips-linux.so /tmp/newroot/lib/
cp /lib/libProtoAPImips-linux.so /tmp/newroot/lib/
cp /lib/libProtoAdaptmips-linux.so /tmp/newroot/lib/
cp /lib/libStubAPIsmips-linux.so /tmp/newroot/lib/
cp -a /usr/sbin/upgrade /tmp/newroot/bin
cp -a /bin/busybox /tmp/newroot/bin
cp -a /bin/dd /tmp/newroot/bin
cp -a /usr/bin/[ /tmp/newroot/bin
cp -a /bin/cp /tmp/newroot/bin
cp -a /bin/cat /tmp/newroot/bin
cp -a /bin/echo /tmp/newroot/bin
cp -a /usr/sbin/ifx_util /tmp/newroot/bin
cp -a /usr/sbin/get_env /tmp/newroot/bin
cp -a /usr/sbin/set_env /tmp/newroot/bin
#cp -a /usr/sbin/flash_erase /tmp/newroot/bin
cp /bin/ash /tmp/newroot/bin
cp -a /bin/ls /tmp/newroot/bin
cp -a /bin/ln /tmp/newroot/bin
cp /sbin/reboot /tmp/newroot/bin
#cp /root/u-boot.img /tmp/newroot/u-boot.img
cp /root/chroot.sh /tmp/newroot/bin
#chmod +x /tmp/newroot/bin/upgrade.sh
cp -a /dev/mtd /tmp/newroot/dev/
cp -a /dev/mtdblock /tmp/newroot/dev/
echo "mounting old config"
mkdir /tmp/jffs
mount -tjffs2 /dev/mtdblock/3 /tmp/jffs
if [ -f /tmp/jffs/rc.conf.gz ] ; then
cp /tmp/jffs/rc.conf.gz /tmp/newroot/
fi
umount /tmp/jffs
BOOTLOADER=/root/u-boot.img
echo "replacing bootloader"
dd if=$BOOTLOADER of=/dev/mtdblock/0 bs=64k
set_env part0_begin 0xB3000000
set_env part1_begin 0xB3020000
set_env part2_begin 0xB3060000
set_env part3_begin 0xb3790000
set_env part4_begin 0xb3790000
set_env total_part 3
set_env f_rootfs_addr 0xb3060000
set_env f_voip_addr 0xB37A0000
set_env f_voip_size 0x40000
set_env f_kernel_addr 0xb3790000
set_env f_kernel_size 0x0
set_env f_firmware_addr 0xB3020000
set_env f_firmware_size 0x40000
set_env f_sysconfig_addr 0xB3790000
set_env f_sysconfig_size 0x10000
set_env data_block0 uboot
set_env data_block1 firmware
set_env data_block2 rootfs
set_env data_block3 kernel
set_env data_block4 sysconfig
set_env data_block5 voip
set_env data_block6 ubootconfig
set_env data_block7 fwdiag
set_env data_block8 calibration
set_env total_db 9
set_env flashargs "setenv bootargs root=/dev/mtdblock2 rootfstype=squashfs"
chroot /tmp/newroot ash -c /bin/chroot.sh