Article 6KK7X Multiple-architecture support on a bootable USB storage device.

Multiple-architecture support on a bootable USB storage device.

by
sylphyk
from LinuxQuestions.org on (#6KK7X)
Hello everyone, it's my first post here, just looking for some advice on setting up an external storage device for two different projects. I believe this thread applies to the Hardware section, but if I'm wrong, feel free to remove. I've copied this text to a file and can repost in the correct section if needed.

For context: found my old Raspberry Pi 2 model B and decided I wanted to get it up and running again. Ordered an SD card for it. SD card shipped then I went out of town for work and I decided on a whim to compile Gentoo on my laptop as I don't have the Pi, but I do have the SD card so I will be booting from that. (Tested and I can boot from it with a LiveCD using my USB card reader, hell it boots a graphical LiveCD faster than Windows on my built in SSD, and leagues faster than the flash drive im about to talk about. Wicked fast SD card, Amazon link not affiliatedhttps://a.co/d/hy6f46e)
Actually, right now, I'm booting systemrescuecd from an old 16gb flash drive and using that to set up my system. I'd prefer to figure it out myself with the minimal install image, but my only Internet connection is Wifi so I have to use that. But for now I plan to build Gentoo on that SD card.

My end goal is to have an SD card I can boot Gentoo on my laptop, or take it out and plug it into my Raspberry Pi and boot into a compatible OS.

I expect a few roadblocks:
The Raspberry Pi's processor (at least for the model I own) locks down the booting process, in short it is basically hard-coded to look for a certain file to boot from. Therefore, a bootloader like Grub is out of the question. However, multi booting is still possible.
My model of Raspberry Pi only supports MBR partition tables, it's not until the Raspberry Pi 4 that they begin to support GUID partition tables. Therefore, my partition scheme is very limited. Also, in regards to the above point, the Pi requires a fat32 filesystem. Not a problem but something worth mentioning.
My Raspberry Pi has an ARM Cortex A7 processor (armv7 architecture), whereas my laptop has an amd64 AMD Ryzen 7 processor. I theorize that due to the above points, if I have those boot files in its own fat32 partition I shouldn't have any issues booting from it.
The Raspberry Pi's various OSs are almost always flashed directly to the SD card from an .img file. Therefore, I need to be able to "flash" without disrupting my Gentoo partitions, or at least figure out how to manually copy the files.

Due to my personal preference in partitioning for Gentoo (separate partitions for boot, root, home, and swap) and due to MBR limit of 4 primary partitions, this doesn't seem to be immediately possible. I believe the raspberry pi only requires a single partition due to the media being flashed to the SD card, but I could be wrong, it might write its own partition table. If not, I'm sure I can figure out how to share the home and swap partitions.
I have a few options and ideas, though.
1. Just compromise and set up only 3 partitions for Gentoo by having one partition for root and home.
2. Idea: Figure out how to have one physical device interpreted by the computer as two separate devices i.e. /dev/sdb and /dev/sdc point to two different partition tables on the *same physical device*. I think this might be possible. You can treat two physical devices as one device (ex: /dev/sdb is two devices). You can set up a hybrid partition table. Surely this is possible.
3. Idea: Set up a hybrid partition table. I don't fully understand this concept yet, but I don't want to try it as it's supposedly "flaky" (as per the warning in the program gdisk), and by the looks of it in my limited amount of research it's just a "mask" allowing MBR-only operating systems to see GPT-labelled partitions -- doesn't sound like what I want to do, but technically it might apply as the Pi board is MBR only (note that I say board here and OS previously, this discrepancy might be important if i try to navigate this path).
4. Idea: flash the SD card with the Pi OS first, then create and format 3 partitions for Gentoo to use, then continue working on my laptop. I've got a feeling this will be the answer, but unfortunately I am still out of town without my Pi.
5. Give up on this concept, finish setting up Gentoo, and when I get an external SSD I will clone the SD card and then start on my Pi project.

If I can set up this SD card to be bootable on both my Raspberry Pi and my laptop, I now have a portable development environment. My goal is to set it up so that I can multiboot the Pi (with multiple OSs for the Pi), have a custom LiveCD so that I can plug into any modern computer, and also have my full Gentoo environment specifically for my laptop.

I guess I don't have much of a single question, but I do want to know if something like this is within the realm of possibility. I think if I were to ask a question, it would be, is it possible to create a multi-bootable USB drive with OSs supporting different processor architectures? Not specific to the Raspberry Pi, but it is relevant as I am limited by it. Also will take full advantage of my ability to document what I'm doing here. I will be updating this with replies to this top post throughout the week with my findings, and I look forward to hearing your ideas and input!
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments