I have successfully booted into a NetBSD kernel with a custom ramdisk that has a statically linked init that does nothing.
Baby steps!
Discussion
I have successfully booted into a NetBSD kernel with a custom ramdisk that has a statically linked init that does nothing.
Baby steps!
Or, you know... I'll just ship /dev in the ramdisk, because that's easier. I'll address that part later.
What to do next... I suppose making it boot with dinit would be the logical next step, and then I can try building a minimal system in the store, boot that up, and go from there.
Whee!
Booted with dinit, kind of. Only have two services so far: mount -a and getty on constty, but we're getting there, this is enough to validate the approach.
Now to figure out the next step!
Previously, I considered setting up a hand-built store, and going from there, but... that's a very big leap: it involves not only moving netbsd's userland to the store, I'd also have to write the "lets reconstruct the ephemeral parts of /".
Like, the goal is to have / on tmpfs...
Idea is turning out to be harder than anticipated, because I have to figure out how to mount mfs on /, and mfs_args has a caddr_t base member, and what's that, and how does that and size relate to the parameters given to mount_mfs?
And where's the source of mount_mfs? Because I can't find it in /usr/src/sbin/...
Aha! It's /sbin/newfs.
Yeah, well, I'm not gonna do that from C, and /rescue/mount_mfs is big. But perhaps it fits.
Buut, there's mount_tmpfs! And I suppose I actually want that, not mfs, so lets see how hard it is to do in C.
Nice. That works. So the next step then is:
tmpfs as /altroot/dev/dk0 as /altroot/tbd/altroot/tbd to /altroot/altroot/usr/pkg/sbin/dinit