1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 06:40:31 +00:00

Started separating out the kernel modules from initrd, but there are some details that will delay it

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2016-12-06 10:33:10 +10:00
parent cc78ff7bd1
commit f5193d065a
6 changed files with 62 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ set -e
source $(dirname $0)/version
cd $(dirname $0)/..
ARTIFACTS=$(pwd)/dist/artifacts
BUILD=build
INITRD_DIR=${BUILD}/initrd
@@ -43,29 +44,50 @@ if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then
for i in vmlinuz vmlinux; do
if [ -e ${BUILD}/kernel/boot/${i}-* ]; then
mkdir -p dist/artifacts
mkdir -p ${ARTIFACTS}
# frustratingly, the vmlinuz versioned filename != the tag name, so we need to do some guessing
# for eg, 4.9-rc8-rancher2 is called vmlinuz-4.9.0-rc8-rancher
echo "Copy ${BUILD}/kernel/boot/${i}-* to dist/artifacts/vmlinuz-${KERNEL_VERSION}"
cp ${BUILD}/kernel/boot/${i}-* "dist/artifacts/vmlinuz-${KERNEL_VERSION}"
echo "Copy ${BUILD}/kernel/boot/${i}-* to ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}"
cp ${BUILD}/kernel/boot/${i}-* ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}
# use an unversioned filename for `scripts/run`
cp ${BUILD}/kernel/boot/${i}-* ${BUILD}/kernel/vmlinuz
break
fi
done
# TODO: move these into a separate tar.gz and add to the syslinux initrd line
if [ -d ${BUILD}/kernel/lib ]; then
rm -rf ${INITRD_DIR}/usr/lib
cp -rf ${BUILD}/kernel/lib ${INITRD_DIR}/usr/
depmod -b ${INITRD_DIR}/usr $(basename ${INITRD_DIR}/usr/lib/modules/*)
#TODO:
# new: put the kernel modules into their own initrd file
#mkdir -p ${BUILD}/kernel-fs/usr/
#pushd .
#cp -rf ${BUILD}/kernel/lib ${BUILD}/kernel-fs/usr/
#depmod -b ${BUILD}/kernel-fs/usr $(basename ${BUILD}/kernel-fs/usr/lib/modules/*)
## and then package it up cpio
#cd ${BUILD}/kernel-fs/
#echo Creating kernel ${ARTIFACTS}/linuxmods-${KERNEL_VERSION}
#if [ "$COMPRESS" == "" ]; then
# COMPRESS="gzip -1"
#fi
#find | cpio -H newc -o | ${COMPRESS} > ${ARTIFACTS}/linuxmods-${KERNEL_VERSION}
#popd
#echo Done creating kernel ${ARTIFACTS}/linuxmods-${KERNEL_VERSION}
## use an unversioned filename for `scripts/run`
#cp ${ARTIFACTS}/linuxmods-${KERNEL_VERSION} ${BUILD}/kernel/linuxmods
fi
else
echo "no ${DOWNLOADS}/kernel.tar.gz found"
exit 1
fi
ls -lah dist/artifacts/vmlinuz-*
if [ ! -e "dist/artifacts/vmlinuz-${KERNEL_VERSION}" ]; then
echo "Can't find dist/artifacts/vmlinuz-${KERNEL_VERSION}"
ls -lah ${ARTIFACTS}/vmlinuz-*
if [ ! -e "${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}" ]; then
echo "Can't find ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}"
exit -1
fi