X86 bootloader deployment
来自Jack's Lab
---++ X86 Bootloader Deployment (for loading large ELF file)
---+++ 0. Issue
PXELINUX can not load ELF file.
Grub can only load small ELF file (less than 5MB) using following commands:
grub> kernel --type=netbsd (hd0,0)/boot/system.elf grub> boot
---+++ 1. Overview
* Setup the BIOS to make the first bootable device is hard disk. * Install a grub into this hard disk and configure the grub to use the serial console * Make sure you have a gPXE usable NIC (Intel epro/100 or 8139 ...) * Load the gPXE image through grub * Load the large ELF file in gPXE through http or tftp or ftp ...
---+++ 2. Install and configure GRUB
root@server:~/> grub-install --root-directory=/mnt /dev/sda
Modify the /mnt/boot/grub/menu.lst something like:
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console default 0 timeout 3 title default pxelinux kernel /boot/gpxe.krn
---+++ 3. Using the gPXE with serial console support
We need serial console to support the remote control :)
Attachment has a prebuilt gPXE image with serial console support
---+++ 4. Load ELF file in gPXE
Make sure you have a gPXE usable NIC (Intel epro/100 or 8139 ...)
Then use 'dhcp' to configure the NIC and use 'kernel' to load the ELF file:
gPXE> dhcp net1 DHCP (net1 00:0e:2e:7e:f5:e6).... ok gPXE> kernel tftp://128.224.149.6/lwang2/17772/wrhv tftp://128.224.149.6/lwang2/17772/wrhv........ ok gPXE>boot
If you want to the PXE to load the kernel automatically please follow these commands:
ssh <your_id>@yow-lpgnfs-01.ottawa.wrs.com sudo target-config.pl --config=silk_city_2 --type=pxe --action="replace config ../ttai/common_pc/pxelinux-config" --restart
---+++ 5. Example
* Reset the 17771 board
vlmTool turnOff -s amazon.wrs.com -t 17771 ; sleep 12; vlmTool turnOn -s amazon.wrs.com -t 17771
* Connet the remote serial console
telnet
* Press 'ESC' to entry grub
grub> kernel /boot/gpxe.krn [Linux-zImage, setup=0x800, size=0x33807] grub> boot
* After loading the gpxe.krn image, press the Ctrl + B to entry gPXE shell
gPXE 0.9.7+ -- Open Source Boot Firmware -- http://etherboot.org Features: HTTP DNS TFTP AoE iSCSI bzImage COMBOOT ELF Multiboot PXE PXEXT gPXE>
* Then
gPXE> dhcp net1 DHCP (net1 00:0e:2e:7e:f5:e6).... ok gPXE> kernel tftp://128.224.149.6/lwang2/17772/wrhv tftp://128.224.149.6/lwang2/17772/wrhv........ ok gPXE>boot