<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 4, 2023 at 1:59 PM Theodore Ts'o <<a href="mailto:tytso@mit.edu">tytso@mit.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Sep 04, 2023 at 11:20:31AM -0600, Warner Losh wrote:<br>
> <br>
> Yea, it was an effort to move mounting of root out of the<br>
> kernel. The earliest scripts just mounted the right disk and moved<br>
> on, and didn't load any new drivers: they just had the logic to pick<br>
> the desired root. But at the same time, there were a lot of people<br>
> that were running on 4MB and 8MB systems that noticed they could put<br>
> all the router software in the initramfs and never pivot to<br>
> something else and they could have quite the product with that. And<br>
> those were the first few bricks that paved the road to hell :)<br>
<br>
The other reason why you might need something like an initial ramdisk<br>
is if you don't yet *have* a root file system on the hardware, and you<br>
are trying to install a system using TFTP boot. At that point, you<br>
have three choices:<br>
<br>
(a) Use a NFS root<br>
<br>
(b) Use a read-only network block device (for example, MIT Project<br>
Athena had a read-only Remote Virtual Disk which was a network block<br>
device that was used to provide a read-only system image used for<br>
installation and update, as well as a read-only /usr image).<br>
<br>
(c) Use a built-in ramdisk. (And here's not just Linus which has<br>
adopted this strategy; OpenBSD's installer does this as well.)<br></blockquote><div><br></div><div>Yes. FreeBSD did this originally, and some installers still do that.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The other dynamic at play was that ramdisks were needed when you were<br>
installing on a 386 PC with, say, 16 megs of memory, a 320 megabyte<br>
hard disk, and a *single* 1.44MB floppy --- and no ethernet, because<br>
this was for the home PC user, so the best that you had might be a<br>
38kbps dialup link with PPP --- if you were lucky.<br>
<br>
So putting the kernel on the first floppy disk, and putting a ramdisk<br>
image on the second floppy disk, so you could then eject the floppy<br>
disk and insert subsequent floppy disks so you could install rest of<br>
the installation binaries (including the shell utilities, the C<br>
compiler, X windows systems, etc.) and then reboot onto the HDD with a<br>
fully set up system, was a pretty natural evolution.<br></blockquote><div><br></div><div>Yes. FreeBSD 2.0 definitely did that, and I think FreeBSD 1.0 as well.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
And since we had the ramdisk infrastructure, and most users didn't<br>
want to configure their own kernel as part of the installation<br>
process, that begat kernel modules and the initial ramdisk being used<br>
to store the kernel modules. In the very early days, this made Linux<br>
*far* more user friendly for non-system programmers to install,<br>
compared to say, FreeBSD during that era, which was still stuck in the<br>
BSD 4.x days of a generic kernel, followed by a kernel configuration<br>
step, etc.<br></blockquote><div><br></div><div>GENERIC worked fine in the early days: it was small enough that the savings</div><div>from removing all the extra devices was small... but that's because the number</div><div>of devices supported was also relatively small. By the time it became an issue</div><div>FreeBSD did have dynamic loading of drivers, but retained the GENERIC</div><div>kernel for install (it should have gone to a minimal kernel, but hasn't yet</div><div>completed the migration: the savings wasn't big enough due to Moore's</div><div>Law growing machine memories faster than the kernel grew: FreeBSD's kernel</div><div>only doubled every 2 years...).</div><div><br></div><div>But yea, it was a bit of a kludge. And FreeBSD grew the ability to configure</div><div>the morass of ISA devices in the boot loader early on so you could at least</div><div>boot the generic kernel, and have the loader remember your choices.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
These days, given that some enterprise setups what their servers to be<br>
installed from a Fibre Channel Storage Area Network, or iSCSI, perhaps<br>
using Kerberos to authenticate to the iSCSI target, it makes<br>
absolutely a huge amount of sense to have an initial ramdisk as an<br>
option. That being said, for a long time, the initial ramdisk was an<br>
*option*. You didn't have to use it, if you were willing to have a<br>
custom kernel and you are using a device which has a fixed and stable<br>
boot-time enumeration.<br></blockquote><div><br></div><div>Yea. FreeBSD can use it to this day (and many interesting use cases</div><div>use it), but generally the loader tells the kernel what root filesystem to</div><div>use. These smarts in the boot loader have also kept the pressure of the</div><div>vast majority of cases where initramfs makes sense in Linux land.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This tended to only be used by people who knew what they were doing,<br>
but for example, my file system test appliance VM system doesn't use<br>
an initial ramdisk at all. It uses qemu, and has a built-in kernel<br>
configuration and build system, and this works perfectly fine booting<br>
into the latest Debian stable distribution, with no initial ramdisk<br>
used at all:<br><br>
<a href="https://github.com/tytso/xfstests-bld/blob/master/Documentation/kvm-quickstart.md" rel="noreferrer" target="_blank">https://github.com/tytso/xfstests-bld/blob/master/Documentation/kvm-quickstart.md</a><br></blockquote></div><div class="gmail_quote"><br></div><div class="gmail_quote">Ah, cool. Every single distro I've run in the past has had an initramfs. I thought</div><div class="gmail_quote">it had become no longer an option...</div><div class="gmail_quote"><br></div><div class="gmail_quote">I do similar things for my VM setup with FreeBSD :)<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Warner<br></div></div>