H3C OAP Module Developing Manual(V1.01)

DownLoad Chapters Download(102.72 KB)

02-Text


Chapter 1  Operation Guide for OAP Module Customization

1.1  Booting the Linux OS on an OAP Module

OAP modules support two storage media: CF card (required) and hard disk (optional). On the CF card stored the master boot recorder (MBR) installed with LILO and in addition the kernel and initrd files needed for booting the Linux OS.

Note that the OAP module uses the Linux Loader (LILO) rather than the grand unified bootloader (GRUB) as the bootloader.

When LILO starts, you can see the following:

============<BIOS-BASIC MENU(Ver 1.13)>================

| <1> Boot Linux From CF  Card                        |

| <2> Install Linux OS  With Ethernet                 |

| <3> Backup BIOS to the backup portion               |

| <4> Recover BIOS from the backup portion            |

| <5> Reboot                                          |

=======================================================

Enter your choice(1-5):1Reading boot sector...done.

Switching to boot loader.

 

LILO boot:

# At the prompt, press Tab. You can see the following two boot options:

linux-hdc       linux-ramdisk

boot: 

# Enter either option to boot the corresponding system.

The following describes the two options in detail.

I. Linux-ramdisk

If the linux-ramdisk option is selected, ramdisk will be used as the root file system and the first partition of the CF card will be mounted as the /boot partition. The system provides such functions as private protocol module, dongle and CPLD driver.

II. Linux-hdc

If the linux-hdc option is selected, LILO uses the hard disk as the root file system to boot the Linux OS. A complete root file system is installed on the hard disk, providing tools such as GCC, RPM and VI Editor and some network services. You can configure the services on the Linux OS just as you do on a PC. By default, the linux-hdc option is selected.

By default, the hard disk and CF card are partitioned as follows:

Device name

Partition name

Mount point

File system format

Function

CF card

/dev/hda1

/boot

ext3

The boot partition for the Linux OS.

LILO is stored in MBR. In addition, the kernel and initrd files needed for booting the Linux OS are stored on the card.

The volume label of the partition is /boot.

Hard disk

/dev/hdc1

/

ext3

The root file system for the Linux OS when the linux-hdc option is selected. The volume label of the partition is /.

/dev/hdc2

/alt

ext3

Backup partition of the root file system. Its factory setting is null.

/dev/hdc3

/opt

ext3

The largest partition for users. No system file is stored in it.

/dev/hdc4

swap

swap

The swap partition for the Linux OS when the linux-hdc option is selected.

 

You can customize partitions as needed, except that only the first partition of the CF card can be as the boot partition.

1.2  Compiling the Linux Kernel and the Module

If you select linux-hdc, the system takes /dev/hdc1 of the hardware as the root file system. You can then customize the OAP module based on the Linux OS. This is the same as you do on a PC running the Linux OS, except that the input/output mode is different.

I. Compiling the Linux kernel

Sometimes, you may need to recompile the kernel to accommodate requirements such as reconfiguring features of Linux kernel or compiling some loadable device driver.

The OAP module is not delivered with the 2.6.9-42.0.3.EL source codes. You can download the source code from the following web site:

ftp://updates.redhat.com/enterprise/4AS/en/os/SRPMS/kernel-2.6.9-42.0.3.EL.src.rpm

To use the code for the OAP module, you need to install the following patch program in addition:

kernel-2.6.9-42.0.3.EL-appboard.patch

You are recommended to compile the Linux kernel in the following procedure:

1)         Download the kernel source code to the directory /opt.

[root@localhost root]#cd /opt

[root@localhost opt]#scp root@192.168.0.2:/home/zxh/centos/kernel-2.6.9-42.0.3.EL.src.rpm ./

root@192.168.0.2's password:

kernel-2.6.9-42.0.3.EL.src.rpm           100%   45MB  11.3MB/s   00:04

[root@localhost opt]#

2)         Download the patch.

[root@localhost opt]# scp root@192.168.0.2:/home/zxh/centos/kernel-2.6.9-42.0.3.EL-appboard.patch ./

root@192.168.0.2's password:

kernel-2.6.9-42.0.3.EL-appboard.patch    100%   14KB  13.8KB/s   00:00

[root@localhost opt]#

3)         Decompress the source code of the kernel.

[root@localhost opt]# rpm -Uvh kernel-2.6.9-42.0.3.EL.src.rpm

[root@localhost opt]# cd /usr/src/redhat/SPECS/

[root@localhost SPECS]# rpmbuild -bp --target $(uname -m) kernel-2.6.spec

4)         Patch the initial source code, generating the kernel source code applicable to the OAP module.

[root@localhost SPECS]#cd ../BUILD/kernel-2.6.9/linux-2.6.9/

[root@localhost linux-2.6.9]#cp /opt/kernel-2.6.9-42.0.3.EL-appboard.patch ./

[root@localhost linux-2.6.9]# patch -p1 < kernel-2.6.9-42.0.3.EL-appboard.patch

patching file arch/i386/boot/video.S

patching file arch/i386/kernel/reboot.c

patching file drivers/net/e1000/e1000_hw.c

patching file drivers/serial/8250.c

patching file init/main.c

patching file Makefile

[root@localhost linux-2.6.9]#

5)         Compile the kernel and driver.

[root@localhost linux-2.6.9]# make clean

[root@localhost linux-2.6.9]# make mrproper

[root@localhost linux-2.6.9]# cp configs/kernel-2.6.9-i686.config ./.config

[root@localhost linux-2.6.9]# make oldconfig

[root@localhost linux-2.6.9]# make menuconfig

# Customize the features of the kernel as needed.

[root@localhost linux-2.6.9]# make

[root@localhost linux-2.6.9]# make modules

[root@localhost linux-2.6.9]# make modules_install

[root@localhost linux-2.6.9]# make installl

II. Configuring LILO

After compiling the kernel and initrd, manually update LILO so that it can use the new kernel to load the Linux OS.

You can use the VI Editor to modify the startup settings in the LILO configuration file lilo.conf, which is available under /etc. The following are the sample contents of lilo.conf:

prompt

timeout=50

default=linux-hdc

boot=/dev/hda

map=/boot/map

install=/boot/boot.b

linear

image=/boot/vmlinuz-2.6.9-42.0.3.EL

         label=linux-ramdisk

         initrd=/boot/initrd-2.6.9-42.0.3.EL-appboard.img

         append="root=/dev/ram0 console=ttyS0,9600 rw"

image=/boot/vmlinuz-2.6.9-42.0.3.EL

         label=linux-hdc

         initrd=/boot/initrd-2.6.9-42.0.3.EL.img

         append="console=ttyS0,9600 root=LABEL=/ "

Because the startup information of the OAP module is input/output through a serial port, you need to append the following configuration through LILO:

append="console=ttyS0,9600"

Suppose you are using the HyperTerminal for configuration. On the HyperTerminal, set terminal emulation to VT100, connect to the console port on your network device, and enter the oap connect slot x command to connect to the serial port on the OAP module. The VI Editor can thus work normally. The following figure shows the settings that you should make on the HyperTerminal.

Figure 1-1 Setting terminal type

III. Compiling e1000 driver

An Intel Gigabit Ethernet chip is used on the OAP module and the default e1000 driver is 7.0.33. The kernel patching operation mentioned earlier modifies the e1000 codes as well. To update the Ethernet driver, e1000 drive 7.0.41 for example, do the following:

1)         Download the source code e1000-7.0.41.tar.gz of e1000 driver 7.0.41 from the official Web of Intel and then decompress it.

[root@localhost tmp]# ls

e1000-7.0.41.tar.gz

[root@localhost tmp]# tar -zxf e1000-7.0.41.tar.gz -C ./

[root@localhost tmp]#

2)         Obtain the patch file for e1000 driver and copy it to a specific directory.

[root@localhost tmp]# cd e1000-7.0.41

[root@localhost e1000-7.0.41]# ls

e1000.7                      e1000.spec    LICENSE      README  SUMS

e1000-7.0.41-appboard.patch  ldistrib.txt  pci.updates  src

[root@localhost e1000-7.0.41]# patch -p1 < e1000-7.0.41-appboard.patch

patching file src/e1000.h

patching file src/e1000_hw.c

patching file src/e1000_main.c

[root@localhost e1000-7.0.41]#

3)         Compile e1000 driver.

[root@localhost e1000-7.0.41]#cd src

[root@localhost src]#make clean

[root@localhost src]#make

[root@localhost src]#make install

4)         Reload the system and update e1000 to a specified version.

[root@localhost root]# ethtool -i eth0

driver: e1000

version: 7.0.41

firmware-version: N/A

bus-info: 01:00.0

[root@localhost root]#

You may compile other modules following the usual compilation procedure.

 


Chapter 2  Operation Guide for OAPS Module Customization

2.1  Booting the Linux OS on an OAPS Module

An OAPS module provides two storage media: CF card and hard disk. LILO is installed On the CF card stored the MBR installed with LILO and the kernel and initrd files needed for booting the Linux OS are saved on the CF card.

Note that the OAPS module supports both LILO and GRUB as the bootloader of the system.

When LILO starts, you can see the following:

============<BIOS-BASIC MENU(Ver1.00)>=================

| <1> Boot Linux from CF Card                            |

| <2> Boot Linux from Hard Disk                          |

| <3> Boot Linux from USB                                |

| <4> Boot Linux from Ethernet                           |

| <5> Default boot device                                |

| <6> Backup BIOS to the backup portion                  |

| <7> Recover BIOS from the backup portion               |

| <8> Reboot                                             |

=======================================================

Enter your choice(1-8):1

Reading boot sector...done.

Switching to boot loader.

 

LILO boot:

# At the prompt, press Tab. you can see the following two boot options:

linux-hdc       linux-ramdisk

boot: 

# Enter either option to boot the corresponding system.

The following describes the two options in detail.

I. Linux-ramdisk

If the linux-ramdisk option is selected, ramdisk will be used as the root file system and the first partition of the CF card will be mounted as the /boot partition. The system provides such functions as private protocol module, dongle and CPLD driver.

II. Linux-hdc

If the linux-hdc option is selected, LILO uses the hard disk as the root file system to boot the Linux OS. A complete root file system is installed on the hard disk, providing tools such as GCC, RPM and VI Editor and some network services. You can configure the services on the Linux OS just as you do on a PC. By default, the linux-hdc option is selected.

By default, the hard disk and CF card are partitioned as follows:

Device name

Partition name

Mount point

File system format

Function

CF card

/dev/hda1

/boot

ext3

The boot partition for the Linux OS.

LILO is stored in MBR. In addition, the kernel and initrd files needed for booting the Linux OS are stored on the card.

The volume label of the partition is /boot.

Hard disk

/dev/sda1

/

ext3

The root file system for the Linux OS when the linux-hdc option is selected. The volume label of the partition is /.

/dev/sda2

/alt

ext3

Backup partition of the root file system. Its factory setting is null.

/dev/sda3

/opt

ext3

The largest partition for users. No system file is stored in it.

/dev/sda4

swap

swap

The swap partition for the Linux OS when the linux-hdc option is selected.

 

You can customize partition mode as needed.

2.2  Compiling the Linux Kernel and the Module

If you select the linux-hdc option when booting from the CF card or select to boot from the hard disk, the system takes the /dev/sda1 partition of the hardware as the root file system. You can then customize the OAPS module based on the Linux OS. This is the same as you do on a PC running the Linux OS, except that the input/output mode is different.

I. Compiling the Linux kernel

To recompile the kernel to accommodate special functions, you can download the kernel from the following web site:

ftp://updates.redhat.com/enterprise/4AS/en/os/SRPMS/kernel-2.6.9-42.0.3.EL.src.rpm

After downloading the kernel, follow these steps to decompress and compile the kernel (assuming the source codes of the kernel have been downloaded to the directory /opt):

1)         Decompress the source codes of the kernel.

[root@localhost root]#cd /opt

[root@localhost opt]# rpm -Uvh kernel-2.6.9-42.0.3.EL.src.rpm

[root@localhost opt]# cd /usr/src/redhat/SPECS/

[root@localhost SPECS]# rpmbuild -bp --target $(uname -m) kernel-2.6.spec

2)         Configure the kernel.

[root@localhost linux-2.6.9]# make clean

[root@localhost linux-2.6.9]# make mrproper

[root@localhost linux-2.6.9]# make menuconfig

3)         Customize the features of the kernel as needed.

[root@localhost linux-2.6.9]# make

[root@localhost linux-2.6.9]# make modules

[root@localhost linux-2.6.9]# make modules_install

[root@localhost linux-2.6.9]# make installl

II. Configuring LILO

After compiling the kernel and initrd, manually update LILO so that it can use the new kernel to load the Linux OS.

You can use the VI Editor to modify the startup settings in the LILO configuration file lilo.conf, which is available under /etc. The following are the sample contents of lilo.conf:

prompt

timeout=50

default=linux-hdc

boot=/dev/hda

map=/boot/map

install=/boot/boot.b

linear

image=/boot/vmlinuz-2.6.9-42.0.3.EL-oaps

         label=linux-ramdisk

         initrd=/boot/initrd-2.6.9-42.0.3.EL-appboard-oaps.img

         append="root=/dev/ram0 console=ttyS0,9600 rw"

image=/boot/vmlinuz-2.6.9-42.0.3.EL-oaps

         label=linux-hdc

         initrd=/boot/initrd-2.6.9-42.0.3.EL-oaps.img

         append="console=ttyS0,9600 rw root=LABEL=/"

Because the startup information of the OAPS module is input/output through a serial port, you need to append the following configuration through LILO:

append="console=ttyS0,9600"

Suppose you are using the HyperTerminal for configuration. On the HyperTerminal, set terminal emulation to VT100, connect to the console port on your network device, and enter the oap connect slot x command to connect to the serial port on the OAPS module. The VI Editor can thus work normally. The following figure shows the settings that you should make on the HyperTerminal.

Figure 2-1 Setting terminal type

H3C reserves the right to modify its collaterals without any prior notice. For the latest information of the collaterals, please consult H3C sales or call 400 hotline.