Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for including sedutil-cli (Opal Drive management) in the image #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ SOFTWARE = BCACHE_TOOLS \
MDADM \
MULTIPATH_TOOLS \
POPT \
SEDUTIL \
STRACE \
THIN_PROVISIONING_TOOLS \
UNIONFS_FUSE \
Expand Down
6 changes: 6 additions & 0 deletions defaults/software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ GKPKG_POPT_SRCTAR="${GKPKG_POPT_SRCTAR:-${DISTDIR}/popt-${GKPKG_POPT_PV}.tar.gz}
GKPKG_POPT_SRCDIR="${GKPKG_POPT_SRCDIR:-popt-${GKPKG_POPT_PV}}"
GKPKG_POPT_BINPKG="${GKPKG_POPT_BINPKG:-%%CACHE%%/popt-${GKPKG_POPT_PV}-%%ARCH%%.tar.xz}"

GKPKG_SEDUTIL_PN="sedutil"
GKPKG_SEDUTIL_PV="${GKPKG_SEDUTIL_PV:-${VERSION_SEDUTIL}}"
GKPKG_SEDUTIL_SRCTAR="${GKPKG_SEDUTIL_SRCTAR:-${DISTDIR}/sedutil-${GKPKG_SEDUTIL_PV}.tar.gz}"
GKPKG_SEDUTIL_SRCDIR="${GKPKG_SEDUTIL_SRCDIR:-sedutil-${GKPKG_SEDUTIL_PV}}"
GKPKG_SEDUTIL_BINPKG="${GKPKG_SEDUTIL_BINPKG:-%%CACHE%%/sedutil-${GKPKG_SEDUTIL_PV}-%%ARCH%%.tar.xz}"

GKPKG_STRACE_PN="strace"
GKPKG_STRACE_PV="${GKPKG_STRACE_PV:-${VERSION_STRACE}}"
GKPKG_STRACE_DEPS="libaio"
Expand Down
4 changes: 4 additions & 0 deletions gen_cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ parse_cmdline() {
fi
print_info 3 "CMD_SSH_HOST_KEYS: ${CMD_SSH_HOST_KEYS}"
;;
--sedutil|--no-sedutil)
CMD_SEDUTIL=$(parse_optbool "$*")
print_info 3 "CMD_SEDUTIL: ${CMD_SEDUTIL}"
;;
--strace|--no-strace)
CMD_STRACE=$(parse_optbool "$*")
print_info 3 "CMD_STRACE: ${CMD_STRACE}"
Expand Down
1 change: 1 addition & 0 deletions gen_determineargs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,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 SEDUTIL CMD_SEDUTIL "no"
set_config_with_override BOOL STRACE CMD_STRACE "no"
set_config_with_override BOOL BCACHE CMD_BCACHE "no"
set_config_with_override BOOL LVM CMD_LVM "no"
Expand Down
28 changes: 28 additions & 0 deletions gen_initramfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ append_base_layout() {
isTrue "${ZFS}" && build_parameters+=( --zfs ) || build_parameters+=( --no-zfs )
isTrue "${SPLASH}" && build_parameters+=( --splash ) || build_parameters+=( --no-splash )
isTrue "${PLYMOUTH}" && build_parameters+=( --plymouth ) || build_parameters+=( --no-plymouth )
isTrue "${SEDUTIL}" && build_parameters+=( --sedutil ) || build_parameters+=( --no-sedutil )
isTrue "${STRACE}" && build_parameters+=( --strace ) || build_parameters+=( --no-strace )
isTrue "${KEYCTL}" && build_parameters+=( --keyctl ) || build_parameters+=( --no-keyctl )
isTrue "${GPG}" && build_parameters+=( --gpg ) || build_parameters+=( --no-gpg )
Expand Down Expand Up @@ -1386,6 +1387,32 @@ append_plymouth() {
fi
}

append_sedutil() {
local PN=sedutil
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 . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \
|| gen_die "Failed to append ${PN} to cpio!"

cd "${TEMP}" || die "Failed to chdir to '${TEMP}'!"
if isTrue "${CLEANUP}"
then
rm -rf "${TDIR}"
fi
}

append_strace() {
local PN=strace
local TDIR="${TEMP}/initramfs-${PN}-temp"
Expand Down Expand Up @@ -2168,6 +2195,7 @@ create_initramfs() {
append_data 'multipath' "${MULTIPATH}"
append_data 'splash' "${SPLASH}"
append_data 'plymouth' "${PLYMOUTH}"
append_data 'sedutil' "${SEDUTIL}"
append_data 'strace' "${STRACE}"
append_data 'unionfs_fuse' "${UNIONFS}"
append_data 'xfsprogs' "${XFSPROGS}"
Expand Down
25 changes: 25 additions & 0 deletions gkbuilds/sedutil.gkbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#

src_prepare() {
default

gkautoreconf
}

src_configure() {
append-ldflags -static

local myopts=(
)

gkconf "${myopts[@]}"
}

src_install() {
default

rm -rf "${D}"/usr/sbin/linuxpba
rm -rf "${D}"/usr/share
}
12 changes: 12 additions & 0 deletions patches/sedutil/1.20.0/sedutil-1.20.0-fix-uint8_t.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/Common/DtaOptions.h b/Common/DtaOptions.h
index c012af1..4d88539 100644
--- a/Common/DtaOptions.h
+++ b/Common/DtaOptions.h
@@ -20,6 +20,7 @@ along with sedutil. If not, see <http://www.gnu.org/licenses/>.

#ifndef _DTAOPTIONS_H
#define _DTAOPTIONS_H
+#include <cstdint>

/** Output modes */
typedef enum _sedutiloutput {
Loading