Skip to content

Commit

Permalink
Removed use of format-sdcard script
Browse files Browse the repository at this point in the history
  • Loading branch information
danngreen committed Oct 6, 2023
1 parent 74ab305 commit a4de8db
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 57 deletions.
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,29 +244,25 @@ ls -l build/fsbl.stm32
## 3) Loading the bootloader onto your SD card

Now you need to format and partition an SD card. Insert a card and do:
```
## Linux:
mkfs.fat -F 32 /dev/sdX

## MacOS:
diskutil eraseDisk FAT32 BAREMETA /dev/disk#
```
Where /dev/sdX or /dev/disk# is the actual device name, such as /dev/sdc or /dev/disk3.
scripts/partition-sdcard.sh /dev/XXX
```

_If you need to find out what the device is, you can type `ls -l /dev/sd` or `ls -l /dev/disk` and then hit Tab.
Or, on macOS you can type `mount` instead of `ls -l /dev/disk<TAB>`
Take note of what it lists. Then remove (or insert) the SD card, and repeat the command. Whatever changed is the SD card's device name(s). Use the base name, e.g. /dev/sdc, not /dev/sdc3._
Where /dev/XXX is the actual device name, such as /dev/sdc or /dev/disk3.
Take care to get the device name right because the script will FULLY ERASE
whatever device you tell it!

You also could use the script `format-sdcard.sh`, though it's just a wrapper around the above commands.
This script will create four partitions, and format the fourth to FAT32.

I recommend you eject and re-insert the card at this point (you might get some cryptic errors if you don't).
_If you need to find out what the device is, you can type `ls -l /dev/sd` or
`ls -l /dev/disk` and then hit Tab. Or, on macOS you can type `mount` instead
of `ls -l /dev/disk<TAB>` Take note of what it lists. Then remove (or insert)
the SD card, and repeat the command. Whatever changed is the SD card's device
name(s). Use the base name, e.g. /dev/sdc, not /dev/sdc3._

Then run the script to partition the drive
```
scripts/partition-sdcard.sh /dev/XXX
```
...where /dev/XXX is the SD card device name such as /dev/sdc or /dev/disk2
This script will create four partitions, and format the fourth to FAT32.
I recommend you eject and re-insert the card at this point (you might get some
cryptic errors if you don't).

Then run the script to copy the bootloader to the first two or three partitions:

Expand Down
37 changes: 0 additions & 37 deletions scripts/format-sdcard.sh

This file was deleted.

15 changes: 12 additions & 3 deletions scripts/partition-sdcard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ fi

echo ""
echo "Device $1 found, removing partitions"

echo "sudo sgdisk -Z $1"
sudo sgdisk -g $1 || exit

echo "sudo sgdisk -o $1"
sudo sgdisk -o $1
sudo sgdisk -o $1 || exit

echo ""
echo "Partitioning..."
echo "sudo sgdisk --resize-table=128 -a 1 -n 1:34:545 -c 1:fsbl1 -n 2:546:1057 -c 2:fsbl2 -n 3:1058:5153 -c 3:ssbl -N 4 -c 4:prog -p $1"
sudo sgdisk --resize-table=128 -a 1 -n 1:34:545 -c 1:fsbl1 -n 2:546:1057 -c 2:fsbl2 -n 3:1058:5153 -c 3:ssbl -N 4 -c 4:prog -p $1
echo "sudo sgdisk --resize-table=128 -a 1 -n 1:34:545 -c 1:fsbl1 -n 2:546:1057 -c 2:fsbl2 -n 3:1058:17441 -c 3:ssbl -N 4 -c 4:prog -p $1"
sudo sgdisk --resize-table=128 -a 1 \
-n 1:34:545 -c 1:fsbl1 \
-n 2:546:1057 -c 2:fsbl2 \
-n 3:1058:17441 -c 3:ssbl \
-N 4 -c 4:prog \
-p $1

echo ""
echo "Formatting partition 4 as FAT32"
Expand Down

0 comments on commit a4de8db

Please sign in to comment.