svn commit: r229675 - head/tools/bsdbox

Adrian Chadd adrian at FreeBSD.org
Fri Jan 6 00:56:31 UTC 2012


Author: adrian
Date: Fri Jan  6 00:56:31 2012
New Revision: 229675
URL: http://svn.freebsd.org/changeset/base/229675

Log:
  Import the first cut of "bsdbox".
  
  This uses the existing crunchgen infrastructure to build
  a series of tools designed to replace the base and networking
  tools on an embedded system.
  
  It reuses 'bsd.crunchgen.mk' to drive the actual file
  creation. The rescue build system also uses this.
  
  Unlike busybox, it doesn't include its own source - instead,
  it just builds from the sources in /usr/src/ and leverages
  the existing BSD framework.
  
  Thie is still quite messy and could do with a whole lot of
  cleaning up.   However it is proving to be very useful with
  my current build framework, allowing me to build binary root
  images that are about 30% less than simply cherrypicking files
  and libraries from an installworld.

Added:
  head/tools/bsdbox/
  head/tools/bsdbox/Makefile   (contents, props changed)
  head/tools/bsdbox/Makefile.base   (contents, props changed)
  head/tools/bsdbox/Makefile.fs   (contents, props changed)
  head/tools/bsdbox/Makefile.hostapd   (contents, props changed)
  head/tools/bsdbox/Makefile.kld   (contents, props changed)
  head/tools/bsdbox/Makefile.login   (contents, props changed)
  head/tools/bsdbox/Makefile.net   (contents, props changed)
  head/tools/bsdbox/Makefile.telnetd   (contents, props changed)
  head/tools/bsdbox/Makefile.textproc   (contents, props changed)
  head/tools/bsdbox/README   (contents, props changed)

Added: head/tools/bsdbox/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,115 @@
+#$FreeBSD$
+#	@(#)Makefile	8.1 (Berkeley) 6/2/93
+
+NO_MAN=
+
+.include <bsd.own.mk>
+MK_SSP=	no
+
+PROG=	bsdbox
+BINDIR?=/sbin
+
+#################################################################
+#
+# 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
+
+# Don't do symlinks as part of the install
+CRUNCH_GENERATE_LINKS= no
+
+# Which sources have local-arch build tools?
+# Define as blank; othrs need to override
+CRUNCH_BUILDTOOLS=
+
+###################################################################
+# Programs from stock /bin
+#
+# WARNING: Changing this list may require adjusting
+# /usr/include/paths.h as well!  You were warned!
+#
+CRUNCH_SRCDIRS+= bin
+# These are required to be shared so login and su can run as
+# setuid binaries - they use these libraries. PAM needs to be
+# built dynamically or it tries to build _all_ of the modules
+# statically - and that ends very badly.
+CRUNCH_SHLIBS+=	-lc -lutil
+CRUNCH_LIBS+= -lkvm -lmemstat -lnetgraph
+CRUNCH_LIBS+= -lcrypt -ledit -ll -ltermcap
+
+###################################################################
+# 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 -lsbuf -lufs
+
+##################################################################
+# 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"
+.include "Makefile.login"
+.include "Makefile.kld"
+# telnet/telnetd are too broken to include as a crunchgen'ed binary,
+# thanks to some of the horrible layering violations going on.
+# .include "Makefile.telnetd"
+.include "Makefile.fs"
+
+CRUNCH_LIBS+= -lcrypto -lssl -lz
+
+# the crunchgen build environment
+.include <bsd.crunchgen.mk>
+
+# and since it creates a program..
+.include <bsd.prog.mk>

Added: head/tools/bsdbox/Makefile.base
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.base	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,55 @@
+#
+# This builds a variety of "base" tools, useful for an embedded
+# system.
+#
+# $FreeBSD$
+#
+CRUNCH_PROGS_sbin+=	dmesg sysctl init reboot
+CRUNCH_PROGS_bin+=	ls cat dd df cp hostname kill mkdir sleep ps ln rm hostname
+CRUNCH_PROGS_usr.bin+=	true false hexdump tail nc w head uname tset
+CRUNCH_PROGS_usr.sbin+=	gpioctl
+CRUNCH_ALIAS_w=		uptime
+CRUNCH_ALIAS_tset=	reset
+
+CRUNCH_PROGS_usr.bin+=	vmstat systat
+CRUNCH_LIBS+=		-ldevstat -lncursesw -lncurses -lmemstat -lkvm
+
+CRUNCH_PROGS_usr.bin+=	tar cpio
+# XXX SSL ?
+CRUNCH_LIBS+=		-larchive -lbz2 -lz -llzma -lbsdxml -lssl -lcrypto
+
+# Clear requires tput, and it's a shell script so it won't be crunched
+CRUNCH_PROGS_usr.bin+=	tput
+
+# 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
+
+# Basic filesystem stuff
+CRUNCH_PROGS_sbin+=	mount umount
+
+# grep
+# grep doesn't yet work -adrian
+CRUNCH_PROGS_usr.bin+=	grep 
+
+# less/more
+CRUNCH_PROGS_usr.bin+=	less
+CRUNCH_ALIAS_less=	more
+
+# passwd
+CRUNCH_PROGS_usr.bin+=	passwd
+# These need to be shared, or PAM wants to include _all_ of the libraries
+# at runtime.
+CRUNCH_SHLIBS+= -lpam -lbsm
+
+# gzip/gunzip
+CRUNCH_PROGS_usr.bin+=	gzip
+CRUNCH_ALIAS_gunzip=	gzip
+CRUNCH_ALIAS_gzcat=	gzip
+CRUNCH_LIBS+=		-lz -llzma -lbz2

Added: head/tools/bsdbox/Makefile.fs
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.fs	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,17 @@
+#
+# Filesystem related tools
+#
+# $FreeBSD$
+
+# mfs
+CRUNCH_PROGS_sbin+=	mdmfs mdconfig newfs
+CRUNCH_ALIAS_mdmfs=	mount_mfs
+
+# UFS
+CRUNCH_PROGS_sbin+=	fsck_ffs
+CRUNCH_LIBS+= -lgeom
+CRUNCH_LIBS+= -lufs
+
+# msdos
+# CRUNCH_PROGS_sbin+=	mount_msdosfs
+# CRUNCH_LIBS+= -lkiconv

Added: head/tools/bsdbox/Makefile.hostapd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.hostapd	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,15 @@
+#
+# Build hostap/wpa_supplicant and supporting utilities.
+#
+# $FreeBSD$
+#
+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_PROGS_usr.sbin+=	wpa_supplicant wpa_cli
+CRUNCH_SRCDIR_wpa_supplicant=	$(.CURDIR)/../../usr.sbin/wpa/wpa_supplicant
+CRUNCH_SRCDIR_wpa_cli=	$(.CURDIR)/../../usr.sbin/wpa/wpa_cli
+
+CRUNCH_LIBS+=	-lpcap
+

Added: head/tools/bsdbox/Makefile.kld
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.kld	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,6 @@
+#
+# This builds the kld related programs.
+#
+# $FreeBSD$
+#
+CRUNCH_PROGS_sbin+=	kldload kldunload kldstat

Added: head/tools/bsdbox/Makefile.login
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.login	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,9 @@
+#
+# This builds login and friends.
+#
+# $FreeBSD$
+#
+
+CRUNCH_PROGS_libexec+=	getty
+CRUNCH_PROGS_usr.bin+=	cap_mkdb
+CRUNCH_PROGS_usr.sbin+=	pwd_mkdb

Added: head/tools/bsdbox/Makefile.net
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.net	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,32 @@
+#
+# This builds network tools.
+#
+# $FreeBSD$
+#
+
+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
+
+# wlan stuff
+CRUNCH_PROGS_usr.sbin+=	wlandebug
+
+# tcpdump
+CRUNCH_PROGS_usr.sbin+=	tcpdump
+# CRUNCH_LIBS+=	-lpcap -lcrypto

Added: head/tools/bsdbox/Makefile.telnetd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.telnetd	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,14 @@
+# 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
+
+# $FreeBSD$
+
+CRUNCH_PROGS_libexec+=	telnetd
+CRUNCH_PROGS_usr.bin+=	telnet
+CRUNCH_LIBS+=		-lkrb5 -lhx509 -lasn1 -lcom_err -lroken -ltelnetd
+# CRUNCH_BUILDOPTS_telnetd=	WITHOUT_KERBEROS_SUPPORT=yes

Added: head/tools/bsdbox/Makefile.textproc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/Makefile.textproc	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,20 @@
+#
+# This builds a variety of text processing tools that
+# may be useful on an embedded device.
+#
+# $FreeBSD$
+#
+
+# 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
+
+CRUNCH_PROGS_usr.bin+=	ee

Added: head/tools/bsdbox/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/bsdbox/README	Fri Jan  6 00:56:31 2012	(r229675)
@@ -0,0 +1,12 @@
+$FreeBSD$
+
+This is a very cut down implementation of a "busybox" style binary
+for FreeBSD.
+
+It's based on the rescue build system, which uses the crunchgen functionality
+to build binaries.
+
+It's a work in progress.
+
+  -- adrian
+


More information about the svn-src-all mailing list