API Reference: Libraries

Top

# BootDevice

#### NAME

> BootDevice - Preparing a boot device for I86 platforms

#### ROUTINES

> No user-callable routines

#### DESCRIPTION

> This file contains informations for the PREPARING A BOOT DEVICE section of the board support package (BSP) target.ref file:

#### Generation of a boot disk

> Romable images intended for a disk can be copied to the device using the DOS boot utility mkboot.bat or the VxWorks boot utilities mkbootFd( ) for floppy disks or mkbootAta( ) for hard disks. The boot loader searches the disk for the file bootrom.sys. Boot files with the .bin extension may be renamed to bootrom.sys.

> At this point, the instructions fork into separate sets of that apply to Linux, Windows and VxWorks itself.

#### Creating bootable diskettes from Linux

> Use /usr/bin/fdformat, /usr/bin/mformat, /sbin/dosfsck that comes with Linux and mtools tool. It requires a bootstrap loader file called vxld.bin located in your GPP directory tree at $WIND_BASE/host/$WIND_HOST_TYPE/bin/vxld.bin

> Insert a 1.44MB diskette into the diskette drive, login as root and issue the fdformat command to format the diskette.

>     > fdformat /dev/fd0
>     Double-sided, 80 tracks, 18sec/track. Total capacity 1440kB.
>     Formatting ...
>     Verifying ...

> Format the floppy with FAT12 file system and specified boot sector:

>     > mformat a: -B $WIND_BASE/host/$WIND_HOST_TYPE/bin/vxld.bin

> Check the floppy disk:

>     > dosfsck -v /dev/fd0
>     dosfsck 2.11 (12 Mar 2005)
>     dosfsck 2.11, 12 Mar 2005, FAT32, LFN
>     Checking we can access the last sector of the filesystem
>     Boot sector contents:
>     System ID "IBM  3.3"
>     Media byte 0xf0 (5.25" or 3.5" HD floppy)
>            512 bytes per logical sector
>            512 bytes per cluster
>              1 reserved sector
>     First FAT starts at byte 512 (sector 1)
>              2 FATs, 12 bit entries
>           4608 bytes per FAT (= 9 sectors)
>     Root directory starts at byte 9728 (sector 19)
>            224 root directory entries
>     Data area starts at byte 16896 (sector 33)
>           2847 data clusters (1457664 bytes)
>     18 sectors/track, 2 heads
>              0 hidden sectors
>           2880 sectors total
>     Checking for unused clusters.
>     /dev/fd0: 0 files, 0/2847 clusters

> Mount the diskette and copy the bootrom image to it. Use cp for bin images or objcopypentium for all other images.

>     > mount /dev/fd0 /floppy/

>     > cp bootrom.bin /floppy/bootrom.sys
>      or
>     > objcopypentium -O binary bootrom /floppy/bootrom.sys

> Umount the diskette:

>     > umount /dev/fd0

#### Creating bootable diskettes from Windows

>     $WIND_BASE\target\config\<bsp_name>\> format a: /v /q
>     Insert new disk for drive A:
>     and press ENTER when ready...
>     The type of the file system is FAT.
>     Verifying 1.44M
>     Format complete.
>     Volume label (11 characters, ENTER for none)?

>       1457664 bytes total disk space.
>       1457664 bytes available on disk.

>           512 bytes in each allocation unit.
>          2847 allocation units available on disk.

>     Volume Serial Number is 307A-4ACB

>     Format another (Y/N)? n

>     $WIND_BASE\target\config\<bsp_name>\> mkboot a: bootrom.bin
>     VxSys 1.6 (c) Wind River 1993-2002
>     Boot sector installed OK.
>             1 file(s) copied.
>     System transferred.  Checking a:BOOTROM.SYS is contiguous
>     chkdsk a:bootrom.sys
>     The type of the file system is FAT.
>     Volume Serial Number is D4CF-F52B
>     Windows is verifying files and folders...
>     File and folder verification is complete.
>     Windows has checked the file system and found no problem.

>         1,457,664 bytes total disk space.
>           271,360 bytes in 1 files.
>         1,186,304 bytes available on disk.

>               512 bytes in each allocation unit.
>             2,847 total allocation units on disk.
>             2,317 allocation units available on disk.
>     All specified file(s) are contiguous.

> mkboot.bat writes the boot sector containing the boot loader onto the floppy disk. Then mkboot copies the boot file to the floppy disk and checks to ensure the boot file is contiguous. The user must pay attention to the output and ensure the boot file is reported as contiguous. The boot loader will not properly handle a non-contiguous boot files.

> An alternative to mkboot.bat is to manually invoke:

> format

> use $WIND_BASE\host\$WIND_HOST_TYPE\bin\vxsys to create a boot sector

> use copy for boot images with a .bin extension

> use objcopypentium for all other boot images

> For example:

>     $WIND_BASE\target\config\<bsp_name>\> format a: /v /q
>     Insert new disk for drive A:
>     and press ENTER when ready...
>     The type of the file system is FAT.
>     QuickFormatting 1.44M
>     Format complete.
>     Volume label (11 characters, ENTER for none)?

>       1457664 bytes total disk space.
>       1457664 bytes available on disk.

>           512 bytes in each allocation unit.
>          2847 allocation units available on disk.

>     Volume Serial Number is DC31-1143

>     QuickFormat another (Y/N)? n

>     $WIND_BASE\host\x86-win32\bin> vxsys a:
>     VxSys 1.6 (c) Wind River 1993-2002
>     Boot sector installed OK.

> Now copy the boot image to the floppy. For .bin images use copy

>     $WIND_BASE\target\config\<bsp_name>\> copy bootrom.bin a:bootrom.sys

> For all other images use objcopypentium

>     $WIND_BASE\host\x86-win32\bin\objcopypentium -O binary --gap-fill=0
>     bootrom a:bootrom.sys

> Now verify that the file is contiguous. Non contiguous images will not boot.

>     $WIND_BASE\target\config\<bsp_name>\> chkdsk a:bootrom.sys
>     The type of the file system is FAT.
>     Volume Serial Number is DC31-1143
>     CHKDSK is verifying files and directories...
>     File and directory verification completed.

>       1457664 bytes total disk space.
>        493056 bytes in 1 user files.
>        964608 bytes available on disk.

>           512 bytes in each allocation unit.
>          2847 total allocation units on disk.
>          1884 allocation units available on disk.
>     All specified file(s) are contiguous.

> You may also use a hard disk to boot VxWorks. You must boot from a primary bootable partition on the primary disk as seen by the PC BIOS.

> It is recommended that you use FDISK or a similar utility to create the primary bootable partition. The reason is that FDISK uses PC BIOS calls to create the disks master boot record. The BIOS is responsible for loading the boot loader during the boot process. Therefore, a utility that uses the BIOS to write partitions, such as FDISK, is recommended.

> The partition and file system on the disk may be either FAT12, or FAT16, or VxWorks proprietary VXLONGNAMES file system. FAT32 is not supported by the boot loader. If you need FAT32, make a small primary boot partition that is FAT16, and a second larger partition that is FAT32 atop the remainder of the disk.

> To create a bootable hard disk, replace "c:" for "a:" in the above example. When you use c:, vxsys.com will ask you the following:

>     That's a hard disk!  Are you sure (y/n)?

> You should enter a "y" to indicate approval of the operation. Be aware that this will prevent other operating systems from booting on the disk.

#### Creating bootable diskettes from VxWorks

> The usage of the two VxWorks boot utilities is as follows:

>     STATUS mkbootFd
>         (
>         int drive,    /* destination drive number: (0 - 3)  */
>         int fdType,   /* type of floppy disk: (0 - 1)       */
>         char *in      /* source file name                   */
>         )

>     STATUS mkbootAta
>         (
>         int ctrl,     /* dest. controller number: (0 - 1)   */
>         int drive,    /* dest. drive number: (0 - 1)        */
>         char *in      /* source file name                   */
>         )

> All routines return OK on success and ERROR if there is an error while copying the image from the source onto the disk. The source code for these routines is in the BSP file mkboot.c. The following examples are showing how to prepare a floppy disk and the compact flash device for booting an image.

> Example 1

>   The floppy disk is in drive 0, the diskette is of type 0, and the image file name is bootrom.sys:

>           -> mkbootFd 0, 0, "bootrom.sys"

>   Please note, that this routine will only work for floppy's, connected on the floppy disk controller. It will not work on USB floppy's.

> Example 2

>   The compact flash is on ATA controller 0 and is drive number 0 (or c:). The image file name is bootrom.sys:

>           -> mkbootAta 0, 0, "bootrom.sys"

#### VxWorks bootstrap loader

> Once a disk has been prepared for booting the VxWorks bootstrap loader is present on the disk, and you don't need to repeat the complete procedure for new ROM images. Just copy a new boot image to the disk that has already had a boot sector installed.

> Alternatively it is possible to copy the bootrom to a floppy or a compact flash with the popular Linux OS by help with the "dd" tool.

> Example

>   for floppy disk:

>               -> mount /media/floppy
>               -> dd if=bootrom.bin of=/media/floppy/bootrom.sys
>               -> umount /media/floppy

>   for compact flash:

>               -> mount /dev/sda1 /mnt  (as root)
>               -> dd if=bootrom.bin of=/mnt/bootrom.sys
>               -> umount /mnt

#### New Reboot Mechanism

> The new mechanism saves the brand new bootrom image to the top of the physical memory in sysPhysMemTop( ), and restores it when reboot in sysToMonitor( ). The saved image is protected by the MMU during runtime of the VxWorks. This mechanism is independent of the BIOS boot devices, is faster and simpler than the current method. It also preserves the boot line. This reboot mechanism assumes that the brand new bootrom image is kept in the lower memory when it is saved. That means the bootrom image needs to be located in the upper memory. The FAST_REBOOT macro can be defined statically in config.h. The memory size LOCAL_MEM_SIZE may need to be increased for larger page sizes. Note that the bootrom image in your boot device needs to be updated before downloading the new VxWorks image that contains this mechanism. Fast reboot is not supported for SMP images.

#### Booting VxWorks via PXE

> It is possible to boot VxWorks on a Pentium class system via the network using PXE (the Preboot eXecution Environment). PXE support may be provided either by the BIOS on motherboards with integrated Ethernet ports, or by standalone Ethernet adapters with PXE ROMs. Many of the Intel PRO/100 cards (supported by the fei driver) with management features include PXE ROM support. The advantage to using PXE is that no floppy or hard disk is required (this is important given that support for floppy disk dives is becoming increasingly rare with newer PC systems).

> A bootrom.pxe loader is provided for PXE booting VxWorks in addition to the regular bootrom.bin loader. The bootrom.pxe loader is virtually identical to the normal bootrom.bin, except that it has an extra block of padding prepended to it. When booting from disk, the vxld.bin loader is normally loaded by the BIOS at address 0x7C00. It then in turn loads the bootrom at address 0x8000 and starts it running. By contrast, when booting with PXE, the bootrom is loaded directly at address 0x7C00 by the PXE ROM. A leading block of 1024 NOP instructions is therefore used to force the actual romInit( ) entry point to fall at address 0x8000, just as it would as if it had been loaded from disk. Once loaded and running, bootrom.pxe will be able to load VxWorks images via the network just as the normal bootrom.bin does.

> PXE booting requires the use of a DHCP and TFTP server. When the PXE ROM starts up, it will use DHCP to discover an IP address and the path for the bootrom file. Generally, the PXE ROM assumes that the DHCP and TFTP servers will be running on the same machine. Exactly how you configure the DHCP and TFTP servers will depend on what software is used. DHCP and TFTP support is available for most *NIX/Linux/*BSD systems, as well as for Microsoft Windows (R).

> For more information on how to configure a DHCP and TFTP server for PXE boot on your host machine please refer to the used operating systems and appropriate applications documentation.

> Once the setup has been done, reboot the PXE client system. It should display output similar to the following:

>     CLIENT MAC ADDR: 00 00 E8 01 02 03  GUID: xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx
>     CLIENT IP: 10.0.0.3  MASK: 255.255.255.0  DHCP IP: 10.0.0.1
>     GATEWAY IP: 10.0.0.1
>     TFTP...

> Very shortly after this output appears, the VxWorks bootrom should start up and the bootrom startup banner should be displayed. At this point, you can enter the desired VxWorks boot parameters and use the bootrom to load a VxWorks image.

> To create PXE romable images type for GEI type the following command:

>             make bootrom.pxe

> Important notes:

> - PXE is a 16-bit real mode environment. Consequently, boot applications
> downloaded via PXE are limited in that they must be able to start up
> in 16-bit real mode, and they must be less than 640K in size. The
> VxWorks bootrom.bin image meets these requirements, however standalone
> VxWorks images might not.

> - The PXE environment also provides a universal API for accessing the
> underlying Ethernet device, however VxWorks has no support for this
> feature. This means that while you can download the VxWorks bootrom
> via any PXE-enabled Ethernet device, a native driver for the Ethernet
> device must be available in VxWorks in order for the bootrom to
> subsequently download a VxWorks image (or for the downloaded VxWorks
> image to be able to use the Ethernet port).

#### INCLUDE FILES

> none