Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:afeijoo:branches:devel:microos:systemd-boot
initrd
mkmoduleinitrd
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mkmoduleinitrd of Package initrd
#!/bin/bash set -e if [ "${1:0:1}" = '-' ]; then echo "Usage: $0 ROOT KERNELVERSION OUTPUT" exit 0 fi root="${1:-/}" kv="${2:-$(uname -r)}" of="${3:-initrd-modules-"$kv"}" if [ -z "$all_modules" ]; then # figure out modules automatically like /usr/lib/dracut/modules.d/90kernel-modules/module-setup.sh ? modules=(btrfs vfat overlay efivarfs virtio_blk qemu_fw_cfg) modules+=(dm-crypt essiv xts cryptd aes) while read -r key _colon value; do [ "$key" = "driver" ] || continue modules+=("$value") done < /proc/crypto else while read -r m _rest; do modules+=("$m") done < /proc/modules fi tmpdir=$(mktemp -d -t mkinitrd.XXXXXX) cleanup() { rm -rf "$tmpdir" } trap cleanup EXIT declare -A mods todo=("${modules[@]}") i=0 while [ "$i" -lt "${#todo[@]}" ]; do module="${todo[$i]}" : $((i++)) [ -z "${mods[$module]}" ] || continue fn="$(/usr/sbin/modinfo -b "$root" -k "$kv" -F filename "$module" 2>/dev/null || :)" [ -n "$fn" -a "$fn" != "(builtin)" ] || continue mods["$module"]="${fn#"$root"}" IFS=, read -r -a d < <(/usr/sbin/modinfo -b "$root" -k "$kv" -F depends "$module" || :) for m in "${d[@]}"; do [ -z "${mods[$m]}" ] || continue todo+=("$m") done done for m in "${!mods[@]}"; do fn="${mods[$m]}" mkdir -p "$tmpdir/${fn%/*}" cp -a "$root$fn" "$tmpdir/$fn" done for i in builtin builtin.modinfo order; do cp -a "$root/usr/lib/modules/$kv/modules.$i" "$tmpdir/usr/lib/modules/$kv/modules.$i" done /usr/sbin/depmod -b "$tmpdir" "$kv" for i in /etc/modprobe.conf /etc/modprobe.d /usr/lib/modprobe.d; do [ -e "$i" ] || continue mkdir -p "$tmpdir${i%/*}" cp -a "$i" "$tmpdir$i" done # XXX: should detect / automatically, independent of marker if [ -e /etc/crypttab ]; then grep x-initrd.attach /etc/crypttab > "$tmpdir/etc/crypttab" fi # TODO: fixup time stamps (cd "$tmpdir" ; find -print0 | cpio --format newc --null -R root:root -o --quiet) | zstd -3 -T0 -q > "$of"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor