Changes between Version 1 and Version 2 of Software/fImages/kPxeImage


Ignore:
Timestamp:
Jun 20, 2014, 6:59:20 PM (10 years ago)
Author:
ssugrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Software/fImages/kPxeImage

    v1 v2  
    11== PXE Image ==
    22
    3 === Build Instructions for PXE images ===
    4 
     3=== Build Instructions for PXE Images ===
     4
     5''' Build Setup '''
     6
     7The current build package for making pxe images lives on:
     8{{{
     9console.sb5.orbit-lab.org:/root/pxe/omf/pxe/
     10}}}
     11
     12In there is a make master make file with all the parameters to build the kernel / initramfs image pair. It will also build a pxelinux.bin from sources. This version of pxelinux.bin doesn't need to match with kernel / initramfs pair.
     13
     14in the Makefiel the values of the following variables control what kernel directory the make process will consult to build a kernel:
     15{{{
     16KERNEL_VERSION = 3
     17KERNEL_PATCHLEVEL = 0
     18KERNEL_SUBLEVEL = 4
     19}}}
     20
     21In the /root/pxe/omf/pxe/src directory should be a directory named linux-VERSIONNUMBERS. In this directory is the config file for the kernel being built.
     22
     23Additionally ins the same source dir is a busbox-VERSION directory with a .config file that controls what features are built into busybox.
     24
     25''' Building in NTP clock updates '''
     26
     27 1. Even though the version of the kernel source tree is
     28    specified in the make file, the build process does not
     29    use the kernel config file that was downloaded from the
     30    mirror. Instead it uses the file named
     31    {{{
     32    linux-omf-pxe-#.#.#.config
     33    }}}
     34    in the directory:
     35    {{{
     36    /root/pxe/omf/pxe/config
     37    }}}
     38 2. the same is true for the busy box, I think it uses the file:
     39    {{{
     40    busybox-winlab.config
     41    }}}
     42 3. Finally the startup script rcS.actual will be copied to the init-ram-fs and run as part
     43    of the pxe preOS sequence. We recently modified that file to have it poll NTP and
     44    correct the system clock. We added the following lines:
     45    {{{
     46    /usr/sbin/ntpd -d -n -q -p consolec
     47    /sbin/hwclock --directisa -w
     48    }}}
     49
     50''' Bumping the Kernel Version '''
     51
     52Made a few modification for the most current version based on kernel 3.11.1
     53
     54 1. Copied a running ubuntu config from an ubuntu 13.10 install to serve as sane default. It does throw one question about vesa support which I said yes to, but mostly complies. Happily.
     55 2. After some testing we decided to remove R8169 (realtek) support and only enumerate the intel interfaces (this will cause some other boards to pxe/boot off eth0).
     56 3. Made specially modified pxelinux.cfg file that boots off of eth0 for the newest (Gen4 asus) nodes
     57
     58'''
     59
     60=== Usage Notes ===
     61
     62''' Makefile '''
     63
     64PXE has a 'changelog' in the top directory. The following extracts the version number from the first line in the changelog - enjoy:
     65
     66{{{
     67        24      VER = $(shell grep -o -E '[0-9]+\.[0-9.-]+' -m 1 changelog) 
     68}}}
     69
     70The following line copies a directory from one place to the other, but without ".svn" directories and emacs temporary files (*~)
     71
     72{{{
     73        119             tar -C static --exclude=.svn --exclude='*~' -cf - . | (cd $(RDISK); tar -xf -)
     74}}}
     75
     76The image target should now exist on its own (the incuded software is a sub target). I just added a few 'sudo' commands to allow it to compile from a user account.
     77
     78The main addition is the apt target:
     79{{{
     80        141     apt: dirs kernel image 
     81        142             @echo Building APT V$(VER) 
     82        143             rm -rf $(BUILD_APT_DIR) 
     83        144             install -d $(BUILD_APT_DIR) 
     84        145             cp -rp debian $(BUILD_APT_DIR) 
     85        146             rm -rf $(BUILD_APT_DIR)/debian/.svn       
     86        147             mv $(BUILD_APT_DIR)/debian/Makefile $(BUILD_APT_DIR) 
     87        148             cp changelog $(BUILD_APT_DIR)/debian 
     88        149             cp ../copyright $(BUILD_APT_DIR)/debian 
     89        150             if [ -r README.debian ] ; then \ 
     90        151                     cp README.debian $(BUILD_APT_DIR)/debian; \ 
     91        152             fi 
     92        153             env O_VER=$(VER) O_KERNEL_V=$(KERNEL_VERSION) $(MAKE) -C $(BUILD_APT_DIR) deb 
     93        154     #       $(MAKE) DESTDIR=$(BUILD_APT_DIR)/debian/$(APT_NAME) install 
     94        155     
     95        156     apt-install: apt 
     96        157             scp $(BUILD_APT_DIR)/../*.deb $(REPOSITORY):$(REPOSITORY_ROOT)/binary 
     97        158             ssh $(REPOSITORY) sudo $(REPOSITORY_ROOT)/rebuild.sh 
     98}}}
     99
     100The BUILD_APT_DIR variable was defined above, but it's in build. 143 and 144 create new apt directory. I added a new top level directory 'debian' to hold all the debian related files. This directory is copied into the apt build area (145, 146 - Should really be using something similar to 119). The 'debian' directory contains the Makefile which should really be a level up in the build area. Debian apt's also need a change log which we copy into the build area (148) as well. Same goes for the copyright file which we take from the nodehandler proper (149), and the README.debian, if it exists (150-152). 153 is a bit tricky. Basically we need to know the version of this apt, as well as the kernel version for the 'install' target in 'debian/Makefile'. However, we are calling the 'deb' target, which calls some dpkg util, which ultimately uses the 'debian/rules' file to call the 'install' target of 'debian/Makefile' - still following? In short, we put the two versions into environment variables "env O_VER=... make ...' before calling the first make which the 'install' target can retrieve and use (remember a non-initialized Makefile variable takes it's value from an environment variable of the same name if it exists).
     101
     102''' debian/Makefile '''
     103
     104{{{
     105install:
     106        echo "INSTALL $(O_VER) $(O_KERNEL_V)"
     107        install -d $(TFTP_DIR)
     108        install -m666 ../initrd-orbit-pxe-$(O_VER).img $(TFTP_DIR)
     109        install -d $(CFG_DIR)
     110        sed -e s/@KERNEL_VER@/$(O_KERNEL_V)/ ../../config/default.orbit | sed -e s/@VER@/$(O_VER)/ > $(CFG_DIR)/default.orbit-$(O_VER)
     111        install -m755 ../../config/makeLink $(CFG_DIR)
     112}}}
     113
     114The O_VER and O_KERNEL_V come form the environment variables defined in 153 above. This apt installs the image we built into /tftpboot, as well as 'default.orbit-XXX' and 'makeLink' in /tftpboot/pxelinux.cfg. The 'default.orbit-XXX' file is created from the  template stored in the config directory.
     115
     116{{{
     117DEFAULT boel
     118
     119LABEL boel
     120KERNEL linux-@KERNEL_VER@
     121APPEND vga=extended root=/dev/ram0 rw load_ramdisk=1 prompt_ramdisk=1 ramdisk_size=32768 init=/vmlinuz initrd=initrd-orbit-pxe-@VER@.img console=ttyS0,9600
     122DISPLAY message.txt
     123PROMPT 1
     124TIMEOUT 1
     125}}}
     126
     127
     128''' Default Pxe Issues '''
     129
     130As part of the normal (non-pxe) boot process the nodes must pass though the pxe phase of the bios and "fail". The pxe client on all of the nodes should contact the tftp server and request a file named with the node ip adress in hex. It will then proceed to remove the trailing character until it runs out of characters. Once that process fails, the node will look for a file named default (no extention).
     131
     132The current default used the localboot pxe directive (part of the standard) to instruct the nodes to fail over to disk. The file (now named default.localboot) has the following contents:
     133{{{
     134default harddisk
     135
     136label harddisk
     137  localboot 0
     138}}}
     139
     140A recent test with some of the newest mother boards however failed. The pxeclient did not honor the locaboot 0 option (or rather they locked up when given this option). A work around documented [http://www.gossamer-threads.com/lists/syslinux/users/7127 here] (stored as a pdf for future use) recommended trying the syslinux chainloader. This required a new default file with the contents:
     141{{{
     142default harddisk
     143
     144label harddisk
     145KERNEL chain.c32
     146APPEND hd0 0
     147}}}
     148
     149=== Service Requirements ===
     150
     151
     152To bootstrap the testbed nodes, in fact any server in the system, we use [http://en.wikipedia.org/wiki/PXE PXE] to have the nodes load an image which contains a [wiki:NodeHandler/NodeAgent nodeagent] and a [http://www.cs.utah.edu/flux/papers/frisbee-usenix03-base.html frisbee] client.
     153
     154PXE requires the following support:
     155
     156 1. A [http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP] server pointing to an TFTP server
     157 1. A [http://en.wikipedia.org/wiki/TFTP TFTP] server proving the following:
     158   1. A network bootstrap program (NBP)
     159   1. A file containing instructions for the NBP
     160   1. A boot image
     161 1. A PXE [wiki:NodeHandler/GridService grid service]
     162
     163''Ideally the later referenced "orbit-pxe-server" apt package should include dependencies to all required packages and should setup everything. For instance, it should depend on gridservices and should then automatically instantiate the PXE grid service.''
     164
     165''' DHCP Server '''
     166
     167To support PXE we need a DHCP server. This server does not necessarily need to be instantiated at the same machine as the TFTP server, but it's configuration needs to point to it.
     168
     169Installing a DHCP server on Debian is as simple as:
     170
     171{{{
     172% apt-get install dhcp
     173}}}
     174
     175
     176To support PXE, we need to add to /etc/dhcpd.conf something like:
     177
     178{{{
     179option domain-name "example.com";
     180
     181default-lease-time 600;
     182max-lease-time 7200;
     183
     184allow booting;
     185
     186# The next paragraph needs to be modified to fit your case
     187subnet 192.168.1.0 netmask 255.255.255.0 {
     188  range 192.168.1.200 192.168.1.253;
     189  option broadcast-address 192.168.1.255;
     190# the gateway address which can be different
     191# (access to the internet for instance)
     192  option routers 192.168.1.1;
     193# indicate the dns you want to use
     194  option domain-name-servers 192.168.1.3;
     195}
     196
     197group {
     198# The address of the TFTP server that hosts the PXE image.
     199 next-server 192.168.1.3;
     200 host tftpclient {
     201# tftp client hardware address
     202  hardware ethernet  00:10:DC:27:6C:15;
     203
     204# The PXE boot loader that instructs the client to load a script corresponding to its IP address.
     205# The script defines the kernel and memory based image to download and boot.  Think of it as a
     206# network aware grub/lilo type boot loader.
     207  filename "/tftpboot/pxelinux.bin";
     208 }
     209}
     210
     211}}}
     212
     213After you have edited the dhcpd configuration file, restart it with "/etc/init.d/dhcpd restart".
     214
     215''' Installing a TFTP server '''
     216
     217Debian makes that easy.  We prefer atftpd since its the only tftp server that has verbose output.  It also gives the ability to control the number of threads which handle transfers.  With 400+ simultaneous clients, a good tftp server is required.
     218{{{
     219% apt-get install atftd
     220}}}
     221
     222''' Installing NBP -- pxelinux '''
     223
     224'pxelinux.bin' is a file found in the syslinux package. [http://syslinux.zytor.com/ Syslinux]  The nitty gritty of how it works, what to do to make a machine netboot, and all of the other specifics can be found at [http://syslinux.zytor.com/pxe.php Syslinux].
     225
     226
     227''' Installing an PXE image '''
     228
     229The PXE client gets the address of the TFTP server through DHCP. Taking it's IP address it attempts to download a specific file containing further instructions from the TFPT server. The name of the file is created from the PXE client's IP address. For Orbit, the instructions are identical for every node and are stored in "/tftpboot/pxelinux.cfg/default.orbit-''version''". This file instructs the node to fetch the image "/tftpboot/initrd-orbit-pxe-''version''.img" from the TFTP server and boot into it.
     230
     231Both files will be installed through:
     232
     233{{{
     234% apt-get install orbit-pxe-server
     235}}}
     236
     237''' Installing the PXE Grid Service '''
     238
     239Every service on Orbit which can be controlled by the experimenter requires a [wiki:NodeHandler/GridService grid service] component. The PXE grid service must be installed on the TFTP server.
     240
     241{{{
     242% apt-get install gridservices
     243% cd /etc/gridservices/enabled
     244% ln -s ../available/pxe .
     245% /etc/init.d/gridservices restart
     246}}}