Merge "Add fedora support for ramdisk-image-create."

This commit is contained in:
Jenkins 2013-06-05 10:00:11 +00:00 committed by Gerrit Code Review
commit 8532b3d7ad
4 changed files with 82 additions and 27 deletions

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
[ -n "$TARGET_ROOT" ]
DISTRO=`lsb_release -si` || true
if [[ "Fedora RedHatEnterpriseServer" =~ "$DISTRO" ]]; then
mkdir -p "$TARGET_ROOT/usr"
ln -s ../lib "$TARGET_ROOT/usr/lib"
if [ "`uname -m`" = "x86_64" ]; then
ln -s lib "$TARGET_ROOT/lib64"
fi
fi

View File

@ -52,7 +52,7 @@ function save_image () {
function generate_hooks () {
mkdir -p $TMP_HOOKS_PATH
for _ELEMENT in $IMAGE_ELEMENT ; do
for _ELEMENT in $IMAGE_ELEMENT $RAMDISK_ELEMENT ; do
for dir in $(echo $ELEMENTS_PATH | tr ":" " ") ; do
[ -d $dir/$_ELEMENT ] || continue
cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ;

View File

@ -68,11 +68,14 @@ function create_base () {
# cjk adding for discovery support
mkdir -p "$TMP_MOUNT_PATH/var/lib/dhcp"
mkdir -p "$TMP_MOUNT_PATH/var/run"
mkdir -p "$TMP_MOUNT_PATH/lib/udev/rules.d"
cp -a "$LIB_UDEV/rules.d/50-firmware.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d"
cp -a "$LIB_UDEV/rules.d/80-drivers.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d"
if [ -a $LIB_UDEV/firmware ]; then
cp -a "$LIB_UDEV/firmware" "$TMP_MOUNT_PATH/lib/udev"
fi
# cjk adding for hwdiscovery support
cp "/sbin/dhclient-script" "$TMP_MOUNT_PATH/sbin"
@ -89,6 +92,9 @@ udev_root="/dev"
udev_rules="/lib/udev/rules.d"
udev_log="no"
EOF
generate_hooks
TARGET_ROOT=$TMP_MOUNT_PATH run_d root
}
function copy_required_libs() {
@ -140,7 +146,25 @@ function copy_required_libs() {
function populate_lib () {
echo "Populating /lib"
for i in "$BUSYBOX" "$LIB_UDEV/firmware" bash lsmod modprobe udevd udevadm wget reboot shutdown $BINARY_DEPS ; do
# find udevd
UDEVD=
for f in /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd \
/usr/lib/systemd/systemd-udevd \
/usr/lib/udev/udevd; do
if [ -x "$f" ]; then
UDEVD="$f"
break
fi
done
UDEV_FIRMWARE=
if [ -a $LIB_UDEV/firmware ]; then
UDEV_FIRMWARE="$LIB_UDEV/firmware"
fi
for i in "$BUSYBOX" bash lsmod modprobe udevadm \
wget reboot shutdown $UDEVD $UDEV_FIRMWARE \
$BINARY_DEPS ; do
if "$BUSYBOX" --list | grep "^$i\$" >/dev/null; then
continue
fi

View File

@ -49,6 +49,21 @@ readonly DEPLOYMENT_KEY=$(get_kernel_parameter deployment_key)
readonly ISCSI_TARGET_IQN=$(get_kernel_parameter iscsi_target_iqn)
mount -t sysfs none /sys
UDEVD=
if [ -x "/bin/systemd-udevd" ]; then
UDEVD="systemd-udevd"
else
UDEVD="udevd"
fi
if [ "$UDEVD" = "systemd-udevd" ]; then
# devtmpfs is required since udev 176
mount -t devtmpfs none /dev
mkdir -p /run
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir -p /run/lock
else
mount -t tmpfs none /dev
ln -sf /proc/self/fd /dev/fd
mknod /dev/null c 1 3
@ -70,6 +85,7 @@ mknod -m 0600 /dev/console c 5 1
mknod -m 0666 /dev/ptmx c 5 2
mkdir -p /dev/.udev
mkdir -p /dev/.udev/data
fi
echo "starting syslogd"
@ -78,7 +94,7 @@ syslogd
klogd
echo "starting udevd"
udevd --daemon --resolve-names=never
$UDEVD --daemon --resolve-names=never
echo "load modules"
load_modules_by_udev