Hacking [TOOL] Script to set up Android + L4T Ubuntu + CFW + EmuMMC on the same SD card

konamicode89

Well-Known Member
Member
Joined
Mar 13, 2018
Messages
140
Trophies
0
Age
33
XP
728
Country
United States
That's more of an Android related issue more than the script. It doesn't matter what image you use but if you set up your android partitions manually you can make it any size you want. You can still do so even if you use the script but that's a whole different matter.

What you have to keep in mind is that after flashing android you have to first boot it to twrp by holding onto vol+ when booting android and then install gapps and whatever else you'd like to add, then reboot to android from twrp when finished.

I never boot straight into android knowing that there's more to setup before intializing android, so unless it's something else that causing it I can't tell you since I never had an issue installing android
 

Jay1175

Member
Newcomer
Joined
May 7, 2020
Messages
5
Trophies
0
Age
32
XP
38
Country
United States
That's more of an Android related issue more than the script. It doesn't matter what image you use but if you set up your android partitions manually you can make it any size you want. You can still do so even if you use the script but that's a whole different matter.

What you have to keep in mind is that after flashing android you have to first boot it to twrp by holding onto vol+ when booting android and then install gapps and whatever else you'd like to add, then reboot to android from twrp when finished.

I never boot straight into android knowing that there's more to setup before intializing android, so unless it's something else that causing it I can't tell you since I never had an issue installing android

I'm trying to boot into twrp with vol+ for the initial boot. I think the script is actually failing to create system/vendor partitions, but it isn't giving me any errors. I'm running [sudo ./setup.sh --android "/home/user/Desktop/android-16gb.img" --emummc] and using default partition size for everything except userdata which I'm giving 16GB.

When the script finishes, I'm left with a 31GB volume (emummc I presume), an 18GB volume (android userdata I think), and a 75GB volume for the rest of my data. Those partitions are empty except for the bootloader and switchroot folders in the 75GB volume.

When I flash the android image using etcher it leaves me with additional partitions that I can see like system/vendor and can see the android filestructure.
 

konamicode89

Well-Known Member
Member
Joined
Mar 13, 2018
Messages
140
Trophies
0
Age
33
XP
728
Country
United States
I'm trying to boot into twrp with vol+ for the initial boot. I think the script is actually failing to create system/vendor partitions, but it isn't giving me any errors. I'm running [sudo ./setup.sh --android "/home/user/Desktop/android-16gb.img" --emummc] and using default partition size for everything except userdata which I'm giving 16GB.

When the script finishes, I'm left with a 31GB volume (emummc I presume), an 18GB volume (android userdata I think), and a 75GB volume for the rest of my data. Those partitions are empty except for the bootloader and switchroot folders in the 75GB volume.

When I flash the android image using etcher it leaves me with additional partitions that I can see like system/vendor and can see the android filestructure.

Have you considered using Linux to do your partitions?
 

Jay1175

Member
Newcomer
Joined
May 7, 2020
Messages
5
Trophies
0
Age
32
XP
38
Country
United States
Have you considered using Linux to do your partitions?

I'm working on it right now.

Viewing it in gparted, the script did in fact make vendor/system/boot/recovery/dtb partitions but they were all showing as unknown file system instead of ext4 or unallocated like they should be.
 

konamicode89

Well-Known Member
Member
Joined
Mar 13, 2018
Messages
140
Trophies
0
Age
33
XP
728
Country
United States
I'm working on it right now.

Viewing it in gparted, the script did in fact make vendor/system/boot/recovery/dtb partitions but they were all showing as unknown file system instead of ext4 or unallocated like they should be.

That's normal, as they are all system related partitions, I can't recall which ones exactly but userdata is definitely supposed to be ext4 as its where you will put all of your personal data, if you know how to use the Gdisk and DD commands you can extract the Android image, recreate the partitions manually with gparted and also make your Horizon and emunand partitions still readable. I know it defeats the purpose of the tool but at least that way if something goes wrong then you'll know if it was either a missed step or a bad image

You can DM me for more details
 
Last edited by konamicode89,

Jay1175

Member
Newcomer
Joined
May 7, 2020
Messages
5
Trophies
0
Age
32
XP
38
Country
United States
That's normal, as they are all system related partitions, I can't recall which ones exactly but userdata is definitely supposed to be ext4 as its where you will put all of your personal data, if you know how to use the Gdisk and DD commands you can extract the Android image, recreate the partitions manually with gparted and also make your Horizon and emunand partitions still readable. I know it defeats the purpose of the tool but at least that way if something goes wrong then you'll know if it was either a missed step or a bad image

You can DM me for more details

What I ended up doing was first flashing the 16gb image via etcher and then I went in gparted to manually resize the hosdata/userdata partitions and added the emummc partition. Then I used gdisk to fix the MBR settings.

I am glad other people got this tool to work, the github says if using a virtual machine you're on your own. If anyone else stumbles across this thread who isn't having any luck, I was using VirtualBox running Ubuntu 18.04 and could not get it to work.
 

konamicode89

Well-Known Member
Member
Joined
Mar 13, 2018
Messages
140
Trophies
0
Age
33
XP
728
Country
United States
The guy who came up with the Linux method explicitly said not to use virtual box, although with what I gathered but haven't had time to experiment is doing this on L4T Ubuntu maybe? Maybe Linux live disc? Besides isn't the script a windows tool for people who want a windows only method? I also only swear by the Linux method because I could actually size my partitions for Android accordingly in case the pie release has bigger sized partitions so I won't have to redo my entire SD card again and lose my emummc or Linux partitions and data
 

lulle2007200

Active Member
OP
Newcomer
Joined
Dec 1, 2017
Messages
25
Trophies
0
Age
24
XP
309
Country
Germany
To answer some questions:
1. The script is a linux tool
2. It let's you customize the partition sizes (of all partitions)
3. On Windows, you're stuck with balena etcher. were is virtually no way to set up the necessary partitions manually.
4. VM with proper USB pass through *should* work. I tested it a few times with Virtualbox. However the "connect switch in rcm" thing seems to not work properly in VM.
5. Some sd cards simply don't work at all with android oreo, Samsung evo cards are known to work well tho. That'll be fixed in the next android version.

As for why the script didn't work for you - can't tell exactly. If you should try it again and it fails, feel free to send the command line output.

Android Pie will have a different partition layout so you're pretty much forced to start over. You can backup your Emummc tho.
 

Jay1175

Member
Newcomer
Joined
May 7, 2020
Messages
5
Trophies
0
Age
32
XP
38
Country
United States
To answer some questions:
1. The script is a linux tool
2. It let's you customize the partition sizes (of all partitions)
3. On Windows, you're stuck with balena etcher. were is virtually no way to set up the necessary partitions manually.
4. VM with proper USB pass through *should* work. I tested it a few times with Virtualbox. However the "connect switch in rcm" thing seems to not work properly in VM.
5. Some sd cards simply don't work at all with android oreo, Samsung evo cards are known to work well tho. That'll be fixed in the next android version.

As for why the script didn't work for you - can't tell exactly. If you should try it again and it fails, feel free to send the command line output.

Android Pie will have a different partition layout so you're pretty much forced to start over. You can backup your Emummc tho.

Using virtualbox to get the USB passthrough to work you need to install the guest additions disk in the VM, then you can toggle whether a specific USB slot is read by the host machine or the VM
 

Karlingen

Member
Newcomer
Joined
Nov 11, 2019
Messages
20
Trophies
0
XP
91
Country
Germany
I hope this is the right thread for my question.
I have a patched Switch (not Mariko) with an installed SX Core. Currently I use the file based emunand from SX and want to use Ubuntu and Android additionally (everything on one sd card).

Can I use your script, copy the content of my backed up fat32 partition to the new one created, launch hekate through the SX bootloader and use Android and Ubuntu as described?

Edit:

Got Android working but Ubuntu only partly. I had some errors after sudo apt update and upgrade..
I don't know whether that could be solved by the updates from
https://gbatemp.net/threads/l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/

But how to modify his ubunti.ini and bootloader files (boot.scr for example) to make the update work with your setup?
 
Last edited by Karlingen,

pixel_mx

Member
Newcomer
Joined
Nov 3, 2018
Messages
6
Trophies
0
Age
23
XP
79
Country
Mexico
hi i found some errors when using your script:

1.- if the partition for HOS is in exfat it will not be accessible in both linux and windows unless it is formatted in fat 32 and the process is repeated

2.- your scrip creates the emunand partition in the range 0x03, it would be appropriate if it were in the range 0x2 so you save problems for those who use sx os and atmosphere
 

evil_santa

Well-Known Member
Member
Joined
Jan 15, 2020
Messages
274
Trophies
1
Age
38
XP
1,379
Country
Germany
Got Android working but Ubuntu only partly. I had some errors after sudo apt update and upgrade..
I don't know whether that could be solved by the updates from
https://gbatemp.net/threads/l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/

But how to modify his ubunti.ini and bootloader files (boot.scr for example) to make the update work with your setup?
Show in Post nr 6 in this https://gbatemp.net/threads/setup-g...id-with-emummc-bigger-fat32-partition.544981/ thread and edit the boot.scr from the l4t 3.0.1 update. Use the partition where your Ubuntu is stored.
When you have problems I can do this for you.
How can you use Payloads in sxcore?
 
Last edited by evil_santa,
  • Like
Reactions: Karlingen

Karlingen

Member
Newcomer
Joined
Nov 11, 2019
Messages
20
Trophies
0
XP
91
Country
Germany
Show in Post nr 6 in this https://gbatemp.net/threads/setup-g...id-with-emummc-bigger-fat32-partition.544981/ thread and edit the boot.scr from the l4t 3.0.1 update. Use the partition where your Ubuntu is stored.
When you have problems I can do this for you.
How can you use Payloads in sxcore?

Thanks for the link and the help!
I tried to decrypt, edit the boot.scr and enrypt it again two or three weeks ago. It didn't help, but maybe I did something wrong. I will check your solution in a few weeks since I'm quite busy right now.

I own a patched unit (Erista) and loaded hekate.bin after selecting it in the SX bootloader. Booting Android and Ubuntu with hekate worked. But I had problems with updating Ubuntu as I said.
 

lulle2007200

Active Member
OP
Newcomer
Joined
Dec 1, 2017
Messages
25
Trophies
0
Age
24
XP
309
Country
Germany
1.- if the partition for HOS is in exfat it will not be accessible in both linux and windows unless it is formatted in fat 32 and the process is repeated

May look into that later.

2.- your scrip creates the emunand partition in the range 0x03, it would be appropriate if it were in the range 0x2 so you save problems for those who use sx os and atmosphere

No offense, but i couldnt care less if it's compatible with sx os or not. Besides that, i can't test with sx os.
 

pixel_mx

Member
Newcomer
Joined
Nov 3, 2018
Messages
6
Trophies
0
Age
23
XP
79
Country
Mexico
No offense, but i couldnt care less if it's compatible with sx os or not. Besides that, i can't test with sx os.

I understand you, the hidden emunand of sx os is shit since it writes in sectors where the information of the mbr would have to be making it difficult to manipulate
 
Last edited by pixel_mx,

OldGnashburg

Cobra Chicken Summoner
Member
Joined
Feb 6, 2017
Messages
483
Trophies
0
Location
Alberta, Canada
XP
2,589
Country
Canada
I had this working a while back, but now I can't get it to work. It either fails to detect my SD. It either says SD not inserted or I get the message
lsblk: switch: not a block device
sfdisk: cannot open switch: No such file or directory
Storage device too small, aborting.

I'm trying to get Android, Ubuntu and EmuNAND working
 

jacobsson

Well-Known Member
Member
Joined
Oct 30, 2019
Messages
140
Trophies
0
Age
37
XP
665
Country
Sweden
hi i found some errors when using your script:
1.- if the partition for HOS is in exfat it will not be accessible in both linux and windows unless it is formatted in fat 32 and the process is repeated

How come you can't keep your HOS exfat when having a multi-boot setup? I'm using files larger than 4GB for RetroArch etc. so I'd love to try figuring this out.
 
Last edited by jacobsson,

Draxzelex

Well-Known Member
Member
Joined
Aug 6, 2017
Messages
18,674
Trophies
2
Age
28
Location
New York City
XP
12,636
Country
United States
How come you can't keep your HOS exfat when having a multi-boot setup? I'm using files larger than 4GB for RetroArch etc. so I'd love to try figuring this out.
Because there is no reason to be using exFAT since it can corrupt your SD card. There are numerous workarounds for whatever files larger than 4 GB that you are currently using.
 
General chit-chat
Help Users
  • Veho @ Veho:
    Lasenge.
  • Veho @ Veho:
    Once again I fell down the martial arts rabbit hole and am plumbing the murky depths of the internet's various martial arts and fighting crafts echo chambers.
  • Veho @ Veho:
    I like to get up to speed on that every now and then, see what the newest high wisdom everyone is spouting nowadays.
  • Veho @ Veho:
    If you're not actively involved and only get up to speed every few years or so, you can see the tide of public opinion flapping worse than my dong while I'm skipping naked down a hallway.
  • Veho @ Veho:
    And the "established wisdom" changes every decade.
  • Veho @ Veho:
    England is installing a new king.
  • Veho @ Veho:
    Their previous monarch has reached End Of Life and is being replaced.
  • Veho @ Veho:
    Like most forced updates, this one has terrible support and was very poorly received by the userbase.
  • Psionic Roshambo @ Psionic Roshambo:
    And mostly just adds useless features
  • Psionic Roshambo @ Psionic Roshambo:
    We need AI overlords
  • Veho @ Veho:
    Someone mowed a giant dick into the lawn in front of Westminster Abbey.
  • Veho @ Veho:
    Just in time for the coronation.
  • Veho @ Veho:
    That's what I said, maybe they were just doing a recreation of the Cerne Abbas giant but didn't finish it in time.
  • Veho @ Veho:
    The Abbey building was supposed to be the hat.
  • H @ hecker_isaac:
    goodmorning peeps
  • Psionic Roshambo @ Psionic Roshambo:
    Bell end lol
  • K3N1 @ K3N1:
    I got gas
  • Psionic Roshambo @ Psionic Roshambo:
    Save it Ken stuff is expensive lol
  • K3N1 @ K3N1:
    I save it for Walmart
  • Psionic Roshambo @ Psionic Roshambo:
    https://imgur.com/gallery/ZfBfPgk 100 million... Can think of better uses but OK lol
  • K3N1 @ K3N1:
    $35 just for drinks milk and bread today
  • K3N1 @ K3N1:
    I like how this is #2 in headphones Perytong Sleep Headphones Wireless, Bluetooth Sports Headband Headphones with Ultra-Thin HD Stereo Speakers Perfect for Sleeping,Workout,Jogging,Yoga,Insomnia, Air Travel, Meditation, Grey https://a.co/d/fPOFL4J
    K3N1 @ K3N1: I like how this is #2 in headphones Perytong Sleep Headphones Wireless, Bluetooth Sports...