28 June 2010

multi-boot in embedded device

My device have U-Boot boot loader and 64MB cavium-nand flash (for "kernel" and "filesystem"). How can i support dual-boot in it???

I have decided to format the NAND flash like this:
/dev/mtd0 : 0x00000000-0x00300000 :  3 MB : "kernel1"
/dev/mtd1 : 0x00300000-0x01300000 : 16 MB : "cramfs1"

/dev/mtdblock2 : 0x01300000-0x01700000 : 4 MB : "jffs2"
/dev/mtdblock3 : 0x01700000-0x01800000 : 1 MB : "nvram"

/dev/mtd4 : 0x01800000-0x01b00000 : 3 MB : "kernel2"
/dev/mtd5 : 0x01b00000-0x02b00000 : 16 MB : "cramfs2"
And made device soft link like:
/dev/mtd-kernel     -> mtd0
/dev/mtd-rfs -> mtd1

/dev/mtd-kernel-alt -> mtd4
/dev/mtd-rfs-alt -> mtd5
How does U-Boot does the boot process:
1. Read kernel from NAND to RAM
2. un-compress the kernel to RAM
3. execute kernel

Ex:-
bootcmd=nand read <TO> <FROM> <SIZE>; \
gunzip <FROM> <SIZE> <TO> <MAX SIZE>; \
bootoctlinux <NEW FROM> root=/dev/mtdblock1 ${mtdparts}

bootcmd=nand read 0x500000 0x00000 0x300000; \
gunzip 0x500000 0x300000 0x2800000 0xf00000; \
bootoctlinux 0x2800000 root=/dev/mtdblock1 ${mtdparts}

Solution:
1. get the current kernel information from U-Boot parameter
2. burnel kernel image in alternate locations (mtd0, mtd5)
3. update U-Boot parameter

Ideal U-Boot parameters:
bootcmd=run boot1
altbootcmd=run boot2

boot1=namedfree __tmp_reserved_bootloader; \
nand read 500000 00000 300000; \
run boot11
boot2=namedfree __tmp_reserved_bootloader; \
nand read 500000 1800000 300000; \
run boot21

mtdparts=mtdparts=cavium-nand:3072k(kernel1),16384k(cramfs1), \
4096k(jffs2),1024k(nvram), \
3072k(kernel2),16384k(cramfs2),3072k()

boot11=gunzip 0x500000 300000 0x2800000 0xf00000; \
bootoctlinux 2800000 root=/dev/mtdblock1 ${mtdparts}
boot21=gunzip 0x500000 300000 0x2800000 0xf00000; \
bootoctlinux 2800000 root=/dev/mtdblock5 ${mtdparts}
firmware upgrade script:
#!/bin/sh

bootcmd=`bootenv -d bootcmd`
altcmd=`bootenv -d altbootcmd`

if [ "$bootcmd" == "run boot1" ];
then
kernelimage="/dev/mtd-kernel-alt"
rfsimage="/dev/mtd-rfs-alt"
else
kernelimage="/dev/mtd-kernel"
rfsimage="/dev/mtd-rfs"
fi

# Kernel in mtd-kernel
echo "Erasing the kernel image in $kernelimage"
echo -n "Flashing in the new kernel image. Please wait..."

# Root File System in mtd-rfs
echo "Erasing the root f/s image in $rfsimage"
echo -n "Flashing in the new root f/s image. Please wait..."

if [ "$bootcmd" == "run boot1" ];
then
echo "Setting new bootcmd as run boot2 and backup as run boot1"
bootenv -s bootver "$upgradeVersion"
bootenv -s bootcmd "run boot2"
bootenv -s altbootver "$existingVersion"
bootenv -s altbootcmd "run boot1"
else
echo "Setting new bootcmd as run boot1 and backup as run boot2"
bootenv -s bootver "$upgradeVersion"
bootenv -s bootcmd "run boot1"
bootenv -s altbootver "$existingVersion"
bootenv -s altbootcmd "run boot2"
fi

/bin/sync
/bin/sleep 2

# Reboot
exec /sbin/init -r


Reference:

13 June 2010

How To: Add Subtitles to your PS3 Movies

The types of video formats supported by PS3 are MPEG-1, MPEG-2, MP4, AVI, DivX, WMV etc.

There are two such subtitle formats that can be used
1. The XSUB format - where the generated bitmaps are presented as an additional stream inserted in the video file itself. This works only with avi files. In this case another avi is generated that has the subtitles incorporated.
2. The idx/sub format - This format uses a pair of files, one with extension idx and another with extension sub. These files go together and replace the srt in your player.

AVIAddXSubs takes an AVI with XVID/DIVX content plus SRT/IDX/SUB files and merges them into a DIVX container (XSUB) which is what the PS3 supports. PS3 from firmware version 2.2 supports XSUB subtitles.


Reference:
http://www.calcitapp.com/AVIAddXSubs.php
http://dontcthis.com/2009/09/how-to-add-subtitles-to-your-ps3-movies
http://manuals.playstation.net/document/en/ps3/3_15/video/filetypes.html

08 June 2010

Equal Cost Multipath (ECMP) routing

In Nortel BayStack switches ECMP requires separate license. So that does it provide extra???

Many of today's businesses measure network downtime in millions of dollars per minute. With ECMP, network managers can increase the capacity of backbone trunks and virtually eliminate network downtime.

This routing mechanism enables packet routing along multiple paths with equal cost and ensures load balancing. With ECMP, a new gateway is chosen for each new source/destination IP pair. For example, one FTP connection will use only one link, but new connection to a different server will use another link.

--> The ECMP routes can be created by routing protocols (RIP or OSPF), or by adding a static route with multiple gateways.
--> The ECMP routes can be created by adding a static route with multiple gateways.

In BayStack, ECMP allows up to 4 paths to pass traffic simultaneously.
5650TD#show ip route
=========================================================
Ip Route
=========================================================
DST MASK NEXT COST TYPE
---------------------------------------------------------
0.0.0.0 0.0.0.0 47.152.228.1 10 IB
47.152.228.0 255.255.255.0 47.152.228.226 1 DB
Total Routes: 2
----------------------------------------------------------
TYPE Legend:
I=Indirect Route, D=Direct Route, A=Alternative Route, B=
Best Route, E=Ecmp Route, U=Unresolved Route, N=Not in HW

5650TD(config)# maximum-path 2
Access not granted.
Contact support@nortel.com to update Software license.

5650TD(config)# ip route 0.0.0.0 0.0.0.0 47.152.228.254 10
% Cannot modify settings
% ECMP: Maximum allowed IP paths already reached


Reference:
http://www.mikrotik.com/testdocs/ros/2.9/ip/route.php
http://www.networkaccess.ru/catalogue/Network_equipment/switches/nortel

07 June 2010

Proxy Auto-Detect, how does it affect YM???

Recently i had an issue with Yahoo Messenger, the login was failing all the time and troubleshoot give the following error.
Checking virtual IP servers...
[VIP Raw] Resolving host name us1.proxy.mycomp.com... [PASSED]
[VIP Raw] Connecting to Virtual IP server 75.X.Y.Z... [FAILED]
*** 'COMPONENT_TYPE_WININET' value: '12017' ***
[VIP Raw] Connecting to Virtual IP server 75.X.Y.Z...
[VIP Raw] Connecting to Virtual IP server 75.X.Y.Z... [FAILED]
*** 'COMPONENT_TYPE_WININET' value: '12017' ***
[VIP Raw] Connecting to Virtual IP server 75.X.Y.Z... [FAILED]
*** 'COMPONENT_TYPE_WININET' value: '12017' ***
[VIP Raw] FAILED
*** 'COMPONENT_TYPE_YCP' YCPError: 'YMSG.ColoSelectionTimeout' ***
IE8 -> Tools -> Internet Options -> Connections -> 
LAN Settings -> Automatically detect settings (uncheck it)
# nslookup wpad
Name: wpad.mycomp.com
Address: 79.X1.Y1.Z1
# http://wpad/wpad.dat
--> return "PROXY us1.proxy.mycomp.com:8000;";
# The proxy server redirects all HTTP req to auth page

# The same was happening to YM and hence the issue.
# It seems IE, Chrome and YM are sharing same configuration.
# what the ..ck???


Reference:
http://blog.freyguy.com/archives/2006/03/01/proxy-auto-detect-ie-and-firefox
http://www.grape-info.com/doc/win2000srv/internet-gw/wpad/index.html