Skip to content

Creating MicroSD Card ‐ Obsolete

siffland edited this page Sep 22, 2023 · 1 revision

WITH THE ADDITION OF FAT32 THIS PAGE IS OBSOLETE FOR VERSIONS AFTER NESTANG 0.6

Prerequisites

  • Python3 installed
  • Python Pillow installed
  • Nintendo Entertainment System Compatible ROMs
  • Etcher (or another image writing program)

Using the nes2img.py Utility on *nix system

  1. Download the nestang repository from Nestang, and extract the zip file to a computer that has Python3 installed or clone the repository with git.
  2. Legally obtain Nintendo Entertainment System Compatible ROMs and save them on the computer where Python3 is installed.
  3. Utilize the nes2img.py script to generate an IMG file suitable for writing to a microSD card using Etcher.

Examples:

  • Adding a single file
user@machine [tools]$ python3 nes2img.py -o /tmp/single.img /tmp/roms/homebrew_1.nes 
/tmp/roms/homebrew_1.nes
Number of menu pages: 1
Done.
user@machine [tools]$ 
  • adding multiple files
user@machine [tools]$ python3 nes2img.py -o /tmp/multiple.img /tmp/roms/homebrew_1.nes /tmp/roms/homebrew_2.nes /tmp/roms/homebrew_3.nes
/tmp/roms/homebrew_1.nes
/tmp/roms/homebrew_2.nes
/tmp/roms/homebrew_3.nes
Number of menu pages: 1
Done.
user@machine [tools]$
  • adding an entire directory
user@machine [tools]$ find /tmp/roms -type f -print0 | sort -z | xargs -0 python3 nes2img.py -o /tmp/directory.img
/tmp/roms/homebrew 1.nes
/tmp/roms/homebrew 2.nes
/tmp/roms/homebrew 3.nes
/tmp/roms/homebrew 4.nes
/tmp/roms/homebrew 5.nes
Number of menu pages: 1
Done.
user@machine [tools]$

Write the .img file to a microSD card with Etcher (or other suitable program).

NOTES:

  • Please note that the provided commands assume a *nix system and may require adjustments when used on a Windows system. Windows uses different slashes for file paths and includes drive letters, so users should be cautious and modify the commands accordingly when running them on Windows.
  • The ROMs are written in the order they are passed to the script and are not automatically sorted alphabetically. They will be displayed in that order in the menu.
  • To ensure the proper execution of nes2img.py, it is necessary to run the command from within the tools directory, as it relies on other Python libraries imported from that specific location.
  • Please be aware that Etcher might display a warning message indicating that the IMG file is not bootable. This behavior is expected since the microSD card image is intended solely for storing ROMs and does not serve as a bootable system.
  • To simplify the execution of nes2img.py, you can make the script executable using the following chmod command: chmod +x nes2img.py. By running this command, you will no longer need to type "python3" before executing nes2img.py. Instead, you can directly run the script by typing ./nes2img.py.
  • The menu will show the file name without the ".nes" extension. However, please note that the menu can only display the first 29 characters of the file name. Filenames can also contain spaces.
  • The menu is presented in multiple pages, each consisting of 20 entries.