Build SD card image file

This commit is contained in:
Joris van Rantwijk 2024-10-14 21:38:13 +02:00
parent 8d2b414d57
commit 18df83caf7
3 changed files with 30 additions and 0 deletions

1
sw/.gitignore vendored
View File

@ -1,3 +1,4 @@
puzzlefw_sdcard.img
devicetree/devicetree.dtb
buildroot_overlay/opt/puzzlefw/bin/puzzlecmd
buildroot_overlay/opt/puzzlefw/bin/remotectl

28
sw/23_sdcard_image.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e
. script_env
# Delete stale output file.
rm -f "$SDCARD_IMG"
# Create empty SD card image.
dd if=/dev/zero of="$SDCARD_IMG" bs=1M seek=507 count=1
# Create partition table.
cat <<END | /sbin/sfdisk "$SDCARD_IMG"
label: dos
start=8192, size=512000, type=e
start=524288, size=512000, type=83
END
# Create DOS partition.
/sbin/mkdosfs -F 16 --offset 8192 ${SDCARD_IMG} 256000
# Copy files to SD card.
mcopy -i ${SDCARD_IMG}@@4M ${SDCARD_DIR}/* ::
# Create empty ext4 partition for configuration.
/sbin/mke2fs -t ext4 -b 4096 -E offset=$((524288 * 512)) ${SDCARD_IMG} 256000k

View File

@ -16,6 +16,7 @@ LINUX_DIR="linux-xlnx"
BOOTIMG_DIR="boot_img"
SDCARD_DIR="sdcard_files"
SDCARD_IMG="puzzlefw_sdcard.img"
XSA_FILE="../fpga/redpitaya_puzzlefw.xsa"
FIRMWARE_FILES="../fpga/puzzlefw_top.bit.bin ../fpga/puzzlefw_top_4ch.bit.bin"