disabled
  7   ˆl–ß=¿J	¥!®Å6 [¸Ð.6â˜´o�þ\ddYÆYyàF'eüÿÀ„m…Ï¿ÃÂ ?÷     # -*- shell-script -*-

catenate_cpiogz() {
	# Sanity check
	if [ ! -e "${1}" ]; then
		echo "W: catenate_cpiogz: arg1='${1}' does not exist." >&2
		return
	fi

	cat "${1}" >>"${__TMPCPIOGZ}"
}

prepend_earlyinitramfs() {
	# Sanity check
	if [ ! -e "${1}" ]; then
		echo "W: prepend_earlyinitramfs: arg1='${1}' does not exist." >&2
		return
	fi

	cat "${1}" >>"${__TMPEARLYCPIO}"
}

# force_load module [args...]
force_load()
{
	manual_add_modules "$1"
	echo "${@}" >>"${DESTDIR}/conf/modules"
}

# Takes a file containing a list of modules to be added as an
# argument, figures out dependancies, and adds them.
#
# Input file syntax:
#
#   # comment
#   modprobe_module_name [args ...]
#   [...]
#
add_modules_from_file()
{
	# Sanity check
	if [ ! -e "${1}" ]; then
		echo "W: add_modules_from_file: arg1='${1}' does not exist." >&2
		return
	fi

	grep '^[^#]' "${1}" | while read -r module args; do
		[ -n "$module" ] || continue
		force_load "${module}" "${args}"
	done
}

# Locate a firmware file with the given name and copy it into DESTDIR, unless
# DESTDIR already contains such a file.
# Returns an error if no such firmware file can be located and DESTDIR doesn't
# already contain any matching file. (It is up to the caller to figure out
# whether a warning should be printed in that case.)
add_firmware()
{
	local firmware fwloc

	firmware="${1}"

	if [ -e "${DESTDIR}/lib/firmware/updates/${version?}/${firmware}" ] \
	|| [ -e "${DESTDIR}/lib/firmware/updates/${firmware}" ] \
	|| [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ] \
	|| [ -e "${DESTDIR}/lib/firmware/${firmware}" ]; then
		return 0
	fi

	for fwloc in "/lib/firmware/updates/${version}/${firmware}" \
		"/lib/firmware/updates/${firmware}" \
		"/lib/firmware/${version}/${firmware}" \
		"/lib/firmware/${firmware}"; do
		if [ -e "$fwloc" ]; then
			copy_file firmware "$fwloc"
			return 0
		fi
	done

	# We can't figure out where to get that firmware from.
	return 1
}

# Add dependent modules + eventual firmware
manual_add_modules()
{
	local prefix kmod options firmware

	if [ $# -eq 0 ]; then
		return
	fi

	# modprobe --ignore-install inhibits processing of 'install'
	# configuration lines, so that instead we will see 'insmod
	# module.ko' as we want.  However it also means that 'softdep'
	# configuration lines and embedded softdep information is not
	# processed.  So we run twice, with and without this option.
	# shellcheck disable=SC2034
	{ /sbin/modprobe --all --set-version="${version?}" --ignore-install --quiet --show-depends "$@";
	  /sbin/modprobe --all --set-version="${version}" --quiet --show-depends "$@"; } |
	while read -r prefix kmod options ; do
		if [ "${prefix}" != "insmod" ]; then
			continue
		fi

		copy_file module "${kmod}" || continue

		# Add required firmware
		for firmware in $(modinfo -k "${version}" -F firmware "${kmod}"); do
			# Only print warning for missing fw of loaded module
			# or forced loaded module
			if ! add_firmware "$firmware"; then
				# Only warn about missing firmware if
				# /proc/modules exists
				if [ ! -e /proc/modules ] ; then
					continue
				fi

				kmod_modname="${kmod##*/}"
				kmod_modname="${kmod_modname%%.*}"
				if grep -q "^$kmod_modname\\>" /proc/modules "${CONFDIR}/modules"; then
					echo "W: Possible missing firmware /lib/firmware/${firmware} for module ${kmod_modname}" >&2
				fi
				continue
			fi
		done
	done
}

# manual_add_modules() takes care of adding firmware for things that were built
# as modules; but drivers can also be built into the kernel itself. To cover
# that case, we have to look at modules.builtin.modinfo instead.
# This file is generated by the kernel's build process since commit 898490c010b5
# ("moduleparam: Save information about built-in modules in separate file"),
# which was added in Linux 5.2.
add_builtin_firmware()
{
	local builtin_modinfo_path builtin_modname firmware

	builtin_modinfo_path="/lib/modules/${version?}/modules.builtin.modinfo"
	if [ ! -e "$builtin_modinfo_path" ]; then
		if linux-versio