Skip to content

Commit

Permalink
- support usage of VM kernel from build target
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Dec 3, 2013
1 parent 94481bc commit 6828560
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
32 changes: 28 additions & 4 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
# fallback time for broken hosts
date '+@%s' > $BUILD_ROOT/.build/.date
if [ "$VM_TYPE" = 'emulator' ]; then
# emulator may not be able to hand over kernel parameters
ln -sf /.build/build $BUILD_ROOT/sbin/init
fi
if [ "$VM_TYPE" = 'zvm' ]; then
Expand All @@ -2164,9 +2165,9 @@ for SPECFILE in "${SPECFILES[@]}" ; do
mkdir -p $BUILD_ROOT/boot
cp $vm_kernel $vm_initrd $BUILD_ROOT/boot
mkdir -p $BUILD_ROOT/boot/zipl
# finally, install bootloader to the worker disk
zipl -t $BUILD_ROOT/boot/zipl -i ${BUILD_ROOT}${vm_kernel} -r ${BUILD_ROOT}${vm_initrd} \
--parameters "${zvm_param} init=$zvm_init_script rootfsopts=noatime"
# finally, install bootloader to the worker disk
zipl -t $BUILD_ROOT/boot/zipl -i ${BUILD_ROOT}${vm_kernel} -r ${BUILD_ROOT}${vm_initrd} \
--parameters "${zvm_param} init=$zvm_init_script rootfsopts=noatime"
fi
umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null || true
Expand Down Expand Up @@ -2213,9 +2214,32 @@ for SPECFILE in "${SPECFILES[@]}" ; do
fi
fi
if [ -n "$VM_IMAGE" ]; then
# copy out kernel & initrd (if they exist) during unmounting VM image
KERNEL_TEMP_DIR=
if [ -e $BUILD_ROOT/.build.kernel."$VM_TYPE" ]; then
KERNEL_TEMP_DIR=`mktemp -d`
cp $BUILD_ROOT/.build.kernel."$VM_TYPE" "$KERNEL_TEMP_DIR/kernel"
if [ -e $BUILD_ROOT/.build.initrd."$VM_TYPE" ]; then
cp $BUILD_ROOT/.build.initrd."$VM_TYPE" "$KERNEL_TEMP_DIR/initrd"
fi
fi
check_exit
# needs to work otherwise we have a corrupted file system
umount $BUILD_ROOT || cleanup_and_exit 3
if ! umount $BUILD_ROOT; then
rm -rf "$KERNEL_TEMP_DIR"
cleanup_and_exit 3
fi
# copy back the kernel and set it for VM
if [ -n "$KERNEL_TEMP_DIR" ]; then
mkdir -p $BUILD_ROOT/boot
mv $KERNEL_TEMP_DIR/kernel $BUILD_ROOT/boot/kernel
vm_kernel=$BUILD_ROOT/boot/kernel
if [ -e $KERNEL_TEMP_DIR/initrd ]; then
mv $KERNEL_TEMP_DIR/initrd $BUILD_ROOT/boot/initrd
vm_initrd=$BUILD_ROOT/boot/initrd
fi
rmdir "$KERNEL_TEMP_DIR"
fi
fi

if [ "$VM_TYPE" = 'openstack' -o "$VM_TYPE" = 'ec2' ]; then
Expand Down
7 changes: 1 addition & 6 deletions init_buildsystem
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ clean_build_root()
umount -n "$BUILD_ROOT/mnt" 2> /dev/null || true
rm -rf -- "$BUILD_ROOT"/*
rm -rf -- "$BUILD_ROOT/.build"
rm -rf -- "$BUILD_ROOT/.build.kernel.*"
rm -rf -- "$BUILD_ROOT/.root"
rm -rf -- "$BUILD_ROOT/.init_b_cache"
rm -rf -- "$BUILD_ROOT/.preinstall_image/*"
Expand Down Expand Up @@ -1307,12 +1308,6 @@ if test -x $BUILD_ROOT/bin/rpm -a ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a !
chroot $BUILD_ROOT rpm -q --whatprovides rpm >/dev/null 2>&1
fi

# create modules.dep in kvm/xen
# This can not work, until we use the native repository kernel
#if [ $BUILD_ROOT = "/" -a -x /sbin/depmod ]; then
# /sbin/depmod -a
#fi

rm -f $BUILD_ROOT/.rpmmacros $BUILD_ROOT/root/.rpmmacros
rm -rf "$BUILD_ROOT/.init_b_cache"
rm -f $BUILD_IS_RUNNING
Expand Down

0 comments on commit 6828560

Please sign in to comment.