On Fri, Sep 02, 2016 at 03:25:52AM +0200, William Z. wrote: > Hi, > > I'm currently trying to replace Linux with NetBSD in some of > my embedded devices. > > I have read "The Guide" and found out how to create a crosscompiler and > compile a tiny custom kernel. However, I also want to create a very > minimal userland, but as far as I can tell "The Guide" only explains how > to compile the full NetBSD userland. > > How can I disable unneeded parts of the userland?
The easiest way is to build everything, but use additional setlists to produce a sort of "micro-base" and "micro-etc". Then install these rather than base and etc. I have reduced a working NetBSD userland to well under 64MB in this way, for an embedded product that shipped thousands of units. As a test, I reduced it to under 4MB (at which point it was dwarfed by the kernel...) for an upgrade installer image. It is a little work to get it going but once done it is surprisingly easy to maintain. You may also want to turn off some of the MK options both to shrink your built binaries and to save time in the build. There are a number of options unlikely to be useful for a modern embedded device. Thor