1
0
mirror of https://github.com/rancher/os.git synced 2025-06-25 22:41:36 +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

@ -1,5 +1,8 @@
default rancheros
label rancheros
kernel /boot/vmlinuz-${KERNEL_VERSION}
initrd /boot/initrd
append quiet rancher.autologin=tty1 rancher.autologin=ttyS0
timeout 10 #1s
prompt 1
# doesn't work as a softlink?
default rancheros-${KERNEL_VERSION}
INCLUDE isolinux-current.cfg
#INCLUDE isolinux-previous.cfg

View File

@ -0,0 +1,8 @@
# TODO: should add ros-version
label rancheros-${KERNEL_VERSION}
say Booting ... RancherOS ${VERSION} ${KERNEL_VERSION}
kernel /boot/vmlinuz-${KERNEL_VERSION}
initrd /boot/initrd
#TODO,/boot/linuxmods-${KERNEL_VERSION}
append quiet rancher.autologin=tty1 rancher.autologin=ttyS0

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

View File

@ -18,13 +18,23 @@ if [ ! -f ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ] || [ ! -f ${ARTIFACTS}/initrd
fi
cp ${ARTIFACTS}/initrd ${CD}/boot
cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ${CD}/boot
# TODO: these move to os-kernel
pwd
ls dist/artifacts/vmlinuz-${KERNEL_VERSION}
cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ${CD}/boot/
#TODO cp ${ARTIFACTS}/linuxmods-${KERNEL_VERSION} ${CD}/boot/
cat scripts/isolinux.cfg | envsubst > ${CD}/boot/isolinux/isolinux.cfg
cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux
cat scripts/isolinux_label.cfg | envsubst > ${CD}/boot/isolinux/isolinux-${KERNEL_VERSION}.cfg
cp ${CD}/boot/isolinux/isolinux-${KERNEL_VERSION}.cfg ${CD}/boot/isolinux/isolinux-current.cfg
cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux/
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux/
# add the installer image to the iso for non-network / dev/test
cp ${ARTIFACTS}/installer.tar ${CD}/rancheros
cp assets/bootinfoscript ${CD}/rancheros
cp ${ARTIFACTS}/installer.tar ${CD}/rancheros/
cp assets/bootinfoscript ${CD}/rancheros/
gzip ${CD}/rancheros/installer.tar
cd ${CD} && xorriso \
-as mkisofs \

View File

@ -37,6 +37,7 @@ BUILD_ID=
HERE
# need to make relative links to the os-release file
mkdir -p ${INITRD_DIR}/usr/lib
cd ${INITRD_DIR}/usr/lib
ln -s ../share/rancher/os-release os-release
cd $(dirname $0)/..

View File

@ -34,10 +34,11 @@ BUILD=build
BASE=$(pwd)
UNAME=$(uname)
#KERNEL=${BASE}/dist/artifacts/vmlinuz-${KERNEL_VERSION}*
KERNEL=${BASE}/build/kernel/vmlinuz
INITRD_SRC=${BASE}/build/initrd
INITRD=${BASE}/build/initrd.tmp
#LINUXMOD=${BASE}/build/kernel/linuxmods
QEMU=1
FORMAT=1