initrd: Add various binaries and scripts
authorFrançois Tigeot <ftigeot@wolfpond.org>
Wed, 9 Apr 2014 15:30:44 +0000 (17:30 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Wed, 9 Apr 2014 21:17:51 +0000 (23:17 +0200)
* Crunch bin and sbin commands with some usr.bin and usr.sbin binaries into
  /bin and /sbin respectively, we don't want to maintain a /usr directory

* Some of the symbols cryptsetup and tcplay use conflict with others used
  by regular /sbin binaries, crunch them separately

* lvm's libraries conflict even more, build it as a separate static binary

share/initrd/Makefile
share/initrd/bin/Makefile [new file with mode: 0644]
share/initrd/sbin.libcrypto/Makefile [new file with mode: 0644]
share/initrd/sbin.lvm/Makefile [new file with mode: 0644]
share/initrd/sbin/Makefile [new file with mode: 0644]

index 4520dbf..58f2fa4 100644 (file)
@@ -1,3 +1,3 @@
-SUBDIR=        etc mini_init
+SUBDIR=        etc bin sbin sbin.libcrypto sbin.lvm mini_init
 
 .include <bsd.subdir.mk>
diff --git a/share/initrd/bin/Makefile b/share/initrd/bin/Makefile
new file mode 100644 (file)
index 0000000..050f354
--- /dev/null
@@ -0,0 +1,67 @@
+#$FreeBSD: head/rescue/rescue/Makefile 252356 2013-06-28 21:00:08Z davide $
+#      @(#)Makefile    8.1 (Berkeley) 6/2/93
+
+NO_MAN=        YES
+
+.include <bsd.own.mk>
+
+PROG=  rescue
+BINDIR=        /usr/share/initrd/bin
+
+###################################################################
+# Programs from stock /bin
+#
+# WARNING: Changing this list may require adjusting
+# /usr/include/paths.h as well!  You were warned!
+#
+CRUNCH_SRCDIRS+= bin
+CRUNCH_PROGS_bin=      \
+       cat             \
+       chmod           \
+       cp              \
+       cpdup           \
+       dd              \
+       df              \
+       echo            \
+       kill            \
+       ln              \
+       ls              \
+       mined           \
+       mkdir           \
+       mv              \
+       ps              \
+       pwd             \
+       rm              \
+       rmdir           \
+       sh              \
+       sleep           \
+       sync            \
+       test
+
+CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -lmd -ltermcap -lutil
+CRUNCH_BUILDTOOLS+= bin/sh
+
+# Additional options for specific programs
+CRUNCH_ALIAS_test= [
+
+CRUNCH_ALIAS_sh= -sh
+# The -sh alias shouldn't appear in /rescue as a hard link
+CRUNCH_SUPPRESS_LINK_-sh= 1
+
+CRUNCH_ALIAS_ln= link
+CRUNCH_ALIAS_rm= unlink
+
+
+CRUNCH_SRCDIRS+= usr.bin
+CRUNCH_PROGS_usr.bin= du less
+CRUNCH_ALIAS_less= more
+
+CRUNCH_SRCDIRS+= secure/usr.bin
+CRUNCH_PROGS_secure/usr.bin= ssh
+
+CRUNCH_KEEP_ssh= roaming_write roaming_read add_recv_bytes
+
+CRUNCH_LIBS+= -lssh -lcrypto -lz
+
+.include <bsd.crunchgen.mk>
+.include <bsd.prog.mk>
diff --git a/share/initrd/sbin.libcrypto/Makefile b/share/initrd/sbin.libcrypto/Makefile
new file mode 100644 (file)
index 0000000..1efdd24
--- /dev/null
@@ -0,0 +1,20 @@
+#$FreeBSD: head/rescue/rescue/Makefile 252356 2013-06-28 21:00:08Z davide $
+#      @(#)Makefile    8.1 (Berkeley) 6/2/93
+
+NO_MAN=        YES
+
+.include <bsd.own.mk>
+
+PROG=  sbin.libcrypto
+BINDIR=        /usr/share/initrd/sbin
+
+CRUNCH_SRCDIRS+= sbin
+CRUNCH_PROGS_sbin= tcplay
+
+CRUNCH_SRCDIRS+= gnu/sbin
+CRUNCH_PROGS_gnu/sbin= cryptsetup
+
+CRUNCH_LIBS+= -lcrypto -ldm -lprop -lutil
+
+.include <bsd.crunchgen.mk>
+.include <bsd.prog.mk>
diff --git a/share/initrd/sbin.lvm/Makefile b/share/initrd/sbin.lvm/Makefile
new file mode 100644 (file)
index 0000000..c81496f
--- /dev/null
@@ -0,0 +1,90 @@
+#      $NetBSD: Makefile,v 1.7 2009/12/01 23:12:51 haad Exp $
+
+BINDIR=                /usr/share/initrd/sbin
+NOSHARED=      yes
+NO_MAN=                yes
+
+LVM2_DIR=      ${.CURDIR}/../../../contrib/lvm2
+LVM2_DISTDIR=       ${LVM2_DIR}/dist
+LIBDM_DISTDIR=        ${LVM2_DIR}/dist/libdm
+LIBDM_SRCDIR= ${LVM2_DIR}/lib/libdevmapper
+
+PROG=          lvm
+
+CSTD?=         gnu89
+
+SRCS=          dumpconfig.c formats.c lvchange.c lvconvert.c lvcreate.c \
+               lvdisplay.c lvextend.c lvmchange.c lvmcmdline.c \
+               lvmdiskscan.c lvreduce.c lvremove.c lvrename.c lvresize.c \
+               lvscan.c polldaemon.c pvchange.c pvck.c pvcreate.c \
+               pvdisplay.c pvmove.c pvremove.c pvresize.c pvscan.c \
+               reporter.c segtypes.c toollib.c vgcfgbackup.c \
+               vgcfgrestore.c vgchange.c vgck.c vgconvert.c vgcreate.c \
+               vgdisplay.c vgexport.c vgextend.c vgimport.c vgmerge.c \
+               vgmknodes.c vgreduce.c vgremove.c vgrename.c vgscan.c \
+               vgsplit.c lvm.c
+
+
+CFLAGS+=       -D_XOPEN_SOURCE=600
+CFLAGS+=       -I${LVM2_DISTDIR}/lib -I${LVM2_DISTDIR}/include \
+               -I. -I${LVM2_DISTDIR}/tools \
+               -I${LIBDM_DISTDIR}
+
+CFLAGS+=       -DLVM_SHARED_PATH=\"$(BINDIR)/lvm\"
+
+# Some parts of the code can't be protected because if its
+# alloca() usage.
+#
+.if defined(USE_SSP) && (${USE_SSP} != "no")
+CFLAGS+=      -Wno-stack-protector
+.endif
+
+SYMLINKS+=     lvm ${BINDIR}/lvchange \
+               lvm ${BINDIR}/lvconvert \
+               lvm ${BINDIR}/lvcreate \
+               lvm ${BINDIR}/lvdisplay \
+               lvm ${BINDIR}/lvextend \
+               lvm ${BINDIR}/lvmchange \
+               lvm ${BINDIR}/lvmdiskscan \
+               lvm ${BINDIR}/lvmdump \
+               lvm ${BINDIR}/lvreduce \
+               lvm ${BINDIR}/lvremove \
+               lvm ${BINDIR}/lvrename \
+               lvm ${BINDIR}/lvresize \
+               lvm ${BINDIR}/lvs \
+               lvm ${BINDIR}/lvscan \
+               lvm ${BINDIR}/pvchange \
+               lvm ${BINDIR}/pvck \
+               lvm ${BINDIR}/pvcreate \
+               lvm ${BINDIR}/pvdisplay \
+               lvm ${BINDIR}/pvmove \
+               lvm ${BINDIR}/pvremove \
+               lvm ${BINDIR}/pvresize \
+               lvm ${BINDIR}/pvs \
+               lvm ${BINDIR}/pvscan \
+               lvm ${BINDIR}/vgcfgbackup \
+               lvm ${BINDIR}/vgcfgrestore \
+               lvm ${BINDIR}/vgchange \
+               lvm ${BINDIR}/vgck \
+               lvm ${BINDIR}/vgconvert \
+               lvm ${BINDIR}/vgcreate \
+               lvm ${BINDIR}/vgdisplay \
+               lvm ${BINDIR}/vgexport \
+               lvm ${BINDIR}/vgextend \
+               lvm ${BINDIR}/vgimport \
+               lvm ${BINDIR}/vgmerge \
+               lvm ${BINDIR}/vgmknodes \
+               lvm ${BINDIR}/vgreduce \
+               lvm ${BINDIR}/vgremove \
+               lvm ${BINDIR}/vgrename \
+               lvm ${BINDIR}/vgs \
+               lvm ${BINDIR}/vgscan \
+               lvm ${BINDIR}/vgsplit
+
+LDADD+=                -llvm -ldevmapper -lprop -ledit -ltermcap -ldevattr
+DPADD+=                ${LIBLVM} ${LIBDEVMAPPER} ${LIBPROP} ${LIBEDIT} ${LIBTERMCAP}
+DPADD+=                ${LIBDEVATTR}
+
+.PATH: ${LVM2_DISTDIR}/tools
+
+.include <bsd.prog.mk>
diff --git a/share/initrd/sbin/Makefile b/share/initrd/sbin/Makefile
new file mode 100644 (file)
index 0000000..ff76654
--- /dev/null
@@ -0,0 +1,78 @@
+#$FreeBSD: head/rescue/rescue/Makefile 252356 2013-06-28 21:00:08Z davide $
+#      @(#)Makefile    8.1 (Berkeley) 6/2/93
+
+NO_MAN=        YES
+
+.include <bsd.own.mk>
+
+PROG=  rescue.sbin
+BINDIR=        /usr/share/initrd/sbin
+
+SCRIPTS= ../../../sbin/dhclient/dhclient-script
+
+CRUNCH_SRCDIRS+= sbin
+CRUNCH_PROGS_sbin=     \
+       camcontrol      \
+       ccdconfig       \
+       dhclient        \
+       diskinfo        \
+       disklabel32     \
+       disklabel64     \
+       dmesg           \
+       dumpfs          \
+       dumpon          \
+       fdisk           \
+       ffsinfo         \
+       fsck            \
+       fsck_msdosfs    \
+       gpt             \
+       growfs          \
+       hammer          \
+       ifconfig        \
+       kldconfig       \
+       kldload         \
+       kldstat         \
+       kldunload       \
+       md5             \
+       mount           \
+       mount_cd9660    \
+       mount_hammer    \
+       mount_msdos     \
+       mount_nfs       \
+       mount_ntfs      \
+       mount_null      \
+       mount_tmpfs     \
+       mount_ufs       \
+       natacontrol     \
+       newfs           \
+       newfs_hammer    \
+       newfs_msdos     \
+       ping            \
+       ping6           \
+       rconfig         \
+       reboot          \
+       route           \
+       shutdown        \
+       swapon          \
+       sysctl          \
+       tunefs          \
+       udevd           \
+       umount          \
+       vinum
+
+CRUNCH_ALIAS_disklabel64= disklabel
+CRUNCH_ALIAS_md5= rmd160
+CRUNCH_ALIAS_newfs= mount_mfs
+CRUNCH_ALIAS_reboot= halt
+CRUNCH_ALIAS_shutdown= poweroff
+CRUNCH_ALIAS_swapon= swapoff swapctl
+
+CRUNCH_LIBS+= -lcam -lsbuf -lutil -lkvm -lm -lmd -lhammer -lkiconv -ledit
+CRUNCH_LIBS+= -ltermcap -ldevstat -lprop -lpthread
+CRUNCH_LIBS+= -lipx -lbsdxml -lipsec
+
+CRUNCH_SRCDIRS+= usr.sbin
+CRUNCH_PROGS_usr.sbin= boot0cfg chroot
+
+.include <bsd.crunchgen.mk>
+.include <bsd.prog.mk>