#!/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 # to work correctly for architectures other than PC. # eg. export ARCH=powerpc # We don't compile anything, we only install headers #unset CROSS_COMPILE && SYSROOT=${SYSROOT:-""} # Applying patches (if any) apply_patches ${1} && # Move files to their final destination mkdir -pv ${SYSROOT}/usr/src && mv ${LFS_TMP}/${1} ${SYSROOT}/usr/src && # Remove any previous link. Otherwise, the # new link would be created inside kernel directory. cd ${SYSROOT}/usr/src && rm -fv linux && ln -sfv ${1} linux && # First step, install kernel API headers: cd ${SYSROOT}/usr/src/${1} && make -j ${MAKEJOBS} mrproper && make -j ${MAKEJOBS} headers_check && make -j ${MAKEJOBS} INSTALL_HDR_PATH=dest headers_install && mkdir -pv ${SYSROOT}/usr/include && cp -rv dest/include/* ${SYSROOT}/usr/include && # Second, install HV kernel compilation script: cd ${SYSROOT}/usr/src && VERSION=$(get_pkg_ver ${1}) && echo "#!/bin/sh" > compile-kernel && echo "KERNEL_VERSION=${VERSION}" >> compile-kernel && echo "DEST=/boot" >> compile-kernel && cat >> compile-kernel << "EOF" && make bzImage && make modules && make modules_install && cp arch/x86/boot/bzImage ${DEST}/vmlinuz-${KERNEL_VERSION} && 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 chmod -v u+x compile-kernel # Return last error exit $?