Subject: Adding a program to my custom userland.
To: None <current-users@NetBSD.org>
From: Brian Rose <lists@brianrose.net>
List: current-users
Date: 08/28/2006 20:19:15
I am in the process of building a customized NetBSD system to go onto an 
embedded device. Currently I can build the kernel and userland and boot 
from the kernel. I start by building the kernel (with a ramdisk), then 
userland, and then I finally use crunchgen to select the programs I am 
interested in to populate my system. I take this uber-binary and put it 
into a filesystem, populate some hard links, and stuff it into a ramdisk 
kernel. You can see the process at

http://brianrose.net/columns/TinyNetBSD-3.0.1.html

I'd like to add one of my programs to this, but I need to figure out the 
magical incantation used to build the correct binary for my target 
system. The NetBSD guide indicates that building userland is done with

./build.sh -U -u -m sparc64 release

My question is how do I add my custom program to this? I am not familiar 
with the ins and outs of the makefile system, so please address this as 
if I were a newbie to NetBSD (but not software development in general).

I'm guessing that I can clone one of the simpler programs, like init, 
and just replace init.c with hello.c and then replace all references to 
init with hello. This is rather crude, I admit, but I have not been able 
to find a handy little reference document that shows one how to add a 
program to the standard distribution so that it can be easily 
cross-compiled.


Ideas?

Thanks in advance.