Skip to content

Commit

Permalink
Rename final artifacts. Add sha256sum.
Browse files Browse the repository at this point in the history
  • Loading branch information
szszszsz committed Jul 30, 2021
1 parent 6e6319a commit 62af34d
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ include build.mk

GIT=$(shell git describe)
FIRMWARE=nitrokey-storage-$(GIT).hex
FIRMWARE_CLEAN=nitrokey-storage-$(GIT)-reproducible.hex

all: firmware.hex $(FIRMWARE) firmware_info firmware.lss firmware-extended.hex
ls -lh $<
all: $(FIRMWARE_CLEAN) $(FIRMWARE) firmware_info firmware.lss sha256sum
-rm firmware.hex firmware-extended.hex
ls -lh *hex *sha256sum
@cat sha256sum

#%.sha256sum: %
# sha256sum $< > $@

sha256sum: $(FIRMWARE_CLEAN) $(FIRMWARE)
sha256sum $^ > $@

$(FIRMWARE): firmware-extended.hex
cp $< $@

.PHONY: clean_artifacts
clean_artifacts:
-rm *sha256sum *hex

.PHONY: clean
clean:
-rm $(OBJS) $(OBJSASM) $(STATEFILES)
Expand All @@ -34,9 +47,9 @@ USB_MASS.elf: $(OBJS) $(OBJSASM)
@$(RUNASM) -o $@ $<

.PHONY: firmware_info
firmware_info: | pipenv firmware.hex
-cd ../tools && pipenv run ./randomize_empty_space.py status --firmware-file ../src/firmware.hex
-cd ../tools && pipenv run ./randomize_empty_space.py status --firmware-file ../src/firmware-extended.hex
firmware_info: | pipenv $(FIRMWARE_CLEAN) $(FIRMWARE)
-cd ../tools && pipenv run ./randomize_empty_space.py status --firmware-file ../src/$(FIRMWARE_CLEAN)
-cd ../tools && pipenv run ./randomize_empty_space.py status --firmware-file ../src/$(FIRMWARE)

firmware.lss: USB_MASS.elf
$(OBJDUMP) -h -S $< > $@
Expand All @@ -47,10 +60,10 @@ pipenv:
cd ../tools && pipenv install --python `which python3`
touch $@

firmware-extended.hex: | pipenv firmware.hex
cd ../tools && pipenv run ./randomize_empty_space.py fill-empty --random-data random.bin --firmware-file ../src/firmware.hex --output-file-name ../src/firmware-extended
firmware-extended.hex: | pipenv $(FIRMWARE_CLEAN)
cd ../tools && pipenv run ./randomize_empty_space.py fill-empty --random-data random.bin --firmware-file ../src/$(FIRMWARE_CLEAN) --output-file-name ../src/firmware-extended

firmware.hex: USB_MASS.elf
$(FIRMWARE_CLEAN): USB_MASS.elf clean_artifacts
ls -l $<
$(OBJCOPY) -R .eeprom -O ihex $< $@

Expand Down

0 comments on commit 62af34d

Please sign in to comment.