Version 1 (modified by 19 years ago) ( diff ) | ,
---|
Makefile
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).
debian/Makefile
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