Добавлены модули для dracut

atratsevskiy
Mike khiretskiy 11 years ago
parent 4b191f18df
commit 4201ed3e54

@ -27,6 +27,7 @@ USE="${USE} bash-completion logrotate"
AUTOCLEAN="yes"
CAMERAS="*"
DRACUT_MODULES="dmraid dmsquash-live gensplash lvm mdraid nfs"
DISTDIR="/var/calculate/remote/distfiles"
FEATURES="metadata-transfer parallel-install -userpriv"
FOO2ZJS_DEVICES="*"

@ -12,6 +12,7 @@ media-gfx/splashutils fbcondecor
net-fs/samba quota
sys-fs/aufs2 inotify kernel-patch
sys-kernel/calculate-sources symlink vmlinuz minimal
sys-kernel/dracut device-mapper net
#fix update xorg
sys-fs/udev extras

@ -0,0 +1 @@
# Calculate merge()!=&&pkg()!= append=skip path=/usr/lib/dracut name=modules.d

@ -0,0 +1,65 @@
load_videodrv() {
info "Loading frame buffer video driver"
# find all available fb drivers
videodrv_count=$(find /lib/modules \
-name "nouveau.ko" -o \
-name "uvesafb.ko" -o \
-name "i915.ko" -o \
-name "radeon.ko" |
grep -c "")
# load specified videodrv
modules_list=
case "${videodrv}" in
nouveau)
modules_list="nouveau"
;;
radeon)
modules_list="radeon"
;;
i915|intel)
modules_list="i915"
;;
""|auto)
# videoautodetect
if [[ -x /usr/sbin/lspci ]]
then
if lspci | grep -m1 VGA | grep -qi intel
then
modules_list="i915"
elif lspci | grep -m1 VGA | grep -qi nvidia
then
modules_list="nouveau"
elif lspci | grep -m1 VGA | grep -q -e "Ati" -e "ATI"
then
modules_list="radeon"
else
modules_list=""
fi
else
modules_list="i915"
fi
;;
esac
for x in $modules_list
do
if [ "`find /lib/modules -name "${x}.ko" | grep -c ''`" -eq "1" ]
then
modprobe "${x}" modeset=1 &>/dev/null
lsmod | grep -q "^${x}" && \
[ "`cat /sys/module/${x}/refcnt`" -gt 0 ] && return 0
fi
done
# else load uvesafb with specified video resolution
if [ -n "${videoresolution}" ]
then
if ! echo $videoresolution | grep -q "\-"
then
videoresolution="${videoresolution}-32"
fi
else
videoresolution="1024x768-32"
fi
modprobe uvesafb mode_option=${videoresolution} &>/dev/null
}
load_videodrv

@ -0,0 +1,41 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
check() {
return 255
}
depends() {
echo gensplash
return 0
}
installkernel() {
instmods radeon uvesafb nouveau i915
}
install() {
# inst_dir /lib/modules/keys
inst_binary /usr/sbin/lspci
inst_binary /usr/bin/sleep
inst_binary /bin/grep
inst_binary /sbin/lsmod
inst_binary /usr/bin/find
inst_binary /usr/bin/cut
inst_simple /usr/share/misc/pci.ids
inst_hook pre-trigger 01 "$moddir/load-video.sh"
inst_hook cmdline 50 "$moddir/parse-cmdline.sh"
#
# inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
#
# for x in /lib/modules/keys/* ; do
# [[ "${x}" = "/lib/modules/keys/*" ]] && break
# inst_simple "${x}"
# done
}

@ -0,0 +1,38 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -z "$calculate" ] && calculate=$(getarg calculate=)
[ -z "$video" ] && video=$(getarg video=)
[ -z "$calculate" ] && [ -z "$video" ] && return
if [ -n "$video" ]
then
for i in ${video//,/ }
do
if [ -z "${i//[0-9-x@]}" ]
then
videoresolution=${i}
fi
done
fi
if [[ "${calculate//:/}" != "${calculate}" ]]
then
for i in ${calculate//,/ }
do
case "${i}" in
video:*)
videodrv=`echo "${i}" | cut -s -d: -f2-`
;;
resolution:*)
resolution=`echo "${i}" | cut -s -d: -f2-`
if [ -n "${resolution}" -a "${resolution}" != "auto" ]
then
videoresolution=${resolution}-32
fi
;;
esac
done
fi

@ -0,0 +1,11 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# live images are specified with
# root=live:backingdev
isofile=$(getarg iso-scan/filename)
if [ -n "$isofile" -a "$root" = "live" ]; then
rootok=1
fi

@ -0,0 +1,43 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
echo "ISOFILE $1"
isofile=$1
[ -z "$isofile" ] && exit 1
ismounted "/run/initramfs/isoscan" && exit 0
mkdir -p "/run/initramfs/isoscan"
do_iso_scan() {
local _name
local dev
for dev in /dev/disk/by-uuid/*; do
_name=$(dev_unit_name "$dev")
[ -e /tmp/isoscan-${_name} ] && continue
> /tmp/isoscan-${_name}
mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
if [ -f "/run/initramfs/isoscan/$isofile" ]; then
if [ "$root" == "live" ]; then
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `losetup -f --show "/run/initramfs/isoscan/$isofile"`
else
losetup -f --show "/run/initramfs/isoscan/$isofile"
fi
rm -f -- "$job"
exit 0
else
umount "/run/initramfs/isoscan"
fi
done
}
do_iso_scan
rmdir "/run/initramfs/isoscan"
exit 1

@ -0,0 +1,30 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# a live host-only image doesn't really make a lot of sense
[[ $hostonly ]] && return 1
return 255
}
depends() {
# if dmsetup is not installed, then we cannot support fedora/red hat
# style live images
echo rootfs-block dmsquash-live
return 0
}
installkernel() {
instmods squashfs loop iso9660
}
install() {
inst_multiple umount dmsetup blkid dd losetup grep blockdev cat cut sed rmdir pidof
inst_hook mount 20 "$moddir/scratch-mount-root.sh"
inst_hook cmdline 31 "$moddir/iso-scan-rootok.sh"
inst_script "$moddir/scratch-live-root.sh" "/sbin/dmsquash-live-root"
inst_script "$moddir/mount-squashfs.sh" "/sbin/mount-squashfs"
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
inst_script "$moddir/nfsroot.sh" "/sbin/nfsroot"
}

@ -0,0 +1,85 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
live_dir=$(getarg rd.live.dir -d live_dir )
squash_image=$(getarg rd.live.squashimg -d loop)
[ -z "$squash_image" ] && squash_image="livecd.squashfs"
getargbool 0 rd.live.ram -d -y live_ram -d -y docache && live_ram="yes"
# we might have an embedded fs image on squashfs (compressed live)
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
fi
do_cache() {
allmemory=0
for i in $(cat /proc/meminfo | grep -e ^MemFree -e ^Cached | \
cut -d: -f2 | cut -dk -f1 | sed -e "s/^\s*//") ;
do
allmemory=$((${allmemory} + $i))
done
# getting size tmpfs of default
let curtfs=${allmemory}/2
# getting size of image
let imagesize=`ls -la ${SQUASHED} | sed -r -n 's/(\S*\s*){4}(\S*).*/\2/p'`/20000*21
let addon=${imagesize}/7
if [[ ${curtfs} -gt $(( ${imagesize} + ${addon} )) ]];
then
newsize=${curtfs}
else
newsize=$(( ${addon} + ${imagesize} ))
fi
if [[ ${newsize} -lt ${allmemory} ]];
then
LIVECACHE=/run/initramfs/livecache
mkdir -m 0755 -p $LIVECACHE
mount -o remount,size=${newsize}k -t tmpfs tmpfs /run
echo "Copying live image to RAM..."
echo "(this may take a few minutes)"
dd if=$SQUASHED of=${LIVECACHE}/livecd.squashfs bs=512 2> /dev/null
if [ $? -ne 0 ]
then
bad_msg "Failed to cache the loop file! Lack of space?"
umount ${LIVECACHE}
else
SQUASHED="${LIVECACHE}/livecd.squashfs"
echo "Unmounting media from /var/initramfs/live"
umount -n /run/initramfs/live
fi
else
echo "Too low memory for cache the loop file." 1>&2
fi
}
if [ -e "$SQUASHED" ] ; then
if [ -n "$live_ram" ] ; then
do_cache
fi
SQUASHED_LOOPDEV=$( losetup -f )
losetup -r $SQUASHED_LOOPDEV $SQUASHED
mkdir -m 0755 -p /run/initramfs/squashfs
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
fi
ROOTFLAGS="$(getarg rootflags)"
if [ -n "$ROOTFLAGS" ]; then
ROOTFLAGS="-o $ROOTFLAGS"
else
ROOTFLAGS="-o udba=reval,br:/overlay=rw,/run/initramfs/squashfs=ro"
fi
ln -s ${SQUASHED_LOOPDEV} /dev/mapper/live-rw
need_shutdown
exit 0

@ -0,0 +1,26 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/nfs-lib.sh
[ "$#" = 3 ] || exit 1
# root is in the form root=nfs[4]:[server:]path[:options], either from
# cmdline or dhcp root-path
netif="$1"
root="$2"
NEWROOT="$3"
nfs_to_var $root $netif
[ -z "$server" ] && die "Required parameter 'server' is missing"
mkdir -m 0755 -p /run/initramfs/live
mount_nfs $root /run/initramfs/live $netif && { [ -e /dev/root ] || ln -s null /dev/root ; }
/sbin/mount-squashfs
echo '[ -e /run/initramfs/squashfs/proc ]' > $hookdir/initqueue/finished/nfsroot.sh
need_shutdown

@ -0,0 +1,37 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
exec > /tmp/liveroot.$$.out
exec 2>> /tmp/liveroot.$$.out
set -x
fi
[ -z "$1" ] && exit 1
livedev="$1"
# parse various live image specific options that make sense to be
# specified as their own things
ln -s $livedev /run/initramfs/livedev
modprobe squashfs
CMDLINE=$(getcmdline)
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
# mount the backing of the live image first
mkdir -m 0755 -p /run/initramfs/live
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
if [ "$?" != "0" ]; then
echo "FAILED1!"
die "Failed to mount block device of live image"
exit 1
fi
/sbin/mount-squashfs
exit 0

@ -0,0 +1,24 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
mount_live_root() {
mkdir /run/initramfs/workspace
mountoption="-o udba=reval,br:/run/initramfs/workspace=rw:/run/initramfs/squashfs=ro"
if getargbool 0 scratch
then
mkdir /run/initramfs/delta
mountoption="-o udba=reval,br:/run/initramfs/workspace=rw:/run/initramfs/delta=ro+wh:/run/initramfs/squashfs=ro"
fi
mount -t aufs $mountoption none $NEWROOT
if getargbool 0 scratch
then
mkdir $NEWROOT/run/builder
mountoption="-o udba=reval,br:/run/initramfs/delta=rw:/run/initramfs/squashfs=ro"
mount -t aufs $mountoption none $NEWROOT/run/builder
fi
}
[ -n "$root" -a -z "${root%%live*}" -o "$root" = "nfs" ] && mount_live_root

@ -0,0 +1,5 @@
# Calculate path=/etc format=patch
<reg>omit_dracutmodules+=""</reg>
<text>omit_dracutmodules+="i18n"</text>
<reg>add_dracutmodules+=""</reg>
<text>add_dracutmodules+="video nfs calculate"</text>
Loading…
Cancel
Save