On 2011-05-09 14:34, Pasi Kärkkäinen wrote:
On Mon, May 09, 2011 at 01:48:03PM +0200, Robin Axelsson wrote:
On 2011-05-09 08:45, Pasi Kärkkäinen wrote:
On Fri, May 06, 2011 at 04:18:14PM +0200, Robin Axelsson wrote:
On 2011-05-06 08:03, Pasi Kärkkäinen wrote:
On Thu, May 05, 2011 at 07:48:36PM +0200, Robin Axelsson wrote:
Hi,
I have compiled Jeremy's kernel on Fedora 14 and it turned out that
xen-pciback is compiled into the kernel as a module. So I made a
"xen-pciback.conf" file in /etc/modprobe.d. The problem is that I have
to get modprobe to load before the drivers to the PCI devices I want to
hide are loaded.
So my question is how do I locate the drivers and find the points in the
boot scripts where I can put the modprobe so that it is loaded before
them? I tried lsmod and modinfo but they don't give much information. I
only managed to find the driver for the Intel EXPI9400PT adapter e1000e.
I want to hide the graphics adapter (Radeon 5450), Two USB2.0 ports, the
Intel adapter, the USB3.0 controller and the Audio device, their
assignments on machine are as follows:
pci_0000_00_02_0 (GPU)
pci_0000_00_12_0 (USB 2.0 should give 2 ports)
pci_0000_00_14_2 (Audio device)
pci_0000_00_0a_0 (Intel Adapter)
pci_0000_00_09_0 (USB 3.0 Interface)
but the question is where can I locate their drivers and how can I tap
into the boot sequence so that the xen-pciback driver is loaded
beforehand? The page
http://wiki.xensource.com/xenwiki/Assign_hardware_to_DomU_with_PCIBack_as_module
gives no information about this. It mentions something about "install
skge ... " but it doesn't say where this line is to be put and how you
figure out that skge is the driver to be disabled.
You probably should add the modules to be loaded from initrd image.
Are you using mkinitrd? If yes, there's an option to preload modules..
-- Pasi
I issued the command
mkinitrd -v -f --preload xen-pciback /boot/initramfs-2.6.32.39.img
2.6.32.39
and I noticed that the initramfs image file generated is considerably
smaller than the initramfs imagefile generated by dracut. The dracut
file is a bit over 80 MB whereas the new one is less than 8 MB.
But the preload doesn't load the xen-pciback module. After the reboot
when I list assignable PCI devices using xm, Xen returns nothing. If I
issue 'modprobe xen-pciback' and then list the devices using xm I get
one entry. What's wrong?
Hmm.. Is it possible that the other xen-related required modules
are not yet loaded at that point, so loading xen-pciback fails?
You could always extract initramfs-2.6.32.39.img and read the 'init'
script in it and see what it's trying to do..
-- Pasi
Perhaps you know how to extract the initramfs? I'm unable to find the
compression headers and I'm not sure what headers to look for. In the
first step I tried to locate the gzip header:
They're usually gzipped cpio archives.
So something like this should work:
mkdir temp&& cd temp&& zcat /boot/initramfs-version.img | cpio -i -d
-- Pasi
That worked, thanks!
I cannot find any entry in the init file (I attach it here as
"myinitfile.txt") that suggests that xen-pciback is being loaded. But
pciback files are located in
initramfsimage:lib/modules/2.6.32.39/kernel/drivers/xen/pciback
and
ls -alR initramfsimage: | grep -i pciback
shows that there is a xen-pciback.conf file somewhere in the initramfs
image.
Robin.
# grep -a -b --only-matching $'\x8B'$'\x08' \boot\initramfs-`uname -r`.img
(offset1): (pattern)
...
(offset<n>): (pattern)
# dd if=/boot/intramfs-`uname -r`.img bs=1 skip=(offset1) | gunzip>
myimagefile
but I'm unable to get to the cpio file. I tried once again grepping for
compression headers in myimagefile but I couldn't find anything. It
appears not to be compressed with zx, bzip2 or gzip. I could not use
cpio on the file directly either.
Robin.
I have set up the machine to init level 3 in the /etc/inittab (my
install of F14 have no upstart targets). The xen-pciback module seems to
be working. Something is wrong with the onboard sound chip. No drivers
have ever successfully initiated it, neither in Windows nor Linux. So it
is marked as an assignable device when looking it up with xm.
Regards
Robin.
--
xen mailing list
xen@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/xen
.
--
xen mailing list
xen@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/xen
.
.
#!/bin/sh
#
# Licensed under the GPLv2
#
# Copyright 2008-2009, Red Hat, Inc.
# Harald Hoyer <harald@xxxxxxxxxx>
# Jeremy Katz <katzj@xxxxxxxxxx>
wait_for_loginit()
{
if getarg rdinitdebug; then
set +x
exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
# wait for loginit
i=0
while [ $i -lt 10 ]; do
j=$(jobs)
[ -z "$j" ] && break
[ -z "${j##*Running*}" ] || break
sleep 0.1
i=$(($i+1))
done
[ $i -eq 10 ] && kill %1 >/dev/null 2>&1
while pidof -x /sbin/loginit >/dev/null 2>&1; do
for pid in $(pidof -x /sbin/loginit); do
kill $HARD $pid >/dev/null 2>&1
done
HARD="-9"
done
set -x
fi
}
emergency_shell()
{
if [ "$1" = "-n" ]; then
_rdshell_name=$2
shift 2
else
_rdshell_name=dracut
fi
wait_for_loginit
echo ; echo
echo $@
source_all emergency
echo
if getarg rdshell || getarg rdbreak; then
echo "Dropping to debug shell."
echo
export PS1="$_rdshell_name:\${PWD}# "
[ -e /.profile ] || echo "exec 0<>/dev/console 1<>/dev/console 2<>/dev/console" > /.profile
sh -i -l
else
echo "Boot has failed, sleeping forever."
while :; do sleep 365d;done
fi
}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
NEWROOT="/sysroot"
trap "emergency_shell Signal caught!" 0
RDDEBUG=""
. /lib/dracut-lib.sh
mknod -m 0666 /dev/null c 1 3
# mount some important things
mount -t proc /proc /proc >/dev/null 2>&1
mount -t sysfs /sys /sys >/dev/null 2>&1
if [ ! -c /dev/ptmx ]; then
# try to mount devtmpfs
if ! mount -t devtmpfs -omode=0755 udev /dev >/dev/null 2>&1; then
# if it failed fall back to normal tmpfs
mount -t tmpfs -omode=0755 udev /dev >/dev/null 2>&1
# Make some basic devices first, let udev handle the rest
mknod -m 0666 /dev/null c 1 3
mknod -m 0666 /dev/ptmx c 5 2
mknod -m 0600 /dev/console c 5 1
mknod -m 0660 /dev/kmsg c 1 11
fi
fi
ln -s /proc/self/fd /dev/fd >/dev/null 2>&1
if getarg rdinitdebug; then
getarg quiet && DRACUT_QUIET="yes"
mkfifo /dev/initlog.pipe
/sbin/loginit $DRACUT_QUIET </dev/initlog.pipe >/dev/console 2>&1 &
exec >/dev/initlog.pipe 2>&1
else
exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
fi
setdebug
mkdir /dev/shm
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 devpts /dev/pts >/dev/null 2>&1
mount -t tmpfs tmpfs /dev/shm >/dev/null 2>&1
UDEVVERSION=$(udevadm --version)
source_conf /etc/conf.d
# run scriptlets to parse the command line
getarg 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_all cmdline
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
# Network root scripts may need updated root= options,
# so deposit them where they can see them (udev purges the env)
{
echo "root='$root'"
echo "rflags='$rflags'"
echo "fstype='$fstype'"
echo "netroot='$netroot'"
echo "NEWROOT='$NEWROOT'"
} > /tmp/root.info
# pre-udev scripts run before udev starts, and are run only once.
getarg 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
source_all pre-udev
# start up udev and trigger cold plugs
udevd --daemon --resolve-names=never
UDEV_LOG_PRIO_ARG=--log-priority
UDEV_QUEUE_EMPTY="udevadm settle --timeout=0"
if [ $UDEVVERSION -lt 140 ]; then
UDEV_LOG_PRIO_ARG=--log_priority
UDEV_QUEUE_EMPTY="udevadm settle --timeout=1"
fi
getarg rdudevinfo && udevadm control $UDEV_LOG_PRIO_ARG=info
getarg rdudevdebug && udevadm control $UDEV_LOG_PRIO_ARG=debug
getarg 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
source_all pre-trigger
# then the rest
udevadm trigger --action=add $udevtriggeropts >/dev/null 2>&1
getarg 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
RDRETRY=$(getarg 'rd_retry=')
RDRETRY=${RDRETRY:-20}
RDRETRY=$(($RDRETRY*2))
i=0
while :; do
check_finished && break
udevsettle
check_finished && break
if [ -f /initqueue/work ]; then
rm /initqueue/work
fi
for job in /initqueue/*.sh; do
[ -e "$job" ] || break
job=$job . $job
check_finished && break 2
done
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
modprobe scsi_wait_scan && rmmod scsi_wait_scan
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
for job in /initqueue-settled/*.sh; do
[ -e "$job" ] || break
job=$job . $job
check_finished && break 2
done
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
# no more udev jobs and queues empty.
sleep 0.5
# dirty hack for some cdrom drives,
# which report no medium for quiet
# some time.
for cdrom in /sys/block/sr*; do
[ -e "$cdrom" ] || continue
# skip, if cdrom medium was already found
strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
ID_CDROM_MEDIA && continue
echo change > "$cdrom/uevent"
done
i=$(($i+1))
[ $i -gt $RDRETRY ] \
&& { flock -s 9 ; emergency_shell "No root device found"; } 9>/.console_lock
done
unset job
unset queuetriggered
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
getarg 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
source_all pre-mount
getarg 'rdbreak=mount' && emergency_shell -n mount "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
[ -d "$NEWROOT/proc" ] && break;
for f in /mount/*.sh; do
[ -f "$f" ] && . "$f"
[ -d "$NEWROOT/proc" ] && break;
done
i=$(($i+1))
[ $i -gt 20 ] \
&& { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
done
{
echo -n "Mounted root filesystem "
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
# pre pivot scripts are sourced just before we switch over to the new root.
getarg 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_all pre-pivot
# by the time we get here, the root filesystem should be mounted.
# Try to find init.
for i in "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
[ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
done
[ "$INIT" ] || {
echo "Cannot find init!"
echo "Please check to make sure you passed a valid root filesystem!"
emergency_shell
}
getarg rdbreak && emergency_shell -n switch_root "Break before switch_root"
# stop udev queue before killing it
udevadm control --stop-exec-queue
HARD=""
while pidof udevd >/dev/null 2>&1; do
for pid in $(pidof udevd); do
kill $HARD $pid >/dev/null 2>&1
done
HARD="-9"
done
# Clean up the environment
for i in $(export -p); do
i=${i#declare -x}
i=${i#export}
i=${i%%=*}
[ "$i" = "root" -o "$i" = "PATH" -o "$i" = "HOME" -o "$i" = "TERM" ] || unset $i
done
initargs=""
read CLINE </proc/cmdline
if getarg init= >/dev/null ; then
ignoreargs="console BOOT_IMAGE"
# only pass arguments after init= to the init
CLINE=${CLINE#*init=}
set $CLINE
shift
for x in "$@"; do
for s in $ignoreargs; do
[ "${x%%=*}" = $s ] && continue 2
done
initargs="$initargs $x"
done
unset CLINE
else
set $CLINE
shift
for x in "$@"; do
case "$x" in
[0-9]|s|S|single|emergency|auto )
initargs="$initargs $x"
;;
esac
done
fi
# Debug: Copy state
if getarg rdcopystate; then
mkdir /dev/.initramfs/
cp /tmp/* /dev/.initramfs/ >/dev/null 2>&1
fi
info "Switching root"
wait_for_loginit
exec switch_root "$NEWROOT" "$INIT" $initargs || {
echo "Something went very badly wrong in the initramfs. Please "
echo "file a bug against dracut."
emergency_shell
}
# vim:ts=8:sw=4:sts=4:et
--
xen mailing list
xen@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/xen