Skip to content

Instantly share code, notes, and snippets.

@shauninman
Created November 10, 2023 02:51
Show Gist options
  • Save shauninman/5a801ff9acdc14cf2cc391f5e1a61b66 to your computer and use it in GitHub Desktop.
Save shauninman/5a801ff9acdc14cf2cc391f5e1a61b66 to your computer and use it in GitHub Desktop.
rg35xx-stock-expand-ROMS-partition-macos
Note: Commands that are prefaced with one backtick (`) are entered directly into the terminal. Commands with two backticks (``) are entered into the gdisk prompt. Each step is explained in English with the corresponding terminal command below it. This was done on MacOS 12.3 Monterey with an M1 processor but should work without problem on any modern MacOS, M1 or otherwise. You will end up formatting the ROM partition completely, so it is best to do this before you waste time copying any rom files over.
1. Back up the CFW folder from the ROMS partition. If the image named both partitions "No Name" rename the one with the CFW folder "ROMS" and the other partition "MISC" before starting this. This can be done in the Finder just like renaming any other file.
2. Install gdisk using homebrew. If you don't have Homebrew already installed please visit https://brew.sh/ for details on how to install it.
`brew install --cask gdisk
3. Use diskutil to get the list of mounted drives and look for the micro SD card path, mine was /dev/disk4 and had four partitions on it
`diskutil list
4. Launch gdisk, you must use sudo. If you don't use sudo it won't stop you from launching it but it will fail on some of the later steps.
`sudo gdisk
5. gdisk will ask you what device filename, type in the path from diskutil
``/dev/disk4
6. Enter the Print command to verify we have loaded the right disk, should see your four partitions
``p
7. Enter Xpert mode to access a command we need
``x
8. Enter e to move backup data structurs to end of disk
``e
9. Exit xpert mode with m and return to main menu
``m
10. We are going to delete the 'ROM' partition from the GPT table by entering Delete mode
``d
11. It's going to ask what partition we want to delete. For me the ROM partition was 4 (verify yours from the initial print command but it should also be 4)
``4
12. (Optional) Enter print command again to verify that we have deleted the correct partition. Remember nothing takes effect until we save and quit, so if there is a mistake just quit without saving (q) and start again.
``p
13. Enter Create New Partition mode
``n
14. It's going to ask you where you want to create the new partition, enter 4
``4
15. It's going to ask you the first and last sector, press enter on both of these to use the default values of start of the largest available block for the start sector and the end of the same block for the end sector.
``enter
``enter
16. It's going to ask you for a hex code, you're goign to give it 0700 for "Microsoft Basic Data" as the partition is FAT32.
``0700
17. (Optional) Enter print command again to verify that we have recreated the correct partition and that it has the correct size of roughly whatever the rest of your drive space is. Remember nothing takes effect until we save and quit, so if there is a mistake just quit without saving (q) and start again.
``p
18. Enter write mode, this will make the changes to your disk. This is your last chance to quit without breaking anything (q) if you have noticed a mistake during the print step.
``w
19. It will ask you to confirm that you want to overwrite the partitions.
``Y
20. It will re-write the partitions pretty quickly, at this point you'll have to eject the device and restart your Mac for the new partition table to be read correctly. (Restart may not be necessary...)
21. Open Disk Utility and you should now be able to erase the ROMS partition easily using the GUI. Do this, and then re-copy the CFW folder and any rom files you want to the partition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment