aboutsummaryrefslogtreecommitdiff
path: root/tools/bsdbox
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2012-01-06 00:56:31 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2012-01-06 00:56:31 +0000
commit6b1dcfcd830a500ea6c851dd22d6c7f2663c6ab4 (patch)
treed3d4aab2228680e468475edc7143852358db74e1 /tools/bsdbox
parent0d9f40f219c2f8eadddeda1e604a3a44bacd101f (diff)
downloadsrc-6b1dcfcd830a500ea6c851dd22d6c7f2663c6ab4.tar.gz
src-6b1dcfcd830a500ea6c851dd22d6c7f2663c6ab4.zip
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.
Notes
Notes: svn path=/head/; revision=229675
Diffstat (limited to 'tools/bsdbox')
-rw-r--r--tools/bsdbox/Makefile115
-rw-r--r--tools/bsdbox/Makefile.base55
-rw-r--r--tools/bsdbox/Makefile.fs17
-rw-r--r--tools/bsdbox/Makefile.hostapd15
-rw-r--r--tools/bsdbox/Makefile.kld6
-rw-r--r--tools/bsdbox/Makefile.login9
-rw-r--r--tools/bsdbox/Makefile.net32
-rw-r--r--tools/bsdbox/Makefile.telnetd14
-rw-r--r--tools/bsdbox/Makefile.textproc20
-rw-r--r--tools/bsdbox/README12
10 files changed, 295 insertions, 0 deletions
diff --git a/tools/bsdbox/Makefile b/tools/bsdbox/Makefile
new file mode 100644
index 000000000000..8656da6f896f
--- /dev/null
+++ b/tools/bsdbox/Makefile
@@ -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>
diff --git a/tools/bsdbox/Makefile.base b/tools/bsdbox/Makefile.base
new file mode 100644
index 000000000000..5e8e9a3c2879
--- /dev/null
+++ b/tools/bsdbox/Makefile.base
@@ -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
diff --git a/tools/bsdbox/Makefile.fs b/tools/bsdbox/Makefile.fs
new file mode 100644
index 000000000000..03fe4b58198e
--- /dev/null
+++ b/tools/bsdbox/Makefile.fs
@@ -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
diff --git a/tools/bsdbox/Makefile.hostapd b/tools/bsdbox/Makefile.hostapd
new file mode 100644
index 000000000000..e16a0d134d50
--- /dev/null
+++ b/tools/bsdbox/Makefile.hostapd
@@ -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
+
diff --git a/tools/bsdbox/Makefile.kld b/tools/bsdbox/Makefile.kld
new file mode 100644
index 000000000000..96be779faeeb
--- /dev/null
+++ b/tools/bsdbox/Makefile.kld
@@ -0,0 +1,6 @@
+#
+# This builds the kld related programs.
+#
+# $FreeBSD$
+#
+CRUNCH_PROGS_sbin+= kldload kldunload kldstat
diff --git a/tools/bsdbox/Makefile.login b/tools/bsdbox/Makefile.login
new file mode 100644
index 000000000000..a4574ec0abc4
--- /dev/null
+++ b/tools/bsdbox/Makefile.login
@@ -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
diff --git a/tools/bsdbox/Makefile.net b/tools/bsdbox/Makefile.net
new file mode 100644
index 000000000000..1b9bc789851e
--- /dev/null
+++ b/tools/bsdbox/Makefile.net
@@ -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
diff --git a/tools/bsdbox/Makefile.telnetd b/tools/bsdbox/Makefile.telnetd
new file mode 100644
index 000000000000..c0d6c4b05117
--- /dev/null
+++ b/tools/bsdbox/Makefile.telnetd
@@ -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
diff --git a/tools/bsdbox/Makefile.textproc b/tools/bsdbox/Makefile.textproc
new file mode 100644
index 000000000000..a913d4605975
--- /dev/null
+++ b/tools/bsdbox/Makefile.textproc
@@ -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
diff --git a/tools/bsdbox/README b/tools/bsdbox/README
new file mode 100644
index 000000000000..2f63652d9799
--- /dev/null
+++ b/tools/bsdbox/README
@@ -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
+