Page 1 of 1

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 8:26 am
by Kushan
Hi everyone,

I'm not brilliantly familliar with Linux, so apologies if this is a really obvious yet stupid question but I was wondering if its possible to load multiple OS/Distributions onto one SD card?

I have a Pi and I've been playing around with debian and openelec but I only have one SD card. It's a 16Gb card though, so plenty of space and it'd be cool to fill it with the various distributions that are lying around rather than having to format it each time.

However, I'm wondering how plausible this is and what limitations there may be?

I know on most windows machines, you can only have 4 partitions per drive due to limitations mainly with BIOS (I believe). I also believe that UEFI can have more partitions and thus presumably more OS's. However, it's my understanding that most linux distributions require a couple of partitions (there seems to be a lot that use a FAT32 and an EXT combination) and I'm not really sure where the Pi falls in all of this (Does it even have a  "BIOS" or something similar?).

In any case, can anyone suggest what is possible and point to a guide on it? The dream is to have this little credit card sized device with about 10 different OSs on it, for giggles and lols (And easier switching to XBMC when I'm not playing with it =P).

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 9:08 am
by Techmeology
To do this properly, you'd need some kind of bootloader that presents a menu on start up. However, you could use cmdline.txt to change the root partition. So you could have one distribution on partition 2, and another on partition 3, and use the root=/dev/mmcblk0p2 or root=root=/dev/mmcblk0p3 to switch between them.

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 11:48 am
by Kushan
Yeah, I figured we'd have to use GRUB or something to do it properly.

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 11:56 am
by plugwash
Some settings which you will likely want to change between images (e.g. the memory map) will require a reboot to clear.

If I was doing a menu system for the Pi I think i'd have the SD card set up to boot into the menu system most of them time. When you select an entry from the menu it would setup the boot files for that entry and then reboot the Pi.

A script would then be added to each OS to reset the boot files back to the menu as early as possible in the boot process (what i'd be tempted to do is launch the script with init= on the kernel command line and then have it exec the normal init process when it finishes).

As for number of partitions PC style partition tables support 4 primary partitions. Of those four primary partitions one can be an "extended partition". The extended partition in turn contains partitions known as "logical drives". Afaict the partition table structure itself imposes no limit on the number of logical drives but I think linux does have a limit on the number of partitions it can see.

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 12:14 pm
by mahjongg
booting multiple partitions was one reason I proposed a "boot menu" was needed for the R-PI (the other reason being the need to boot a distro with a memory split of the users choice). See:

http://www.raspberrypi.org/for.....-of-choice

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 6:00 pm
by Kushan
Yeah, I wasn't thinking anything massively fancy, just a menu when you boot the pi that maybe has a "default" selection after 30s - you know, just your standard boot menu.

I just don't know how to go about doing that, particularly as SD cards tend to be loaded up in advance whereas on a PC the bootloader stuff tends to be taken care of during OS installation. I presume that, ultimately, it's just a case of getting the partitions right and editing some config files but I'm really not sure where to begin.

Once that's done, I guess there's a way to extract the necessary files from a .img file?

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 9:25 pm
by Techmeology
Although the RPi distros are generally distributed as images, it's possible to extract the partitions, and shuffle them around as you see fit. I expect it would also be possible to create installers (that either expand them selves onto the SD card, or that read from a memory stick, create and write a custom image, or something of this nature).

The maximum number of installed distros, it should be possible to use logical partitions.

As for a menu system, the easiest approach is probably as plugwash suggested.

Re: Multiple boot images on one SD card?

Posted: Mon Apr 30, 2012 9:43 pm
by Gert van Loo
As the GPU always boots first a really nice boot selector would run on the GPU and select the image you want. I don't think it is that difficult so I assume in due time  a Broadcom SW engineer will spend an evening on adding that to the GPU boot code.

You can always ask and offer some incentive <a beer or two>.

Re: Multiple boot images on one SD card?

Posted: Tue May 01, 2012 8:05 am
by Kushan
I would happily donate a beer or two! Although I'm a programmer myself, I don't have any experience with low-level hardware stuff to be able to do something like this myself (although I'd love to learn), so if guilting some engineer into writing some code (using wonderful, wonderful beer!) that we can all benefit from is a way I can help out, I'd be glad to!

Just point me to a donation page or something and I'm there!

Re: Multiple boot images on one SD card?

Posted: Tue May 01, 2012 9:16 am
by dom
@gert while displaying a loader menu from start.elf is straightforward, we have no USB driver until Linux loads, so can"t act on key presses.

Re: Multiple boot images on one SD card?

Posted: Tue May 01, 2012 9:29 am
by nick.mccloud
Could we have another setting or another setting file to point to the desired boot partition - at least then we can change it from the Pi even if we boot in to another distro to do so?

Re: Multiple boot images on one SD card?

Posted: Tue May 01, 2012 9:51 am
by Techmeology
That's already possible by changing cmdline.txt's root option (and optionally changing the kernel image).

Re: Multiple boot images on one SD card?

Posted: Tue May 01, 2012 10:31 am
by markb
Would it be possible to load a small linux image (such as puppy) and from there re-load another image? That way keyobards/mice etc would be supported.

Re: Multiple boot images on one SD card?

Posted: Tue May 01, 2012 11:37 am
by nick.mccloud
Techmeology said:


That's already possible by changing cmdline.txt's root option (and optionally changing the kernel image).


Cool - I've obviously not being paying attention - when I get my hands on a Pi I have a fortnights long playing session planned - shame real work will interrupt - but at least I'll have a whole summer of fun on tap!

Re: Multiple boot images on one SD card?

Posted: Fri Jun 01, 2012 11:35 pm
by the_dude
hi wondering if Gerts hypothetical 'incentive' had been forthcomming yet?

my setup:

boot from sdcard, run from external hdd on relevant hdd partition, I have one partition for xmbc;one for debian squeeze, currently I'm swapping sd cards, each with pointers to one of the the two distros in cmdline.txt. Some form of boot menu at the initial load ( similar to grub) would be very handy, currently I'm switching sd cards at each boot to run the system from the relevent patition on my hard drive/or editing cmdline.txt prior to rebooting for the alternate distro.

if beer is required I'm willing to provide... ;)

LLJ&P

Rob

Re: Multiple boot images on one SD card?

Posted: Sun Jun 03, 2012 10:50 am
by AndrewS
Rather than swapping SD cards or editing cmdline.txt you could adapt my runemu script from http://www.raspberrypi.org/phpBB3/viewt ... 027#p88027 to copy either cmdline_debian.txt or cmdline_xbmc.txt to cmdline.txt :)
I guess you'd want rundebian on the xbmc partition, and runxbmc on the debian partition.

Re: Multiple boot images on one SD card?

Posted: Mon Jun 04, 2012 7:23 am
by MVC
I was hoping to be abe to boot to different flavours of linux but as the img files negate this possibilty the low cost of sd cards really makes this point moot i think. It is nice and easy to swap a card out to start Debian one time then Arch the next so i will be using that method when my new shiny pi arrives in 5 weeks! It is coming with Debian but i have downloaded Arch to play with on sd card 2.

Re: Multiple boot images on one SD card?

Posted: Fri Dec 07, 2012 8:55 pm
by confiture
Hello,

I read in a magazine few weeks ago
that there was in a single iso available with multiple distro in multiboot.
Shame I did not write the reference, and no luck with google.

Anybody please know the name of that iso/"distro"

Thanks

Re: Multiple boot images on one SD card?

Posted: Fri Dec 07, 2012 9:02 pm
by confiture
ok after further searches it was BerryBoot
not an iso as such
maybe there is a ready iso as well...