summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-02-03 13:59:46 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-02-03 13:59:46 +0000
commita8f79b8d50115af4c36c07f83ec7dd9bc4475710 (patch)
treef30a0668ae41f06be86a037d6d4ef8e265ff4582
parentb0c2b7e56e62aeb2bca8b4d2ab396f3d83a48def (diff)
downloadlh-bootstrap-a8f79b8d50115af4c36c07f83ec7dd9bc4475710.tar.xz
Add strace and an optional mechanism
-rw-r--r--Makefile9
-rw-r--r--lh-config.dist3
-rwxr-xr-xmake5
-rw-r--r--sub/strace/Makefile32
-rw-r--r--sub/util-linux/Makefile131
5 files changed, 45 insertions, 135 deletions
diff --git a/Makefile b/Makefile
index 6cbbfe5..ba127fc 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,12 @@ rwfs: $(OUTPUT)/tmp/.lh_rwfs_installed
userfs: $(OUTPUT)/tmp/.lh_userfs_installed
images: $(OUTPUT)/tmp/.lh_diskimages_done
+ifeq ($(LH_DEV),true)
+include sub/strace/Makefile
+LH_DEV_TARGETS := $(OUTPUT)/build-host/.lh_strace_installed
+else
+LH_DEV_TARGETS :=
+endif
# clean everything
distclean:
@@ -57,7 +63,8 @@ $(OUTPUT)/build-build/.lh_done: $(OUTPUT)/build-build/.lh_skarnet_installed $(OU
# The filesystems
-$(OUTPUT)/tmp/.lh_rootfs_installed: $(OUTPUT)/tmp/.lh_layout_installed $(OUTPUT)/build-host/.lh_skarnet_installed $(OUTPUT)/build-host/.lh_socklog_installed $(OUTPUT)/build-host/.lh_bb_installed $(OUTPUT)/build-host/.lh_dropbear_installed
+$(OUTPUT)/tmp/.lh_rootfs_installed: $(OUTPUT)/tmp/.lh_layout_installed $(OUTPUT)/build-host/.lh_skarnet_installed $(OUTPUT)/build-host/.lh_socklog_installed $(OUTPUT)/build-host/.lh_bb_installed $(OUTPUT)/build-host/.lh_dropbear_installed $(LH_DEV_TARGETS)
+
exec setuidgid $(NORMALUSER) touch $@
$(OUTPUT)/tmp/.lh_rwfs_installed: $(OUTPUT)/tmp/.lh_layout_installed
diff --git a/lh-config.dist b/lh-config.dist
index b320a02..4fe15fe 100644
--- a/lh-config.dist
+++ b/lh-config.dist
@@ -26,6 +26,9 @@ NORMALUSER=nobody
# LIBC_COPY=
# LIBC_SYSROOT=
+# Whether or not you want development packages
+# DEVELOPMENT=false
+
# Filesystems size, as understood by libguestfs's virt-make-fs
ROOTFS_SIZE=1024M
RWFS_SIZE=512M
diff --git a/make b/make
index 4030480..1324c98 100755
--- a/make
+++ b/make
@@ -26,8 +26,7 @@ BUILD_HOST_CC="$TRIPLE-${CROSS_CC:-gcc}"
ROOTFS_SIZE=${ROOTFS_SIZE:-1024M}
RWFS_SIZE=${RWFS_SIZE:-512M}
USERFS_SIZE=${USERFS_SIZE:-512M}
-
-
+LH_DEV=${DEVELOPMENT:-false}
if test -z "$BUILD_HOST_STATIC" ; then
case "$TRIPLE" in
@@ -71,7 +70,7 @@ PATH="$WD/bin:$OUTPUT/build-build/command:$OUTPUT/build-build/bin:$OUTPUT/build-
umask 022
exec env -i $crossenv LH_MAKE_MARKER=1 "WD=$WD" "NORMALUSER=$NORMALUSER" "TRIPLE=$TRIPLE" "OUTPUT=$OUTPUT" "PATH=$PATH" \
"ROOTFS_SIZE=$ROOTFS_SIZE" "RWFS_SIZE=$RWFS_SIZE" "USERFS_SIZE=$USERFS_SIZE" \
- "BUILD_HOST_STATIC=$BUILD_HOST_STATIC" "LIBC_SYSROOT=$LIBC_SYSROOT" "LIBC_COPY=$LIBC_COPY" \
+ "BUILD_HOST_STATIC=$BUILD_HOST_STATIC" "LIBC_SYSROOT=$LIBC_SYSROOT" "LIBC_COPY=$LIBC_COPY" "LH_DEV=$LH_DEV" \
"BUILD_HOST_CC=$BUILD_HOST_CC" "BUILD_HOST_CC_FULL=$BUILD_HOST_CC_FULL" "BUILD_HOST_SYSROOT=$BUILD_HOST_SYSROOT" "BUILD_HOST_PREFIX=$BUILD_HOST_PREFIX" \
"KERNEL_ARCH=$KERNEL_ARCH" "KERNEL_GENERIC_ARCH=$KERNEL_GENERIC_ARCH" "QEMU_ARCH=$QEMU_ARCH" "KERNEL_CONFIG=$KERNEL_CONFIG" \
"BUILD_BUILD_CC=$BUILD_BUILD_CC" SHELL=/bin/sh "CONSOLE=$CONSOLE" \
diff --git a/sub/strace/Makefile b/sub/strace/Makefile
new file mode 100644
index 0000000..d99ca85
--- /dev/null
+++ b/sub/strace/Makefile
@@ -0,0 +1,32 @@
+
+STRACE_VERSION ?= 5.4
+STRACE_MAKE_STATIC := $(if $(filter true,$(BUILD_HOST_STATIC)),LDFLAGS=-static,)
+
+clean-strace:
+ rm -f $(OUTPUT)/build-host/.lh_strace_*
+
+
+$(OUTPUT)/sources/strace-$(STRACE_VERSION).tar.xz: | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget https://strace.io/files/$(STRACE_VERSION)/strace-$(STRACE_VERSION).tar.xz
+
+$(OUTPUT)/build-host/.lh_strace_dled: $(OUTPUT)/sources/strace-$(STRACE_VERSION).tar.xz | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-host/.lh_strace_copied: $(OUTPUT)/build-host/.lh_strace_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-host/strace-$(STRACE_VERSION)
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host tar -Jxpvf $(OUTPUT)/sources/strace-$(STRACE_VERSION).tar.xz
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-host/.lh_strace_configured: $(OUTPUT)/build-host/.lh_strace_copied | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/strace-$(STRACE_VERSION) export CC "$(BUILD_HOST_CC)" ./configure --host=$(TRIPLE) --prefix=/opt/strace-$(STRACE_VERSION) --enable-mpers=no
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-host/.lh_strace_built: $(OUTPUT)/build-host/.lh_strace_configured | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-host/strace-$(STRACE_VERSION) $(MAKE) $(STRACE_MAKE_STATIC)
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-host/.lh_strace_installed: $(OUTPUT)/build-host/.lh_strace_built | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec cd $(OUTPUT)/build-host/strace-$(STRACE_VERSION) $(MAKE) install DESTDIR=$(OUTPUT)/rootfs
+ exec makenamelink $(OUTPUT)/rootfs/opt strace strace-$(STRACE_VERSION) $(OUTPUT)/tmp
+ exec makelinks $(OUTPUT)/rootfs /bin /opt/strace/bin
+ exec setuidgid $(NORMALUSER) s6-touch $@
diff --git a/sub/util-linux/Makefile b/sub/util-linux/Makefile
deleted file mode 100644
index f357a32..0000000
--- a/sub/util-linux/Makefile
+++ /dev/null
@@ -1,131 +0,0 @@
-
-UTLX_NAME := util-linux
-UTLX_VERSION := 2.34
-UTLX_MAJOR := $(word 1, $(subst ., ,$(UTLX_VERSION)))
-UTLX_MINOR := $(word 2, $(subst ., ,$(UTLX_VERSION)))
-UTLX_URLDIR := https://cdn.kernel.org/pub/linux/utils/$(UTLX_NAME)/v$(UTLX_MAJOR).$(UTLX_MINOR)
-UTLX_TAREXT := tar.xz
-UTLX_TARLETTER := J
-UTLX_CONFIGURE_OPTIONS := \
---prefix=$(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION) \
---disable-assert \
---disable-nls \
---disable-widechar \
-# --disable-all-programs \
---enable-libuuid \
---enable-libfdisk \
---enable-libsmartcols \
---enable-losetup \
---enable-libblkid \
---enable-libmount \
---enable-mount \
---disable-zramctl \
---disable-fsck \
---disable-partx \
---disable-uuidd \
---disable-mountpoint \
---disable-fallocate \
---disable-unshare \
---disable-nsenter \
---disable-setpriv \
---disable-eject \
---disable-agetty \
---disable-plymouth-support \
---disable-cramfs \
---disable-bfs \
---disable-minix \
---disable-fdformat \
---disable-hwclock \
---disable-lslogins \
---disable-wdctl \
---disable-cal \
---disable-logger \
---disable-switch_root \
---disable-pivot_root \
---disable-lsmem \
---disable-chmem \
---disable-ipcrm \
---disable-ipcs \
---disable-rfkill \
---disable-tunelp \
---disable-kill \
---disable-last \
---disable-utmpdump \
---disable-line \
---disable-mesg \
---disable-raw \
---disable-rename \
---disable-vipw \
---disable-newgrp \
---disable-chfn-chsh \
---disable-login \
---disable-nologin \
---disable-sulogin \
---disable-su \
---disable-runuser \
---disable-ul \
---disable-more \
---disable-pg \
---disable-setterm \
---disable-schedutils \
---disable-wall \
---disable-write \
---disable-bash-completion \
---disable-pylibmount \
---disable-pg-bell \
---disable-sulogin-emergency-mount \
---disable-makeinstall-chown \
---disable-makeinstall-setuid \
---disable-use-tty-group \
---disable-colors-default \
---with-gnu-ld \
---without-util \
---without-libiconv-prefix \
---without-selinux \
---without-audit \
---without-udev \
---without-user \
---without-python \
---without-ncurses \
---without-ncursesw \
---without-slang \
---without-tinfo \
---without-readline \
---without-utempter \
---without-cap-ng \
---without-user \
---without-btrfs \
---without-systemd \
---without-smack
-
-UTLX_CFLAGS := ""
-UTLX_CONFLDFLAGS := ""
-UTLX_MAKELDFLAGS := "-s"
-
-$(OUTPUT)/sources/$(UTLX_NAME)-$(UTLX_VERSION).$(UTLX_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
- exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(UTLX_URLDIR)/$(UTLX_NAME)-$(UTLX_VERSION).$(UTLX_TAREXT)
-
-$(OUTPUT)/sources/.lh_$(UTLX_NAME)_dled: $(OUTPUT)/sources/$(UTLX_NAME)-$(UTLX_VERSION).$(UTLX_TAREXT)
- exec setuidgid $(NORMALUSER) s6-touch $@
-
-$(OUTPUT)/build-build/.lh_$(UTLX_NAME)_copied: $(OUTPUT)/sources/.lh_$(UTLX_NAME)_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
- exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)/src
- exec setuidgid $(NORMALUSER) s6-mkdir -p $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)
- exec setuidgid $(NORMALUSER) makenamelink $(OUTPUT)/build-build/opt $(UTLX_NAME) $(UTLX_NAME)-$(UTLX_VERSION) $(OUTPUT)/tmp
- exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION) tar $(UTLX_TARLETTER)xpvf $(OUTPUT)/sources/$(UTLX_NAME)-$(UTLX_VERSION).$(UTLX_TAREXT)
- exec setuidgid $(NORMALUSER) s6-rename $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)/$(UTLX_NAME)-$(UTLX_VERSION) $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)/src
- exec setuidgid $(NORMALUSER) s6-touch $@
-
-$(OUTPUT)/build-build/.lh_$(UTLX_NAME)_configured: $(OUTPUT)/build-build/.lh_$(UTLX_NAME)_copied $(OUTPUT)/build-build/.lh_kernel_headers_installed | $(OUTPUT)/build-build/.lh_skarnet_installed
- exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)/src export CC "$(BUILD_BUILD_CC)" export CFLAGS $(UTLX_CFLAGS) export LDFLAGS $(UTLX_CONFLDFLAGS) ./configure --prefix=$(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION) $(UTLX_CONFIGURE_OPTIONS)
- exec setuidgid $(NORMALUSER) s6-touch $@
-
-$(OUTPUT)/build-build/.lh_$(UTLX_NAME)_built: $(OUTPUT)/build-build/.lh_$(UTLX_NAME)_configured | $(OUTPUT)/build-build/.lh_skarnet_installed
- exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)/src $(MAKE) CC="$(BUILD_BUILD_CC)" LDFLAGS=$(UTLX_MAKELDFLAGS)
- exec setuidgid $(NORMALUSER) s6-touch $@
-
-$(OUTPUT)/build-build/.lh_$(UTLX_NAME)_installed: $(OUTPUT)/build-build/.lh_$(UTLX_NAME)_built | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
- exec cd $(OUTPUT)/build-build/opt/$(UTLX_NAME)-$(UTLX_VERSION)/src $(MAKE) install CC="$(BUILD_BUILD_CC)"
- exec setuidgid $(NORMALUSER) makelinks $(OUTPUT)/build-build /bin /opt/$(UTLX_NAME)/bin
- exec setuidgid $(NORMALUSER) makelinks $(OUTPUT)/build-build /bin /opt/$(UTLX_NAME)/sbin
- exec setuidgid $(NORMALUSER) s6-touch $@