[The views expressed on this website/blog are mine alone and do not necessarily reflect the views of my employer.]
Friday, March 24, 2006
Unified Extensible Firmware Interface
Forum released their UEFI 2 Specification a couple of months back. OK why I am writing about this now is because of Microsoft’s press release about Vista will not support EFI in initial phase. So I just want to focus some light on this subject.
The basic sequence that goes in booting a PC is, power on, load BIOS and then boot loaded and then Operating system. This is what we learned and experimented around since years. First time when you though of upgrading your BIOS, you would have got a doubt whether my PC supports BIOS upgrade though flash update or do I need to replace those funny chips. To go a bit deeper, what is BIOS doing on your box?
As you can think of every processor by virtue of hardware design can jump to particular location when it is powered on. It is not as simple as jumping, but to keep things simple just make an assumption of such feature. Then it got to find out some instructions there to run your computer. These instructions are important to build an environment where in various different components of your computer can be controlled. By then some fixed locations of your RAM are holding pointers to various device controls. So as a programmer that is your environment, schedule your tasks to leverage on this environment. But such a sophisticated program (typically operating system) consumes more footprint, which your BIOS chip doesn’t have. So BIOS need a position to jump into some location which has huge memory to feed in further instructions of operating system. Such a location is typically a mass storage device or hard disk or even a network interface card. Thus BIOS provides options to boot from floppy (this for traditional support only, can do much because of 1.44 MB limitation), cd-rom, hard disk, network, and even some new BIOS chips can understand USB flash sticks also. Mean basically BIOS need to understand how to initialize these devices and keep a place holder in RAM, so that when OS boots up it can utilize these placeholders either to reinitialize or use then to control devices.
Then what is boot loader? Now when you select hard disk option, there is some tricky thing here. There can be many hard disks and there can be many operating systems on these hard disks. BIOS solve this problem by assuming a fixed location on first hard disk which is called Master Boot Record (MBR) of your hard disk. MBR is a 512 byte block which points to operating selected. But for the operating system to boot up it requires some pre built binaries at specified location. Means kernel code will have idea about a file system that you are going to mount as root. It is this root file system that holds various small programs that help kernel initialize hardware and keep pointers.
All is good then why we need a change from BIOS? Of course the primary reason is aging. BIOS is developed in pre-historic times. Earlier it is used only to initialize and bootstrap the operating system. Later OS can reinitialize the interfaces again. But in recent times this phenomenon changed. The dependency on BIOS increased again due to advent of ACPI and hot plug stuff. This called for layered BIOS architecture.
Also BIOS, being a binary code, is specific to processor architecture. Mean different versions of BIOS are needed to boot different architecture families. To overcome this problem a byte coded BIOS is needed.
Then plug in support should be possible for BIOS. Right now additional boot options can be provided using BIOS boot specification API. And BIOS options are stored on CMOS which is a non volatile memory in addition to BIOS EEPROM. This complicated the stuff to customize the boot environment. That called for a modular architecture.
Open source community attempted to build Linux BIOS to overcome limitations of BIOS. But this is more of subject of hardware manufacturers than software. So a strong initiative from Intel kind of companies is envisaged. Thus came out EFI.
So what this can do so special is explained in much of technical terms in UEFI_2_Specification.pdf. I am going through this now. And want to write some simplistic gist out of this soon.
Thursday, March 09, 2006
My Gentoo 2006.0
Till that week end I couldn’t download the package. Now there is a special installer cum live cd for x86 architecture. I thought I will not have much fun this time. But actually I got lot more fun compared with last two years.
As I don’t have laptop with cd writer now, I happened to take help of internet cafĂ© to burn the iso image. But unfortunately that CD didn’t work for me. CD got a sector error when it is about to start gdm. So nothing was moving after that white screen. I couldn’t believe it first time and tried couple of more times to conclude that it is problem with CD only.
Then thought of booting the from hard drive or USB hard disk. But my machine got old USB(1.1) stuff and even the USB drive is not bootable.
So I thought of using existing gentoo installation’s boot partition (32MB) to hold kernel and initrd binarirs. Then I thought I can point the root at some other ext3 partition. I don’t remember much but that didn’t work quite well. It was always ending up with loop path error. Only thing I could guess is to keep image file on same partition where kernel and initrd are located. By then my enthusiasm is slightly down. And I decided to try alternate methods to do the same exercise.
First I want to increase boot partition size, I am not aware how to do that online. So I thought I can quickly re install gentoo 2005 with increased boot partition. Something I missed even that didn’t work out. And while doing it during midnight I screwed up my MBR. So I couldn’t even boot to XP. Then I took help of Windows 2003 evaluation CD.
I tried to install Win20003 Server on hard disk where my Linux was there. So I get a clean slate on that front and also that fixes my MBR also. Anyway I don’t have key for Win2003 Server, but I know it does over write MBR the moment you select the partition to install Windows. All this exercise took whole night.
And by morning I thought I would Grub for NT. Created just one ext2 partition and took help of grub for NT. After tweaking hear and there in grub configuration file finally I could boot the cd image from hard disk. Rest of the details I will post with the screen shots of my gentoo 2006.0. I am thinking of using crossover office and work on gentoo 2006.0 for quite some time now. Let me hope gentoo supports me.
Friday, February 24, 2006
Windows XP DNS Cache problem
The problem is about DNS cache. When ever you visit a site from a browser or try to ping a hostname from command line, XP looks for “A (Host) Record” of that hostname in its DNS Cache.
DNS Cache can be accessed from command prompt using following command
C:\>ipconfig /displaydns
Here I listed typical entries. One of type CNAME and another of type A (Host) Record
www.math.harvard.edu
----------------------------------------
Record Name . . . . . : www.math.harvard.edu
Record Type . . . . . : 5
Time To Live . . . . : 9015
Data Length . . . . . : 4
Section . . . . . . . : Answer
CNAME Record . . . . : math.harvard.edu
stuff.techwhack.com
----------------------------------------
Record Name . . . . . : stuff.techwhack.com
Record Type . . . . . : 1
Time To Live . . . . : 4399
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . : 70.87.95.34
XP has its own algorithm to add items into cache. It normally adds records based on “Time To Live” parameter or based on frequency of access. If TTL is very small it doesn’t make any sense to add it to cache even though it is frequently accessed.
The problem I faced is with expired A (Host) Record entry in DNS cache. I have a domain account with Yahoo and hosting account with znetindia. I changed nameserver settings in my yahoo domain account to point to my new name server provided by znet. I left “A (Host) Records”, CNAME Records and MX Records as they were in Yahoo. I have new entries for them at my new nameserver with znet.
When I try to access my page say with the request http://sriharsha.net/ or http://www.sriharsha.net/ sometimes it takes me to my old starter webpage with Yahoo.
I got following of solutions to get around with this problem.
check for entries in DNS cache, if there are expired entries then consider flushing DNS cache by following command
"C:\ipconfig /flushdns"
If there are no entries in DNS cache try adding an entries at the end of
“c:\WINDOWS\system32\drivers\etc\hosts” file
70.85.149.228 sriharsha.net
70.85.17.215 mail.sriharsha.net
Try to ping your domain and check IP address. Based on that change your “A (Host) Records” and CNAME records in domain control panel
Also consider adding following two entries to registry key
HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Services\Dnscache\Parameters
Block XP from adding unresolved or failed (Negative) entries to cache
DWORD: MaxNegativeCacheTtl
Value: 0
Force XP to keep valid (Positive) entries only for specified time. This will be useful if your ISP/Domain registrar updates DNS entries more frequently than your XP DWORD:
MaxCacheTtl
Value: 14400
Wednesday, February 15, 2006
What is in IBM's new P6
So following is the update that ISA published about IBM's P6
For years, chipmakers have improved computer performance by shrinking the size of transistors, squeezing more of them into smaller spaces, and ratcheting up the speed at which they process instructions. Recently, the benefits have diminished as the chips’ power requirements and temperatures have risen.
To get around the problem, the industry has resorted to building two or more computing engines known as "cores" on a single chip and throttling back the clock speed to prevent a silicon meltdown. As a result, performance does increase, but it does not double, even with two computing cores.
IBM claims its upcoming Power6, which is multicore and designed for higher-end servers running the Unix operating system, was crafted from the ground up to run fast without major losses in power efficiency.
Power6 is expected to run somewhere between four and five gigahertz.
Can someone focus on it and post what is special with IBM's P6
Tuesday, January 24, 2006
Industrial Controllers
Many a times we debated on 96 MHz big endian processor and the operating system, Linux which we chose for this project.
Many players in the market still use a typical board with a 100 MHz processor.
Of course with industry standard compliance list like EMC, ESD, RF, Surge, Power etc. and stringent temperature (-40 to +70 degrees Celsius) and relative humidity requirements. And most importantly the heat dissipation factor which may cause the need of a fan.
What is that operating system which can meet all demands of a real-time controller.
Currently industry uses VXWorks, Nucleus PLUS, VRTX and recently some flavors of Linux like Monta Vista, RT-Linux. Of course there are so many proprietary custom made operating systems.
How do we boot the board? Traditionally it is done using TFTP boot. A TFTP server runs on a work station and is expected to be ON while the controllers are booting up. And applications are built to take the complete image while comprised of kernel, control engine, custom network stacks, process control applications etc.
Some controllers use on board flash to store boot code and kernel and basic services to receive and execute control applications. Recent hardware designs are done considering more on board flash, typically ranging from 4 MB to 64 MB. These boards got more RAM also, typically in the range of 16MB to 128MB.
Apart from this external compact flash interfaces are adding storage options to controller.
Hi speed compact flashes or micro drives can be added as per requirement. However the disadvantage here is number of read/write cycles and kind of hardware interface (parallel/PCMCIA etc.).
And newer boards are coming up with 100 Mega bits per seconds Ethernet controllers.
Of course it is needed because all most all IO networks of today got Ethernet variants.
With the addition/enhancements of these peripherals the CPU performance demands are increasing dramatically. More storage options and high speed Ethernet access added new challenges like bulk data management and faster memory access. More and more functional requirements are now met on controllers itself using embedded web servers, embedded databases and time synchronization modules.
But are these CPU’s, with their resources being managed by RTOS, capable enough to meet the real time demands without effecting basic operations like IO scanning, control execution and hardware monitoring tasks?
Recently the demand for thin but service rich operating systems is growing. Security is one more aspect that adds heavy computing routines to basic operating tasks list. Firewalls are part of controller design now. Embedded databases and NFS partitions are commonly used by many controllers for non critical storage purposes.
Advanced power management, online upgrade and Ethernet based mirroring demands more computing resources out of modern controllers.
I would like to do some detailed study on this. Are there any good links for this.
Saturday, September 03, 2005
Modbus TCP simulator
Thought of doing something quickly using VB6. Then ended up with limitaion of good threading library. Then thought of doing in VB.Net. Coded using MsFlexGrid controls. Found them looking very nice. All working fine for 15 minutes. Suddenly there is a red cross across the Grid. After 10 minutes another grid got the same. Then observed Microsoft already accepted that bug and I need to hunt for a patch to fix it. Left that option too.
Then thought of doing in VC6 using MFC Dialog. Another problem, I want to simulate 64 AI, 64 AO, 64 DO and 64 DI. So thought of using text boxes for AI and AO and CheckBoxes for DI and DO. Another limitation, I cant have more than 255 controls on a Dialog box. As all frames are inherited from Dialog boxes no option left.
Then decided to use VB UI and VC library. I am more biased towards pthread library (ftp://sources.redhat.com/pub/pthreads-win32) than Windows. Just decided to use Win API instead of going through big loop of ATL and COM stuff.
Interesting I got good working Simulator. Its not complete but easy to enhance.
I have VB6 application which essentially has code to export handles of controls to vc library.
Nice Coding practice for byte packing
My intention to find out healthiness of Target with minimum overhead. Instead of trying to call connect i want to use ICMP protocols like ping. While doing that i thought why cant I do event ARP. Then started looking for some sample code for ARP.
I found Blacky Room at fdin. He got simple codes for lower level Ethernet Protocols. Ofcourse the site is in Japanese language. But can access code samples.
One good thing i liked at these code samples is the way packing of bytes is done before calling send. In the following function , buffer is a character array. And eth and arp are just pointers.
Iinitially these pointers are just addressed to respective positions. Then as members are filled buffer is ready.
Normally i do other way around. First i update structures and then assign to each byte of buffer like buf[0] = arp->arp_hrd.
But this method essentially eliminates second copy and more secure.
int send_arprequest(int sock, struct dev *dev, struct addr *src, struct addr *dst)
{
struct sockaddr_ll sll;
struct ether_header *eth;
struct ether_arp *arp;
char buf[sizeof(struct ether_header) + sizeof(struct ether_arp)];
memset(&sll, 0, sizeof(sll));
sll.sll_family = PF_PACKET;
sll.sll_ifindex = dev->index;
sll.sll_halen = ETH_ALEN;
memcpy(&sll.sll_addr, dst->mac, ETH_ALEN);
memset(buf, 0, sizeof(buf));
eth = (struct ether_header *)buf;
arp = (struct ether_arp *)((char *)eth + sizeof(struct ether_header));
/* arp header */
arp->arp_hrd = htons(ARPHRD_ETHER);
arp->arp_pro = htons(ETH_P_IP);
arp->arp_hln = ETH_ALEN;
arp->arp_pln = IP_LEN;
arp->arp_op = htons(ARPOP_REQUEST);
memcpy(arp->arp_sha, src->mac, ETH_ALEN);
memcpy(arp->arp_spa, &(src->ip), IP_LEN);
memset(arp->arp_tha, 0, ETH_ALEN);
memcpy(arp->arp_tpa, &(dst->ip), IP_LEN);
/* ether_header */
memcpy(eth->ether_shost, src->mac, ETH_ALEN);
memcpy(eth->ether_dhost, dst->mac, ETH_ALEN);
eth->ether_type = htons(ETH_P_ARP);
/* send to arp request packet */
return sendto(sock, buf, sizeof(buf), 0, (struct sockaddr *)&sll, sizeof(sll));
}
Friday, April 15, 2005
Can we expect rich editors for 61131-3 using XML schemas
Isagraf claims XML usage in their new release 4.5 .
One definite advantage of using XML schemas for 61131-3 representation is seamless integration of all five languages. Also better export and import features.
Ofcourse there are some other advantages also. But most of them cant make a new impression to users (control programmers). These representation remain at back end.
I feel neutral characteristic of XML can also be capitalized here. In today's world most of the configurators generate target independent code and launch virtual machines on target to make up control application.
I guess now the need comes to build platform independent configurators. Also ability to view control programs over web using the power of XML and style sheets. Probably browsers can be used to monitor online , modify/force variables and to do minor modifications if schema permits.
can we expect rich editors for 61131-3 using these XML schemas...!!!!
Wednesday, April 13, 2005
Ethernet TCP/IP as control/neutral network
I guess , in instrumentation and Automation world , hunt for a better network never stops. We try to have a network that is reliable , redundant , light (minimum message overhead), neutral , open , fast , cheap etc..etc.. Recommendations and restrictions are there for every cause like interference , collision , optimised routing , quick recovery , open , security etc.. Industry developed so many proprietary networks and applications by spending expensive resources. But when trend started to make things on open standards , Ethernet TCP/IP stood as best option. On the other hand field bus technologies like Profibus , FF etc and neutral applications like OPC cropped up. Later on to bring field buses onto plant network TCP/IP extensions demanded MODBUS over TCP/IP , PROFINET , HSE Ethernet/IP etc.. At some other corner a new dish by name wireless is getting prepared.
so the result is industrial networks are on IEEE x802.xx race... RACE is ON , who is going to Win?
Are there any blogs on Industrial Automation
Somehow they are not very lively. Some one started a few but discontinued.
I have spent seven years of my professional life in this domain and still continuing with this.
Felt like starting one another with the only intention to keep it live as long as I can.
here i am ...