Comments on the PXE Makefile
Made a few modification for the most current version based on kernel 3.11.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.
- 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).
- Made specially modified pxelinux.cfg file that boots off of eth0 for the newest (Gen4 asus) nodes.
A few more things to note about how the config is done when building the image.
- Even though the version of the kernel source tree is
specified in the make file, the build process does not
use the kernel config file that was downloaded from the
mirror. Instead it uses the file named
linux-omf-pxe-#.#.#.configin the directory:
- the same is true for the busy box, I think it uses the file:
- Finally the startup script rcS.actual will be copied to the init-ram-fs and run as part
of the pxe preOS sequence. We recently modified that file to have it poll NTP and
correct the system clock. We added the following lines:
/usr/sbin/ntpd -d -n -q -p consolec /sbin/hwclock --directisa -w
The current build package for making pxe images lives on:
In 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.
in the Makefiel the values of the following variables control what kernel directory the make process will consult to build a kernel:
KERNEL_VERSION = 3 KERNEL_PATCHLEVEL = 0 KERNEL_SUBLEVEL = 4
In 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.
Additionally ins the same source dir is a busbox-VERSION directory with a .config file that controls what features are built into busybox.
PXE has a 'changelog' in the top directory. The following extracts the version number from the first line in the changelog - enjoy:
24 VER = $(shell grep -o -E '[0-9]+\.[0-9.-]+' -m 1 changelog)
The following line copies a directory from one place to the other, but without ".svn" directories and emacs temporary files (*~)
119 tar -C static --exclude=.svn --exclude='*~' -cf - . | (cd $(RDISK); tar -xf -)
The 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.
The main addition is the apt target:
141 apt: dirs kernel image 142 @echo Building APT V$(VER) 143 rm -rf $(BUILD_APT_DIR) 144 install -d $(BUILD_APT_DIR) 145 cp -rp debian $(BUILD_APT_DIR) 146 rm -rf $(BUILD_APT_DIR)/debian/.svn 147 mv $(BUILD_APT_DIR)/debian/Makefile $(BUILD_APT_DIR) 148 cp changelog $(BUILD_APT_DIR)/debian 149 cp ../copyright $(BUILD_APT_DIR)/debian 150 if [ -r README.debian ] ; then \ 151 cp README.debian $(BUILD_APT_DIR)/debian; \ 152 fi 153 env O_VER=$(VER) O_KERNEL_V=$(KERNEL_VERSION) $(MAKE) -C $(BUILD_APT_DIR) deb 154 # $(MAKE) DESTDIR=$(BUILD_APT_DIR)/debian/$(APT_NAME) install 155 156 apt-install: apt 157 scp $(BUILD_APT_DIR)/../*.deb $(REPOSITORY):$(REPOSITORY_ROOT)/binary 158 ssh $(REPOSITORY) sudo $(REPOSITORY_ROOT)/rebuild.sh
The 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).
install: echo "INSTALL $(O_VER) $(O_KERNEL_V)" install -d $(TFTP_DIR) install -m666 ../initrd-orbit-pxe-$(O_VER).img $(TFTP_DIR) install -d $(CFG_DIR) sed -e s/@KERNEL_VER@/$(O_KERNEL_V)/ ../../config/default.orbit | sed -e s/@VER@/$(O_VER)/ > $(CFG_DIR)/default.orbit-$(O_VER) install -m755 ../../config/makeLink $(CFG_DIR)
The 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.
DEFAULT boel LABEL boel KERNEL linux-@KERNEL_VER@ APPEND 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 DISPLAY message.txt PROMPT 1 TIMEOUT 1