commit: 8ef7e7ec94162d39dfdc71da20b9532db6cfab2b Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> AuthorDate: Sun Jul 14 10:43:27 2019 +0000 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> CommitDate: Sun Jul 14 11:58:18 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=8ef7e7ec
Add --strace support For debugging purpose. Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> defaults/software.sh | 7 +++++++ gen_cmdline.sh | 4 ++++ gen_determineargs.sh | 1 + gen_initramfs.sh | 21 +++++++++++++++++++++ gkbuilds/strace.gkbuild | 25 +++++++++++++++++++++++++ 5 files changed, 58 insertions(+) diff --git a/defaults/software.sh b/defaults/software.sh index 34b38dc..ec4dc78 100644 --- a/defaults/software.sh +++ b/defaults/software.sh @@ -142,6 +142,13 @@ GKPKG_POPT_SRCDIR="${GKPKG_POPT_SRCDIR:-popt-${GKPKG_POPT_PV}}" GKPKG_POPT_SRCTAR="${GKPKG_POPT_SRCTAR:-${DISTDIR}/popt-${GKPKG_POPT_PV}.tar.gz}" GKPKG_POPT_BINPKG="${GKPKG_POPT_BINPKG:-%%CACHE%%/popt-${GKPKG_POPT_PV}-%%ARCH%%.tar.xz}" +GKPKG_STRACE_PN="strace" +GKPKG_STRACE_PV="${GKPKG_STRACE_PV:-VERSION_STRACE}" +GKPKG_STRACE_DEPS="" +GKPKG_STRACE_SRCTAR="${GKPKG_STRACE_SRCTAR:-${DISTDIR}/strace-${GKPKG_STRACE_PV}.tar.xz}" +GKPKG_STRACE_SRCDIR="${GKPKG_STRACE_SRCDIR:-strace-${GKPKG_STRACE_PV}}" +GKPKG_STRACE_BINPKG="${GKPKG_STRACE_BINPKG:-%%CACHE%%/strace-${GKPKG_STRACE_PV}-%%ARCH%%.tar.xz}" + GKPKG_UNIONFS_FUSE_PN="unionfs-fuse" GKPKG_UNIONFS_FUSE_PV="${GKPKG_UNIONFS_FUSE_PV:-VERSION_UNIONFS_FUSE}" GKPKG_UNIONFS_FUSE_DEPS="fuse" diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 2131f77..e740087 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -448,6 +448,10 @@ parse_cmdline() { fi print_info 2 "CMD_SSH_HOST_KEYS: ${CMD_SSH_HOST_KEYS}" ;; + --strace|--no-strace) + CMD_STRACE=$(parse_optbool "$*") + print_info 2 "CMD_STRACE: ${CMD_STRACE}" + ;; --loglevel=*) CMD_LOGLEVEL="${*#*=}" LOGLEVEL="${CMD_LOGLEVEL}" diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 75b7b3b..b5052eb 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -146,6 +146,7 @@ determine_real_args() { set_config_with_override BOOL SSH CMD_SSH "no" set_config_with_override STRING SSH_AUTHORIZED_KEYS_FILE CMD_SSH_AUTHORIZED_KEYS_FILE "/etc/dropbear/authorized_keys" set_config_with_override STRING SSH_HOST_KEYS CMD_SSH_HOST_KEYS "create" + set_config_with_override BOOL STRACE CMD_STRACE "no" set_config_with_override BOOL LVM CMD_LVM "no" set_config_with_override BOOL DMRAID CMD_DMRAID "no" set_config_with_override BOOL ISCSI CMD_ISCSI "no" diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 45bf4fe..41f0269 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -828,6 +828,26 @@ append_splash() { || gen_die "Failed to append splash to cpio!" } +append_strace() { + local PN=strace + local TDIR="${TEMP}/initramfs-${PN}-temp" + if [ -d "${TDIR}" ] + then + rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!" + fi + + populate_binpkg ${PN} + + mkdir -p "${TDIR}" || gen_die "Failed to create '${TDIR}'!" + + unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}" + + cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" + log_future_cpio_content + find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ + || gen_die "Failed to append ${PN} to cpio!" +} + append_overlay() { cd "${INITRAMFS_OVERLAY}" || gen_die "Failed to chdir to '${INITRAMFS_OVERLAY}'!" @@ -1482,6 +1502,7 @@ create_initramfs() { append_data 'modprobed' append_data 'multipath' "${MULTIPATH}" append_data 'splash' "${SPLASH}" + append_data 'strace' "${STRACE}" append_data 'unionfs_fuse' "${UNIONFS}" append_data 'xfsprogs' "${XFSPROGS}" append_data 'zfs' "${ZFS}" diff --git a/gkbuilds/strace.gkbuild b/gkbuilds/strace.gkbuild new file mode 100644 index 0000000..540f6cb --- /dev/null +++ b/gkbuilds/strace.gkbuild @@ -0,0 +1,25 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +src_configure() { + append-ldflags -static -pthread + export ac_cv_header_libaio_h=yes + + local myconf=( + --enable-mpers=check + --without-libunwind + --without-libdw + ) + + gkconf "${myconf[@]}" +} + +src_install() { + mkdir -p "${D}"/usr/bin || die "Failed to create '${D}/usr/bin'!" + + cp -a strace "${D}"/usr/bin/ \ + || die "Failed to copy '${S}/strace' to '${D}/usr/bin/'!" + + "${STRIP}" --strip-all "${D}"/usr/bin/strace \ + || die "Failed to strip '${D}/usr/bin/strace'!" +}