Powered By

Free XML Skins for Blogger

Powered by Blogger

Tuesday, October 14, 2008

Dual BIOS

Dual BIOS

A computer motherboard that contains two BIOS chips, a main BIOS and a backup BIOS. This type of motherboard setup helps a motherboard recover from any issues that may happen during a BIOS update, helps protect the BIOS from any potential virus, and helps with any other issues that may arise related to the BIOS.

Dual-BIOS Architecture


System Layout

Below is the firmware layout for our systems.

NAND Writer                      |--> NOR Flash
u-boot                          -
Linux kernel |--> NAND Flash
Rescue root filesystems -
Root Filesystems                 |--> CF or Hard Disk

The firmware (u-boot, Linux kernel and rescue root file system) is stored in NAND flash. Roof filesystem is stored in CF card or hard disk. In usual cases, the NAND flash itself cannot be used as a booting media. The NAND boot design of Samsung processor makes it possible to use NAND solely as a booting media. Under proper hardware configuration, the processor will automatically copy the first page of NAND flash to SDRAM and execute the boot code. (u-boot) The boot code is transferred into 4-kbytes steppingstone during reset. After the transfer, the boot code will be executed on the steppingstone. The NAND boot design will save the PCB space and product cost. However, since the bootloader and kernel are stored in the same NAND flash. The bootloader might be erased during software development or firmware upgrade by typing the wrong download address. In this case, people usually use ICE (In Circuit Emulation) to recover the bootloader. But using ICE is a tedious way and not convenient for software engineers or maintenance engineers. It is therefore; Embedian adopts a dual-BIOS design by adding a 0.5MB NOR flash and uses jumper selection to switch back to NOR boot when the u-boot in NAND flash been erased. A "NAND Writer" program in NOR could recover the system by setting the jumper to NOR boot. The default jumper setting is NAND boot.

Figure 1 shows the block diagram of NOR boot and NAND boot.

Figure 1. NOR boot and NAND boot

Below the "device" stands for the APC series single board computers or EBC series box computers.

1.2.1. NOR Boot

This section describes how to transfer and write u-boot image to NAND flash using NOR boot configuration. This is usual the case when the u-boot in NAND flash been erased. If you simply upgrade the firmware, you could use u-boot to upgrade u-boot itself without setting the jumper to NOR boot unless your u-boot in NAND is gone. The manufacturer's defualt is with NAND image and developers could design theirs own application directly and stored in CF or harddisk. Unless necessary, we don't recommend user alert the firmware in NAND.

1.2.1.1. Transfer and Write U-Boot Image to NAND Flash

To transfer and write u-boot image to NAND, first, power off device and set the jumper JP2 to NOR flash configuration. (Be sure to power off the system before you changing the jumper.) Install the USB host driver and DNW programs Embedian provided in your host Windows PC. Connect the serial console cable (10-1151-0809) from serial console port (CN6) of device to the COM port of your Windows PC. And connect a USB cable from USB device port (CN5) to USB host port of your Windows PC.

Open the DNW program in your Windows PC, in "Configuration", set the COM port as the following setting of figure 2. And the Download Address is "0x3000000", this is the SDRAM address where the program will be executed.

Figure 2. COM and USB Port Setting of DNW program

Power on device, and you should see the following screen in your DNW programs as shown in figure 3.

Figure 3. NOR Boot Download

Here the program will detect if the USB cable is connected, if not, the program will tell you to connect the USB cable. Plug the USB cable and USB is waiting for download the u-boot binary.

In "USB Port" of DNW program, click "Transmit" as following figure 4.

Figure 4. Configure USB Port

A file browser will ask you to transmit the file. Find the file "2440test.bin" in your PC and click. You will see the following screen.

Figure 5. NOR Boot Test Menu

Select the function "25: NAND Program" and press "Enter". You will see the following screen.

Figure 6. NAND Writer Menu

Select "9: K9F5608 Program" and press "Enter".

Now the "NAND Writer" program is ready to download u-boot to SDRAM of the device from your PC. You need to specify the download address as following instruction. In "Configuration" of DNW program, set the Download Address to "0x30100000" as following figure 6. This will download the program to SDRAM.

Figure 7. USB Download Address Setting for U-Boot

A file browser will ask you to transmit the file. Find the file "u-boot.bin" in your PC and click. The version of u-boot binary is build from original 1.1.4. u-boot source tree with some modification.

Now you are ready to write the u-boot to NAND flash from SDRAM. At "Input target block number:", type "0" and the u-boot will be written to NAND flash. This is to tell device writing u-boot to NAND flash from the 0th block. Figure 8 illustrates the above steps.

Figure 8. U-Boot Target Block

After the u-boot been written to NAND flash, set the jumper 2 back to NAND boot. And you will see u-boot menu in DNW (or you could use Hyper Terminal) program from the console.

1.2.2. NAND Boot

After you installed, upgraded or recovered the u-boot in NAND flash and running on your system, you can use the u-boot command line to download another u-boot image to replace the current u-boot, kernel image and rescue root file systems to boot Linux kernel without setting jumper JP2 back again unless your u-boot or writting address is typing wrong by accident. The NOR and NAND boot are completely hardware independent, and it is impossible to breach the data in NOR flash when you set to NAND boot. You could also use Linux kernel to download u-boot. We will detail the instructions in section 1.4.

Warning: Before you can install the new image, you have to erase the current one. If anything goes wrong your system will be dead. Set the jumper to NOR boot to rescue the system. It is strongly recommended that:

  • you have a backup of the old, working u-boot image. (You could also download from Embedian's website.)
  • you know how to install an image on a virgin system.
  • always power off the system before change the jumpers

Figure 9. U-Boot Screen

You can interrupt the "Count-Down" of autoboot and enter the command line interface of u-boot by pressing any key. If you have programmed a kernel and root filesystem into on-board flash using the procedures outlined in section 1.4, u-boot's environment variables will be set to automatically boot that system after the five-second delay. If u-boot is not interrupted by activity on the debug port, Linux will boot automatically and you will not receive a u-boot command prompt.

If you wish to alter the default behavior of u-boot, you should use the setenv command to change the environment variables. Once you have set the environment variables the way you want them, use the saveenv command to store your current environment into flash.

Two different command interpreters are available.

  • Simple command line interface
  • Bourne comaptible shell (HUSH shell from Busybox)
Configuration parameters and commands sequences (scripts !) can be stored in "environment variables" which can be saved to NAND flash storage. The next section will introduce the u-boot command line interface.

No comments: