Add scripts
automates the process of overwriting the boot sector of the SD card and copying over the filesystem.
This commit is contained in:
19
sw/script/copy_files.sh
Normal file
19
sw/script/copy_files.sh
Normal file
@@ -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
|
||||
23
sw/script/format_disk.sh
Normal file
23
sw/script/format_disk.sh
Normal file
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user