Question Can you copy your EmuNAND to your SysNAND?

Discussion in 'Switch - Exploits, Custom Firmwares & Soft Mods' started by benfah, Jun 24, 2019.

  1. benfah
    OP

    benfah Newbie

    Newcomer
    1
    Jun 23, 2019
    Germany
    Hello guys,
    I'm currently facing a problem, that my SysNAND is bricked and I'm missing BOOT1.bin to restore my nand, yet my EmuNAND is intact. So, is there currently any way to Copy your EmuNAND to your SysNAND?

    Thanks in advance,
    benfah :)

    Edit: I was able to restore my nand backup, because I made a backup of my BOOT0/1 and used the BOOT1 from the fresh backup with the BOOT0 of my old backup.
     
    Last edited by benfah, Jun 24, 2019
  2. ksanislo

    ksanislo GBAtemp Fan

    Member
    3
    Feb 23, 2016
    United States
    Seattle, WA
    In case someone else needs this still, you can use the following bash script on a Mac or Linux computer to extract an emuMMC partition into files that can be restored to your sysMMC.


    #!/bin/bash
    # The device node for your sd card, yours may be different.
    device=/dev/disk3

    # emummc_sector from your .ini in decimal, not hex. 0x2 == 2 is the default SX location.
    offset=2

    #################################################################
    # These values shouldn't change unless there's new hardware revision with a different size internal storage.
    # All of these are in bytes.
    sectorsize=512
    nandsize=31276924928
    maxsize=2147483648
    bootsize=4194304

    # The position is counted in sectors, not bytes.
    position=0

    # Dump our BOOT0 file
    dd bs=${sectorsize} if=${device} of=BOOT0 skip=$(( ${offset} + ${position} )) count=$(( ${bootsize}/${sectorsize} ))
    position=$(( ${position} + ${bootsize}/${sectorsize} ))

    # Dump our BOOT1 file
    dd bs=${sectorsize} if=${device} of=BOOT1 skip=$(( ${offset} + ${position} )) count=$(( ${bootsize}/${sectorsize} ))
    position=$(( ${position} + ${bootsize}/${sectorsize} ))

    # This loops over the rest and dumps the rawnand.bin.* files
    while [ ${position} -lt $(( ${nandsize}/${sectorsize} )) ] ; do
    if [ $(( ${position} + ${maxsize}/${sectorsize} )) -gt $(( ${nandsize}/${sectorsize} )) ] ; then
    sectors=$(( ${nandsize}/${sectorsize} - ${position} ))
    else
    sectors=$(( ${maxsize}/${sectorsize} ))
    fi

    filename=$( printf "rawnand.bin.%02d" $(( (${position} - ${bootsize}/${sectorsize} * 2) / (${maxsize}/${sectorsize}) )) )

    dd bs=${sectorsize} if=${device} of=${filename} skip=$(( ${offset} + ${position} )) count=${sectors}
    position=$(( ${position} + ${sectors} ))
    done
     
    benfah and thaikhoa like this.
Loading...