From f5193d065a2822cb3d64d0f34e44d25d085e7b30 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Tue, 6 Dec 2016 10:33:10 +1000 Subject: [PATCH] Started separating out the kernel modules from initrd, but there are some details that will delay it Signed-off-by: Sven Dowideit --- scripts/isolinux.cfg | 13 ++++++++----- scripts/isolinux_label.cfg | 8 ++++++++ scripts/layout | 34 ++++++++++++++++++++++++++++------ scripts/package-iso | 20 +++++++++++++++----- scripts/package-rootfs | 1 + scripts/run-common | 3 ++- 6 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 scripts/isolinux_label.cfg diff --git a/scripts/isolinux.cfg b/scripts/isolinux.cfg index a297072d..a10a42b7 100644 --- a/scripts/isolinux.cfg +++ b/scripts/isolinux.cfg @@ -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 diff --git a/scripts/isolinux_label.cfg b/scripts/isolinux_label.cfg new file mode 100644 index 00000000..4faa79d8 --- /dev/null +++ b/scripts/isolinux_label.cfg @@ -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 \ No newline at end of file diff --git a/scripts/layout b/scripts/layout index 501cb343..451d382e 100755 --- a/scripts/layout +++ b/scripts/layout @@ -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 diff --git a/scripts/package-iso b/scripts/package-iso index 92ce8413..b8f00eac 100755 --- a/scripts/package-iso +++ b/scripts/package-iso @@ -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 \ diff --git a/scripts/package-rootfs b/scripts/package-rootfs index aa532524..3671c3c3 100755 --- a/scripts/package-rootfs +++ b/scripts/package-rootfs @@ -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)/.. diff --git a/scripts/run-common b/scripts/run-common index 8cc7916e..ba49042b 100755 --- a/scripts/run-common +++ b/scripts/run-common @@ -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