-#!/bin/sh
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# The ARCH variable must be exported for this script
-# eg. ARCH=powerpc
-
-# We don't compile anything, we only install headers
-##################################################################unset CROSS_COMPILE &&
-
-# Applying patches (if any)
-apply_patches ${1} &&
-
-# Move files to their final destination
-mkdir -pv ${SYSROOT}/usr/src &&
-cp -a ${LFS_TMP}/${1} ${SYSROOT}/usr/src &&
-
-cd ${SYSROOT}/usr/src &&
-
-# Create the link only if it does not exist. Otherwise, the
-# new link will be created inside kernel directory.
-rm -fv linux &&
-ln -sfv ${1} linux &&
-
-cd ${SYSROOT}/usr/src/${1} &&
-
-# First step, install kernel API headers:
-make mrproper &&
-make headers_check &&
-make INSTALL_HDR_PATH=dest headers_install &&
-mkdir -pv ${SYSROOT}/usr/include &&
-cp -rv dest/include/* ${SYSROOT}/usr/include &&
-
-# Second, install HV kernel compilation script:
-cat > ${SYSROOT}/usr/src/compile-kernel << "EOF" &&
-#!/bin/sh
-
-KERNEL_VERSION=$(basename $(pwd))
-DEST=/boot
-
-export ARCH=_ARCH_
-export CROSS_COMPILE=_CROSS_COMPILE_
-export SYSROOT=_SYSROOT_
-
-KERNELMAKE="make -j 4"
-
-${KERNELMAKE} bzImage &&
-
-if cat .config | grep "CONFIG_MODULES=y" 1> /dev/null 2>&1; then
- ${KERNELMAKE} modules &&
- ${KERNELMAKE} INSTALL_MOD_PATH=${SYSROOT} modules_install
-fi &&
-
-cp arch/${ARCH}/boot/images/zImage.elf ${DEST}/vmlinuz-${KERNEL_VERSION} &&
-cp arch/${ARCH}/boot/images/zImage.elf ${DEST}/vmlinuz-latest &&
-cp System.map ${DEST}/System-${KERNEL_VERSION}.map &&
-cp .config ${DEST}/config-${KERNEL_VERSION}
-
-if [ $? -ne 0 ]; then
- echo "*** Kernel compilation error ***."
- exit 1
-fi
-
-exit 0
-EOF
-
-sed -i -e "s!_ARCH_!${ARCH}!g" ${SYSROOT}/usr/src/compile-kernel &&
-sed -i -e "s!_CROSS_COMPILE_!${CROSS_COMPILE}!g" ${SYSROOT}/usr/src/compile-kernel &&
-sed -i -e "s!_SYSROOT_!${SYSROOT}!g" ${SYSROOT}/usr/src/compile-kernel &&
-
-chmod -v u+x ${SYSROOT}/usr/src/compile-kernel
-
-# Return last error
-exit $?