Skip to content

Commit 228c52f

Browse files
committed
add flash and format for an file on disk
Being able to make an file of the output for testing under qemu or similar is useful. Copy the card flashing and just target an IMGFILE= parameteter. Example: dd if=/dev/zero of=output.img bs=1G count=8 make IMGFILE=output.img flash-file Signed-off-by: Ben Dooks <[email protected]>
1 parent 8721bc6 commit 228c52f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ format-sd: $(SDDEVICE)
142142
@test -n "$(SDDEVICE)" || (echo 'SDDEVICE must be set, Ex: make flash-sdcard SDDEVICE=/dev/sdc' && exit 1)
143143
sgdisk --clear -g --new=1:$(FWPAYLOAD_SECTORSTART):$(FWPAYLOAD_SECTOREND) --new=2:$(UIMAGE_SECTORSTART):${UIMAGE_SECTOREND} --typecode=1:3000 --typecode=2:8300 $(SDDEVICE)
144144

145+
# flash-file and format-file are basically the same as the sdcard ones but aum to use a file
146+
147+
flash-file: format-file
148+
dd if=$(RISCV)/fw_payload.bin of=$(IMGFILE) seek=${FWPAYLOAD_SECTORSTART} status=progress conv=notrunc bs=512
149+
dd if=$(RISCV)/uImage of=$(IMGFILE) seek=$(UIMAGE_SECTORSTART) status=progress conv=notrunc bs=1
150+
151+
format-file:
152+
@test -n "$(IMGFILE)" || (echo 'IMGFILE must be set, Ex: make format-file IMGFILE=output.img' && exit 1)
153+
sgdisk --clear -g --new=1:$(FWPAYLOAD_SECTORSTART):$(FWPAYLOAD_SECTOREND) --new=2:$(UIMAGE_SECTORSTART):${UIMAGE_SECTOREND} --typecode=1:3000 --typecode=2:8300 $(IMGFILE)
154+
145155
# specific recipes
146156
gcc: $(CC)
147157
vmlinux: $(RISCV)/vmlinux

0 commit comments

Comments
 (0)