Mounting a MicroSD card

Overview

Jason Mac Mullan kindly develops and maintains the SAGA SDCard Driver to be used with the MicroSD slot of the Vampire boards. This device can be used as an additional disk for use with your AmigaOS 3.x setup.

  • The driver is still in a beta stage. Always BACK UP your data before using such a piece of software, until you are sure that everything works as expected.
It is possible to insert standard-size SD cards into the MicroSD slot using a simple adapter (explained here). Therefore, for brevity, the “Micro” prefix will be omitted, and only “SD card” will be used in this article.

Important notes

The current SAGA SD Driver does NOT implement - in its current version - the AUTOMATIC disk drive geometry methods that would allow AmigaOS DOSDrivers MountLists to use some handy default values. As a consequence, keep in mind that:

  1. MountList attributes such as LowCyl, HighCyl and some others must be explicitly specified. For example, LowCyl = 0 will NOT work!
  2. Each SD card must use its own MountList. NEVER use a MountList dedicated to a given SD card with another SD card.
  3. Use a third-party program, such as GiggleDisk, to create correct MountList by reading the lowlevel geometry of the disk.

1) Install the required files

The installation of the SDCard on the Vampire requires some files, provided in the SAGA driver package and some additional tools available on Aminet. Please, follow the following procedure step by step:

1.1) Install the SAGA SD Driver

  1. Run the installer provided in the SAGADriver package.

1.2) Install SCSIQuery (optional)

  1. Download SCSIQuery, available on Aminet.
  2. Copy the file SCSIQuery/SCSIQuery to C:SCSIQuery

1.3) Install the desired filesystem

Recommended filesystem: PFS3 All-In-One

  1. Download PFS3AIO, available on Aminet.
  2. Copy the file pfs3_aio-handler to L:pfs3_aio-handler.
  3. Download PFS3_53, available on Aminet.
  4. Copy the file PFS3/tools/pfsformat to C:pfsformat.
  5. Optionally, you can copy the other PFS tools (pfsdoctor, setfnsize, …) to C:.

Other filesystems to consider:

1.4) Reboot your computer


2) Check the SD card

The SAGA SD Driver (sagasd.device) provides a method to READ GEOMETRY of the disk. First step is to check if your SD card is compatible or not.

  1. Insert your card into the dedicated Vampire MicroSD slot.
  2. Open a CLI (newcli).
  3. Type SDDiag.
    • If you get an error, then your card will NOT work with the driver.
    • If you get information such as Block Size, Blocks and Capacity, then your card should work with the driver.
  4. Additionally, type SCSIQuery to double-check the geometry of your SDCard.
    • Check if Capacity in blocks is the same as Blocks shown in SDDiag.
    • Check if Block length is the same as Block Size shown in SDDiag.
    • If there are differences, something is wrong and should be reported in the Apollo Forum.


3) Prepare the SD card

Different options for different uses:

  • Prepare the card on Vampire using HDToolBox with a given filesystem.
    • See “Tutorial: Preparing the SD card on a Vampire” below for a detailed guide.
  • Prepare the card on WinUAE or FS-UAE using HDToolBox with a given filesystem.
  • Prepare the card on Windows with the FAT32 filesystem.
  • Prepare the card on Linux with the ext2 or ext3 filesystem.
    • If you want to prepare the card on Linux with the FAT32 filesystem, see “Issue: Preparing the SD card with FAT32 on Linux” below.

4) Prepare and run MountLists for the SD card

  1. Insert your card into the dedicated Vampire MicroSD slot.
  2. Open a CLI (newcli).
  3. Type Execute SYS:System/SDMountOnOff.
    • This script uses C:GiggleDisk to read the SD partitions table, and creates one MountList per partition in T:SDMount directory.
    • GiggleDisk should detect each partition's filesystem automatically, as long as you have that filesystem installed.
    • The script then attempts to mount each partition.
  4. Type CD T:SDMount.
  5. Type Dir.
  6. Type Ed SD0.
    • Ensure that the FileSystem attribute has been set correctly.
    • Repeat this verification for the other partitions in that directory (SD1, SD2, etc.).
  7. Type Copy ALL TO SYS:Storage/DOSDrivers/ to store the MountLists permanently.
  8. After every reboot, you will need to re-mount the SD partitions by running Mount SYS:Storage/DOSDrivers/SD?. If you want to mount them automatically during boot, type Copy ALL TO DEVS:DOSDrivers/ while you are still in the T:SDMount directory.
  9. Reboot.
  10. If the partitions have not already been formatted, they will appear Uninitialized after mounting them, and you will need to format them.

Tutorial: Preparing the SD card on a Vampire

For this tutorial, we will create a single partition, and format it with the PFS3 filesystem.

  1. Insert your card into the dedicated Vampire MicroSD slot.
  2. Open a CLI (newcli).
  3. Type SYS:Tools/HDToolBox device=sagasd.device.
  4. HDToolBox should open the GUI and show SAGASD, Vampire SAGA-SD.
  5. Click on this item in the list and then click the Install Drive button.
  6. Confirm the Warning requester.
  7. Click New in the requester if the disk already has an RDB.
  8. The program now shows the Drive Definition for SAGASD.
    • Information is read by the sagasd.device and should be correct, no need to modify anything.
  9. Click Install button and wait for a small delay.
  10. Click Partition Drive button.
  11. Select '1' in the Default Setup ComboBox, for a single partition.
  12. Change Buffers to '150'.
  13. Change Partition Name to SD0.
  14. Ensure Bootable is NOT checked.
  15. Click Add / Update button.
  16. Delete all items (filesystems) in the list.
  17. Click Add new File System… and select L:pfs3_aio-handler.
  18. Modify the Identifier 0x444F5303 to 0x50445303.
  19. Ensure Version is '18.0'.
  20. Click Ok button.
  21. Click Change… button.
  22. Select PDS\03 in the File System ComboBox.
  23. Click Save button.
  24. Click Exit button.
  25. Reboot.
  26. Follow the instructions under “Prepare and run MountLists for the SD card” above.
    • For formatting the mounted partition, open a CLI (newcli) and type C:PFSFormat DEVICE=SD0 NAME=SDCARD1 QUICK FNSIZE=107.
      • ALWAYS use QUICK option on SDCard devices (true for all non-mechanical devices, including CompactFlash).
      • FNSIZE stands for 'FileName Size'; max is 107 chars with PFS.

Issue: Preparing the SD card with FAT32 on Linux

If you are using mkfs on Linux to create an SD card partition with the FAT32 filesystem, then mkfs.vfat will write the string mkfs.fat into the OEM Name field of the boot sector (superblock). However, GiggleDisk on the Amiga expects to see either the MSWIN?.? pattern or the MSDOS?.? pattern in that field, where ? can be any character.

The OEM Name field is an 8-byte string that starts at byte location 3 (the 4th byte) of the boot sector. If you could overwrite this field with an “expected” string, then your SD card partition would be recognized by GiggleDisk correctly. This can be accomplished using the dd command on Linux.

Using the dd command is dangerous. It could lead to data loss if used incorrectly. You are at your own risk.

Example:

echo -n "MSWIN4.1" | sudo dd of=<sd_partition_device_path> bs=1 seek=3 count=8

where <sd_partition_device_path> is the Linux device path to the correct partition on your SD card, like /dev/mmcblk0p1.

Finding the device path to the SD card partition:

  • If you have mounted the SD card partition manually, then you already know the device path.
  • If Linux has automatically mounted the SD card partition, then you can find out the device path by examining the output of the mount command:
    • Any modern Linux distribution will mount the partition using either the “volume label” (if set) or the “volume serial number”.
    • For example, if the volume label (or serial number) is C8D5-2EC3, you can run the following:
      $ mount | grep "C8D5-2EC3"
      /dev/mmcblk0p1 on /media/steve/C8D5-2EC3 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
    • The device path is in the first column (/dev/mmcblk0p1).

Additional information


Roadmap

  1. Add Automatic disk drive geometry, for much friendlier usage.
  2. Handle on-the-fly Removable disk. Such feature is NOT supported natively by AmigaOS3.x.
  3. Make it Romable so that the OS can boot from SD.

You are here: start » system_tools » microsd

Last modified: le 2019/11/27 06:44