Skip to content

Commit 70b3272

Browse files
authored
Merge pull request #1671 from tlaurion/nix_qemu-canokey_derivate
flake.nix + qemu.mk : add working qemu-canokey usable from all qemu boards by default
2 parents 1e583e0 + c73692e commit 70b3272

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ commands:
4545
jobs:
4646
prep_env:
4747
docker:
48-
- image: tlaurion/heads-dev-env:v0.1.4
48+
- image: tlaurion/heads-dev-env:v0.1.6
4949
resource_class: large
5050
working_directory: ~/heads
5151
steps:
@@ -111,7 +111,7 @@ jobs:
111111

112112
build_and_persist:
113113
docker:
114-
- image: tlaurion/heads-dev-env:v0.1.4
114+
- image: tlaurion/heads-dev-env:v0.1.6
115115
resource_class: large
116116
working_directory: ~/heads
117117
parameters:
@@ -139,7 +139,7 @@ jobs:
139139

140140
build:
141141
docker:
142-
- image: tlaurion/heads-dev-env:v0.1.4
142+
- image: tlaurion/heads-dev-env:v0.1.6
143143
resource_class: large
144144
working_directory: ~/heads
145145
parameters:
@@ -160,7 +160,7 @@ jobs:
160160

161161
save_cache:
162162
docker:
163-
- image: tlaurion/heads-dev-env:v0.1.4
163+
- image: tlaurion/heads-dev-env:v0.1.6
164164
resource_class: large
165165
working_directory: ~/heads
166166
steps:

flake.nix

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,21 @@
6969
zlib
7070
zlib.dev
7171
] ++ [
72-
# Packages for qemu support with Canokey integration.
72+
# Below are overrides to make canokey-qemu library available to qemu built derivative through a qemu override, which qemu is used for other derivatives
73+
canokey-qemu # Canokey lib for qemu build-time compilation.
74+
(qemu.override {
75+
canokeySupport = true; # This override enables Canokey support in QEMU, resulting in -device canokey being available.
76+
})
77+
# Packages for qemu support with Canokey integration from previous override
7378
#qemu_full #Heavier but contains qemu-img, kvm and everything else needed to do development cycles under docker
7479
qemu # To test make BOARD=qemu-coreboot-* boards and then call make BOARD=qemu-coreboot-* with inject_gpg statement, and then run statement.
7580
qemu_kvm # kvm additional support for qemu without all the qemu-img and everything else under qemu_full
76-
#
77-
# TODO: make work qemu-canokey not existing in caches:
78-
# Below are overrides to make canokey-qemu library availabe to qemu built derivative through override)
79-
#canokey doesn't work still even if compiled in, so no reason to add 1Gb of stuff in the image (qemu -device canokey not exposed even if configured in)
80-
#canokey-qemu # Canokey lib for qemu build-time compilation.
81-
#(qemu.override {
82-
# canokeySupport = true; # This override enables Canokey support in QEMU, resulting in -device canokey being available.
83-
#})
8481
] ++ [
8582
# Additional tools for debugging/editing/testing.
8683
vim # Mostly used amongst us, sorry if you'd like something else, open issue.
8784
swtpm # QEMU requirement to emulate tpm1/tpm2.
8885
dosfstools # QEMU requirement to produce valid fs to store exported public key to be fused through inject_key on qemu (so qemu flashrom emulated SPI support).
86+
#diffoscope #should we include it? Massive:11 GB uncompressed. Wow?!?!
8987
] ++ [
9088
# Tools for handling binary blobs in their compressed state. (blobs/xx30/vbios_[tw]530.sh)
9189
bundler

targets/qemu.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ endif
2626

2727
#borrowed from https://github.com/orangecms/webboot/blob/boot-via-qemu/run-webboot.sh
2828
TPMDIR=$(build)/$(BOARD)/vtpm
29+
CANOKEY_DIR=$(build)/$(BOARD)
2930
$(TPMDIR)/.manufacture:
3031
mkdir -p "$(TPMDIR)"
3132
$(SWTPM_PRESETUP)
@@ -74,6 +75,10 @@ else ifeq "$(USB_TOKEN)" "LibremKey"
7475
QEMU_USB_TOKEN_DEV := -device usb-host,vendorid=12653,productid=19531
7576
else ifneq "$(USB_TOKEN)" ""
7677
QEMU_USB_TOKEN_DEV := -device "usb-host,$(USB_TOKEN)"
78+
# If no USB token is specified, support canokey by default
79+
else
80+
# official instruction -usb -device canokey,file=$HOME/.canokey-file -device canokey
81+
QEMU_USB_TOKEN_DEV := -usb -device canokey,file=$(CANOKEY_DIR)/.canokey-file
7782
endif
7883

7984
run: $(TPMDIR)/.manufacture $(ROOT_DISK_IMG) $(MEMORY_SIZE_FILE) $(USB_FD_IMG)
@@ -106,4 +111,4 @@ run: $(TPMDIR)/.manufacture $(ROOT_DISK_IMG) $(MEMORY_SIZE_FILE) $(USB_FD_IMG)
106111
$(QEMU_USB_TOKEN_DEV) \
107112

108113
stty sane
109-
@echo
114+
@echo

0 commit comments

Comments
 (0)