From a6e4734a188460d3dff46e551eb75c276e3fafc3 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 27 Jun 2016 20:59:39 -0400 Subject: Mostly working. A few scripts still missing from binary packages, and no Homebrew yet. --- Makefile | 12 +++++++++--- build-shadow-tree.py | 21 +++------------------ source/Makefile | 29 +++++++++++++++++------------ source/sw/pkcs11 | 2 +- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 1f5b63f..5d62630 100644 --- a/Makefile +++ b/Makefile @@ -19,9 +19,13 @@ PBUILDER_TARGETS := debian/jessie/i386 debian/jessie/amd64 ubuntu/xenial/i386 ub REPO_UPLOAD_USER := aptbot REPO_UPLOAD_URI := rsync://apt.cryptech.is/alpha/ -# Yes, we really are putting the firmware tarball into the source package here. +# Yes, we really are putting the firmware tarball into the source package. +# We want to supply the firmware in both source and binary form, to save users +# the trouble of all the cross compilation and Verilog synthesis, and the Alpha +# firmware is the same regardless of the host platform, so including the firmware +# tarball in the source package lets us simplify installation for the user. -FIRMWARE_TARBALL := build/cryptech-alpha-firmware.tar.gz +FIRMWARE_TARBALL := source/cryptech-alpha-firmware.tar.gz BITSTREAM := build/core/platform/alpha/build/alpha_fmc.bit ELVES := build/sw/stm32/projects/bootloader/bootloader.elf build/sw/stm32/projects/hsm/hsm.elf FIRMWARE_BINARY := ${ELVES} ${ELVES:.elf=.bin} @@ -55,6 +59,8 @@ sandblast: clean firmware: shadow ${FIRMWARE_TARBALL} shadow: build + +build: ./build-shadow-tree.py ${FIRMWARE_TARBALL}: ${BITSTREAM} $(sort ${ELVES} ${ELVES:.elf=.bin}) @@ -69,7 +75,7 @@ ${BITSTREAM}: ${RTL_SOURCE} ${ELVES:.elf=.bin}: shadow elves elves: - ${MAKE} -C build/core/sw/stm32 bootloader hsm + ${MAKE} -C build/sw/stm32 distclean bootloader hsm dsc: cd source; ${DCH} diff --git a/build-shadow-tree.py b/build-shadow-tree.py index f8c2376..e86ba85 100755 --- a/build-shadow-tree.py +++ b/build-shadow-tree.py @@ -14,29 +14,17 @@ import os -verbose = True -dry_run = False - source_root = "source" build_root = "build" -if verbose: - " mkdir", build_root - -if not dry_run: - os.mkdir(build_root) +os.mkdir(build_root) for source_head, dirs, files in os.walk(source_root): build_head = build_root + source_head[len(source_root):] - print source_head, build_head, dirs, files - for dn in dirs: d = os.path.join(build_head, dn) - if verbose: - print " mkdir", d - if not dry_run: - os.mkdir(d) + os.mkdir(d) for fn in files: if fn == ".git": @@ -45,7 +33,4 @@ for source_head, dirs, files in os.walk(source_root): s = os.path.join(source_head, fn) s = os.path.abspath(s) s = os.path.relpath(s, build_head) - if verbose: - print " ln -s", s, d - if not dry_run: - os.symlink(s, d) + os.symlink(s, d) diff --git a/source/Makefile b/source/Makefile index e2fdb1b..18462a8 100644 --- a/source/Makefile +++ b/source/Makefile @@ -1,19 +1,24 @@ -# Makefile to build Debian package for Cryptech Alpha board software +# Source package makefile for Cryptech Alpha board software. +# +# This is, deliberately, a very simplified Makefile. for the most +# part we just want to do the bare minimum needed for whatever +# software packaging system we use to work. At least for the moment, +# the primary packaging system is Debian-based, so this is written +# to work in that environment. At some point we'll probably add +# Homebrew support for Mac OS X. + all: - cd sw/thirdparty/libtfm; ${MAKE} - cd sw/libhal; ${MAKE} daemon - cd sw/pkcs11; ${MAKE} + ${MAKE} -C sw/pkcs11 clean distclean: - cd sw/thirdparty/libtfm; ${MAKE} $@ - cd sw/libhal; ${MAKE} $@ - cd sw/pkcs11; ${MAKE} $@ + ${MAKE} -C sw/pkcs11 $@ install: all - install -m 644 -D sw/pkcs11/libpkcs11.so ${DESTDIR}/usr/lib/libpkcs11.so - install -D sw/pkcs11/p11util ${DESTDIR}/usr/sbin/p11util - install -D sw/libhal/cryptech_rpcd ${DESTDIR}/usr/sbin/cryptech_rpcd - ln -s libpkcs11.so ${DESTDIR}/usr/lib/libpkcs11.so.0 + install -D -m 644 cryptech-alpha-firmware.tar.gz ${DESTDIR}/usr/share/cryptech-alpha-firmware.tar.gz + install -D -m 644 sw/pkcs11/libpkcs11.so ${DESTDIR}/usr/lib/libpkcs11.so + install -D sw/pkcs11/p11util ${DESTDIR}/usr/sbin/p11util + install -D sw/pkcs11/libhal/cryptech_rpcd ${DESTDIR}/usr/sbin/cryptech_rpcd + ln -s libpkcs11.so ${DESTDIR}/usr/lib/libpkcs11.so.0 -# Might also want to install the firmware tarball, scripts to use it, .... +# Still need scripts to do something useful with the firmware tarball diff --git a/source/sw/pkcs11 b/source/sw/pkcs11 index 3118c13..f13948e 160000 --- a/source/sw/pkcs11 +++ b/source/sw/pkcs11 @@ -1 +1 @@ -Subproject commit 3118c1384c46140269033ea63faa6ebca9a3af5a +Subproject commit f13948ea98afb9cb1e8ea0f7a15554621c1fe08a -- cgit v1.2.3