diff --git a/sw/script/copy_files.sh b/sw/script/copy_files.sh new file mode 100644 index 0000000..17bc144 --- /dev/null +++ b/sw/script/copy_files.sh @@ -0,0 +1,19 @@ +DEVICE=/dev/mmcblk0 +TMPMOUNT=/tmp/sd +FSDIR=fsdir + +V= + +echo "$(tput bold setaf 11)Mounting Device$(tput sgr 0)" +mkdir $V -p $TMPMOUNT +sudo mount $V $DEVICE $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 $DEVICE +rmdir $V $TMPMOUNT +echo \ No newline at end of file diff --git a/sw/script/format_disk.sh b/sw/script/format_disk.sh new file mode 100644 index 0000000..99b82a6 --- /dev/null +++ b/sw/script/format_disk.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +BOOTLOADER=bootloader/bootloader.bin +DEVICE=/dev/mmcblk0 +TMPBOOTSECT=/tmp/bootsect +TMPMOUNT=/tmp/sd + +V= +STATUS="status=none" + +echo "$(tput bold setaf 11)Creating Filesystem$(tput sgr 0)" +sudo mkfs.vfat -F32 $DEVICE -n SUPER6502 $V +echo + +echo "$(tput bold setaf 11)Modifying Boot Sector$(tput sgr 0)" +sudo dd if=$DEVICE of=$TMPBOOTSECT bs=512 count=1 $STATUS +sudo dd conv=notrunc if=$BOOTLOADER of=$DEVICE bs=512 skip=0 count=1 $STATUS +sudo dd conv=notrunc if=$TMPBOOTSECT of=$DEVICE bs=1 skip=0 count=90 iflag=skip_bytes,count_bytes $STATUS +sudo dd conv=notrunc if=$BOOTLOADER of=$DEVICE bs=1 skip=0 count=3 iflag=skip_bytes,count_bytes $STATUS +echo + +echo "$(tput bold setaf 10)Done!$(tput sgr 0)" +