| 1 | == Makefile == |
| 2 | |
| 3 | PXE has a 'changelog' in the top directory. The following extracts the version number from the first line in the changelog - enjoy: |
| 4 | |
| 5 | {{{ |
| 6 | 24 VER = $(shell grep -o -E '[0-9]+\.[0-9.-]+' -m 1 changelog) |
| 7 | }}} |
| 8 | |
| 9 | The following line copies a directory from one place to the other, but without ".svn" directories and emacs temporary files (*~) |
| 10 | |
| 11 | {{{ |
| 12 | 119 tar -C static --exclude=.svn --exclude='*~' -cf - . | (cd $(RDISK); tar -xf -) |
| 13 | }}} |
| 14 | |
| 15 | 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. |
| 16 | |
| 17 | The main addition is the apt target: |
| 18 | {{{ |
| 19 | 141 apt: dirs kernel image |
| 20 | 142 @echo Building APT V$(VER) |
| 21 | 143 rm -rf $(BUILD_APT_DIR) |
| 22 | 144 install -d $(BUILD_APT_DIR) |
| 23 | 145 cp -rp debian $(BUILD_APT_DIR) |
| 24 | 146 rm -rf $(BUILD_APT_DIR)/debian/.svn |
| 25 | 147 mv $(BUILD_APT_DIR)/debian/Makefile $(BUILD_APT_DIR) |
| 26 | 148 cp changelog $(BUILD_APT_DIR)/debian |
| 27 | 149 cp ../copyright $(BUILD_APT_DIR)/debian |
| 28 | 150 if [ -r README.debian ] ; then \ |
| 29 | 151 cp README.debian $(BUILD_APT_DIR)/debian; \ |
| 30 | 152 fi |
| 31 | 153 env O_VER=$(VER) O_KERNEL_V=$(KERNEL_VERSION) $(MAKE) -C $(BUILD_APT_DIR) deb |
| 32 | 154 # $(MAKE) DESTDIR=$(BUILD_APT_DIR)/debian/$(APT_NAME) install |
| 33 | 155 |
| 34 | 156 apt-install: apt |
| 35 | 157 scp $(BUILD_APT_DIR)/../*.deb $(REPOSITORY):$(REPOSITORY_ROOT)/binary |
| 36 | 158 ssh $(REPOSITORY) sudo $(REPOSITORY_ROOT)/rebuild.sh |
| 37 | }}} |
| 38 | |
| 39 | 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). |
| 40 | |
| 41 | == debian/Makefile == |
| 42 | |
| 43 | {{{ |
| 44 | install: |
| 45 | echo "INSTALL $(O_VER) $(O_KERNEL_V)" |
| 46 | install -d $(TFTP_DIR) |
| 47 | install -m666 ../initrd-orbit-pxe-$(O_VER).img $(TFTP_DIR) |
| 48 | install -d $(CFG_DIR) |
| 49 | sed -e s/@KERNEL_VER@/$(O_KERNEL_V)/ ../../config/default.orbit | sed -e s/@VER@/$(O_VER)/ > $(CFG_DIR)/default.orbit-$(O_VER) |
| 50 | install -m755 ../../config/makeLink $(CFG_DIR) |
| 51 | }}} |
| 52 | |
| 53 | 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. |
| 54 | |
| 55 | {{{ |
| 56 | DEFAULT boel |
| 57 | |
| 58 | LABEL boel |
| 59 | KERNEL linux-@KERNEL_VER@ |
| 60 | 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 |
| 61 | DISPLAY message.txt |
| 62 | PROMPT 1 |
| 63 | TIMEOUT 1 |
| 64 | }}} |