0

I've seen several answers where there are hints at creating a partition in memory, copying the contents of a SD Card into that partition and then booting an operating system (linux) from that memory partition.

What boot loader would I use for something like this and where can I find documentation on setting it up?

1
  • This is already done by default for every Linux (disk > mem, that is), and most x86 systems require no bootloader at all.
    – mikeserv
    Commented Jan 20, 2016 at 18:44

2 Answers 2

0

The bootloader is not involved at all, this task is usually performed by Linux kernel after it gets loaded into memory from SD card by bootloader which is located on SD card.

The modern way of "booting" from memory requires you to write a custom initramfs script that will detect media where Linux is booted from (since bootloaders do not provide such a useful information although some of them certainly can detect media where they boot from), "open" it's filesystem in readonly mode, allocate tmpfs space for the future root filesystem and then copy everything from media to it, then just switchroot and execute /sbin/init from there.

You can find a good example here - a script which detects where to find a media to copy from, and you will need to create initramfs image, usually by hand, see this script for some key instructions.

If you do not know how initramfs works, you should check out good info first, consider reading Documentation/filesystems/ramfs-rootfs-initramfs.txt as well as Linux From Scratch - About initramfs, and google "linux initramfs".

0

You could either look at a live distribution like GRML which supports copying its entire squashfs to RAM on boot (using the grml2ram argument) and which can be customized easily (see grml-live); or you could lay out your system as an initramfs and have the bootloader load that along with the kernel.

Less elegantly, you could stick with a stock initramfs and add a script to it that loads the contents of your sdcard into memory, then uses that as the rootfs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .