Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. DEBIAN_RELEASE := stretch
  2. XILINX_TARBALL := Xilinx_ISE_DS_Lin_14.7_1015_1.tar
  3. XILINX_LICENSE := Xilinx.lic
  4. XILINX_PKGDIR := fs/$(basename ${XILINX_TARBALL})
  5. BOOT_CONTAINER := cryptech-builder-boot
  6. BOOT_IMAGE := cryptech-builder:boot
  7. BASE_IMAGE := cryptech-builder:base
  8. BASE_IMAGE_EXISTS := $(shell docker image ls -q ${BASE_IMAGE})
  9. BOOT_IMAGE_EXISTS := $(shell docker image ls -q ${BOOT_IMAGE})
  10. BOOT_CONTAINER_EXISTS := $(shell docker container ls -a --format='{{.Names}}' --filter='name=^/${BOOT_CONTAINER}$$')
  11. ifneq (./,$(sort $(dir ${XILINX_TARBALL} ${XILINX_LICENSE})))
  12. $(error XILINX_TARBALL and XILINX_LICENSE must be in this directory for bind mount)
  13. endif
  14. all:
  15. ifeq (,${BASE_IMAGE_EXISTS})
  16. docker container rm -f ${BOOT_CONTAINER} || true
  17. ifeq (,${BOOT_IMAGE_EXISTS})
  18. rm -rf fs
  19. mkdir fs
  20. sudo /usr/sbin/debootstrap --foreign ${DEBIAN_RELEASE} fs
  21. sudo tar -C fs -c . | docker import - ${BOOT_IMAGE}
  22. endif
  23. sudo rm -rf fs
  24. mkdir fs
  25. tar -C fs -xf ${XILINX_TARBALL}
  26. test -d ${XILINX_PKGDIR}
  27. docker run -it --name ${BOOT_CONTAINER} \
  28. --mount type=bind,source=$(abspath .),target=/cryptech-builder \
  29. --env 'XILINX_PKGDIR=/cryptech-builder/${XILINX_PKGDIR}' \
  30. --env 'XILINX_LICENSE=${XILINX_LICENSE}' \
  31. ${BOOT_IMAGE} \
  32. /cryptech-builder/Builder
  33. rm -rf fs
  34. mogrify -verbose -format png *.xwd && rm -f *.xwd || true
  35. docker commit ${BOOT_CONTAINER} ${BASE_IMAGE}
  36. docker container rm -f ${BOOT_CONTAINER}
  37. endif
  38. docker build -t cryptech-builder .
  39. clean:
  40. git clean -dfx -e ${XILINX_TARBALL} -e ${XILINX_LICENSE}
  41. docker container rm -f ${BOOT_CONTAINER} || true
  42. sandblast: clean
  43. docker image rm -f ${BOOT_IMAGE} || true
  44. docker image rm -f ${BASE_IMAGE} || true
  45. .PHONY: all clean sandblast