1 |
On Sat, Mar 27, 2021 at 5:43 PM Joshua Kinard <kumba@g.o> wrote: |
2 |
> |
3 |
> I kinda wish the Linux kernel had an ability to partially boot, init the |
4 |
> networking subsystem, then fetch an initramfs image over TFTP like it can do |
5 |
> with NFS Root. That would solve the problem on my MIPS system(s) (and make |
6 |
> install netboots better). I've dug around, but this does not seem to be a |
7 |
> capability currently in the kernel, unless I have over looked something. |
8 |
|
9 |
Support exists, in the form of an initramfs. Bear with me for a second. |
10 |
|
11 |
An initramfs does not need to be large. It is just software. Sure, |
12 |
they're often implemented in bash with all sorts of userspace tools in |
13 |
the image, and that uses lots of space. However, an initramfs could |
14 |
be nothing but a small compiled binary and nothing else - a few |
15 |
kilobytes even. |
16 |
|
17 |
I'm not aware if anything like this has already been created, but you |
18 |
could do something reminiscent of coreboot, and it would be |
19 |
distro-agnostic. Just build a minimal kernel with only support for |
20 |
whatever you need to read a kernel and initramfs (from disk, network, |
21 |
whatever). Then build an initramfs that minimally fetches that kernel |
22 |
- it could just be a tiny binary, or it could use tools like curl/etc. |
23 |
Then you'd kexec the new kernel/initramfs which would do the full |
24 |
boot, and this wouldn't have any size limitation. |
25 |
|
26 |
An initramfs is just a way to automate the kernel boot process using |
27 |
userspace code, vs needing to do a lot of fancy stuff in kernel space. |
28 |
They can get a bit bloated when you make them full-featured/generic, |
29 |
but if you just want a secondary bootloader you can shrink both the |
30 |
kernel and the initramfs considerably, and use that to boot another |
31 |
kernel. |
32 |
|
33 |
If I were to look anywhere for something I could use out-of-the-box it |
34 |
would be with coreboot. That is a linux-based kernel/initramfs |
35 |
designed to be a bootloader really. |
36 |
|
37 |
-- |
38 |
Rich |