Tutorial  Updated

Setting up Android with EmuMMC + bigger FAT32 partition.

As the title says, here's the video; I'll do a write up later since it's a long process.



This is not possible in windows 10 due to the GPT Hybrid MBR trickery used, the android image already does this when it writes the partition tables and etc.

Don't do this in windows nor attempt it, it's not going to happen unless there's something you can use to mess with partitions like I did, L4T-Ubuntu also won't work due to the partition stuff and etc, I'm currently making something to allow this without any complications, please be patient!

Watch the entire video and you'll understand more about this, if you make simple errors from not watching the video I will simply tell you to properly watch again and listen!
TOOL ETA: Don't ask, it's a complicated tool that needs a lot of maths, safety features and etc
TOOL SO FAR:
EBa_eq9XUAMnNN5

Tool functions: Android, Custom Android user data, 8GB Android install, Ubuntu, Ubuntu Swap, EmuMMC and Lakka dynamic setup.
Planned functions: Multi EmuMMC setup, EmuMMC Backup & restore(including Nintendo folder) + More unique management stuff!


UPDATE: I'm currently setting aside the tool until I finish making & releasing my new modchip
 
Last edited by TariqSoftDev,

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,648
Country
France
I know you said not to do it on windows, but I'm still curious and as I understand how it works I wanted to try.
but tools are just lacking, or not working as intended.

I used easeUS partition manager, it didn't have ext4 support, only ext3 (what? really? and it's one of the most know on windows).
I found gparted self boot image, and I could create all the needed partition. but I had to use keyboard (no mouse support... the computer I use only have 2 usb port, one for live image, one for flashdrive...)
I'm back on windows, disk manager detects all the partitions, and don't ask to format them which is good (as they don't have a letter assigned to them).

now I decide to use dd for windows, which is the normal step. but no, it doesn't work like intended ! it lists only partitions that windows recognizes ! which means only the fat32 (with or without a letter assigned to it).
dd for windows doesn't have an option to specify the device (like dev/sdb/), but it only lists partitions.
so, again, stuck on a simple step because tools are really bad.

I tried to find other image writer, but they all work with partition and mounted letters (win32imager, winDD, rufus, etc.)
someone suggested to use cygwin, to use the native dd command.
I wonder if it'll work and detect partition on SD card or rely on windows detection again.

I wanted a windows app which let you write binary image to arbitrary sector number, why is it so hard to find?
hexeditor could maybe do it? edit: hm, non I checked.

maybe some console hacking tools? some emuNAND manager written for 3DS could maybe do it.
The only one I found for switch still rely on lettered partition...
@DarkMatterCore might be our last resort to get a tool on windows to manage read/write bin and dump from SD card on arbitrary sector numbers :D
He is willing to add ways to generate/parse INI files in his program. it's already doing it for 3DS on arbitrary sectors, it'll be very easy to update it for switch.


I can't do it from my gparted boot image, because of limited USB Port.
and I can't put the img to write on the FAT32 hos_data (because bigger than 4GB), and I can't have another drive on it. Ah, unless I can mount windows partitions from within gparted boot image? hmm, maybe it'll be possible then, I'll try that. no idea if dd and gdisk is part of the image too.


edit:
I won't be home next 2 weeks, so you'll probably will have your tool released when I'll be back :)
Good luck completing it.
thanks for all your work, and to all users : enjoy it.
to the switch scene : Don't make too much changes while I'm not here, I'll have to catch up ;o
 
Last edited by Cyan,

stoffer666

Well-Known Member
Newcomer
Joined
May 21, 2018
Messages
62
Trophies
0
Age
42
XP
869
Country
Denmark
As the title says, here's the video; I'll do a write up later since it's a long process.



This is not possible in windows 10 due to the GPT Hybrid MBR trickery used, the android image already does this when it writes the partition tables and etc.

Don't do this in windows nor attempt it, it's not going to happen unless there's something you can use to mess with partitions like I did, L4T-Ubuntu also won't work due to the partition stuff and etc, I'm currently making something to allow this without any complications, please be patient!

Watch the entire video and you'll understand more about this, if you make simple errors from not watching the video I will simply tell you to properly watch again and listen!
TOOL ETA: Don't ask, it's a complicated tool that needs a lot of maths, safety features and etc
TOOL SO FAR:
EBa_eq9XUAMnNN5

Tool functions: Android, Custom Android user data, 8GB Android install, Ubuntu, Ubuntu Swap, EmuMMC and Lakka dynamic setup.
Planned functions: Multi EmuMMC setup, EmuMMC Backup & restore(including Nintendo folder) + More unique management stuff!


TOOL GUI ETA: 7 Days from date 08 Aug 2019.

I can confirm that sx ox emunand (files) works. on this setup :-)
 
  • Like
Reactions: lordelan

TariqSoftDev

~Zexceil
OP
Member
Joined
Sep 18, 2013
Messages
716
Trophies
1
Location
London
XP
1,018
Country
I know you said not to do it on windows, but I'm still curious and as I understand how it works I wanted to try.
but tools are just lacking, or not working as intended.

I used easeUS partition manager, it didn't have ext4 support, only ext3 (what? really? and it's one of the most know on windows).
I found gparted self boot image, and I could create all the needed partition. but I had to use keyboard (no mouse support... the computer I use only have 2 usb port, one for live image, one for flashdrive...)
I'm back on windows, disk manager detects all the partitions, and don't ask to format them which is good (as they don't have a letter assigned to them).

now I decide to use dd for windows, which is the normal step. but no, it doesn't work like intended ! it lists only partitions that windows recognizes ! which means only the fat32 (with or without a letter assigned to it).
dd for windows doesn't have an option to specify the device (like dev/sdb/), but it only lists partitions.
so, again, stuck on a simple step because tools are really bad.

I tried to find other image writer, but they all work with partition and mounted letters (win32imager, winDD, rufus, etc.)
someone suggested to use cygwin, to use the native dd command.
I wonder if it'll work and detect partition on SD card or rely on windows detection again.

I wanted a windows app which let you write binary image to arbitrary sector number, why is it so hard to find?
hexeditor could maybe do it? edit: hm, non I checked.

maybe some console hacking tools? some emuNAND manager written for 3DS could maybe do it.
The only one I found for switch still rely on lettered partition...
@DarkMatterCore might be our last resort to get a tool on windows to manage read/write bin and dump from SD card :D


I can't do it from my gparted boot image, because of limited USB Port.
and I can't put the img to write on the FAT32 hos_data (because bigger than 4GB), and I can't have another drive on it. Ah, unless I can mount windows partitions from within gparted boot image? hmm, maybe it'll be possible then, I'll try that. no idea if dd and gdisk is part of the image too.


edit:
I won't be home next 2 weeks, so you'll probably will have your tool released when I'll be back :)
Good luck completing it.
thanks for all your work, and to all users : enjoy it.
to the switch scene : Don't make too much changes while I'm not here, I'll have to catch up ;o

Only way you can do this in windows is to figure out how to make a Hybrid MBR setup on a GPT formatted SD Card, I can teach you a trick to actually mount and load live linux off a FAT32 HDD partition rather than using a usb.
 
  • Like
Reactions: lordelan

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,648
Country
France
the hybrid MBR is really not my most concerned problem, I can create the hybrid MBR manually with an hexeditor. it's very easy (unless unexpected problem happen again, like antivirus preventing MBR edition on all drives, not only system drives).
what seems hard is to find a tool which can write binary image at specific sectors, without the need of a lettered partition. and with a good speed. some writer are very slow because dealing with SD Card low level mmc commands (why?).
for info, balena etcher doesn't work for me, it crashes and stop writing right away (maybe antivirus blocking because it detects/remounts the FAT32 partition right away and want to analyze it while it's still writing the img to SD?)

@DarkMatterCore already has one for 3DS multi NAND dump/restore, and he said he is willing to update his tool to add ini file parsing.
https://github.com/DarkMatterCore/3ds-multinand
I have all the starting sector I need already, I just need a tool to write the bin to SD at these position.

Then, making hybrid MBR is so easy I could even help him if he wants to learn how to create/parse MBR and GPT tables, so his tool could do all at once.
MBR is just First/Last sector, in little endian. it also has CHS value, but apparently it can be faked to FF EF FF
My first FAT32 partition is already MBR (apparently, it's added automatically as fallback by easeUS) so I already have the CHS values for it. but gparted can also provide them if exact values are really needed (they aren't. CHS is not used anymore).

DarkMatterCore : Please, if you have time, could you update your tool ? :)
it has already a lot of checks and bug fixed, and alignment check, administration status check, winXP SP2 check, etc.
I see it's based on rufus, but please don't base it from lettered partition, only from raw device.

let me know the ini format you need.
I have all the start/end sectors numbers for each partition, but I don't need to write all binary image to them because apparently FAT32 and MMC require specific alignment, writing MMC at random sectors might not be good so hekate is better to dump to existing partition.
something like "one per line"
Code:
NXpartitions.ini
sector_start sector_end "path_to_image.bin" [nickname optional, only for read mode]
sector_start sector_end "path_to_image.bin" [nickname optional, only for read mode]
sector value could be hex or decimal, detect whether "0x" is present, or read them from GPT table (not hard, really easy to parse all the info from MBR/GPT! writing MBR is very easy too, writing GPT is very hard). but ini is a good idea in case MMC partition is not in the table.
and for read, maybe it could benefit from similar ini file with sector start-end values, and just let the user pick a folder and name each 1.bin 2.bin, etc., or give a partition nickname in the ini to use as filename or prompt user if missing?


I'm curious about your method to load live linux from hdd, but just point me to a guide or website, I can read about it. and I won't be there for next 2 week so I'll have time to read.
don't bother writing it yourself, it's just by curiosity, I won't do it.
 
Last edited by Cyan,
  • Like
Reactions: lordelan

TariqSoftDev

~Zexceil
OP
Member
Joined
Sep 18, 2013
Messages
716
Trophies
1
Location
London
XP
1,018
Country
the hybrid MBR is really not my most concerned problem, I can create the hybrid MBR manually with an hexeditor. it's very easy (unless unexpected problem happen again, like antivirus preventing MBR edition on all drives, not only system drives).
what's seems hard is to find a tool which can write binary image at specific sectors, without the need of a lettered partition.

@DarkMatterCore already has one for 3DS NAND dump/restore, and he said he is willing to update his tool to add ini file parsing.
I have all the starting sector I need already, I just need a tool to write the bin to SD at these position.

Then, making hybrid MBR is so easy I could even help him if he wants so his tool could do all at once.
MBR is just First/Last sector, in little endian. it also has CHS value, but apparently it can be faked to FF EF FF
My first FAT32 partition is already MBR (apparently, it's added automatically as fallback by easeUS) so I already have the CHS values for it. but gparted can also provide them if exact values are really needed (they aren't. CHS is not used anymore).


I'm curious about your method to load live linux from hdd, but just point me to a guide or website, I can read about it. and I won't be there for next 2 week so I'll have time to read.
don't bother writing it yourself, it's just by curiosity, I won't do it.
Here's a work around I did, create a partition with a drive letter and just write to it; I'm 100% going to be making my tool work in windows by making a C++ program that can create Hybrid MBR and do Sector based disk stuff.

Anyways my main tool for Linux is nearly done so I'll test it with WSL; if it doesn't work then I'll make a guide for people on windows on booting Linux without any USB drive(I use it myself to boot any live environment, it's drag n droppo).

--------------------- MERGED ---------------------------

The tool is about 90% done rn.
 
  • Like
Reactions: lordelan and Cyan

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,648
Country
France
maybe you could use darkmattercore old 3DS dumper project (gpl3) as base for your c++ tool, to prevent writing it entirely?
he has already few checks in places (like verify if elevated admin privilege is available, etc.)
but it's just an idea to speed your work, i you prefer to make your own that's fine. the more option the better :)

edit: I checked the sources, it's heavily based on 3DS nand structure, maybe using rufus as base is cleaner for a new tool.
 
Last edited by Cyan,

lordelan

Well-Known Member
Member
Joined
Jan 4, 2015
Messages
5,784
Trophies
1
Age
44
XP
6,509
Country
Germany
Do you mean the emunand works when the files are just placed on the fat32 partition of the drive instead of the hidden partition setup?
No he's talking about file based emuNAND instead of partition based emuNAND which is an option while creating an emuNAND with SX OS (to put files/folders on SD).
However if you use file based with Atmopshère too, it'll be very slow so partition based is highly recommended!

Edit @All:
Interesting link notimp posted here -> https://forum.xda-developers.com/ni...evelopment/guide-resizing-partitions-t3955615
 
Last edited by lordelan,

stoffer666

Well-Known Member
Newcomer
Joined
May 21, 2018
Messages
62
Trophies
0
Age
42
XP
869
Country
Denmark
How did you get it to work?

Mine just boots to regular hos with no cfw loaded when I select emunand from sx boot options
I just did a copy of my intire card. and followed this guide and made a big fat32 partion and transfered my stuff back :-) it is working very good and i don't see any speed issues with the sx-ox filebased emunand. but i heard that atmoshere is slow if you make a filebased on there emunand solution.

--------------------- MERGED ---------------------------

No he's talking about file based emuNAND instead of partition based emuNAND which is an option while creating an emuNAND with SX OS (to put files/folders on SD).
However if you use file based with Atmopshère too, it'll be very slow so partition based is highly recommended!

Edit @All:
Interesting link notimp posted here -> https://forum.xda-developers.com/ni...evelopment/guide-resizing-partitions-t3955615
I have tried that guide first i could not get gparted to resize the unknown partions.
 

pcwizard7

Well-Known Member
Member
Joined
Aug 2, 2013
Messages
1,409
Trophies
0
XP
1,688
Country
Australia
anyone in windows should use vmware player /workstation or virtualbox to install ubuntu in virtual machine and follow this guide. but use ubuntu 18.04 LTS
 

Gavin_Darkglider

Well-Known Member
Member
Joined
May 20, 2019
Messages
232
Trophies
0
Age
34
XP
581
Country
United States
Ok, I didnt watch the video, as I was the one that wrote the original guide. That being said, the ubuntu boot.scr has changed for reboot to payload options, and you might want to update your tool for that.
New kernel command line options are:
Code:
pmc_reboot2payload.default_payload=<payload.bin in /lib/firmware>
pmc_reboot2payload.reboot_action = <bootloader(hekate, or payload defined above), via-payload(Reboot to payload with ID, recovery(Android use only)>
pmc_reboot2payload.hekate_config_id=<ID defined in boot ini for linux/android/hekate_ipl.ini>

The ID stuff isnt released in hekate yet, but should be in the next week. ;) Feel free to update you script for this.
 
  • Like
Reactions: tabzer

tabzer

This place is a meme.
Member
Joined
Feb 15, 2019
Messages
5,844
Trophies
1
Age
39
XP
4,910
Country
Japan
Is this a script we can add to L4T boot.scr to enable reboot to payload? Is it coming out officially in a patch on the L4T thread, or do I have the wrong idea here?
 

Gavin_Darkglider

Well-Known Member
Member
Joined
May 20, 2019
Messages
232
Trophies
0
Age
34
XP
581
Country
United States
I already pushed the patch, it also includes minerva mini(Minerva patches to linux kernel for periodic retraining), and full minerva in coreboot. along with reboot2payload. I pushed out update 1.5.0 yesterday. here is the link: https://www.dropbox.com/s/54ibwj3id4vj2cc/l4t-ubuntu-1.5.0.zip?dl=0

you also need to set some stuff up in userspace, it is all outlined in a post on this page: https://gbatemp.net/threads/l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/page-98

not just read through that page, and you will find what you are looking for.

Should also mention, that for some reason this breaks s2idle sleepmode. I am going to push a bugfix soon enough, just have to figure out what is causing the issue. I know the go to sleep issue is because of the wifi driver, but if you disable power management there, it still has issues waking sometimes. I am going to start by back porting the latest version into the kernel, and then go from there.
 
  • Like
Reactions: lordelan and tabzer

tabzer

This place is a meme.
Member
Joined
Feb 15, 2019
Messages
5,844
Trophies
1
Age
39
XP
4,910
Country
Japan
This was posted before you posted 1.5.0, saying that you just overwrite:


As promised..... I give you Reboot2Payload update for l4t-ubuntu. This update comes with a little more hassle than the previous updates, but it is worth it.

1. Download and extract this to boot(fat32) partition, should overwrite all ubuntu files there: https://www.dropbox.com/s/6mchw2491c1ek36/l4t-ubuntu-reboot2payload.zip?dl=0

2. boot console.
3. Do everything after this as root
3A. If you are overclocking on boot using /etc/rc.local:
change script to
Code:
#!/bin/bash
echo 1 > /sys/kernel/tegra_cpufreq/overclock
echo  2091000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
echo 1 > /sys/bus/platform/drivers/tegra-reboot2payload/r2p/default_payload
exit 0
3B. If not overclocking:
1. Create /etc/rc.local eg. touch /etc/rc.local
2. make rc.local executable eg. chmod +x /etc/rc.local
3. edit /etc/rc.local to add
Code:
#!/bin/bash
echo 1 > /sys/bus/platform/drivers/tegra-reboot2payload/r2p/default_payload
exit 0
4. copy payload of your choice to /lib/firmware and rename it to reboot_payload.fw

5. if doing this on l4t-ubuntu, run in your root terminal: echo 1 > /sys/bus/platform/drivers/tegra-reboot2payload/r2p/default_payload

6. Now reboot to your payload. There is a custom_payload option, that you can echo the name of another payload also in /lib/firmware into and it will reboot to that payload as well.

Credit goes to:
@Stary#0632 for porting reboot2payload from Atmosphere into Coreboot/ATF/U-boot/Kernel :)
@Gavin_Darkglider for testing, and building update for you guys, and writing this awesome guide.
@Switchroot for the awesome work they are doing in the scene, for both linux and android development

Should also thank the atmosphere developers for creating what was ported as well. ;)

We should do this too, correct?
 
  • Like
Reactions: lordelan

Gavin_Darkglider

Well-Known Member
Member
Joined
May 20, 2019
Messages
232
Trophies
0
Age
34
XP
581
Country
United States
Also, I dont know if you saw my guide on multisdcard setup, but there are a few more things like copying joycon pairing keys from horizon, your script might be able to do. It wasnt in my guide, but the guide for that can be found here: https://lewd.pics/f/c9ec2b60/joyconsbluetoothhowto.txt

That is for android, but you can follow the directions to get the pairing keys and patch them into linux as well. You will also need to patch the bluetooth mac address into the kernel. I havnt had time to find a way to script this, to make it easy though.
 
  • Like
Reactions: tabzer

tabzer

This place is a meme.
Member
Joined
Feb 15, 2019
Messages
5,844
Trophies
1
Age
39
XP
4,910
Country
Japan
the reboot2payload works like a charm! as the kinks get ironed out, I am hopeful that it will find its way into lakka and lineageOS.

As for the preserving the joycon keys across the systems, it will probably be impossible to keep pair settings consistent between OFW and CFW. So if we were able to preserve bluetooth keys across all other OSs, we'd have to use different joycons for using OFW if we don't want to go through the hassle of redoing the setup.
 

Gavin_Darkglider

Well-Known Member
Member
Joined
May 20, 2019
Messages
232
Trophies
0
Age
34
XP
581
Country
United States
That post doesnt explain the new reboot2payload kernel command line options that arent included in the original boot.scr Without them, the reboot2payload implementation will by default try to reboot to android, once the version of hekate comes out that supports booting by options by ID. ;) I should also mention that every file in the 1.5.0 update changed except for the initramfs. So, you might want to look at them for reference. Currently the kernel command line is set to reboot to hekate, you can change it from bootloader to via-payload, and it will autoreboot to ubuntu(once the new hekate is released)

the reboot2payload works like a charm! as the kinks get ironed out, I am hopeful that it will find its way into lakka and lineageOS.

As for the preserving the joycon keys across the systems, it will probably be impossible to keep pair settings consistent between OFW and CFW. So if we were able to preserve bluetooth keys across all other OSs, we'd have to use different joycons for using OFW if we don't want to go through the hassle of redoing the setup.

It will find itself in lakka sooner than lineage. Nautinasala is on vacation for another week or so though. As for lineage, probably not, as the focus there has gone to porting android pie. As for the joycon stuff, if you set it on stock nand, then copy the "save" to the emunand, then it is feasable to have joycon configs on all options.
 
  • Like
Reactions: tabzer

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/@legolambs