Hacking Homebrew Android & AMS partition

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
Hello people,

i need some help, im trying to install Android (switchroot, LineageOS) and AMS (Atmosphere) on one microSD, but different Partition, its possible, but is it possible to boot into Hekate and choose between them? Android partition is set to "logical" and AMS to "primary"

Or is it possible to install Android and AMS on one Partition? If yes, how?
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
Hello people,

i need some help, im trying to install Android (switchroot, LineageOS) and AMS (Atmosphere) on one microSD, but different Partition, its possible, but is it possible to boot into Hekate and choose between them? Android partition is set to "logical" and AMS to "primary"

Or is it possible to install Android and AMS on one Partition? If yes, how?

It is absolutely possible to have both and chose which one to boot via Hekate. I have mine set up in this fashion. I also have L4T, Lakka and SXOS options as well as AMS. You simply need to add a new .ini file for each in either the /bootloader/hekate_ipl.ini file or create new .ini files in the /bootloader/ini/ directory. I can walk you through mine if you’d like.

As for slicing up the partitions, it’s honestly much easier to use the Hekate partitioning tool since it will carve out exactly what’s needed and has a button to image the partition directly from inside the tool.

I used a combination of the official guide and forum to set mine up:

https://wiki.switchroot.org/en/Android/Setup-10
https://forum.xda-developers.com/t/rom-unofficial-switchroot-android-10.4229761/

I said all that to get to this…

…there is a lot going on underneath for the android partitioning. Check out the code in gui_tools_partition_manager.c starting around line 318 where they start setting up the numerous GPT partitions for Android. It’s not just one.

https://github.com/CTCaer/hekate/bl...yx_gui/frontend/gui_tools_partition_manager.c

once you grok that the rest should fall into place. Let me know if you have more questions or want more details.

e:

check out this post where I’m setting up fastCFWSwitch to boot the various options in my switch:

https://gbatemp.net/threads/how-to-...e-same-sd-tutorial.601607/page-5#post-9705442

here‘s my 00-android.ini file. The option to boot to it shows up under More Configs if you place this file under /bootloader/ini/

Code:
[Switchroot Android 10]
payload=switchroot/android/coreboot.rom
id=andr

using fastCFWSwitch config.ini I boot everything through Hekate and pass the id that I want Hekate to boot. in this case it would be andr in both the config.ini and the 00-android.ini file.
 
Last edited by binkinator,

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
It is absolutely possible to have both and chose which one to boot via Hekate. I have mine set up in this fashion. I also have L4T, Lakka and SXOS options as well as AMS. You simply need to add a new .ini file for each in either the /bootloader/hekate_ipl.ini file or create new .ini files in the /bootloader/ini/ directory. I can walk you through mine if you’d like.

As for slicing up the partitions, it’s honestly much easier to use the Hekate partitioning tool since it will carve out exactly what’s needed and has a button to image the partition directly from inside the tool.

I used a combination of the official guide and forum to set mine up:

https://wiki.switchroot.org/en/Android/Setup-10
https://forum.xda-developers.com/t/rom-unofficial-switchroot-android-10.4229761/

I said all that to get to this…

…there is a lot going on underneath for the android partitioning. Check out the code in gui_tools_partition_manager.c starting around line 318 where they start setting up the numerous GPT partitions for Android. It’s not just one.

https://github.com/CTCaer/hekate/bl...yx_gui/frontend/gui_tools_partition_manager.c

once you grok that the rest should fall into place. Let me know if you have more questions or want more details.

e:

check out this post where I’m setting up fastCFWSwitch to boot the various options in my switch:

https://gbatemp.net/threads/how-to-...e-same-sd-tutorial.601607/page-5#post-9705442

here‘s my 00-android.ini file. The option to boot to it shows up under More Configs if you place this file under /bootloader/ini/

Code:
[Switchroot Android 10]
payload=switchroot/android/coreboot.rom
id=andr

using fastCFWSwitch config.ini I boot everything through Hekate and pass the id that I want Hekate to boot. in this case it would be andr in both the config.ini and the 00-android.ini file.
Uhm woow sounds complicated, but i really want to use Android, AMS, Lakka and emuNAND.
I used the Hekate Partition Tool too.
Like this:

HOS [190GB]
emuMMC [29GB]
Linux [? GB]
Android [16GB]

I would appreciate to get a walk through from you, thank you!
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
Uhm woow sounds complicated, but i really want to use Android, AMS, Lakka and emuNAND.
I used the Hekate Partition Tool too.
Like this:

HOS [190GB]
emuMMC [29GB]
Linux [? GB]
Android [16GB]

I would appreciate to get a walk through from you, thank you!
I used 8G for Android and L4T and it seemed to run OK. Under both Android and L4T you can link to your HOS FAT32 partition so I store all my ROMs on HOS partition and share it out to RetroArch on all three (for example.) That way I don’t have multiple copies of content everywhere and each needs just enough space to run their respective OS and not much more.

Lakka just uses a directory under HOS so you don’t need another dedicated partition for it.

If you’ve carved out your partitions for L4T and Android using Hekate you are on the happy path and can just follow the switchroot instructions to the letter:

https://wiki.switchroot.org/en/Android/Setup-10

https://wiki.switchroot.org/en/Linux/Distributions

Once you have them installed and working just respond here and I’ll help you get them all booting in a unified fashion with Hekate and fastCFWSwitch. <— link to get Tesla Menu + fastCFWSwitch basics set up before we chat.

talk soon!

e: attached my graphics.zip pack if you want to use my exact configs with matching splash screens and icons. Just extract it at the top level of your SDCard
e2: I’ve attached a bootloader.zip of my hekate_ipl and ini directory. Backup your /bootloader/hekate_ipl.ini and you can just unzip this at the top level of your SDCard as well. You will want to remove SXOS from hekate_ipl.ini and merge any deltas from your original hekate_ipl.ini file but once that’s done…it should just be magic! :-)
e3: I added /config/fastCFWSwitch/config.ini to the bootloader.zip file so that’s handled as well.
 

Attachments

  • bootloader.zip
    1.9 KB · Views: 4
  • graphics.zip
    8.6 MB · Views: 4
Last edited by binkinator,
  • Like
Reactions: Gep_Etto

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
I used 8G for Android and L4T and it seemed to run OK. Under both Android and L4T you can link to your HOS FAT32 partition so I store all my ROMs on HOS partition and share it out to RetroArch on all three (for example.) That way I don’t have multiple copies of content everywhere and each needs just enough space to run their respective OS and not much more.

Lakka just uses a directory under HOS so you don’t need another dedicated partition for it.

If you’ve carved out your partitions for L4T and Android using Hekate you are on the happy path and can just follow the switchroot instructions to the letter:

https://wiki.switchroot.org/en/Android/Setup-10

https://wiki.switchroot.org/en/Linux/Distributions

Once you have them installed and working just respond here and I’ll help you get them all booting in a unified fashion with Hekate and fastCFWSwitch. <— link to get Tesla Menu + fastCFWSwitch basics set up before we chat.

talk soon!

e: attached my graphics.zip pack if you want to use my exact configs with matching splash screens and icons. Just extract it at the top level of your SDCard
e2: I’ve attached a bootloader.zip of my hekate_ipl and ini directory. Backup your /bootloader/hekate_ipl.ini and you can just unzip this at the top level of your SDCard as well. You will want to remove SXOS from hekate_ipl.ini and merge any deltas from your original hekate_ipl.ini file but once that’s done…it should just be magic! :-)
e3: I added /config/fastCFWSwitch/config.ini to the bootloader.zip file so that’s handled as well.
So in the past i followed the guide for android, hekate and the partition tool, did what i said before (how much soace for each OS/Partition) and Android is running pretty fine.
With AMS, im using Tesla, fastCFWSwitch, Lakka and RetroArch on same SD Card without any partition.
Android is atm on another SD Card for testing.
If i use the Partition Tool of Hekate and setting up the partitions, and put the SD into the pc, i just cant take a look into it, there should be at least 1 partition with FAT32, but there is 1 partition with unknown format, what the heck am i doing wrong? Pls tell me the secret Spell of it... 😵
By the way on the AMS SD Card im using StarDust CFW, if its necessary.
 

Attachments

  • Resizer_16525726337651.jpeg
    Resizer_16525726337651.jpeg
    120.5 KB · Views: 5
Last edited by RaynorBlackwood,

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
So in the past i followed the guide for android, hekate and the partition tool, did what i said before (how much soace for each OS/Partition) and Android is running pretty fine.
With AMS, im using Tesla, fastCFWSwitch, Lakka and RetroArch on same SD Card without any partition.
Android is atm on another SD Card for testing.
If i use the Partition Tool of Hekate and setting up the partitions, and put the put into the pc, i just cant take a look into it, there should be at least 1 partition with FAT32, but there is 1 partition with unknown format, what the heck am i doing wrong? Pls tell me the secret Spell of it... 😵
By the way on the AMS SD Card im using StarDust CFW, if its necessary.

I've spoken very briefly with Kronos about his SoundNX sys module that used to be a part of StarDust CFW so yes, I'm familiar and I know that SD CFW won't have any impact on what we're talking about here. Glad you're using it!

Yes, it is difficult to find a tool on Windows that can see the partitions properly.

In your Hekate picture, it shows partitions similar to mine.

You partition of type 0C is FAT32. The rest are not so easy to determine because they are using GPT rather than MBR. It is hybrid of both! https://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/

image.jpg

This is exactly how they were created in Hekate.

image 2.jpg

Here is what that looks like under AOMEI Partition Assistant (APMEI is a free tool that can see the partitions but I don't use it very much for myself.)

1652573787692.png

You can see that there are numerous partitions on Disk 5

Before we discuss that here is a reference for all the partition types:

https://www.win.tue.nl/~aeb/partitions/partition_types-1.html

The first partition is small and unused (it probably contains a partition table)

The next one is E: which is a partition type 0C which according to the link above is FAT32, so that is correct!

Now here is where it gets tricky because it has an 8G partition (which matches what I did in Hekate) but there are a bunch of small drives right behind them. The reason is that the 8G partition is GPT container of all the Android partitions. I believe this one is the one marked EE in the Hekate picture

ee Indication that this legacy MBR is followed by an EFI header

That leaves the E0 partition from Hekate which I believe is the EmuNAND partition:

e0 Reserved by STMicroelectronics for a filesystem called ST AVFS.

Since all the GPT partitions are unknown they are lumped together so it only looks like 3 partitions in Hekate but a whole bunch of partitions inside AOMEI

Here is the section of code I mentioned earlier...

// Android Vendor partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x200000 - 1; // 1GB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'v', 0, 'e', 0, 'n', 0, 'd', 0, 'o', 0, 'r', 0 }, 12);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x200000;
gpt_idx++;

// Android System partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x400000 - 1; // 2GB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'A', 0, 'P', 0, 'P', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x400000;
gpt_idx++;

// Android Linux Kernel partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x10000 - 1; // 32MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'L', 0, 'N', 0, 'X', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x10000;
gpt_idx++;

// Android Recovery partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x20000 - 1; // 64MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'S', 0, 'O', 0, 'S', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x20000;
gpt_idx++;

// Android Device Tree Reference partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x800 - 1; // 1MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'D', 0, 'T', 0, 'B', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x800;
gpt_idx++;

// Android Encryption partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x8000 - 1; // 16MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'M', 0, 'D', 0, 'A', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x8000, (void *)SDMMC_UPPER_BUFFER); // Clear 16MB.
curr_part_lba += 0x8000;
gpt_idx++;

// Android Cache partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x15E000 - 1; // 700MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'C', 0, 'A', 0, 'C', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x15E000;
gpt_idx++;

// Android Misc partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x1800 - 1; // 3MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'M', 0, 'S', 0, 'C', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x1800;
gpt_idx++;

// Android Userdata partition.
u32 user_size = (part_info.and_size << 11) - 0x798000; // Subtract the other partitions (3888MB).
if (!part_info.emu_size)
user_size -= 0x800; // Reserve 1MB.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + user_size - 1;
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'U', 0, 'D', 0, 'A', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += user_size;
gpt_idx++;

Here is a summary of the code so you can see the purpose and size of each parition:

// Android Vendor partition. 1GB
// Android System partition. 2GB
// Android Linux Kernel partition. 32MB
// Android Recovery partition. 64MB
// Android Device Tree Reference partition. 1MB
// Android Encryption partition. 16 MB
// Android Cache partition. 700MB
// Android Misc partition. 3MB
// Android Userdata partition. Subtract the other partions from the whole (- 3888MB) and user gets the rest (just over 4GB because the initial size was 8GB)

This perfectly matches the AOMEI picture above.

The next partition is 8.2GB and that is for L4T

The last one is 29.16GB and is clearly the EmuNAND partition.

There is one small piece of unused partition at the end that doesn't matter.

Whew...are you still with me? That's a lot of information.

So I believe that your partitions are correct and you should proceed to the software installations of Android and L4T
 

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
I've spoken very briefly with Kronos about his SoundNX sys module that used to be a part of StarDust CFW so yes, I'm familiar and I know that SD CFW won't have any impact on what we're talking about here. Glad you're using it!

Yes, it is difficult to find a tool on Windows that can see the partitions properly.

In your Hekate picture, it shows partitions similar to mine.

You partition of type 0C is FAT32. The rest are not so easy to determine because they are using GPT rather than MBR. It is hybrid of both! https://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/

View attachment 310013

This is exactly how they were created in Hekate.

View attachment 310015

Here is what that looks like under AOMEI Partition Assistant (APMEI is a free tool that can see the partitions but I don't use it very much for myself.)

View attachment 310016

You can see that there are numerous partitions on Disk 5

Before we discuss that here is a reference for all the partition types:

https://www.win.tue.nl/~aeb/partitions/partition_types-1.html

The first partition is small and unused (it probably contains a partition table)

The next one is E: which is a partition type 0C which according to the link above is FAT32, so that is correct!

Now here is where it gets tricky because it has an 8G partition (which matches what I did in Hekate) but there are a bunch of small drives right behind them. The reason is that the 8G partition is GPT container of all the Android partitions. I believe this one is the one marked EE in the Hekate picture

ee Indication that this legacy MBR is followed by an EFI header

That leaves the E0 partition from Hekate which I believe is the EmuNAND partition:

e0 Reserved by STMicroelectronics for a filesystem called ST AVFS.

Since all the GPT partitions are unknown they are lumped together so it only looks like 3 partitions in Hekate but a whole bunch of partitions inside AOMEI

Here is the section of code I mentioned earlier...

// Android Vendor partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x200000 - 1; // 1GB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'v', 0, 'e', 0, 'n', 0, 'd', 0, 'o', 0, 'r', 0 }, 12);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x200000;
gpt_idx++;

// Android System partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x400000 - 1; // 2GB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'A', 0, 'P', 0, 'P', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x400000;
gpt_idx++;

// Android Linux Kernel partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x10000 - 1; // 32MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'L', 0, 'N', 0, 'X', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x10000;
gpt_idx++;

// Android Recovery partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x20000 - 1; // 64MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'S', 0, 'O', 0, 'S', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x20000;
gpt_idx++;

// Android Device Tree Reference partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x800 - 1; // 1MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'D', 0, 'T', 0, 'B', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x800;
gpt_idx++;

// Android Encryption partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x8000 - 1; // 16MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'M', 0, 'D', 0, 'A', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x8000, (void *)SDMMC_UPPER_BUFFER); // Clear 16MB.
curr_part_lba += 0x8000;
gpt_idx++;

// Android Cache partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x15E000 - 1; // 700MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'C', 0, 'A', 0, 'C', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x15E000;
gpt_idx++;

// Android Misc partition.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + 0x1800 - 1; // 3MB.
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'M', 0, 'S', 0, 'C', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += 0x1800;
gpt_idx++;

// Android Userdata partition.
u32 user_size = (part_info.and_size << 11) - 0x798000; // Subtract the other partitions (3888MB).
if (!part_info.emu_size)
user_size -= 0x800; // Reserve 1MB.
memcpy(gpt->entries[gpt_idx].type_guid, android_part_guid, 16);
se_gen_prng128(random_number);
memcpy(gpt->entries[gpt_idx].part_guid, random_number, 16);
gpt->entries[gpt_idx].lba_start = curr_part_lba;
gpt->entries[gpt_idx].lba_end = curr_part_lba + user_size - 1;
memcpy(gpt->entries[gpt_idx].name, (char[]) { 'U', 0, 'D', 0, 'A', 0 }, 6);
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
curr_part_lba += user_size;
gpt_idx++;

Here is a summary of the code so you can see the purpose and size of each parition:

// Android Vendor partition. 1GB
// Android System partition. 2GB
// Android Linux Kernel partition. 32MB
// Android Recovery partition. 64MB
// Android Device Tree Reference partition. 1MB
// Android Encryption partition. 16 MB
// Android Cache partition. 700MB
// Android Misc partition. 3MB
// Android Userdata partition. Subtract the other partions from the whole (- 3888MB) and user gets the rest (just over 4GB because the initial size was 8GB)

This perfectly matches the AOMEI picture above.

The next partition is 8.2GB and that is for L4T

The last one is 29.16GB and is clearly the EmuNAND partition.

There is one small piece of unused partition at the end that doesn't matter.

Whew...are you still with me? That's a lot of information.

So I believe that your partitions are correct and you should proceed to the software installations of Android and L4T

That was definitly a huge mass of informations, i read everything of it, but it wasnt really helpful atm, still thank for help. I installed Android already, my next step should be to have AMS on the same SD Card but on HOS Partition, L4T can i do after beeing successful having Android and AMS parallel and selective bootable. Please teach me.

E1: im using "MiniTool Partition Wizard" is same like AOMEI.
I can see them there, but doesnt help that much.

E2: maybe is the plan to put files into the HOS partiton with Ubuntu? Am i right?

E3: GPT is a Linux thing right?
I remember of a Tool called "GParted".
 
Last edited by RaynorBlackwood,

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
That was definitly a huge mass of informations, i read everything of it, but it wasnt really helpful atm, still thank for help. I installed Android already,
great! Glad you’ve got Android completed.

Yes, I was just explaining the layout of the partitions and how they are created by the code. More of the why of things rather than just the how.
my next step should be to have AMS on the same SD Card but on HOS Partition, L4T can i do after beeing successful having Android and AMS parallel and selective bootable. Please teach me.
yes, you can do L4T after getting Android fully configured alongside AMS. after Android and AMS are both booting individually, go back to the zip files and instructions above and drop in the graphics and config files.

Back to AMS…

Dropping AMS on a card is quite simple.

Take a look at this guide: https://rentry.co/SwitchHackingIsEasy

This will give you the most understanding of what is happening on your Switch as you download and configure the software.

Just identify the type of switch you have and follow the appropriate path for your Switch. The fact that you can use Android tells me you are on a V1 (Erista) model. That’s the most straightforward one to set up with AMS.

E1: im using "MiniTool Partition Wizard" is same like AOMEI.
I can see them there, but doesnt help that much.
I use minitool partition wizard as well, but it doesn’t show the GPT partitions so you will get the wrong idea of how many partitions are actually on your SDCard. When things break you will not understand how to fix them without these details.
E2: maybe is the plan to put files into the HOS partiton with Ubuntu? Am i right?
L4T will have it’s own ext4 partitioning. We will use a mount inside of L4T to see the data on HOS. We will do the same for Android so it can see the HOS partition. We will store roms and other content on HOS and then all three will be able to see the same content. This way you put ROMs in one place and can try them out on three different platforms for the best result.
E3: GPT is a Linux thing right?
I remember of a Tool called "GParted".
Yes. GPT is used heavily in Linux. It has a lot more flexibility vs MBR.
 
Last edited by binkinator,
  • Like
Reactions: Gep_Etto

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
great! Glad you’ve got Android completed.

Yes, I was just explaining the layout of the partitions and how they are created by the code. More of the why of things rather than just the how.

yes, you can do L4T after getting Android fully configured alongside AMS. after Android and AMS are both booting individually, go back to the zip files and instructions above and drop in the graphics and config files.

Back to AMS…

Dropping AMS on a card is quite simple.

Take a look at this guide: https://rentry.co/SwitchHackingIsEasy

This will give you the most understanding of what is happening on your Switch as you download and configure the software.

Just identify the type of switch you have and follow the appropriate path for your Switch. The fact that you can use Android tells me you are on a V1 (Erista) model. That’s the most straightforward one to set up with AMS.


I use minitool partition wizard as well, but it doesn’t show the GPT partitions so you will get the wrong idea of how many partitions are actually on your SDCard. When things break you will not understand how to fix them without these details.

L4T will have it’s own ext4 partitioning. We will use a mount inside of L4T to see the data on HOS. We will do the same for Android so it can see the HOS partition. We will store roms and other content on HOS and then all three will be able to see the same content. This way you put ROMs in one place and can try them out on three different platforms for the best result.

Yes. GPT is used heavily in Linux. It has a lot more flexibility vs MBR.

Thanks a lot for your afford, but i think we talk in different directions, let me start again..

I have an Erista Switch, already hacked since for a half of a year, i started with just simply AMS on exFAT and then came retroarch after this came lakka on FAT32. So i think i got advanced knowledge, my main problem is simply how to install AMS on a already partitioned SD Card with Hekate, Android is ready and work perfect, but now AMS is very importan for me, how to put my AMS preset into the partition that i cant reach atm?
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
Thanks a lot for your afford, but i think we talk in different directions, let me start again..

I have an Erista Switch, already hacked since for a half of a year, i started with just simply AMS on exFAT and then came retroarch after this came lakka on FAT32. So i think i got advanced knowledge, my main problem is simply how to install AMS on a already partitioned SD Card with Hekate, Android is ready and work perfect, but now AMS is very importan for me, how to put my AMS preset into the partition that i cant reach atm?

Not sure I understand what you mean by “into partition that I cant reach”
You should be able to easily reach the FAT32 partition when you place the SDCard in your PC. It will be the only usable partition available.

When you say “AMS preset” do you mean you want to dump StarDust CFW onto the partition? That’s should be very easy to accomplish my mounting the 0C partition on your PC.

if that’s all you want to do then you should be all set. if I’m misunderstanding then please tell me how you are stuck and what you have tried so far to access the FAT32 partition.

If you would like to collect the files necessary to deploy AMS on your own so you can build out a custom sdcard that does exactly what you want, continue reading…

Thanks for confirming you are on Erista. This is the page that tells exactly how to get AMS onto a FAT32 partition:

https://rentry.org/EristaEmuNAND

Place the SDCard in your PC and unzip the links on to the card as indicated in the guide.

You have already formatted your card so you don’t need to do the pre-work such as emptying your card and can just skip to step 2.

Continue with step 2 and complete step 3 in its entiret.

For step 4 you must again skip the partitioning steps and begin again with the creation of a partition based Emunand.

Do everything else in between and after and you should be all set.


———————————————————————————————————-

Quick side notes:
1) I updated graphics.zip above. It was missing a folder inside. Fixed
2) I did more research on the way Hekate represents the partitioning In my photo above so here is some clarification:
45B35566-63B0-4D66-BE17-49650B2E453F.jpeg


It seems it is using 2k block size? It’s the only way the math works out.

Partition 0 is 69G which matches what I see for HOS so the 0C (FAT32) is correct.

Partition 1 is 29G and as discussed earlier is the emunand partition.

Partition 2 is the entire disk from 2k onward so that is the entirety of the disk in an “EFI” (which I assume includes GPT) container.

I guess the rest is considered unformatted and for some technical reason it cannot be displayed in this format.

Partition 3 is 0-0 so it contains nothing.
 
Last edited by binkinator,

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
Not sure I understand what you mean by “into partition that I cant reach”
You should be able to easily reach the FAT32 partition when you place the SDCard in your PC. It will be the only usable partition available.

When you say “AMS preset” do you mean you want to dump StarDust CFW onto the partition? That’s should be very easy to accomplish my mounting the 0C partition on your PC.

if that’s all you want to do then you should be all set. if I’m misunderstanding then please tell me how you are stuck and what you have tried so far to access the FAT32 partition.

If you would like to collect the files necessary to deploy AMS on your own so you can build out a custom sdcard that does exactly what you want, continue reading…

Thanks for confirming you are on Erista. This is the page that tells exactly how to get AMS onto a FAT32 partition:

https://rentry.org/EristaEmuNAND

Place the SDCard in your PC and unzip the links on to the card as indicated in the guide.

You have already formatted your card so you don’t need to do the pre-work such as emptying your card and can just skip to step 2.

Continue with step 2 and complete step 3 in its entiret.

For step 4 you must again skip the partitioning steps and begin again with the creation of a partition based Emunand.

Do everything else in between and after and you should be all set.


———————————————————————————————————-

Quick side notes:
1) I updated graphics.zip above. It was missing a folder inside. Fixed
2) I did more research on the way Hekate represents the partitioning In my photo above so here is some clarification:View attachment 310047

It seems it is using 2k block size? It’s the only way the math works out.

Partition 0 is 69G which matches what I see for HOS so the 0C (FAT32) is correct.

Partition 1 is 29G and as discussed earlier is the emunand partition.

Partition 2 is the entire disk from 2k onward so that is the entirety of the disk in an “EFI” (which I assume includes GPT) container.

I guess the rest is considered unformatted and for some technical reason it cannot be displayed in this format.

Partition 3 is 0-0 so it contains nothing.

I installed Android on a fresh and clean SD Card, and used hekate partition tool and made 3 partitions, 1 HOS 180GB; 1 Andrroid 16GB and emuNAND 29GB.
After installing Android and testing it, i was trying to put the SD Card in the PC to fill the HOS (FAT32) Partition, but under Win10 it doesnt appears, but i dont know why.

AMS Preset, means i backuped my AMS, Lakka, RetroArch, StarDust Content and wanted to put them all on the HOS Partition, but as i said it doesnt appear under Win10.

Atm i can run Android standalone on my second sd card or AMS Content on my first SD Card. But sadly not together, and thats my problem right now, i just wanna get access to the HOS Partition over Windows and if this works, i wanna boot between Android and AMS over Hekate, and when this works too, i would give Ubuntu a try on L4T Partiton.

I hope i cleared all missunderstood things out.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
I installed Android on a fresh and clean SD Card, and used hekate partition tool and made 3 partitions, 1 HOS 180GB; 1 Andrroid 16GB and emuNAND 29GB.
After installing Android and testing it, i was trying to put the SD Card in the PC to fill the HOS (FAT32) Partition, but under Win10 it doesnt appears, but i dont know why.

AMS Preset, means i backuped my AMS, Lakka, RetroArch, StarDust Content and wanted to put them all on the HOS Partition, but as i said it doesnt appear under Win10.

Atm i can run Android standalone on my second sd card or AMS Content on my first SD Card. But sadly not together, and thats my problem right now, i just wanna get access to the HOS Partition over Windows and if this works, i wanna boot between Android and AMS over Hekate, and when this works too, i would give Ubuntu a try on L4T Partiton.

I hope i cleared all missunderstood things out.
OK, great! That makes a lot more sense.

On your Windows machine, check the partitions using either Disk Manager (built in) or MiniTool Partition Wizard (free)

Please post a screenshot here of what your partitions look like.
 

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
It looks like this, i think it looks pretty wrong, but im not sure, so i hope you can tell me that.

E1: Im from Germany, sorry for wrong Language.
 

Attachments

  • Partitions.png
    Partitions.png
    7.8 KB · Views: 5

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
It looks like this, i think it looks pretty wrong, but im not sure, so i hope you can tell me that.

E1: Im from Germany, sorry for wrong Language.
I can comprehend it just fine. :)

Your partitioning looks great. I think you just need to assign a drive letter to the 189G partition so you can mount it on your PC. I think S: for Switch would be perfect but it’s your choice.

  1. Ensure that the drive you’re relettering isn’t in use and that no files from that drive are open.
  2. Right-click on the Start button.
  3. Click Disk Management to open the Disk Management console.
  4. Right-click the volume that has the drive letter you want to change.
  5. Click Change Drive Letter And Paths.
  6. Click the Change button.
  7. Choose from a list of available drive letters. (Don’t use A or B, which have historically been reserved for floppy drives and can sometime confuse older software.)
  8. Click OK.
  9. Click Yes if a popup windows appears asking if you really want to do this.
  10. Close the Disk Management console.
 

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
Alright i used MiniTool Partition Wizard to set a Letter for this Partition and it works, i can use it under Windows 10 now, after this i put the SD Card back in my Switch and Payloaded Hekate to boot into Android Again and it doesnt work anymore, any reason why? so Hekate said something about 1bit thingy.
 
  • Like
Reactions: binkinator

RaynorBlackwood

Well-Known Member
OP
Newcomer
Joined
Feb 3, 2022
Messages
91
Trophies
0
Age
34
Location
Home
Website
discord.gg
XP
110
Country
Germany
uhm i dont know thy, but i can boot again into Android, i think now it works, i will try to copy my AMS Files now into the S: Partition and look if it works now. maybe that was the Problem with the Letter, i will give Feedback after trying to copy and boot up.
 
  • Like
Reactions: binkinator

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
Alright i used MiniTool Partition Wizard to set a Letter for this Partition and it works, i can use it under Windows 10 now, after this i put the SD Card back in my Switch and Payloaded Hekate to boot into Android Again and it doesnt work anymore, any reason why? so Hekate said something about 1bit thingy.
thats the Message
This is what i looks like now
That one bit thing is not good. You might have a damaged SDCard reader.

Let’s hope not. Try reseating the card and going back into Hekate.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
1,970
Trophies
1
XP
1,331
Country
United States
uhm i dont know thy, but i can boot again into Android, i think now it works, i will try to copy my AMS Files now into the S: Partition and look if it works now. maybe that was the Problem with the Letter, i will give Feedback after trying to copy and boot up.
Whew! Yes, sometimes it will glitch. You really don’t want 1 bit mode. It is super slow and essentially unusable! Glad you’re sorted! Talk to you after you get Atmos installed and test that both it and Android work individually. You should probably install L4T and Lakka as well. Then when we do the big graphics update you will see the full effect. :-)
 
General chit-chat
Help Users
  • AliceCE @ AliceCE:
    i want one for the 3ds.
    Gift
  • AliceCE @ AliceCE:
    loud speakers, a slide out umbrella like thing for really sunny days, super big battery, built in cartridge holder, nice big stylus, the fuckin' WORKS
    Gift
  • AliceCE @ AliceCE:
    hell, maybe even some tech inside that takes advantage of the microsd slot and allows you to use a fuckin flash drive or something
    Gift
  • AliceCE @ AliceCE:
    could you imagine using a usb had drive on a 3ds
    Gift
  • Dark_Phoras @ Dark_Phoras:
    And a special receptor to play xCloud games
    Gift
  • Dark_Phoras @ Dark_Phoras:
    And an ice maker for your drinks
    +1
    Gift
  • AliceCE @ AliceCE:
    and a mouth cup for sedating you before surgery
    Gift
  • AncientBoi @ AncientBoi:
    Ice maker, make me a Root Beer float! lol
    Gift
  • AliceCE @ AliceCE:
    Starts mario kart 7
    Gift
  • AliceCE @ AliceCE:
    if i ever get another Old3DS it's gonna be a different color than goddamn blue
    Gift
  • Dark_Phoras @ Dark_Phoras:
    3DS had a Super Mario Maker, why not an ice maker?
    Gift
  • AliceCE @ AliceCE:
    i have owned 4 blue old3dses and one black new3ds
    Gift
  • KenniesNewName @ KenniesNewName:
    I got a spam call and the guy hanged up on me when he said he was in DC and I asked how the weather was :sad:
    Gift
  • AliceCE @ AliceCE:
    also, i miss gridlauncher :sad:
    Gift
  • AliceCE @ AliceCE:
    the regular 3ds homebrew menu sucks :angry:
    Gift
  • AliceCE @ AliceCE:
    gridlauncher was much funner
    Gift
  • KenniesNewName @ KenniesNewName:
    I was just being his friend he said I could get 9,000 and I demanded 9 million :sad:
    Gift
  • AliceCE @ AliceCE:
    i liked the themey system, and i like how it had OPTIONS instead of a stupid wrench button that does absolutely nothing
    Gift
  • Dark_Phoras @ Dark_Phoras:
    The best salesman in the world is able to sell his product to the CEO of the company that spam
    calls him to sell their own product
    Gift
  • AliceCE @ AliceCE:
    i may not be a good homebrew dev yet but i personally think gridlauncher was much much better than the shit, bog standard homebrew menu
    Gift
  • Gift
  • AliceCE @ AliceCE:
    it had way more personality, the standard homebrew menu feels like an 3ds applet, developed quickly and without any quirks
    Gift
  • AliceCE @ AliceCE:
    too bad luma just so happens to completely break gridlauncher , and the fact that it's not maintained anmore
    Gift
  • AliceCE @ AliceCE:
    hell, even the wii homebrew menu gives me heavy nostalgia, even if it's barely, if at all customiable, but the 3ds
    homebrew launcher is ass
    Gift
  • AliceCE @ AliceCE:
    rant over
    Gift
    AliceCE @ AliceCE: rant over