Add script for creating verilog filesystem image

This commit is contained in:
Byron Lathi
2023-10-06 06:48:47 -07:00
parent 2b98ad1522
commit 2084054d3d
2 changed files with 45 additions and 0 deletions

3
sw/.gitignore vendored
View File

@@ -53,3 +53,6 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf
# Filesystem Images
*.fat

View File

@@ -0,0 +1,42 @@
#!/bin/bash
BOOTLOADER=../bios/bootloader.bin
FILE=fs.fat
TMPMOUNT=/tmp/lo
FSDIR=../fsdir
V=-v
# Smallest number of blocks where mkfs doesn't complain
BLOCKS=33296
rm $FILE
echo "$(tput bold setaf 11)Creating Filesystem$(tput sgr 0)"
mkfs.vfat $V -I -F32 -C $FILE -n SUPER6502 $BLOCKS
echo
echo "$(tput bold setaf 11)Modifying Boot Sector$(tput sgr 0)"
dd if=$BOOTLOADER of=$FILE bs=1 conv=notrunc count=11 $STATUS
dd if=$BOOTLOADER of=$FILE bs=1 conv=notrunc count=380 seek=71 skip=71 $STATUS
echo "$(tput bold setaf 11)Mounting Device$(tput sgr 0)"
mkdir $V -p $TMPMOUNT
sudo mount $FILE $TMPMOUNT
echo
echo "$(tput bold setaf 11)Copying Files$(tput sgr 0)"
sudo cp $V -r $FSDIR/* $TMPMOUNT
echo
echo "$(tput bold setaf 11)Unmounting Device$(tput sgr 0)"
sudo umount $V $FILE
rmdir $V $TMPMOUNT
echo
echo "$(tput bold setaf 11)Converting Image to Verilog$(tput sgr 0)"
objcopy --input-target=binary --output-target=verilog $FILE $FILE.hex
echo "$(tput bold setaf 10)Done!$(tput sgr 0)"