From a392f5f9f43dde87c750c75b00215869b46d3517 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 19 Feb 2009 16:10:13 +0100 Subject: [PATCH] udev: add initramfs-tools, update depends. --HG-- extra : convert_revision : 2450b2c23182dd801dedb579b86ae3e40c3abdb9 --- templates/udev/template | 20 +++++++++- templates/udev/udev.initramfs-bottom | 28 ++++++++++++++ templates/udev/udev.initramfs-hook | 51 ++++++++++++++++++++++++++ templates/udev/udev.initramfs-premount | 29 +++++++++++++++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 templates/udev/udev.initramfs-bottom create mode 100644 templates/udev/udev.initramfs-hook create mode 100644 templates/udev/udev.initramfs-premount diff --git a/templates/udev/template b/templates/udev/template index c236056cb4..1a6bd82da1 100644 --- a/templates/udev/template +++ b/templates/udev/template @@ -13,4 +13,22 @@ long_desc=" udev is a implementation of devfs in userspace using sysfs and /sbin/hotplug. It requires a 2.5/2.6 kernel to run properly." -run_depends="glibc-2.8" +build_depends="initramfs-tools-0.92 procps-3.2.7" +run_depends="glibc-2.8 $build_depends" + +post_install() +{ + local destdir=$XBPS_DESTDIR/$pkgname-$version + + # Install the initramfs-tools udev scripts. + mkdir -p $destdir/usr/share/initramfs-tools/hooks + mkdir -p $destdir/usr/share/initramfs-tools/scripts/init-premount + mkdir -p $destdir/usr/share/initramfs-tools/scripts/init-bottom + + install -m 755 $XBPS_TEMPLATESDIR/udev/udev.initramfs-hook \ + $destdir/usr/share/initramfs-tools/hooks/udev + install -m 755 $XBPS_TEMPLATESDIR/udev/udev.initramfs-premount \ + $destdir/usr/share/initramfs-tools/scripts/init-premount/udev + install -m 755 $XBPS_TEMPLATESDIR/udev/udev.initramfs-bottom \ + $destdir/usr/share/initramfs-tools/scripts/init-bottom/udev +} diff --git a/templates/udev/udev.initramfs-bottom b/templates/udev/udev.initramfs-bottom new file mode 100644 index 0000000000..6c59eb0a95 --- /dev/null +++ b/templates/udev/udev.initramfs-bottom @@ -0,0 +1,28 @@ +#!/bin/sh -e +# initramfs premount script for udev + +PREREQ="" + +# Output pre-requisites +prereqs() +{ + echo "$PREREQ" +} + +case "$1" in + prereqs) + prereqs + exit 0 + ;; +esac + + +# Stop udevd, we'll miss a few events while we run init, but we catch up +pkill udevd + +# udevd might have been in the middle of something when we killed it, +# but it doesn't matter because we'll do everything again in userspace +rm -rf /dev/.udev/queue + +# Move /dev to the real filesystem +mount -n -o move /dev ${rootmnt}/dev diff --git a/templates/udev/udev.initramfs-hook b/templates/udev/udev.initramfs-hook new file mode 100644 index 0000000000..7ad3595052 --- /dev/null +++ b/templates/udev/udev.initramfs-hook @@ -0,0 +1,51 @@ +#!/bin/sh -e +# initramfs hook for udev + +MINKVER="2.6.24" +PREREQ="" + +# Output pre-requisites +prereqs() +{ + echo "$PREREQ" +} + +case "$1" in + prereqs) + prereqs + exit 0 + ;; +esac + + +. /usr/share/initramfs-tools/hook-functions + +# We use pkill +copy_exec /usr/bin/pkill /sbin + +# Copy across the udev binaries +copy_exec /sbin/udevd /sbin +copy_exec /sbin/udevadm /sbin + +# Copy udev configuration +mkdir -p ${DESTDIR}/etc/udev +cp -p /etc/udev/udev.conf ${DESTDIR}/etc/udev + +# Only copy across relevant rules +mkdir -p ${DESTDIR}/lib/udev/rules.d +for rules in 50-udev-default.rules 60-persistent-storage.rules \ + 61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules; do + cp -p /lib/udev/rules.d/$rules ${DESTDIR}/lib/udev/rules.d +done + +# Copy across helpers the rules need +mkdir -p ${DESTDIR}/lib/udev +# 50-udev-default.rules +# 60-persistent-storage.rules +copy_exec /lib/udev/ata_id /lib/udev +copy_exec /lib/udev/usb_id /lib/udev +copy_exec /lib/udev/vol_id /lib/udev +copy_exec /lib/udev/scsi_id /lib/udev +copy_exec /lib/udev/path_id /lib/udev +# 61-persistent-storage-edd.rules +#copy_exec /lib/udev/edd_id /lib/udev diff --git a/templates/udev/udev.initramfs-premount b/templates/udev/udev.initramfs-premount new file mode 100644 index 0000000000..c413b253bf --- /dev/null +++ b/templates/udev/udev.initramfs-premount @@ -0,0 +1,29 @@ +#!/bin/sh -e +# initramfs premount script for udev + +PREREQ="" + +# Output pre-requisites +prereqs() +{ + echo "$PREREQ" +} + +case "$1" in + prereqs) + prereqs + exit 0 + ;; +esac + + +# It's all over netlink now +echo "" > /proc/sys/kernel/hotplug + +# Start the udev daemon to process events +/sbin/udevd --daemon --resolve-names=never + +# Iterate sysfs and fire off everything; if we include a rule for it then +# it'll get handled; otherwise it'll get handled later when we do this again +# in the main boot sequence. +/sbin/udevadm trigger