Index: share/examples/Makefile =================================================================== --- share/examples/Makefile (revision 217101) +++ share/examples/Makefile (working copy) @@ -8,6 +8,7 @@ FreeBSD_version \ IPv6 \ bootforth \ + bsdbox \ cvsup \ diskless \ drivers \ Index: share/examples/bsdbox/bsdbox/bsdbox/Makefile.net =================================================================== --- share/examples/bsdbox/bsdbox/bsdbox/Makefile.net (revision 0) +++ share/examples/bsdbox/bsdbox/bsdbox/Makefile.net (revision 0) @@ -0,0 +1,19 @@ +CRUNCH_PROGS_sbin+= route ping +CRUNCH_PROGS_usr.sbin+= arp + +# inetd +CRUNCH_PROGS_usr.sbin+= inetd +CRUNCH_LIBS+= -lwrap + +#.if ${MK_INET6_SUPPORT} != "no" +#CRUNCH_PROGS_sbin+= ping6 +#.endif + +# netstat +CRUNCH_PROGS_usr.bin+= netstat +CRUNCH_LIBS+= -lmemstat -lnetgraph +CRUNCH_BUILDOPTS_netstat=-DMK_IPX_SUPPORT=no + +# ifconfig +CRUNCH_PROGS_sbin+= ifconfig +CRUNCH_BUILDOPTS_ifconfig=-DMK_IPX_SUPPORT=no Index: share/examples/bsdbox/bsdbox/bsdbox/Makefile.textproc =================================================================== --- share/examples/bsdbox/bsdbox/bsdbox/Makefile.textproc (revision 0) +++ share/examples/bsdbox/bsdbox/bsdbox/Makefile.textproc (revision 0) @@ -0,0 +1,11 @@ +# Sed +CRUNCH_PROGS_usr.bin+= sed + +# Awk +# Disable - it's big! -adrian +#CRUNCH_PROGS_usr.bin+= awk +#CRUNCH_BUILDTOOLS+= usr.bin/awk + +# vi +# Disable - it's big! -adrian +#CRUNCH_PROGS_usr.bin+= vi Index: share/examples/bsdbox/bsdbox/bsdbox/Makefile.base =================================================================== --- share/examples/bsdbox/bsdbox/bsdbox/Makefile.base (revision 0) +++ share/examples/bsdbox/bsdbox/bsdbox/Makefile.base (revision 0) @@ -0,0 +1,25 @@ +CRUNCH_PROGS_sbin+= dmesg sysctl init reboot +CRUNCH_PROGS_bin+= ls cat dd df cp hostname kill mkdir sleep ps ln +CRUNCH_PROGS_usr.bin+= true false hexdump tail + +# sh +CRUNCH_PROGS_bin+= sh +CRUNCH_ALIAS_sh= -sh +CRUNCH_SUPPRESS_LINK_-sh= 1 +CRUNCH_BUILDTOOLS+= bin/sh + +# chown +CRUNCH_PROGS_usr.sbin+= chown +CRUNCH_ALIAS_chown= chgrp + +# MFS mounting +CRUNCH_PROGS_sbin+= mount mdmfs mdconfig newfs +CRUNCH_ALIAS_mdmfs= mount_mfs + +# grep +# grep doesn't yet work -adrian +#CRUNCH_PROGS_usr.bin+= grep + +# less/more +CRUNCH_PROGS_usr.bin+= less +CRUNCH_ALIAS_less= more Index: share/examples/bsdbox/bsdbox/bsdbox/Makefile.telnetd =================================================================== --- share/examples/bsdbox/bsdbox/bsdbox/Makefile.telnetd (revision 0) +++ share/examples/bsdbox/bsdbox/bsdbox/Makefile.telnetd (revision 0) @@ -0,0 +1,10 @@ +# Build telnetd +# Question - why is telnetds objects ending up in the srcdir? -adrian + +# This won't work yet - because telnetd relies on libtelnet.a which includes +# kerberos support by default; building telnetd without kerberos support +# requires the cross-build world to be built the same. +# -adrian + +CRUNCH_PROGS_libexec+= telnetd +CRUNCH_BUILDOPTS_telnetd= WITHOUT_KERBEROS_SUPPORT=yes Index: share/examples/bsdbox/bsdbox/bsdbox/Makefile =================================================================== --- share/examples/bsdbox/bsdbox/bsdbox/Makefile (revision 0) +++ share/examples/bsdbox/bsdbox/bsdbox/Makefile (revision 0) @@ -0,0 +1,118 @@ +#$FreeBSD$ +# @(#)Makefile 8.1 (Berkeley) 6/2/93 + +NO_MAN= + +.include +MK_SSP= no + +PROG= bsdbox +BINDIR?=/bsdbox + +################################################################# +# +# General notes: +# +# A number of Make variables are used to generate the crunchgen config file. +# +# CRUNCH_SRCDIRS: lists directories to search for included programs +# CRUNCH_PROGS: lists programs to be included +# CRUNCH_LIBS: libraries to statically link with +# CRUNCH_SHLIBS: libraries to dynamically link with +# CRUNCH_BUILDOPTS: generic build options to be added to every program +# CRUNCH_BUILDTOOLS: lists programs that need build tools built in the +# local architecture. +# +# Special options can be specified for individual programs +# CRUNCH_SRCDIR_$(P): base source directory for program $(P) +# CRUNCH_BUILDOPTS_$(P): additional build options for $(P) +# CRUNCH_ALIAS_$(P): additional names to be used for $(P) +# +# By default, any name appearing in CRUNCH_PROGS or CRUNCH_ALIAS_${P} +# will be used to generate a hard link to the resulting binary. +# Specific links can be suppressed by setting +# CRUNCH_SUPPRESS_LINK_$(NAME) to 1. +# + +# Define Makefile variable RESCUE +CRUNCH_BUILDOPTS+= -DRESCUE + +# Which sources have local-arch build tools? +# Define as blank; othrs need to override +CRUNCH_BUILDTOOLS= + +# Define compile-time RESCUE symbol when compiling components +# XXX this isn't needed for bsdbox - the tools should target the normal paths -adrian +# CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE + +# An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk +# rather than incorporating rescue-specific logic into standard files. +#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS} + +# Hackery: 'librescue' exists merely as a tool for appropriately +# recompiling specific library entries. We _know_ they're needed, and +# regular archive searching creates ugly library ordering problems. +# Easiest fix: tell the linker to include them into the executable +# first, so they are guaranteed to override the regular lib entries. +# Note that if 'librescue' hasn't been compiled, we'll just get the +# regular lib entries from libc and friends. +# CRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o + +################################################################### +# Programs from stock /bin +# +# WARNING: Changing this list may require adjusting +# /usr/include/paths.h as well! You were warned! +# +CRUNCH_SRCDIRS+= bin +CRUNCH_LIBS+= -lkvm -lmemstat -lutil -lnetgraph +CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil + +################################################################### +# Programs from standard /sbin +# +# WARNING: Changing this list may require adjusting +# /usr/include/paths.h as well! You were warned! +# +# Note that mdmfs have their own private 'pathnames.h' +# headers in addition to the standard 'paths.h' header. +# +CRUNCH_SRCDIRS+= sbin + +CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec +# Don't forget this - ifconfig, etc -adrian +.if ${MK_IPX} != "no" +CRUNCH_LIBS+= -lipx +.endif +CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz + +################################################################## +# Programs from stock /usr/bin +# +CRUNCH_SRCDIRS+= usr.bin +# grep +CRUNCH_LIBS+= -lbz2 + +################################################################## +# Programs from stock /usr/sbin +# +CRUNCH_SRCDIRS+= usr.sbin + +################################################################## + +CRUNCH_SRCDIRS+= libexec + +CRUNCH_LIBS+= -lm + +.include "Makefile.base" +.include "Makefile.net" +.include "Makefile.hostapd" +.include "Makefile.textproc" +# this doesn't yet work -adrian +#.include "Makefile.telnetd" + +# the crunchgen build environment +.include + +# and since it creates a program.. +.include Index: share/examples/bsdbox/bsdbox/bsdbox/Makefile.hostapd =================================================================== --- share/examples/bsdbox/bsdbox/bsdbox/Makefile.hostapd (revision 0) +++ share/examples/bsdbox/bsdbox/bsdbox/Makefile.hostapd (revision 0) @@ -0,0 +1,5 @@ +CRUNCH_PROGS_usr.sbin+= hostapd hostapd_cli +CRUNCH_SRCDIR_hostapd= $(.CURDIR)/../../usr.sbin/wpa/hostapd +CRUNCH_SRCDIR_hostapd_cli= $(.CURDIR)/../../usr.sbin/wpa/hostapd_cli + +CRUNCH_LIBS+= -lpcap Index: share/examples/bsdbox/bsdbox/Makefile =================================================================== --- share/examples/bsdbox/bsdbox/Makefile (revision 0) +++ share/examples/bsdbox/bsdbox/Makefile (revision 0) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= bsdbox + +.include Index: share/examples/bsdbox/README =================================================================== --- share/examples/bsdbox/README (revision 0) +++ share/examples/bsdbox/README (revision 0) @@ -0,0 +1,39 @@ + +This is a very cut down implementation of a "busybox" style binary +build system for FreeBSD. + +It's based on the rescue build system which uses the crunchgen functionality +to build binaries. + +To build this stuff: + +* place the bsdbox subdirectory in /usr/src/bsdbox, matching what + /usr/src/rescue looks like + +* Take a look at the Makefiles in /usr/src/bsdbox/bsdbox/ ; it is all + relatively straight forward. + +* Use Makefile.inc1.diff to patch /usr/src/Makefile.inc1; this adds the + bsdbox bits to the build tree. + +* Use mtree-BSD.root.dist.diff to patch /usr/src/etc/mtree/BSD.root.dist + to add the /bsdbox directory to the build tree. + +* Build/install as per normal. + +The bsdbox binaries are included in /bsdbox. + +Known issues: + +* The libraries used are those in the normal (cross) build, rather than + whatever build flags are set here. So for example, if your normal (cross) + build includes PAM/kerberos but you wish to build a bsdbox telnetd without + PAM/kerberos, the linking stage will fail. + + Fixing this requires extending bsdbox to build a local set of libraries + with different flags to the base build. + + + + -- adrian + Index: share/examples/bsdbox/Makefile.inc1.diff =================================================================== --- share/examples/bsdbox/Makefile.inc1.diff (revision 0) +++ share/examples/bsdbox/Makefile.inc1.diff (revision 0) @@ -0,0 +1,28 @@ +diff --git a/Makefile.inc1 b/Makefile.inc1 +index a08e4ca..60adb62 100644 +--- a/Makefile.inc1 ++++ b/Makefile.inc1 +@@ -56,6 +56,7 @@ SUBDIR+=kerberos5 + .endif + .if ${MK_RESCUE} != "no" + SUBDIR+=rescue ++SUBDIR+=bsdbox + .endif + SUBDIR+=sbin + .if ${MK_CRYPT} != "no" +@@ -1031,6 +1032,7 @@ _kerberos5_tools= kerberos5/tools + + .if ${MK_RESCUE} != "no" + _rescue= rescue/rescue ++_bsdbox= bsdbox/bsdbox + .endif + + build-tools: +@@ -1038,6 +1040,7 @@ build-tools: + bin/csh \ + bin/sh \ + ${_rescue} \ ++ ${_bsdbox} \ + lib/ncurses/ncurses \ + lib/ncurses/ncursesw \ + ${_share} \ Index: share/examples/bsdbox/mtree-BSD.root.dist.diff =================================================================== --- share/examples/bsdbox/mtree-BSD.root.dist.diff (revision 0) +++ share/examples/bsdbox/mtree-BSD.root.dist.diff (revision 0) @@ -0,0 +1,13 @@ +diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist +index ce8a456..7e86aed 100644 +--- a/etc/mtree/BSD.root.dist ++++ b/etc/mtree/BSD.root.dist +@@ -7,6 +7,8 @@ + . + bin + .. ++ bsdbox ++ .. + boot + defaults + ..