public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/genkernel:master commit in: defaults/, gkbuilds/, /
@ 2019-07-14 13:00 Thomas Deutschmann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Deutschmann @ 2019-07-14 13:00 UTC (permalink / raw
  To: gentoo-commits

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'!"
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/genkernel:master commit in: defaults/, gkbuilds/, /
@ 2020-07-23 23:57 Thomas Deutschmann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Deutschmann @ 2020-07-23 23:57 UTC (permalink / raw
  To: gentoo-commits

commit:     fe4f505dab7c4c1420c54d493d638445d95dc742
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 23 20:59:33 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Jul 23 22:56:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=fe4f505d

multipath: Switch to UDEV usage

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.scripts | 46 ++++++++++------------------------------------
 gen_initramfs.sh        | 31 ++++++++++++++++++++++++++++---
 gkbuilds/lvm.gkbuild    |  5 +++--
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 8e7d109..7d852ee 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1527,48 +1527,22 @@ start_volumes() {
 
 	if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
 	then
-		for multipath_path in /sbin/multipath /bin/multipath MISSING
-		do
-			[ -x "${multipath_path}" ] && break
-		done
-
-		for dmsetup_path in /usr/sbin/dmsetup /sbin/dmsetup /bin/dmsetup MISSING
-		do
-			[ -x "${dmsetup_path}" ] && break
-		done
-
-		for kpartx_path in /sbin/kpartx /bin/kpartx MISSING
-		do
-			[ -x "${kpartx_path}" ] && break
-		done
-
-		fail=0
-		[ "${multipath_path}" = "MISSING" ] && fail=1 && bad_msg "domultipath called, but multipath binary missing! Skipping multipath"
-		[ "${dmsetup_path}" = "MISSING" ] && fail=1 && bad_msg "domultipath called, but dmsetup binary missing! Skipping multipath"
-		[ "${kpartx_path}" = "MISSING" ] && fail=1 && bad_msg "domultipath called, but kpartx binary missing! Skipping multipath"
-
-		if [ ${fail} -eq 0 ]
+		if ! hash multipath >/dev/null 2>&1
 		then
+			bad_msg "domultipath called, but multipath binary missing! Skipping multipath"
+		else
 			good_msg "Scanning for multipath devices"
-			good_msg ":: Populating scsi_id info for libudev queries"
-			run mkdir -p /run/udev/data
 
-			local ech
-			for ech in /sys/block/*
-			do
-				local tgtfile=b$(cat ${ech}/dev)
-				run /lib/udev/scsi_id -g -x /dev/${ech##*/} | sed -e 's/^/E:/' >/run/udev/data/${tgtfile}
-			done
-
-			local multipath_cmd="run ${multipath_path} -v 0 2>&1"
+			local multipath_cmd="run multipath -v 0 2>&1"
 			is_log_enabled && multipath_cmd="${multipath_cmd} | tee -a '${GK_INIT_LOG}'"
-			eval "${multipath_cmd}"
-			sleep 2
 
-			good_msg "Activating multipath devices ..."
-			multipath_cmd="run ${dmsetup_path} ls --target multipath --exec '${kpartx_path} -a -v' 2>&1"
-			is_log_enabled && multipath_cmd="${multipath_cmd} | tee -a '${GK_INIT_LOG}'"
 			eval "${multipath_cmd}"
+			if [ $? -ne 0 ]
+			then
+				bad_msg "Scanning for multipath devices failed!"
+			else
+				udevsettle
+			fi
 		fi
 	fi
 

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index af0ff44..1b8c829 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -701,15 +701,40 @@ append_multipath() {
 
 	mkdir -p "${TDIR}"/etc || gen_die "Failed to create '${TDIR}/etc'!"
 
+	mkdir -p "${TDIR}"/usr/lib/udev/rules.d || gen_die "Failed to create '${TDIR}/usr/lib/udev/rules.d'!"
+
 	local libdir=$(get_chost_libdir)
+	if [[ "${libdir}" =~ ^/usr ]]
+	then
+		libdir=${libdir/\/usr/}
+	fi
 
 	copy_binaries \
-		"${TDIR}"\
+		"${TDIR}" \
 		/sbin/multipath \
 		/sbin/kpartx \
 		/sbin/mpathpersist \
-		${libdir}/multipath/lib*.so \
-		/lib/udev/scsi_id
+		${libdir}/multipath/lib*.so
+
+	local udevdir=$(get_udevdir)
+	local udevdir_initramfs="/usr/lib/udev"
+	local udev_files=( $(qlist -e sys-fs/multipath-tools:0 \
+		| xargs --no-run-if-empty realpath \
+		| grep -E -- "^${udevdir}")
+	)
+
+	if [ ${#udev_files[@]} -eq 0 ]
+	then
+		gen_die "Something went wrong: Did not found any udev-related files for sys-fs/multipath-tools!"
+	fi
+
+	local udev_files
+	for udev_file in "${udev_files[@]}"
+	do
+		local dest_file="${TDIR%/}${udev_file/${udevdir}/${udevdir_initramfs}}"
+		cp -aL "${udev_file}" "${dest_file}" \
+			|| gen_die "Failed to copy '${udev_file}' to '${dest_file}'"
+	done
 
 	cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
 

diff --git a/gkbuilds/lvm.gkbuild b/gkbuilds/lvm.gkbuild
index 1346cb0..3006381 100644
--- a/gkbuilds/lvm.gkbuild
+++ b/gkbuilds/lvm.gkbuild
@@ -63,11 +63,12 @@ src_install() {
 	ln -s dmsetup "${D}"/usr/sbin/dmstats \
 		|| die "Failed to create symlink '${D}/usr/sbin/dmstats' to '${D}/usr/sbin/dmsetup'!"
 
-	# For backward compatibility
+	# For backward compatibility (packages like multipath-tools are
+	# expecting /sbin/dmsetup in udev rules).
 	mkdir "${D}"/sbin || die "Failed to create '${D}/sbin'!"
 
 	ln -s ../usr/sbin/dmsetup "${D}"/sbin/dmsetup \
-		|| die "Failed to create symlink '${D}/sbin/dmstats' to '${D}/usr/sbin/dmstats'!"
+		|| die "Failed to create symlink '${D}/sbin/dmsetup' to '${D}/usr/sbin/dmsetup'!"
 
 	ln -s ../usr/sbin/dmstats "${D}"/sbin/dmstats \
 		|| die "Failed to create symlink '${D}/sbin/dmstats' to '${D}/usr/sbin/dmstats'!"


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-23 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-14 13:00 [gentoo-commits] proj/genkernel:master commit in: defaults/, gkbuilds/, / Thomas Deutschmann
  -- strict thread matches above, loose matches on Subject: below --
2020-07-23 23:57 Thomas Deutschmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox