* [gentoo-commits] proj/genkernel:master commit in: /, gkbuilds/, defaults/
@ 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: 1d0c43bedc00e3365b9e972a91dac11a2c04285c
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 09:41:39 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 11:58:16 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=1d0c43be
Rework --mdadm support
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
defaults/software.sh | 12 ++++++----
gen_compile.sh | 43 ---------------------------------
gen_initramfs.sh | 64 ++++++++++++++++++++++++--------------------------
gkbuilds/mdadm.gkbuild | 35 +++++++++++++++++++++++++++
4 files changed, 73 insertions(+), 81 deletions(-)
diff --git a/defaults/software.sh b/defaults/software.sh
index 532c520..5df1c0c 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -16,11 +16,6 @@ GKPKG_BUSYBOX_SRCTAR="${GKPKG_BUSYBOX_SRCTAR:-${DISTDIR}/busybox-${GKPKG_BUSYBOX
GKPKG_BUSYBOX_SRCDIR="${GKPKG_BUSYBOX_SRCDIR:-busybox-${GKPKG_BUSYBOX_PV}}"
GKPKG_BUSYBOX_BINPKG="${GKPKG_BUSYBOX_BINPKG:-%%CACHE%%/busybox-${GKPKG_BUSYBOX_PV}-%%ARCH%%.tar.xz}"
-MDADM_VER="${MDADM_VER:-VERSION_MDADM}"
-MDADM_DIR="${MDADM_DIR:-mdadm-${MDADM_VER}}"
-MDADM_SRCTAR="${MDADM_SRCTAR:-${DISTDIR}/mdadm-${MDADM_VER}.tar.xz}"
-MDADM_BINCACHE="${MDADM_BINCACHE:-%%CACHE%%/mdadm-${MDADM_VER}-%%ARCH%%.tar.bz2}"
-
GKPKG_DMRAID_PN="dmraid"
GKPKG_DMRAID_PV="${GKPKG_DMRAID_PV:-VERSION_DMRAID}"
GKPKG_DMRAID_DEPS="lvm"
@@ -77,6 +72,13 @@ GKPKG_LVM_SRCDIR="${GKPKG_LVM_SRCDIR:-LVM2.${GKPKG_LVM_PV}}"
GKPKG_LVM_SRCTAR="${GKPKG_LVM_SRCTAR:-${DISTDIR}/LVM2.${GKPKG_LVM_PV}.tgz}"
GKPKG_LVM_BINPKG="${GKPKG_LVM_BINPKG:-%%CACHE%%/LVM2.${GKPKG_LVM_PV}-%%ARCH%%.tar.xz}"
+GKPKG_MDADM_PN="mdadm"
+GKPKG_MDADM_PV="${GKPKG_MDADM_PV:-VERSION_MDADM}"
+GKPKG_MDADM_DEPS=""
+GKPKG_MDADM_SRCDIR="${GKPKG_MDADM_SRCDIR:-mdadm-${GKPKG_MDADM_PV}}"
+GKPKG_MDADM_SRCTAR="${GKPKG_MDADM_SRCTAR:-${DISTDIR}/mdadm-${GKPKG_MDADM_PV}.tar.xz}"
+GKPKG_MDADM_BINPKG="${GKPKG_MDADM_BINPKG:-%%CACHE%%/mdadm-${GKPKG_MDADM_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_compile.sh b/gen_compile.sh
index 1c096cb..92efaa0 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -529,49 +529,6 @@ compile_kernel() {
fi
}
-compile_mdadm() {
- if [ -f "${MDADM_BINCACHE}" ]
- then
- print_info 1 "$(getIndent 2)mdadm: >> Using cache ..."
- else
- [ -f "${MDADM_SRCTAR}" ] ||
- gen_die "Could not find MDADM source tarball: ${MDADM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${MDADM_DIR}" > /dev/null
- /bin/tar -xpf "${MDADM_SRCTAR}" ||
- gen_die 'Could not extract MDADM source tarball!'
- [ -d "${MDADM_DIR}" ] ||
- gen_die "MDADM directory ${MDADM_DIR} is invalid!"
-
- cd "${MDADM_DIR}"
- apply_patches mdadm ${MDADM_VER}
- defs='-DNO_DLM -DNO_COROSYNC'
- sed -i \
- -e "/^CFLAGS = /s:^CFLAGS = \(.*\)$:CFLAGS = -Os ${defs}:" \
- -e "/^CXFLAGS = /s:^CXFLAGS = \(.*\)$:CXFLAGS = -Os ${defs}:" \
- -e "/^CWFLAGS = /s:^CWFLAGS = \(.*\)$:CWFLAGS = -Wall:" \
- -e "s/^# LDFLAGS = -static/LDFLAGS = -static/" \
- Makefile || gen_die "Failed to sed mdadm Makefile"
-
- print_info 1 "$(getIndent 2)mdadm: >> Compiling ..."
- compile_generic 'mdadm mdmon' utils
-
- mkdir -p "${TEMP}/mdadm/sbin"
- install -m 0755 -s mdadm "${TEMP}/mdadm/sbin/mdadm" || gen_die "Failed mdadm install"
- install -m 0755 -s mdmon "${TEMP}/mdadm/sbin/mdmon" || gen_die "Failed mdmon install"
- print_info 1 "$(getIndent 2)mdadm: >> Copying to bincache ..."
- cd "${TEMP}/mdadm"
- ${UTILS_CROSS_COMPILE}strip "sbin/mdadm" "sbin/mdmon" ||
- gen_die 'Could not strip mdadm binaries!'
- /bin/tar -cjf "${MDADM_BINCACHE}" sbin/mdadm sbin/mdmon ||
- gen_die 'Could not create binary cache'
-
- cd "${TEMP}"
- isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${MDADM_DIR}" mdadm
- return 0
- fi
-}
-
determine_busybox_config_file() {
print_info 2 "$(get_indent 3)busybox: >> Checking for suitable busybox configuration ..."
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index fc756d0..3971fd7 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -508,48 +508,46 @@ append_lvm() {
|| gen_die "Failed to append lvm to cpio!"
}
-append_mdadm(){
- if [ -d "${TEMP}/initramfs-mdadm-temp" ]
+append_mdadm() {
+ local PN=mdadm
+ local TDIR="${TEMP}/initramfs-${PN}-temp"
+ if [ -d "${TDIR}" ]
then
- rm -r "${TEMP}/initramfs-mdadm-temp/"
+ rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!"
fi
- cd ${TEMP}
- mkdir -p "${TEMP}/initramfs-mdadm-temp/etc/"
- mkdir -p "${TEMP}/initramfs-mdadm-temp/sbin/"
- if isTrue "${MDADM}"
- then
- if [ -n "${MDADM_CONFIG}" ]
- then
- if [ -f "${MDADM_CONFIG}" ]
- then
- cp -a "${MDADM_CONFIG}" "${TEMP}/initramfs-mdadm-temp/etc/mdadm.conf" \
- || gen_die "Could not copy mdadm.conf!"
- else
- gen_die "${MDADM_CONFIG} does not exist!"
- fi
- else
- print_info 1 "$(getIndent 2)MDADM: Skipping inclusion of mdadm.conf"
- fi
- if [ -e '/sbin/mdadm' ] && LC_ALL="C" ldd /sbin/mdadm | grep -q 'not a dynamic executable' \
- && [ -e '/sbin/mdmon' ] && LC_ALL="C" ldd /sbin/mdmon | grep -q 'not a dynamic executable'
+ populate_binpkg ${PN}
+
+ mkdir "${TDIR}" || gen_die "Failed to create '${TDIR}'!"
+ cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+
+ local mydir=
+ for mydir in \
+ etc \
+ sbin \
+ ; do
+ mkdir -p "${TDIR}"/${mydir} || gen_die "Failed to create '${TDIR}/${mydir}'!"
+ done
+
+ unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
+
+ if [ -n "${MDADM_CONFIG}" ]
+ then
+ if [ -f "${MDADM_CONFIG}" ]
then
- print_info 1 "$(getIndent 2)MDADM: Adding support (using local static binaries /sbin/mdadm and /sbin/mdmon)..."
- cp /sbin/mdadm /sbin/mdmon "${TEMP}/initramfs-mdadm-temp/sbin/" ||
- gen_die 'Could not copy over mdadm!'
+ cp -aL "${MDADM_CONFIG}" "${TDIR}"/etc/mdadm.conf 2>/dev/null \
+ || gen_die "Failed to copy '${MDADM_CONFIG}'!"
else
- print_info 1 "$(getIndent 2)MDADM: Adding support (compiling binaries)..."
- compile_mdadm
- /bin/tar -xpf "${MDADM_BINCACHE}" -C "${TEMP}/initramfs-mdadm-temp" ||
- gen_die "Could not extract mdadm binary cache!";
+ gen_die "Specified '${MDADM_CONFIG}' does not exist!"
fi
+ else
+ print_info 2 "$(get_indent 2)${PN}: >> --mdadm-config not set; Skipping inclusion of mdadm.conf ..."
fi
- cd "${TEMP}/initramfs-mdadm-temp/"
+
+ cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
log_future_cpio_content
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
- || gen_die "compressing mdadm cpio"
- cd "${TEMP}"
- rm -rf "${TEMP}/initramfs-mdadm-temp" > /dev/null
+ || gen_die "Failed to append ${PN} to cpio!"
}
append_zfs(){
diff --git a/gkbuilds/mdadm.gkbuild b/gkbuilds/mdadm.gkbuild
new file mode 100644
index 0000000..504a905
--- /dev/null
+++ b/gkbuilds/mdadm.gkbuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_prepare() {
+ default
+
+ local defs='-DNO_DLM -DNO_COROSYNC'
+ sed -i \
+ -e "/^CFLAGS = /s:^CFLAGS = \(.*\)$:CFLAGS = -Os ${defs}:" \
+ -e "/^CXFLAGS = /s:^CXFLAGS = \(.*\)$:CXFLAGS = -Os ${defs}:" \
+ -e "/^CWFLAGS = /s:^CWFLAGS = \(.*\)$:CWFLAGS = -Wall:" \
+ -e "s/^# LDFLAGS = -static/LDFLAGS = -static/" \
+ Makefile \
+ || die "Failed to sed mdadm Makefile"
+}
+
+src_compile() {
+ gkmake V=1 mdadm mdmon
+}
+
+src_install() {
+ mkdir -p "${D}"/sbin || die "Failed to create '${D}/sbin'!"
+
+ cp -a mdadm "${D}"/sbin/ \
+ || die "Failed to copy '${S}/mdadm' to '${D}/sbin/'!"
+
+ "${STRIP}" --strip-all "${D}"/sbin/mdadm \
+ || die "Failed to strip '${D}/sbin/mdadm'!"
+
+ cp -a mdmon "${D}"/sbin/ \
+ || die "Failed to copy '${D}/sbin/mdmon' to '${D}/sbin/'!"
+
+ "${STRIP}" --strip-all "${D}"/sbin/mdmon \
+ || die "Failed to strip '${D}/sbin/mdmon'!"
+}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: /, gkbuilds/, defaults/
@ 2020-08-28 20:18 Thomas Deutschmann
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Deutschmann @ 2020-08-28 20:18 UTC (permalink / raw
To: gentoo-commits
commit: 743800055c2b0a4bcb6f674c7543598ed8f843e8
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 13:52:43 2020 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 15:41:38 2020 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=74380005
Use switch_root from util-linux
switch_root from busybox does not move /dev, /sys, /proc and /run.
If we do that manually there is a small window for a race condition
when /dev, /sys or /proc is still needed but already moved. switch_root
from util-linux will move these mounts on its own and will therefore
avoid any potential problems.
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
defaults/linuxrc | 32 ++------------------------------
gen_initramfs.sh | 24 ++++++++++++------------
gkbuilds/util-linux.gkbuild | 26 ++++++++++++++++++++++++--
3 files changed, 38 insertions(+), 44 deletions(-)
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 5c3b0ce..afb91d8 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -1335,34 +1335,6 @@ then
run pkill -9 udevd >/dev/null 2>&1
fi
-# If devtmpfs is mounted, try move it to the new root
-# If that fails, try to unmount all possible mounts of
-# devtmpfs as stuff breaks otherwise
-for fs in /run /dev /sys /proc
-do
- if grep -qs "${fs}" /proc/mounts
- then
- chroot_dir="${CHROOT}${fs}"
- [ ! -d "${chroot_dir}" ] && run mkdir -p "${chroot_dir}"
-
- if ! run mount -o move ${fs} "${CHROOT}"${fs}
- then
- run umount ${fs} || \
- bad_msg "Failed to move and unmount the ramdisk ${fs}!"
- fi
-
- unset chroot_dir
- fi
-done
-
-if [ ! -e "${CHROOT}/dev/console" ] || [ ! -e "${CHROOT}/dev/null" ]
-then
- bad_msg "ERROR: your real /dev is missing console and null"
-elif [ -e /etc/initrd.splash -a ! -e "${CHROOT}/dev/tty1" ]
-then
- bad_msg "ERROR: your real /dev is missing tty1, required for splash"
-fi
-
# Run debug shell if requested
rundebugshell "before entering switch_root"
@@ -1380,8 +1352,8 @@ elif [ $$ != 1 ]
then
bad_msg "PID was not 1! switch_root would fail"
else
- good_msg "Switching to real root: switch_root -c /dev/console ${CHROOT} ${init} ${init_opts}"
- exec switch_root -c "/dev/console" "${CHROOT}" "${init}" ${init_opts}
+ good_msg "Switching to real root: switch_root ${CHROOT} ${init} ${init_opts}"
+ exec switch_root "${CHROOT}" "${init}" ${init_opts}
fi
# If we get here, something bad has happened
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 875068c..479e6a6 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -635,9 +635,9 @@ append_bcache() {
fi
}
-append_blkid() {
- local PN="util-linux"
- local TDIR="${TEMP}/initramfs-blkid-temp"
+append_unionfs_fuse() {
+ local PN=unionfs-fuse
+ local TDIR="${TEMP}/initramfs-${PN}-temp"
if [ -d "${TDIR}" ]
then
rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!"
@@ -650,13 +650,9 @@ append_blkid() {
unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
-
- # Delete unneeded files
- rm -rf usr/
-
log_future_cpio_content
find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \
- || gen_die "Failed to append blkid to cpio!"
+ || gen_die "Failed to append ${PN} to cpio!"
cd "${TEMP}" || die "Failed to chdir to '${TEMP}'!"
if isTrue "${CLEANUP}"
@@ -665,9 +661,9 @@ append_blkid() {
fi
}
-append_unionfs_fuse() {
- local PN=unionfs-fuse
- local TDIR="${TEMP}/initramfs-${PN}-temp"
+append_util-linux() {
+ local PN="util-linux"
+ local TDIR="${TEMP}/initramfs-util-linux-temp"
if [ -d "${TDIR}" ]
then
rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!"
@@ -680,6 +676,10 @@ append_unionfs_fuse() {
unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+
+ # Delete unneeded files
+ rm -rf usr/
+
log_future_cpio_content
find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \
|| gen_die "Failed to append ${PN} to cpio!"
@@ -1930,11 +1930,11 @@ create_initramfs() {
CPIO_ARCHIVE="${TMPDIR}/${GK_FILENAME_TEMP_INITRAMFS}"
append_data 'devices' # WARNING, must be first!
append_data 'base_layout'
+ append_data 'util-linux'
append_data 'eudev'
append_data 'devicemanager'
append_data 'auxilary' "${BUSYBOX}"
append_data 'busybox' "${BUSYBOX}"
- append_data 'blkid' "${DISKLABEL}"
append_data 'b2sum' "${B2SUM}"
append_data 'btrfs' "${BTRFS}"
append_data 'dmraid' "${DMRAID}"
diff --git a/gkbuilds/util-linux.gkbuild b/gkbuilds/util-linux.gkbuild
index 81670c1..40ea1fb 100644
--- a/gkbuilds/util-linux.gkbuild
+++ b/gkbuilds/util-linux.gkbuild
@@ -1,6 +1,18 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+src_prepare() {
+ default
+
+ # Build static switch_root
+ sed -i \
+ -e '/^switch_root_SOURCES =.*/a switch_root_LDFLAGS = -all-static' \
+ sys-utils/Makemodule.am \
+ || die
+
+ gkautoreconf
+}
+
src_configure() {
export ac_cv_header_security_pam_misc_h=no
export ac_cv_header_security_pam_appl_h=no
@@ -16,6 +28,7 @@ src_configure() {
--disable-widechar
--without-python
--disable-pylibmount
+ --enable-switch_root
--enable-static-programs=blkid
)
@@ -37,6 +50,15 @@ src_install() {
cp -a blkid.static "${D}"/sbin/blkid \
|| die "Failed to copy '${S}/blkid.static' to '${D}/sbin/blkid'!"
- "${STRIP}" --strip-all "${D}"/sbin/blkid \
- || die "Failed to strip '${D}/sbin/blkid'!"
+ cp -a switch_root "${D}"/sbin/switch_root \
+ || die "Failed to copy '${S}/switch_root' to '${D}/sbin/switch_root'!"
+
+ local sbin
+ for sbin in \
+ "${D}/sbin/blkid" \
+ "${D}/sbin/switch_root" \
+ ; do
+ "${STRIP}" --strip-all "${sbin}" \
+ || die "Failed to strip '${sbin}'!"
+ done
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-28 20:18 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: /, gkbuilds/, defaults/ Thomas Deutschmann
-- strict thread matches above, loose matches on Subject: below --
2020-08-28 20:18 Thomas Deutschmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox