* [gentoo-commits] proj/genkernel:master commit in: /, mdev/, doc/, worker_modules/, defaults/, patches/eudev/3.2.9/, gkbuilds/, ...
@ 2020-07-23 23:57 Thomas Deutschmann
0 siblings, 0 replies; only message in thread
From: Thomas Deutschmann @ 2020-07-23 23:57 UTC (permalink / raw
To: gentoo-commits
commit: c792697d0ec5e54ee9fcf1536f04f2267dff699d
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 23 20:25:44 2020 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Jul 23 22:56:47 2020 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c792697d
Switch from MDEV to UDEV
We need to switch from using MDEV to UDEV to avoid boot problems
due to timeouts caused by some UDEV rules from real system when
real system is using systemd.
Bug: https://bugs.gentoo.org/706434
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
defaults/initrd.defaults | 1 +
defaults/initrd.scripts | 62 +++++++++-----
defaults/linuxrc | 68 +++++++++++----
defaults/software.sh | 16 +++-
defaults/unlock-luks.sh | 2 +
doc/genkernel.8.txt | 4 +
gen_funcs.sh | 18 ++++
gen_initramfs.sh | 121 +++++++++++++++++++++++----
gkbuilds/eudev.gkbuild | 40 +++++++++
gkbuilds/hwids.gkbuild | 35 ++++++++
gkbuilds/lvm.gkbuild | 8 +-
mdev/helpers/nvme | 21 -----
mdev/helpers/storage-device | 52 ------------
mdev/mdev.conf | 40 ---------
patches/eudev/3.2.9/eudev-3.2.9-static.patch | 97 +++++++++++++++++++++
worker_modules/gkbuild.sh | 2 +-
16 files changed, 416 insertions(+), 171 deletions(-)
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index 79d7322..3ac5856 100644
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -96,6 +96,7 @@ GK_SSHD_LOCKFILE='/tmp/remote-rescueshell.lock'
GK_SSHD_PIDFILE='/var/run/dropbear.pid'
GK_SSHD_PORT=22
GK_SSHD_WAIT=
+GK_UDEV_TIMEOUT=120
GK_USERINTERACTION_DISABLED_STATEFILE='/tmp/user-interaction.disabled'
CRYPT_ENV_FILE='/etc/CRYPT_ENV.conf'
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index d5a3612..9b2b32c 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -463,6 +463,12 @@ aufs_insert_dir() {
fi
}
+udevsettle() {
+ local timeout=${1-${GK_UDEV_TIMEOUT}}
+
+ run udevadm settle --timeout=${timeout}
+}
+
# Insert all modules found in $1, usually $CDROOT_PATH
# added to allow users to add their own apps.
union_insert_modules() {
@@ -1612,44 +1618,38 @@ start_volumes() {
if [ "${USE_LVM_NORMAL}" = '1' ]
then
- for lvm_path in /sbin/lvm /bin/lvm MISSING
- do
- [ -x "${lvm_path}" ] && break
- done
-
- if [ "${lvm_path}" = "MISSING" ]
+ if ! hash lvm >/dev/null 2>&1
then
bad_msg "dolvm invoked but LVM binary not available; Skipping LVM volume group activation ..."
else
- for dev in ${RAID_DEVICES}
- do
- setup_md_device "${dev}"
- done
-
- local lvm_cmd
-
# If there is a cache, update it. Unbreak at least dmcrypt
if [ -d /etc/lvm/cache ]
then
good_msg "Scanning for volume groups ..."
- lvm_cmd="run ${lvm_path} vgscan 2>&1"
+
+ local lvm_cmd="run lvm vgscan 2>&1"
is_log_enabled && lvm_cmd="${lvm_cmd} | tee -a '${GK_INIT_LOG}'"
+
eval "${lvm_cmd}"
+ if [ $? -ne 0 ]
+ then
+ bad_msg "Scanning for volume groups failed!"
+ else
+ udevsettle
+ fi
fi
good_msg "Activating volume groups ..."
# To activate volumegroups on all devices in the cache
- local lvm_cmd="run ${lvm_path} vgchange -ay --sysinit 2>&1"
+ local lvm_cmd="run lvm vgchange -ay --sysinit 2>&1"
is_log_enabled && lvm_cmd="${lvm_cmd} | tee -a '${GK_INIT_LOG}'"
- eval "${lvm_cmd}"
- # To create symlinks so users can use root=/dev/vg/root
- # This needs to run after vgchange, using vgchange --mknodes is too
- # early.
- local lvm_cmd="run ${lvm_path} vgmknodes --ignorelockingfailure 2>&1"
- is_log_enabled && lvm_cmd="${lvm_cmd} | tee -a '${GK_INIT_LOG}'"
eval "${lvm_cmd}"
+ if [ $? -ne 0 ]
+ then
+ bad_msg "Activation of volume groups failed!"
+ fi
fi
fi
@@ -1750,6 +1750,8 @@ start_volumes() {
fi
unset ZPOOL_IMPORT_UDEV_TIMEOUT_MS
fi
+
+ udevsettle
}
start_iscsi() {
@@ -1761,7 +1763,14 @@ start_iscsi() {
iscsi_cmd="run iscsistart -b 2>&1"
is_log_enabled && iscsi_cmd="${iscsi_cmd} | tee -a '${GK_INIT_LOG}'"
+
eval "${iscsi_cmd}"
+ if [ $? -ne 0 ]
+ then
+ bad_msg "Activation of iSCSI via iBFT failed!"
+ else
+ udevsettle
+ fi
fi
if [ -n "${ISCSI_INITIATORNAME}" ] && [ -n "${ISCSI_TARGET}" ] && [ -n "${ISCSI_ADDRESS}" ]
@@ -1807,7 +1816,14 @@ start_iscsi() {
iscsi_cmd="run iscsistart -i '${ISCSI_INITIATORNAME}' -t '${ISCSI_TARGET}' -a '${ISCSI_ADDRESS}' ${ADDITIONAL} 2>&1"
is_log_enabled && iscsi_cmd="${iscsi_cmd} | tee -a '${GK_INIT_LOG}'"
+
eval "${iscsi_cmd}"
+ if [ $? -ne 0 ]
+ then
+ bad_msg "Activation of iSCSI via cmdline failed!"
+ else
+ udevsettle
+ fi
fi
}
@@ -1991,6 +2007,8 @@ openLUKS() {
fi
done
+ udevsettle
+
if run mountpoint "${mntkey}" >/dev/null 2>&1
then
run umount "${mntkey}" >/dev/null 2>&1
@@ -2028,6 +2046,7 @@ start_network() {
# Load network modules only when we need them to avoid possible
# firmware problems for people not using network that early
modules_scan net
+ udevsettle
# At least gk.net.iface can only be processed after sysfs was
# mounted.
@@ -2548,6 +2567,7 @@ setup_btrfsctl() {
is_log_enabled && btrfs_cmd="${btrfs_cmd} | tee -a '${GK_INIT_LOG}'"
eval "${btrfs_cmd}"
+ udevsettle
fi
}
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 7e3b388..210085a 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -11,13 +11,13 @@
# Basic /dev content, we need it as fast as possible.
[ ! -e /dev/console ] && mknod /dev/console c 5 1
[ ! -e /dev/null ] && mknod /dev/null c 1 3
+[ ! -e /dev/random ] && mknod /dev/random c 1 8
[ ! -e /dev/tty ] && mknod /dev/tty c 5 0
[ ! -e /dev/tty0 ] && mknod /dev/tty0 c 4 0
[ ! -e /dev/tty1 ] && mknod /dev/tty1 c 4 1
[ ! -e /dev/ttyS0 ] && mknod /dev/ttyS0 c 4 64
[ ! -e /dev/ttyS1 ] && mknod /dev/ttyS1 c 4 65
[ ! -e /dev/urandom ] && mknod /dev/urandom c 1 9
-[ ! -e /dev/random ] && mknod /dev/random c 1 8
[ ! -e /dev/zero ] && mknod /dev/zero c 1 5
# Take control
@@ -33,6 +33,7 @@ fi
mount -t proc -o noexec,nosuid,nodev proc /proc >/dev/null 2>&1
mount -o remount,rw / >/dev/null 2>&1
+mount -t tmpfs -o rw,nosuid,nodev,relatime,mode=755 none /run 2>&1
# Prevent superfluous printks from being printed to the console
echo 1 > /proc/sys/kernel/printk
@@ -356,6 +357,16 @@ do
fi
unset tmp_wait
;;
+ gk.udev.timeout=*)
+ tmp_timeout=${x#*=}
+ if is_int "${tmp_timeout}"
+ then
+ GK_UDEV_TIMEOUT=${tmp_timeout}
+ else
+ warn_msg "'${x}' does not look like a valid time (second) value -- ignored!"
+ fi
+ unset tmp_timeout
+ ;;
gk.userinteraction.disabled=*)
tmp_disabled=${x#*=}
if is_true "${tmp_disabled}"
@@ -532,17 +543,10 @@ mount_devfs
# Mount sysfs
mount_sysfs
-# Initialize mdev
-good_msg 'Activating mdev ...'
-
-# Serialize hotplug events
-run touch /dev/mdev.seq
-
-# Setup hotplugging for firmware loading
-if [ -f "/proc/sys/kernel/hotplug" ]
+if [ -e /proc/sys/kernel/hotplug ]
then
- log_msg "COMMAND: 'echo /sbin/mdev > /proc/sys/kernel/hotplug'"
- echo /sbin/mdev > /proc/sys/kernel/hotplug
+ log_msg "COMMAND: 'echo "" > /proc/sys/kernel/hotplug'"
+ echo "" > /proc/sys/kernel/hotplug
fi
# Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel
@@ -572,8 +576,31 @@ else
good_msg 'Skipping module load; no modules in the ramdisk!'
fi
-# Ensure that device nodes are properly configured
-run mdev -s || bad_msg "mdev -s failed"
+# Initialize udev
+if [ ! -f "/etc/udev/hwdb.bin" ]
+then
+ good_msg 'Generating /etc/udev/hwdb.bin ...'
+ run udevadm hwdb --update \
+ || bad_msg 'Failed to generate /etc/udev/hwdb.bin!'
+fi
+
+good_msg 'Activating udev ...'
+
+udevd_cmd="run udevd --resolve-names=never"
+if is_debug
+then
+ udevd_cmd="${udevd_cmd} --debug > /tmp/udev.debug 2>&1 &"
+else
+ udevd_cmd="${udevd_cmd} --daemon"
+fi
+eval "${udevd_cmd}"
+if [ $? -eq 0 ]
+then
+ run udevadm trigger --action=add
+ udevsettle
+else
+ bad_msg "udevd failed to run"
+fi
cd /
@@ -1326,18 +1353,31 @@ fi
cleanup
+udevsettle
+run udevadm control --exit
+if pgrep udevd >/dev/null 2>&1
+then
+ warn_msg "udevd is still running -- Trying to kill it ..."
+ 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 /dev /sys /proc
+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
diff --git a/defaults/software.sh b/defaults/software.sh
index a9f9cf0..463d8cf 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -65,6 +65,13 @@ GKPKG_DROPBEAR_SRCTAR="${GKPKG_DROPBEAR_SRCTAR:-${DISTDIR}/dropbear-${GKPKG_DROP
GKPKG_DROPBEAR_SRCDIR="${GKPKG_DROPBEAR_SRCDIR:-dropbear-${GKPKG_DROPBEAR_PV}}"
GKPKG_DROPBEAR_BINPKG="${GKPKG_DROPBEAR_BINPKG:-%%CACHE%%/dropbear-${GKPKG_DROPBEAR_PV}-%%ARCH%%.tar.xz}"
+GKPKG_EUDEV_PN="eudev"
+GKPKG_EUDEV_PV="${GKPKG_EUDEV_PV:-VERSION_EUDEV}"
+GKPKG_EUDEV_DEPS="util-linux"
+GKPKG_EUDEV_SRCTAR="${GKPKG_EUDEV_SRCTAR:-${DISTDIR}/eudev-${GKPKG_EUDEV_PV}.tar.gz}"
+GKPKG_EUDEV_SRCDIR="${GKPKG_EUDEV_SRCDIR:-eudev-${GKPKG_EUDEV_PV}}"
+GKPKG_EUDEV_BINPKG="${GKPKG_EUDEV_BINPKG:-%%CACHE%%/eudev-${GKPKG_EUDEV_PV}-%%ARCH%%.tar.xz}"
+
GKPKG_EXPAT_PN="expat"
GKPKG_EXPAT_PV="${GKPKG_EXPAT_PV:-VERSION_EXPAT}"
GKPKG_EXPAT_DEPS=""
@@ -93,6 +100,13 @@ GKPKG_GPG_SRCTAR="${GKPKG_GPG_SRCTAR:-${DISTDIR}/gnupg-${GKPKG_GPG_PV}.tar.bz2}"
GKPKG_GPG_SRCDIR="${GKPKG_GPG_SRCDIR:-gnupg-${GKPKG_GPG_PV}}"
GKPKG_GPG_BINPKG="${GKPKG_GPG_BINPKG:-%%CACHE%%/gnupg-${GKPKG_GPG_PV}-%%ARCH%%.tar.xz}"
+GKPKG_HWIDS_PN="hwids"
+GKPKG_HWIDS_PV="${GKPKG_HWIDS_PV:-VERSION_HWIDS}"
+GKPKG_HWIDS_DEPS="eudev"
+GKPKG_HWIDS_SRCTAR="${GKPKG_HWIDS_SRCTAR:-${DISTDIR}/hwids-${GKPKG_HWIDS_PV}.tar.gz}"
+GKPKG_HWIDS_SRCDIR="${GKPKG_HWIDS_SRCDIR:-hwids-${GKPKG_HWIDS_PV}}"
+GKPKG_HWIDS_BINPKG="${GKPKG_HWIDS_BINPKG:-%%CACHE%%/hwids-${GKPKG_HWIDS_PV}-%%ARCH%%.tar.xz}"
+
GKPKG_ISCSI_PN="open-iscsi"
GKPKG_ISCSI_PV="${GKPKG_ISCSI_PV:-VERSION_ISCSI}"
GKPKG_ISCSI_DEPS="kmod zlib util-linux"
@@ -137,7 +151,7 @@ GKPKG_LIBGPG_ERROR_BINPKG="${GKPKG_LIBGPG_ERROR_BINPKG:-%%CACHE%%/libgpg-error-$
GKPKG_LVM_PN="lvm"
GKPKG_LVM_PV="${GKPKG_LVM_PV:-VERSION_LVM}"
-GKPKG_LVM_DEPS="util-linux libaio"
+GKPKG_LVM_DEPS="util-linux eudev libaio"
GKPKG_LVM_SRCTAR="${GKPKG_LVM_SRCTAR:-${DISTDIR}/LVM2.${GKPKG_LVM_PV}.tgz}"
GKPKG_LVM_SRCDIR="${GKPKG_LVM_SRCDIR:-LVM2.${GKPKG_LVM_PV}}"
GKPKG_LVM_BINPKG="${GKPKG_LVM_BINPKG:-%%CACHE%%/LVM2.${GKPKG_LVM_PV}-%%ARCH%%.tar.xz}"
diff --git a/defaults/unlock-luks.sh b/defaults/unlock-luks.sh
index 6ca60e0..87381ab 100644
--- a/defaults/unlock-luks.sh
+++ b/defaults/unlock-luks.sh
@@ -109,6 +109,8 @@ main() {
fi
done
+ udevsettle
+
if [ -s "${LUKS_KEY}" ]
then
if ! is_debug
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index f84892c..50f1471 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -725,6 +725,10 @@ recognized by the kernel itself.
*gk.net.timeout.interface*=<...>::
By default we will wait up to 10 seconds for interface to show up.
+*gk.udev.timeout*=<...>::
+ By default we will wait up to 120 seconds (UDEV default) for
+ UDEV event queue to become empty.
+
*gk.prompt.timeout*=<...>::
By default a prompt within genkernel initramfs like shown when set
*root* could not be found will never timeout. Use this option to set
diff --git a/gen_funcs.sh b/gen_funcs.sh
index 2dfae7d..b9aa510 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -1113,6 +1113,24 @@ get_temp_file() {
echo "${tempfile}"
}
+get_udevdir() {
+ local pkg_config=$(tc-getPKG_CONFIG)
+
+ if ${pkg_config} --exists udev
+ then
+ local udevdir="$(${pkg_config} --variable=udevdir udev)"
+
+ if [ -n "${BROOT}" ]
+ then
+ udevdir="${udevdir#${BROOT%/}}"
+ fi
+ else
+ udevdir="/lib/udev"
+ fi
+
+ echo "${udevdir}"
+}
+
get_useful_function_stack() {
local end_function=${1:-${FUNCNAME}}
local n_functions=${#FUNCNAME[@]}
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index fa6460c..0669f74 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -178,6 +178,43 @@ log_future_cpio_content() {
print_info 3 "=================================================================" 1 0 1
}
+append_devicemanager() {
+ local PN="lvm"
+ local TDIR="${TEMP}/initramfs-dm-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}'!"
+
+ # Delete unneeded files
+ rm -rf \
+ sbin/lvm \
+ usr/include \
+ usr/lib/device-mapper \
+ usr/lib/pkgconfig \
+ usr/lib/lib* \
+ usr/sbin/lvm \
+ usr/share
+
+ log_future_cpio_content
+ find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \
+ || gen_die "Failed to append bcache to cpio!"
+
+ cd "${TEMP}" || die "Failed to chdir to '${TEMP}'!"
+ if isTrue "${CLEANUP}"
+ then
+ rm -rf "${TDIR}"
+ fi
+}
+
append_devices() {
if isTrue "${BUSYBOX}"
then
@@ -217,10 +254,13 @@ append_devices() {
dir /dev 0755 0 0
nod /dev/console 660 0 0 c 5 1
nod /dev/null 666 0 0 c 1 3
- nod /dev/zero 666 0 0 c 1 5
+ nod /dev/random 600 0 0 c 1 8
nod /dev/tty0 600 0 0 c 4 0
nod /dev/tty1 600 0 0 c 4 1
nod /dev/ttyS0 600 0 0 c 4 64
+ nod /dev/ttyS1 600 0 0 c 4 65
+ nod /dev/urandom 600 0 0 c 1 9
+ nod /dev/zero 666 0 0 c 1 5
EOF
print_info 3 "=================================================================" 1 0 1
@@ -249,13 +289,12 @@ append_base_layout() {
bin \
dev \
etc \
- etc/mdev/helpers \
lib \
lib/console \
lib/dracut \
mnt \
proc \
- run \
+ run/lock \
sbin \
sys \
tmp \
@@ -269,6 +308,7 @@ append_base_layout() {
done
ln -s ../run var/run || gen_die "Failed to create symlink '${TDIR}/var/run' to '${TDIR}/run'!"
+ ln -s ../run/lock var/lock || gen_die "Failed to create symlink '${TDIR}/var/lock' to '${TDIR}/run/lock'!"
chmod 1777 "${TDIR}"/tmp || gen_die "Failed to chmod of '${TDIR}/tmp' to 1777!"
@@ -391,16 +431,6 @@ append_base_layout() {
dd if=/dev/zero of="${TDIR}/run/utmp" bs=1 count=0 seek=0 &>/dev/null \
|| die "Failed to create '${TDIR}/run/utmp'!"
- print_info 2 "$(get_indent 2)>> Adding mdev config ..."
- install -m 644 -t "${TDIR}"/etc "${GK_SHARE}"/mdev/mdev.conf \
- || gen_die "Failed to install '${GK_SHARE}/mdev/mdev.conf'!"
-
- install -m 755 -t "${TDIR}"/etc/mdev/helpers "${GK_SHARE}"/mdev/helpers/nvme \
- || gen_die "Failed to install '${GK_SHARE}/mdev/helpers/nvme'!"
-
- install -m 755 -t "${TDIR}"/etc/mdev/helpers "${GK_SHARE}"/mdev/helpers/storage-device \
- || gen_die "Failed to install '${GK_SHARE}/mdev/helpers/storage-device'!"
-
cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
log_future_cpio_content
find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \
@@ -499,6 +529,59 @@ append_e2fsprogs() {
fi
}
+append_eudev() {
+ local PN=eudev
+ 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}
+ populate_binpkg hwids
+
+ mkdir "${TDIR}" || gen_die "Failed to create '${TDIR}'!"
+
+ unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
+ unpack "$(get_gkpkg_binpkg hwids)" "${TDIR}"
+
+ cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+
+ if isTrue "$(can_run_programs_compiled_by_genkernel)"
+ then
+ print_info 2 "$(get_indent 2)${PN}: >> Pre-generating initramfs' /etc/udev/hwdb.bin ..."
+
+ local gen_hwdb_cmd=( "${TDIR}/usr/bin/udevadm" )
+ gen_hwdb_cmd+=( hwdb --update --root "${TDIR}" )
+ print_info 3 "COMMAND: ${gen_hwdb_cmd[*]}" 1 0 1
+ eval "${gen_hwdb_cmd[@]}" || gen_die "Failed to pre-generate initramfs' /etc/udev/hwdb.bin!"
+
+ # Now that we have a pre-generated hwdb in initramfs
+ # we can delete source files
+ rm -rf usr/lib/udev/hwdb.d/
+ fi
+
+ # Delete unneeded files
+ rm -rf usr/include \
+ usr/lib/libu* \
+ usr/lib/pkgconfig \
+ usr/share
+
+ # Disable predictable network interface names in initramfs
+ echo "" > usr/lib/udev/rules.d/80-net-name-slot.rules \
+ || gen_die "Failed to disable predictable network interface naming rule"
+
+ 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_b2sum() {
local PN="coreutils"
local TDIR="${TEMP}/initramfs-b2sum-temp"
@@ -648,8 +731,6 @@ append_dmraid() {
usr/share \
usr/include
- mkdir -p "${TDIR}"/var/lock/dmraid || gen_die "Failed to create '${TDIR}/var/lock/dmraid'!"
-
log_future_cpio_content
find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \
|| gen_die "Failed to append dmraid to cpio!"
@@ -715,7 +796,10 @@ append_lvm() {
# Delete unneeded files
rm -rf \
- usr/lib \
+ usr/lib/device-mapper \
+ usr/lib/pkgconfig \
+ usr/lib/lib* \
+ usr/sbin/dm* \
usr/share \
usr/include
@@ -743,7 +827,8 @@ append_lvm() {
# Some LVM config options need changing, because the functionality is
# not compiled in:
sed -r -i \
- -e '/^[[:space:]]*obtain_device_list_from_udev/s,=.*,= 0,g' \
+ -e '/^[[:space:]]*obtain_device_list_from_udev/s,=.*,= 1,g' \
+ -e '/^[[:space:]]*udev_sync/s,=.*,= 1,g' \
-e '/^[[:space:]]*use_lvmetad/s,=.*,= 0,g' \
-e '/^[[:space:]]*use_lvmlockd/s,=.*,= 0,g' \
-e '/^[[:space:]]*use_lvmpolld/s,=.*,= 0,g' \
@@ -1770,6 +1855,8 @@ create_initramfs() {
CPIO_ARCHIVE="${TMPDIR}/${GK_FILENAME_TEMP_INITRAMFS}"
append_data 'devices' # WARNING, must be first!
append_data 'base_layout'
+ append_data 'eudev'
+ append_data 'devicemanager'
append_data 'auxilary' "${BUSYBOX}"
append_data 'busybox' "${BUSYBOX}"
append_data 'blkid' "${DISKLABEL}"
diff --git a/gkbuilds/eudev.gkbuild b/gkbuilds/eudev.gkbuild
new file mode 100644
index 0000000..54f2c0d
--- /dev/null
+++ b/gkbuilds/eudev.gkbuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_configure() {
+ local myconf=(
+ --enable-static
+ --enable-blkid
+ --disable-introspection
+ --disable-manpages
+ --disable-selinux
+ --disable-rule-generator
+ --disable-hwdb
+ )
+
+ # Cannot link against static kmod, https://lists.freedesktop.org/archives/systemd-devel/2013-June/011173.html
+ myconf+=( --disable-kmod )
+
+ gkconf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ local files_to_strip=()
+ files_to_strip+=( /usr/bin/udevadm )
+ files_to_strip+=( /usr/lib/udev/ata_id )
+ files_to_strip+=( /usr/lib/udev/cdrom_id )
+ files_to_strip+=( /usr/lib/udev/collect )
+ files_to_strip+=( /usr/lib/udev/mtd_probe )
+ files_to_strip+=( /usr/lib/udev/scsi_id )
+ files_to_strip+=( /usr/lib/udev/v4l_id )
+ files_to_strip+=( /usr/sbin/udevd )
+
+ local file_to_strip=
+ for file_to_strip in "${files_to_strip[@]}"
+ do
+ "${STRIP}" --strip-all "${D}"${file_to_strip} \
+ || die "Failed to strip '${D}${file_to_strip}'!"
+ done
+}
diff --git a/gkbuilds/hwids.gkbuild b/gkbuilds/hwids.gkbuild
new file mode 100644
index 0000000..60492c5
--- /dev/null
+++ b/gkbuilds/hwids.gkbuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+S="${WORKDIR}/hwids-${P}"
+
+_emake() {
+ gkmake \
+ V=1 \
+ NET=yes \
+ PCI=yes \
+ UDEV=yes \
+ USB=yes \
+ "$@"
+}
+
+src_prepare() {
+ default
+
+ # we cannot run host's udevadm
+ sed -i -e '/udevadm hwdb/d' Makefile || die
+}
+
+src_compile() {
+ _emake
+}
+
+src_install() {
+ _emake \
+ HWDBDIR="$(get_udevdir)/hwdb.d" \
+ DESTDIR="${D}" \
+ install
+
+ rm -rf \
+ "${D}"/usr/share
+}
diff --git a/gkbuilds/lvm.gkbuild b/gkbuilds/lvm.gkbuild
index 3af06e6..1346cb0 100644
--- a/gkbuilds/lvm.gkbuild
+++ b/gkbuilds/lvm.gkbuild
@@ -1,8 +1,8 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
src_configure() {
-
+ # devicemapper needs to find udev
append-ldflags -Wl,-rpath-link,${BROOT}/usr/lib
export ac_cv_header_security_pam_misc_h=no
@@ -23,8 +23,8 @@ src_configure() {
--with-thin=internal
--with-cache=internal
--disable-udev-systemd-background-jobs
- --disable-udev_sync
- --disable-udev_rules
+ --enable-udev_sync
+ --enable-udev_rules
)
local texec
diff --git a/mdev/helpers/nvme b/mdev/helpers/nvme
deleted file mode 100644
index 7df96a3..0000000
--- a/mdev/helpers/nvme
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-[ -z "${MDEV}" ] && exit 22
-
-DEV="${MDEV%p*}"
-PART="${MDEV#nvme?n?p}"
-PART="${PART#nvme?n?}"
-
-[ -f "/sys/class/block/${DEV}/device/model" ] || exit 6
-cat "/sys/class/block/${DEV}/device/model" >/dev/null 2>&1 || exit 15
-
-MODEL=$(cat /sys/class/block/"${DEV}"/device/model)
-MODEL=$(echo $MODEL) # leave unquoted, it removes spaces
-MODEL="${MODEL// /_}"
-SERIAL=$(cat /sys/class/block/"${DEV}"/device/serial)
-SERIAL="${SERIAL// /}"
-WWID=$(cat /sys/class/block/"${DEV}"/wwid)
-
-mkdir -p /dev/disk/by-id
-ln -sf "../../${MDEV}" "/dev/disk/by-id/nvme-${MODEL}_${SERIAL}${PART:+-part$PART}"
-ln -sf "../../${MDEV}" "/dev/disk/by-id/nvme-${WWID}${PART:+-part$PART}"
diff --git a/mdev/helpers/storage-device b/mdev/helpers/storage-device
deleted file mode 100644
index 473b1b7..0000000
--- a/mdev/helpers/storage-device
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-# License: Creative Commons Public Domain Dedication (CC0 1.0)
-# <https://creativecommons.org/publicdomain/zero/1.0/>
-
-[ -z "${MDEV}" ] && exit 22
-
-DEV="$(echo ${MDEV} | sed 's/\(.*[a-z]\)\(.*\)/\1/')"
-PART="$(echo ${MDEV} | sed 's/\(.*[a-z]\)\(.*\)/\2/')"
-
-case $DEV in
-vd*)
- TYPE=virtio
- ;;
-sd*)
- TYPE=ata
- ;;
-*)
- exit 33
- ;;
-esac
-
-NAME=
-if [ -f "/sys/class/block/${DEV}/device/vpd_pg83" ]
-then
- # An existing vpd_pg83 node can still fail to read, #569990
- if cat "/sys/class/block/${DEV}/device/vpd_pg83" >/dev/null 2>&1
- then
- NAME=$(echo "$(cat "/sys/class/block/${DEV}/device/vpd_pg83")" | cut -c 36-95 | sed -e 's/ \+/_/g' -e "s/\(.*\)_/${TYPE}-\1${PART:+-part$PART}/")
- fi
-fi
-
-if [ -z "${NAME}" -a -x "/lib/udev/scsi_id" ]
-then
- # Some systems like VMware don't expose Vital Product Data (VPD) via sysfs
- # but will expose at least some information when VM setting "disk.EnableUUID"
- # is set.
- if /lib/udev/scsi_id -p 0x83 -g -d "/dev/${DEV}" >/dev/null 2>&1
- then
- TYPE=scsi
- SERIAL=$(/lib/udev/scsi_id -p 0x83 -g -d "/dev/${DEV}" 2>/dev/null)
- SERIAL="${SERIAL// /}"
- if [ -n "${SERIAL}" ]
- then
- NAME="${TYPE}-${SERIAL}${PART:+-part$PART}"
- fi
- fi
-fi
-
-[ -z "${NAME}" ] && exit 44
-
-mkdir -p /dev/disk/by-id
-ln -sf "../../${MDEV}" "/dev/disk/by-id/${NAME}"
diff --git a/mdev/mdev.conf b/mdev/mdev.conf
deleted file mode 100644
index 4aae0c4..0000000
--- a/mdev/mdev.conf
+++ /dev/null
@@ -1,40 +0,0 @@
-# genkernel mdev.conf
-
-# Syntax:
-# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
-# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
-# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
-#
-# [-]: do not stop on this match, continue reading mdev.conf
-# =: move, >: move and create a symlink
-# !: do not create device node
-# @|$|*: run@cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases
-
-# null may already exist; therefore ownership has to be changed with command
-null 0:0 666 @chmod 666 $MDEV
-zero 0:0 666
-full 0:0 666
-random 0:0 444
-urandom 0:0 444
-hwrandom 0:0 444
-hw_random 0:0 600 =hwrng
-
-# console may already exist; therefore ownership has to be changed with command
-console 0:5 600 @chmod 600 $MDEV
-
-# Typical devices
-tty 0:5 666
-tty[0-9]* 0:5 660
-ttyS[0-9]* 0:14 660
-
-# block devices
-nvme[0-9]n[0-9].* 0:6 660 @/etc/mdev/helpers/nvme
-sd[a-z].* 0:6 660 @/etc/mdev/helpers/storage-device
-vd[a-z].* 0:6 660 @/etc/mdev/helpers/storage-device
-
-# raid controllers
-cciss!(.*) 0:6 660 =cciss/%1
-ida!(.*) 0:6 660 =ida/%1
-rd!(.*) 0:6 660 =rd/%1
-
-fuse 0:0 666
diff --git a/patches/eudev/3.2.9/eudev-3.2.9-static.patch b/patches/eudev/3.2.9/eudev-3.2.9-static.patch
new file mode 100644
index 0000000..fc36b54
--- /dev/null
+++ b/patches/eudev/3.2.9/eudev-3.2.9-static.patch
@@ -0,0 +1,97 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -261,7 +261,7 @@ AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules s
+ if test "x$enable_kmod" != "xno"; then
+ PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
+ if test "x$have_kmod" = "xyes"; then
+- PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
++ PKG_CHECK_MODULES_STATIC(KMOD, [ libkmod >= 15 ],
+ [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
+ AC_MSG_ERROR([*** kmod version >= 15 not found]))
+ fi
+--- a/src/ata_id/Makefile.am
++++ b/src/ata_id/Makefile.am
+@@ -11,6 +11,8 @@ udevlibexec_PROGRAMS = \
+ ata_id_SOURCES = \
+ ata_id.c
+
++ata_id_LDFLAGS = -all-static
++
+ ata_id_LDADD = \
+ $(top_builddir)/src/libudev/libudev-private.la \
+ $(top_builddir)/src/udev/libudev-core.la
+--- a/src/cdrom_id/Makefile.am
++++ b/src/cdrom_id/Makefile.am
+@@ -10,6 +10,8 @@ udevlibexec_PROGRAMS = \
+ cdrom_id_SOURCES = \
+ cdrom_id.c
+
++cdrom_id_LDFLAGS = -all-static
++
+ cdrom_id_LDADD = \
+ $(top_builddir)/src/libudev/libudev-private.la \
+ $(top_builddir)/src/udev/libudev-core.la
+--- a/src/collect/Makefile.am
++++ b/src/collect/Makefile.am
+@@ -11,6 +11,8 @@ udevlibexec_PROGRAMS = \
+ collect_SOURCES = \
+ collect.c
+
++collect_LDFLAGS = -all-static
++
+ collect_LDADD = \
+ $(top_builddir)/src/libudev/libudev-private.la \
+ $(top_builddir)/src/udev/libudev-core.la
+--- a/src/mtd_probe/Makefile.am
++++ b/src/mtd_probe/Makefile.am
+@@ -6,6 +6,8 @@ AM_CPPFLAGS = \
+ udevlibexec_PROGRAMS = \
+ mtd_probe
+
++mtd_probe_LDFLAGS = -all-static
++
+ mtd_probe_SOURCES = \
+ mtd_probe.c \
+ mtd_probe.h \
+--- a/src/scsi_id/Makefile.am
++++ b/src/scsi_id/Makefile.am
+@@ -14,6 +14,8 @@ scsi_id_SOURCES =\
+ scsi.h \
+ scsi_id.h
+
++scsi_id_LDFLAGS = -all-static
++
+ scsi_id_LDADD = \
+ $(top_builddir)/src/libudev/libudev-private.la \
+ $(top_builddir)/src/udev/libudev-core.la
+--- a/src/udev/Makefile.am
++++ b/src/udev/Makefile.am
+@@ -22,6 +22,8 @@ sbin_PROGRAMS = \
+ udevd_SOURCES = \
+ udevd.c
+
++udevd_LDFLAGS = -all-static
++
+ udevd_LDADD = \
+ libudev-core.la
+
+@@ -38,6 +40,7 @@ udevadm_SOURCES = \
+ udevadm-util.c \
+ udevadm-util.h
+
++udevadm_LDFLAGS = -all-static
+
+ udevadm_LDADD = \
+ libudev-core.la
+--- a/src/v4l_id/Makefile.am
++++ b/src/v4l_id/Makefile.am
+@@ -9,6 +9,8 @@ udevlibexec_PROGRAMS = \
+ v4l_id_SOURCES = \
+ v4l_id.c
+
++v4l_id_LDFLAGS = -all-static
++
+ v4l_id_LDADD = \
+ $(top_builddir)/src/libudev/libudev-private.la \
+ $(top_builddir)/src/udev/libudev-core.la
+
diff --git a/worker_modules/gkbuild.sh b/worker_modules/gkbuild.sh
index 668bb8f..7284d84 100644
--- a/worker_modules/gkbuild.sh
+++ b/worker_modules/gkbuild.sh
@@ -365,7 +365,7 @@ _initialize() {
# https://git.dereferenced.org/pkgconf/pkgconf/issues/30
unset PKG_CONFIG_PATH PKG_CONFIG_DIR LIBRARY_PATH
- export PKG_CONFIG_LIBDIR=\${SYSROOT}/usr/lib/pkgconfig
+ export PKG_CONFIG_LIBDIR=\${SYSROOT}/usr/lib/pkgconfig:\${SYSROOT}/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=\${SYSROOT}
exec pkg-config "\$@"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-23 23:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-23 23:57 [gentoo-commits] proj/genkernel:master commit in: /, mdev/, doc/, worker_modules/, defaults/, patches/eudev/3.2.9/, gkbuilds/, Thomas Deutschmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox