Commit 65d27c90 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Initial commit

parents
current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
PACKAGES = $(TEMPORARY_PACKAGES) $(BASE_PACKAGES) $(BOOT_PACKAGES)
.PHONY: packages set-version set-hostname $(PACKAGES) cleanup success
packages: set-version set-hostname $(PACKAGES) cleanup success
set-version: os-release
@echo "$$OS_RELEASE" > /etc/os-release
os-release:
define OS_RELEASE
# Begin /etc/os-release
NAME="$(PROJECT_NAME)"
ID="$(ID)"
PRETTY_NAME="$(PRETTY_NAME)"
ANSI_COLOR=0;33
VERSION=$(VERSION)
VERSION_ID=$(BUILD_ID)
# End /etc/os-release
endef
export OS_RELEASE
set-hostname:
@echo "127.0.0.1 localhost $(HOSTNAME)" > /etc/hosts
hostname $(HOSTNAME)
@echo "$(HOSTNAME)" > /etc/hostname
$(PACKAGES):
mkdir root
mkdir work
mkdir mnt
mount -t overlay -o lowerdir=/,upperdir=root,workdir=work overlay mnt
mount -t devtmpfs /dev mnt/dev
mount -t devpts /dev/pts mnt/dev/pts
mount -t tmpfs /dev/shm mnt/dev/shm
mount -t proc /proc mnt/proc
mount -t sysfs /sysfs mnt/sys
mount -t tmpfs /tmp mnt/tmp
mount -t tmpfs /tmp mnt/var/tmp
mount /dev/$(SECONDARY)1 mnt/build
if [ -d mnt/data ] ; then \
mount /dev/$(DISK)4 mnt/data ; \
fi
chroot mnt $(MAKE) -C $(current_dir)$(firstword $(subst ., ,$@)) $(word 2, $(subst ., ,$@))
if [ -d mnt/data ] && [[ $$(findmnt -M mnt/data) ]] ; then \
umount -l mnt/data ; \
fi
umount -l mnt/build
umount -l mnt/var/tmp
umount -l mnt/tmp
umount -l mnt/sys
umount -l mnt/proc
umount -l mnt/dev/shm
umount -l mnt/dev/pts
umount -l mnt/dev
umount -l mnt
rm -rf work
rm -rf mnt
mkdir -p /usr/share/packages
find root -type f -exec strip --strip-unneeded -K grub_mod_init -K grub_mod_fini '{}' ';' 2> /dev/null
find root -type c -exec bash -c "FILE=\$$(ls -l '{}' | awk '/0, 0/ {print \$$NF}'); if [ ! -z \$$FILE ]; then MAIN=\$$(echo \$$FILE | sed -e 's/root//'); rm -rf \$$MAIN \$$FILE; fi" ';'
find root -type f -exec md5sum '{}' ';' | sed -e 's/ root/ /' >> /usr/share/packages/$@.md5
if [ -s /usr/share/packages/$@.md5 ] ; then \
if [ -f /build/packages/$(firstword $(subst ., ,$@))/$@.groups ] ; then \
cp /build/packages/$(firstword $(subst ., ,$@))/$@.groups /usr/share/packages ; \
fi ; \
for f in `find root -type l | sed -e 's/^root//'`; do rm -rf $$f; done ; \
cp -rdfp --remove-destination root/* / ; \
else \
rm -f /usr/share/packages/$@.md5 ; \
fi
rm -rf root
cleanup:
for pkg in $(TEMPORARY_PACKAGES) ; do \
pkgremove $$pkg ; \
done
rm -rf /kernelconfig
rm -rf /tmp/*
/sbin/fstrim -v /
success:
touch /.success
<project name="Build system common elements" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property environment="env"/>
<property file="${builddir}/machine"/>
<property name="MACHINE" value="${env.MACHINE}"/>
<import file="machines/${MACHINE}/definition.xml" optional="true"/>
<fail unless="BOARD" message="Correct machine type must be specified"/>
<property name="VERSION" value="${ID}-${MACHINE}"/>
<exec executable="bash" outputproperty="LAST_COMMIT">
<arg value="-c"/>
<arg value="git log -1 --format=%cd --date=format:%Y%m%d%H%M%S"/>
</exec>
<exec executable="bash" outputproperty="BUILD_ID">
<arg value="-c"/>
<arg value="{ echo &quot;${LAST_COMMIT}&quot;; cat ${builddir}/id/* 2> /dev/null ; } | sort | tail -1"/>
</exec>
<property name="BUILD_OPTIONS" value="${env.BUILD_OPTIONS}" if:set="env.BUILD_OPTIONS"/>
<property name="BUILD_OPTIONS" value="" unless:set="env.BUILD_OPTIONS"/>
<exec executable="bash" outputproperty="ENABLE_KVM_X86">
<arg value="-c"/>
<arg value="if [ `lsmod | grep -c -E '(kvm_intel|kvm_amd)'` -gt 0 ] ; then echo -n '-enable-kvm' ; fi"/>
</exec>
<target name="copy-to-secondary">
<exec executable="cp" dir="${builddir}" failonerror="true">
<arg line="disk.img secondary.img"/>
</exec>
</target>
<target name="copy-back">
<exec executable="truncate" failonerror="true">
<arg line="--size=${imagesize}M ${builddir}/disk.img"/>
</exec>
<antcall target="copy-back-system"/>
<antcall target="copy-back-ab"/>
<condition property="gpt_label">
<matches string="${DISK_LABEL}" pattern="^gpt$"/>
</condition>
<antcall target="copy-back-gpt"/>
<delete file="${builddir}/secondary.img"/>
</target>
<target name="copy-back-system" if="SystemStart">
<exec executable="dd" failonerror="true">
<arg line="if=${builddir}/secondary.img of=${builddir}/disk.img bs=1048576 count=${SystemStart} conv=notrunc"/>
</exec>
<exec executable="bash" failonerror="true">
<env key="PATH" path="${PATH}:/sbin:/usr/sbin"/>
<arg line="-c 'e2image -ra -o $((${SystemStart} * 1048576)) -O $((${SystemStart} * 1048576)) ${builddir}/secondary.img ${builddir}/disk.img'"/>
</exec>
</target>
<target name="copy-back-ab" if="ABstart">
<exec executable="dd" failonerror="true">
<arg line="if=${builddir}/secondary.img of=${builddir}/disk.img bs=1048576 count=${ABstart} conv=notrunc"/>
</exec>
<exec executable="bash" failonerror="true">
<env key="PATH" path="${PATH}:/sbin:/usr/sbin"/>
<arg line="-c 'e2image -ra -o $((${ABstart} * 1048576)) -O $((${ABstart} * 1048576)) ${builddir}/secondary.img ${builddir}/disk.img'"/>
</exec>
<exec executable="bash" failonerror="true">
<arg line="-c 'e2image -ra -o $(((${ABstart} + ${ABsize} + ${ABsize}) * 1048576)) -O $(((${ABstart} + ${ABsize} + ${ABsize}) * 1048576)) ${builddir}/secondary.img ${builddir}/disk.img'"/>
</exec>
</target>
<target name="copy-back-gpt" if="gpt_label">
<exec executable="bash" failonerror="true">
<arg line="-c 'dd if=${builddir}/secondary.img of=${builddir}/disk.img bs=512 count=34 skip=$((${imagesize} * 2048 - 34)) seek=$((${imagesize} * 2048 - 34)) conv=notrunc'"/>
</exec>
</target>
<target name="mount">
<mkdir dir="${sysdir}"/>
<exec executable="guestmount" failonerror="true">
<env key="LIBGUESTFS_BACKEND" value="direct"/>
<arg line="-a ${builddir}/disk.img --pid-file guestmount.pid -m /dev/sda2 --rw ${sysdir}"/>
</exec>
</target>
<target name="mount-secondary">
<mkdir dir="${sysdir}"/>
<exec executable="guestmount" failonerror="true">
<env key="LIBGUESTFS_BACKEND" value="direct"/>
<arg line="-a ${builddir}/secondary.img --pid-file guestmount.pid -m /dev/sda1 --rw ${sysdir}"/>
</exec>
</target>
<target name="unmount">
<exec executable="guestunmount" error="/dev/null">
<arg line="${sysdir}"/>
</exec>
<exec executable="bash">
<arg value="-c"/>
<arg value="pid=$(cat guestmount.pid); while kill -0 $pid 2>/dev/null; do sleep 1; done; rm guestmount.pid"/>
</exec>
<delete dir="${sysdir}"/>
</target>
<target name="make-disk">
<condition property="mbr_label">
<matches string="${DISK_LABEL}" pattern="^mbr$"/>
</condition>
<condition property="gpt_label">
<matches string="${DISK_LABEL}" pattern="^gpt$"/>
</condition>
<antcall target="make-disk-mbr"/>
<antcall target="make-disk-gpt"/>
</target>
<target name="make-disk-mbr" if="mbr_label">
<exec executable="bash" failonerror="true">
<arg line="-c 'guestfish sparse ${builddir}/disk.img ${imagesize}M : run : part-init /dev/sda mbr : part-add /dev/sda p $((${BootStart} * 2048)) $((${SystemStart} * 2048 - 1)) : part-set-mbr-id /dev/sda 1 0x0c : part-add /dev/sda p $((${SystemStart} * 2048)) $((${imagesize} * 2048 - 1)) : part-set-mbr-id /dev/sda 2 0x83 : mkfs ext4 /dev/sda2 label:CLFS'"/>
</exec>
</target>
<target name="make-disk-gpt" if="gpt_label">
<exec executable="bash" failonerror="true">
<arg line="-c 'guestfish sparse ${builddir}/disk.img ${imagesize}M : run : part-init /dev/sda gpt : part-add /dev/sda p $((${BootStart} * 2048)) $((${SystemStart} * 2048 - 1)) : part-set-gpt-type /dev/sda 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B : part-add /dev/sda p $((${SystemStart} * 2048)) $((${imagesize} * 2048 - 34)) : part-set-gpt-type /dev/sda 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 : mkfs ext4 /dev/sda2 label:CLFS'"/>
</exec>
</target>
<target name="make-secondary">
<condition property="mbr_label">
<matches string="${DISK_LABEL}" pattern="^mbr$"/>
</condition>
<condition property="gpt_label">
<matches string="${DISK_LABEL}" pattern="^gpt$"/>
</condition>
<antcall target="make-secondary-mbr"/>
<antcall target="make-secondary-gpt"/>
</target>
<target name="make-secondary-mbr" if="mbr_label">
<exec executable="bash" failonerror="true">
<arg line="-c 'guestfish sparse ${builddir}/secondary.img ${secondarysize}M : run : part-init /dev/sda mbr : part-add /dev/sda p 2048 $((${secondarysize} * 2048 - 1)) : part-set-mbr-id /dev/sda 1 0x83 : mkfs ext4 /dev/sda1'"/>
</exec>
</target>
<target name="make-secondary-gpt" if="gpt_label">
<exec executable="bash" failonerror="true">
<arg line="-c 'guestfish sparse ${builddir}/secondary.img ${secondarysize}M : run : part-init /dev/sda gpt : part-add /dev/sda p 2048 $((${secondarysize} * 2048 - 34)) : part-set-gpt-type /dev/sda 1 0FC63DAF-8483-4772-8E79-3D69D8477DE4 : mkfs ext4 /dev/sda1'"/>
</exec>
</target>
<target name="fill-secondary">
<exec executable="cp" failonerror="true">
<arg line="-drv ${basedir}/packages ${sysdir}"/>
</exec>
<exec executable="cp" failonerror="true">
<arg line="-drv ${basedir}/build-system/Makefile.common ${sysdir}/packages"/>
</exec>
<antcall target="fill-secondary-mender-keys"/>
</target>
<target name="fill-secondary-mender-keys" if="MENDER_KEYS">
<exec executable="cp" failonerror="true">
<arg line="-drv ${basedir}/host/server.crt ${sysdir}/packages/mender"/>
</exec>
</target>
<target name="run-system-armv7">
<exec executable="qemu-system-arm">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu cortex-a15 -m 1024 -M virt -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device sdhci-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device sd-card,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-armv7">
<exec executable="qemu-system-arm">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu cortex-a15 -m 1024 -M virt -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device sdhci-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device sd-card,drive=disk -device sdhci-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device sd-card,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-armv8">
<exec executable="qemu-system-aarch64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu cortex-a57 -m 1024 -M virt -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device sdhci-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device sd-card,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-armv8">
<exec executable="qemu-system-aarch64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu cortex-a57 -m 1024 -M virt -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device sdhci-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device sd-card,drive=disk -device sdhci-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device sd-card,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-x86_64">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu kvm64 ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-x86_64">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu kvm64 ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-core2">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu core2duo ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-core2">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu core2duo ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-nehalem">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Nehalem ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-nehalem">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Nehalem ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-westmere">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Westmere ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-westmere">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Westmere ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-sandybridge">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu SandyBridge ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-sandybridge">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu SandyBridge ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-ivybridge">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu IvyBridge ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-ivybridge">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu IvyBridge ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-haswell">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Haswell ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-haswell">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Haswell ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-skylake-client">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Skylake-Client ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-skylake-client">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Skylake-Client ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-opteron-g4">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Opteron_G4 ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="run-system-with-secondary-opteron-g4">
<exec executable="qemu-system-x86_64">
<env key="QEMU_AUDIO_DRV" value="none"/>
<arg line=" -kernel ${builddir}/boot/vmlinuz -cpu Opteron_G4 ${ENABLE_KVM_X86} -m 1024 -M pc -no-reboot -append &quot;console=${CONSOLE} root=/dev/${DISK}2 rootwait panic=1 rootfstype=ext4 rootflags=discard rw systemd.unit=rescue.target net.ifnames=0&quot; -device virtio-scsi-pci -drive format=raw,file=${builddir}/disk.img,if=none,id=disk,cache=writeback,discard=unmap -device scsi-hd,drive=disk -device virtio-scsi-pci -drive format=raw,file=${builddir}/secondary.img,if=none,id=secondary,cache=writeback,discard=unmap -device scsi-hd,drive=secondary -device virtio-rng-pci -nographic"/>
</exec>
</target>
<target name="build-boot-kernel">
<antcall target="mount"/>
<antcall target="setup-build-boot-kernel"/>
<antcall target="unmount"/>
<antcall target="make-secondary"/>
<antcall target="mount-secondary"/>
<antcall target="fill-secondary"/>
<antcall target="prepare-kernel-config"/>
<antcall target="unmount"/>
<antcall target="run-system-with-secondary-${BOARD}"/>
<antcall target="check-boot-success"/>
<antcall target="mount-secondary"/>
<antcall target="copy-boot-kernel"/>
<antcall target="unmount"/>
</target>
<target name="setup-build-boot-kernel">
<delete file="${sysdir}/.success"/>
<echo file="${sysdir}/lib/systemd/system/build.service">[Unit]
Description=Build boot kernel
[Service]
Type=oneshot
StandardOutput=tty
ExecStart=/lib/systemd/system/build
ExecStartPost=/sbin/poweroff
[Install]
WantedBy=rescue.target
</echo>
<echo file="${sysdir}/lib/systemd/system/build">#!/bin/sh
LC_ALL=POSIX
PATH=/bin:/usr/bin:/sbin:/usr/sbin
SECONDARY="${SECONDARY}"
export LC_ALL PATH SECONDARY HOSTTYPE
mkdir /build
mount /dev/${SECONDARY}1 /build
make -C /build/packages/linux boot-${BOARD}
if [ $? -eq 0 ]; then
umount /dev/${SECONDARY}1
rm -rf /build
touch /.success
fi
rm -rf /etc/systemd/system/rescue.target.wants
rm /lib/systemd/system/build.service
rm /lib/systemd/system/build
</echo>
<chmod file="${sysdir}/lib/systemd/system/build" perm="755"/>
<mkdir dir="${sysdir}/etc/systemd/system/rescue.target.wants"/>
<exec executable="ln" failonerror="true">
<arg line="-s /lib/systemd/system/build.service ${sysdir}/etc/systemd/system/rescue.target.wants/build.service"/>
</exec>
<exec executable="cp" failonerror="true">
<arg line="-drv ${basedir}/kernelconfig ${sysdir}"/>
</exec>
</target>
<target name="prepare-kernel-config">
<exec executable="cp" failonerror="true">
<arg line="-vL ${builddir}/boot/config ${sysdir}/packages/linux"/>
</exec>
<exec executable="sed" failonerror="true">
<arg line="-e 's/^CONFIG_CROSS_COMPILE.*/# CONFIG_CROSS_COMPILE is not set/' -i ${sysdir}/packages/linux/config"/>
</exec>
</target>
<target name="check-boot-success">
<antcall target="mount"/>
<available file="${sysdir}/.success" property="success"/>
<delete file="${sysdir}/.success"/>
<antcall target="unmount"/>
<fail message="Building of boot kernel has failed" unless="success"/>
</target>
<target name="copy-boot-kernel">
<delete dir="${builddir}/boot"/>
<exec executable="mv" failonerror="true">
<arg line="-v ${sysdir}/packages/linux/boot ${builddir}/boot"/>
</exec>
</target>
<target name="setup-go-bootstrap">
<exec executable="mv" failonerror="true">
<arg line="-v ${builddir}/go-linux-${GOARCH}-bootstrap.tbz ${sysdir}/packages/go"/>
</exec>
</target>
<target name="check-build-success">
<antcall target="mount"/>
<available file="${sysdir}/.success" property="success"/>
<delete file="${sysdir}/.success"/>
<antcall target="unmount"/>
<fail message="Makefile execution has failed" unless="success"/>
</target>
<target name="install-verify-key">
<antcall target="mount"/>
<exec executable="openssl" failonerror="true">
<arg line="rsa -in ${basedir}/host/private.key -out ${sysdir}/etc/mender/verify.key -pubout"/>
</exec>
<antcall target="unmount"/>
</target>
<target name="check-strip-and-trim">
<antcall target="copy-to-secondary"/>
<antcall target="mount"/>
<antcall target="setup-check-strip-and-trim"/>
<antcall target="unmount"/>
<antcall target="run-system-with-secondary-${BOARD}"/>
<antcall target="check-trim-success"/>
<antcall target="copy-back"/>
</target>
<target name="setup-check-strip-and-trim">
<antcall target="setup-check-strip-and-trim-ab"/>
</target>
<target name="setup-check-strip-and-trim-ab" if="ABstart">
<delete file="${sysdir}/.success"/>
<echo file="${sysdir}/lib/systemd/system/check-strip-and-trim.service">[Unit]
Description=Check, strip and trim file system
[Service]
Type=oneshot
StandardOutput=tty
ExecStart=/lib/systemd/system/check-strip-and-trim
ExecStartPost=/sbin/poweroff
[Install]
WantedBy=rescue.target
</echo>
<echo file="${sysdir}/lib/systemd/system/check-strip-and-trim">#!/bin/sh
/sbin/fsck -yf /dev/${SECONDARY}1
/sbin/fsck -yf /dev/${SECONDARY}2
/sbin/fsck -yf /dev/${SECONDARY}4
/bin/mount -o discard /dev/${SECONDARY}2 /mnt
/bin/mount -o discard /dev/${SECONDARY}4 /mnt/data
/bin/rm -rf /mnt/data/var/log/journal/*
/usr/bin/truncate --size 0 /mnt/data/var/log/btmp
/usr/bin/truncate --size 0 /mnt/data/var/log/lastlog
/usr/bin/truncate --size 0 /mnt/data/var/log/faillog
/usr/bin/truncate --size 0 /mnt/data/var/log/wtmp
/usr/bin/truncate --size 0 /mnt/data/etc/machine-id
/sbin/fstrim -v /mnt/data
/bin/umount /dev/${SECONDARY}4
/bin/mkdir -p /mnt/usr/share/factorydefault
/bin/dd if=/dev/zero of=/tmp/data bs=512 count=$(/sbin/blockdev --getsz /dev/${SECONDARY}4)
/sbin/e2image -ra /dev/${SECONDARY}4 /tmp/data
/bin/xz -9 /tmp/data
/bin/mv -f /tmp/data.xz /mnt/usr/share/factorydefault/data.xz
/sbin/fstrim -v /mnt
/bin/umount /dev/${SECONDARY}2
/bin/mount -o remount,rw /
/usr/bin/touch /.success
/bin/rm -rf /etc/systemd/system/rescue.target.wants
/bin/rm /lib/systemd/system/check-strip-and-trim.service
/bin/rm /lib/systemd/system/check-strip-and-trim
</echo>
<chmod file="${sysdir}/lib/systemd/system/check-strip-and-trim" perm="755"/>
<mkdir dir="${sysdir}/etc/systemd/system/rescue.target.wants"/>
<exec executable="ln" failonerror="true">
<arg line="-s /lib/systemd/system/check-strip-and-trim.service ${sysdir}/etc/systemd/system/rescue.target.wants/check-strip-and-trim.service"/>
</exec>
<exec executable="sed" failonerror="true">
<arg line="-e 's/disk\/by-label\/data/${DISK}4/' -i ${sysdir}/etc/fstab"/>
</exec>
</target>
<target name="check-trim-success">
<antcall target="mount"/>
<available file="${sysdir}/.success" property="success"/>
<delete file="${sysdir}/.success"/>
<antcall target="unmount"/>
<fail message="File system check and trim has failed" unless="success"/>
</target>
<target name="pack-final-system-image">
<exec executable="xz" dir="${builddir}" failonerror="true">
<arg line="-9 disk.img"/>
</exec>
</target>
<target name="unpack-system-image">
<exec executable="unxz" dir="${builddir}" failonerror="true">
<arg line="disk.img.xz"/>
</exec>
</target>
<target name="record-last-commit">
<mkdir dir="${builddir}/id"/>
<echo file="${builddir}/id/${ant.project.name}">${LAST_COMMIT}
</echo>
</target>
</project>
<project name="AMD E2 6110 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for AMD E2-6110"/>
<property name="CLFS_TARGET" value="x86_64-E2_6110-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=btver2 --with-tune=btver2"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="e2-6110"/>
<property name="DEVICE_TYPE" value="E26110"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-e2-6110">
<antcall target="run-system-opteron-g4"/>
</target>
<target name="run-system-with-secondary-e2-6110">
<antcall target="run-system-with-secondary-opteron-g4"/>
</target>
</project>
<project name="Intel i3-540 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel i3-540"/>
<property name="CLFS_TARGET" value="x86_64-i3_540-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=nehalem --with-tune=nehalem"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="i3-540"/>
<property name="DEVICE_TYPE" value="I3540"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-i3-540">
<antcall target="run-system-nehalem"/>
</target>
<target name="run-system-with-secondary-i3-540">
<antcall target="run-system-with-secondary-nehalem"/>
</target>
</project>
<project name="Intel i5-3317U machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel i5-3317U"/>
<property name="CLFS_TARGET" value="x86_64-i5_3317U-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=ivybridge --with-tune=ivybridge"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="i5-3317u"/>
<property name="DEVICE_TYPE" value="I53317U"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-i5-3317u">
<antcall target="run-system-ivybridge"/>
</target>
<target name="run-system-with-secondary-i5-3317u">
<antcall target="run-system-with-secondary-ivybridge"/>
</target>
</project>
<project name="Intel i5-8500 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel i5-8500"/>
<property name="CLFS_TARGET" value="x86_64-i5_8500-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=skylake --with-tune=skylake"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="i5-8500"/>
<property name="DEVICE_TYPE" value="I58500"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-i5-8500">
<antcall target="run-system-skylake-client"/>
</target>
<target name="run-system-with-secondary-i5-8500">
<antcall target="run-system-with-secondary-skylake-client"/>
</target>
</project>
<project name="Intel i7-2600 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel i7-2600"/>
<property name="CLFS_TARGET" value="x86_64-i7_2600-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=sandybridge --with-tune=sandybridge"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="i7-2600"/>
<property name="DEVICE_TYPE" value="I72600"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-i7-2600">
<antcall target="run-system-sandybridge"/>
</target>
<target name="run-system-with-secondary-i7-2600">
<antcall target="run-system-with-secondary-sandybridge"/>
</target>
</project>
<project name="Orange Pi PC Plus machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Orange Pi PC Plus"/>
<property name="CLFS_TARGET" value="armv7-allwinner-linux-gnueabihf"/>
<property name="ARCH" value="arm"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=armv7ve --with-tune=cortex-a7 --with-float=hard --with-fpu=neon-vfpv4"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG} --with-tls=gnu2"/>
<property name="CONSOLE" value="ttyAMA0"/>
<property name="DISK_LABEL" value="mbr"/>
<property name="ROOT_DEVICE" value="mmcblk0"/>
<property name="DISK" value="${ROOT_DEVICE}p"/>
<property name="SECONDARY" value="mmcblk1p"/>
<property name="BOARD" value="orange-pi-pc-plus"/>
<property name="DEVICE_TYPE" value="OrangePiPCPlusonSD"/>
<property name="GOARCH" value="arm"/>
<target name="run-system-orange-pi-pc-plus">
<antcall target="run-system-armv7"/>
</target>
<target name="run-system-with-secondary-orange-pi-pc-plus">
<antcall target="run-system-with-secondary-armv7"/>
</target>
</project>
<project name="Orange Pi Plus 2E machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Orange Pi Plus 2E"/>
<property name="CLFS_TARGET" value="armv7-allwinner-linux-gnueabihf"/>
<property name="ARCH" value="arm"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=armv7ve --with-tune=cortex-a7 --with-float=hard --with-fpu=neon-vfpv4"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG} --with-tls=gnu2"/>
<property name="CONSOLE" value="ttyAMA0"/>
<property name="DISK_LABEL" value="mbr"/>
<property name="ROOT_DEVICE" value="mmcblk0"/>
<property name="DISK" value="${ROOT_DEVICE}p"/>
<property name="SECONDARY" value="mmcblk1p"/>
<property name="BOARD" value="orange-pi-plus-2e"/>
<property name="DEVICE_TYPE" value="OrangePiPlus2EonSD"/>
<property name="GOARCH" value="arm"/>
<target name="run-system-orange-pi-plus-2e">
<antcall target="run-system-armv7"/>
</target>
<target name="run-system-with-secondary-orange-pi-plus-2e">
<antcall target="run-system-with-secondary-armv7"/>
</target>
</project>
<project name="QEMU KVM64 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for QEMU KVM64"/>
<property name="CLFS_TARGET" value="x86_64-kvm64-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=x86-64 --with-cpu=generic"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="mbr"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="qemu-kvm64"/>
<property name="DEVICE_TYPE" value="KVM64"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-qemu-kvm64">
<antcall target="run-system-x86_64"/>
</target>
<target name="run-system-with-secondary-qemu-kvm64">
<antcall target="run-system-with-secondary-x86_64"/>
</target>
</project>
<project name="Raspberry Pi 3 Model B machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Raspberry Pi 3 Model B"/>
<property name="CLFS_TARGET" value="aarch64-broadcom-linux-gnueabi"/>
<property name="ARCH" value="arm64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=armv8-a+crc+nocrypto --with-cpu=cortex-a53"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyAMA0"/>
<property name="DISK_LABEL" value="mbr"/>
<property name="ROOT_DEVICE" value="mmcblk0"/>
<property name="DISK" value="${ROOT_DEVICE}p"/>
<property name="SECONDARY" value="mmcblk1p"/>
<property name="BOARD" value="raspberry-pi-3-b"/>
<property name="DEVICE_TYPE" value="RaspberryPi3ModelB"/>
<property name="GOARCH" value="arm64"/>
<target name="run-system-raspberry-pi-3-b">
<antcall target="run-system-armv8"/>
</target>
<target name="run-system-with-secondary-raspberry-pi-3-b">
<antcall target="run-system-with-secondary-armv8"/>
</target>
</project>
<project name="Intel Xeon 5130 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel Xeon 5130"/>
<property name="CLFS_TARGET" value="x86_64-XEON_5130-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=core2 --with-tune=core2"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="xeon-5130"/>
<property name="DEVICE_TYPE" value="XEON5130"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-xeon-5130">
<antcall target="run-system-core2"/>
</target>
<target name="run-system-with-secondary-xeon-5130">
<antcall target="run-system-with-secondary-core2"/>
</target>
</project>
<project name="Intel Xeon E3 1271 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel Xeon E3 1271"/>
<property name="CLFS_TARGET" value="x86_64-XEON_E3_1271-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=haswell --with-tune=haswell"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="xeon-e3-1271"/>
<property name="DEVICE_TYPE" value="XEONE31271"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-xeon-e3-1271">
<antcall target="run-system-haswell"/>
</target>
<target name="run-system-with-secondary-xeon-e3-1271">
<antcall target="run-system-with-secondary-haswell"/>
</target>
</project>
<project name="Intel Xeon E5620 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel Xeon E5620"/>
<property name="CLFS_TARGET" value="x86_64-XEON_E5620-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=westmere --with-tune=westmere"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="xeon-e5620"/>
<property name="DEVICE_TYPE" value="XEONE5620"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-xeon-e5620">
<antcall target="run-system-westmere"/>
</target>
<target name="run-system-with-secondary-xeon-e5620">
<antcall target="run-system-with-secondary-westmere"/>
</target>
</project>
<project name="Intel Xeon X5650 machine definition">
<property name="PRETTY_NAME" value="${ant.project.name} for Intel Xeon X5650"/>
<property name="CLFS_TARGET" value="x86_64-XEON_X5650-linux-gnu"/>
<property name="ARCH" value="x86_64"/>
<property name="GCC_CROSS_CONFIG" value="--with-arch=westmere --with-tune=westmere"/>
<property name="GCC_CONFIG" value="${GCC_CROSS_CONFIG}"/>
<property name="CONSOLE" value="ttyS0"/>
<property name="DISK_LABEL" value="gpt"/>
<property name="ROOT_DEVICE" value="sda"/>
<property name="DISK" value="${ROOT_DEVICE}"/>
<property name="SECONDARY" value="sdb"/>
<property name="BOARD" value="xeon-x5650"/>
<property name="DEVICE_TYPE" value="XEONX5650"/>
<property name="GOARCH" value="amd64"/>
<target name="run-system-xeon-x5650">
<antcall target="run-system-westmere"/>
</target>
<target name="run-system-with-secondary-xeon-x5650">
<antcall target="run-system-with-secondary-westmere"/>
</target>
</project>
<project name="Mender common elements" xmlns:if="ant:if" xmlns:unless="ant:unless">
<fail message="Mender's private key and certificate are missing">
<condition>
<not>
<resourcecount count="2">
<fileset id="fs" dir="host" includes="private.key,server.crt"/>
</resourcecount>
</not>
</condition>
</fail>
<property name="MENDER_KEYS" value="present"/>
<target name="post-mender-artifact">
<antcall target="build-go"/>
<antcall target="build-mender-artifact"/>
<antcall target="upload-mender-artifact"/>
</target>
<target name="build-go">
<property name="makedir" value="${builddir}/go"/>
<exec executable="tar" failonerror="true">
<arg line="xf ${basedir}/packages/go/go1.4-bootstrap-20170531.tar.gz -C ${builddir}"/>
</exec>
<exec executable="./make.bash" dir="${makedir}/src"/>
<move file="${builddir}/go" tofile="${builddir}/go1.4"/>
<exec executable="tar" failonerror="true">
<arg line="xf ${basedir}/packages/go/go1.8.7.src.tar.gz -C ${builddir}"/>
</exec>
<exec executable="./make.bash" dir="${makedir}/src">
<env key="GOROOT_BOOTSTRAP" path="${builddir}/go1.4"/>
</exec>
<delete dir="${builddir}/go1.4"/>
</target>
<target name="build-mender-artifact">
<mkdir dir="${builddir}/go/src/github.com/mendersoftware"/>
<exec executable="tar" dir="${builddir}" failonerror="true">
<arg line="xf ${basedir}/packages/mender-artifact/mender-artifact-2.1.1.tar.gz -C ${builddir}/go/src/github.com/mendersoftware"/>
</exec>
<exec executable="mv" dir="${builddir}" failonerror="true">
<arg line="${builddir}/go/src/github.com/mendersoftware/mender-artifact-2.1.1 ${builddir}/go/src/github.com/mendersoftware/mender-artifact"/>
</exec>
<exec executable="${builddir}/go/bin/go" dir="${builddir}/go/src/github.com/mendersoftware/mender-artifact" failonerror="true">
<arg line="build -ldflags &quot;-X main.Version=2.1.1&quot;"/>
</exec>
<exec executable="mv" dir="${builddir}" failonerror="true">
<arg line="${builddir}/go/src/github.com/mendersoftware/mender-artifact/mender-artifact ${builddir}"/>
</exec>
<delete dir="${builddir}/go"/>
<antcall target="mount"/>
<exec executable="bash" dir="${sysdir}" failonerror="true">
<arg line="-c &quot;echo 'artifact_name=${ARTIFACT_NAME}-${BUILD_ID}' > ${sysdir}/etc/mender/artifact_info&quot;"/>
</exec>
<copy todir="${builddir}/artifactscripts">
<fileset dir="${sysdir}/etc/mender/artifactscripts"/>
</copy>
<antcall target="unmount"/>
<exec executable="dd" dir="${builddir}" failonerror="true">
<arg line="if=${builddir}/disk.img of=${builddir}/${ARTIFACT_NAME}-${BUILD_ID}.ext4 bs=1048576 skip=${ABstart} count=${ABsize}"/>
</exec>
<exec executable="${builddir}/mender-artifact" dir="${builddir}" failonerror="true">
<arg line="write rootfs-image -t ${DEVICE_TYPE} -n ${ARTIFACT_NAME}-${BUILD_ID} -u ${ARTIFACT_NAME}-${BUILD_ID}.ext4 -o ${ARTIFACT_NAME}-${BUILD_ID}.mender -k ${basedir}/host/private.key -s artifactscripts"/>
</exec>
<delete file="${builddir}/mender-artifact"/>
<delete file="${builddir}/${ARTIFACT_NAME}-${BUILD_ID}.ext4"/>
<delete dir="${builddir}/artifactscripts"/>
</target>
<target name="upload-mender-artifact" if="env.MENDER_USER">
<exec executable="${basedir}/packages/mender-artifact/remove-mender-artifact.sh" dir="${builddir}" failonerror="true">
<arg line="${MENDER_HOST} ${env.MENDER_USER} ${env.MENDER_PASS} ${ARTIFACT_NAME} ${DEVICE_TYPE} ${basedir}/host/server.crt"/>
</exec>
<exec executable="${basedir}/packages/mender-artifact/upload-mender-artifact.sh" dir="${builddir}" failonerror="true">
<arg line="${MENDER_HOST} ${env.MENDER_USER} ${env.MENDER_PASS} ${ARTIFACT_NAME}-${BUILD_ID}.mender ${basedir}/host/server.crt"/>
</exec>
<delete file="${builddir}/${ARTIFACT_NAME}-${BUILD_ID}.mender"/>
</target>
</project>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment