feat(boot_kernel): add support for the boot kernel

This adds the boot_kernel to the build boot partiton and updates the
relevant config files. Mission accomplished.

TODO: Update the installer to not worry about moving files around
anymore
This commit is contained in:
Brandon Philips 2013-07-17 18:02:27 -07:00
parent ed037ea05c
commit 7ea2b4924f
3 changed files with 18 additions and 13 deletions

View File

@ -232,6 +232,7 @@ make_image_bootable() {
--arch=${FLAGS_arch} \
--to="${bootloader_to}" \
--from="${FLAGS_rootfs_mountpoint}"/boot \
--vmlinuz_boot_kernel="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz-boot_kernel \
--vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \
${bootloader_to_flags}

View File

@ -72,6 +72,10 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then
cat <<EOF | sudo dd of="${GRUB_DIR}/menu.lst.A" 2>/dev/null
timeout 0
title CoreOS bootengine
root (hd0,0)
kernel /syslinux/vmlinuz-boot_kernel ${common_args} root=gptprio: cros_legacy
title CoreOS A
root (hd0,0)
kernel /syslinux/vmlinuz.A ${common_args} root=${ROOTA} cros_legacy
@ -82,12 +86,8 @@ kernel /syslinux/vmlinuz.B ${common_args} root=${ROOTB} cros_legacy
EOF
info "Emitted ${GRUB_DIR}/menu.lst.A"
cat <<EOF | sudo dd of="${GRUB_DIR}/menu.lst.B" 2>/dev/null
default 1
EOF
sudo sh -c "cat ${GRUB_DIR}/menu.lst.A >> ${GRUB_DIR}/menu.lst.B"
sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst.B
info "Emitted ${GRUB_DIR}/menu.lst.B"
sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst
# /boot/syslinux must be installed in partition 12 as /syslinux/.
@ -97,9 +97,9 @@ EOF
cat <<EOF | sudo dd of="${SYSLINUX_DIR}/syslinux.cfg" 2>/dev/null
PROMPT 0
TIMEOUT 0
DEFAULT boot_kernel
# the actual target
include /syslinux/default.cfg
include /syslinux/boot_kernel.cfg
# coreos.A
include /syslinux/root.A.cfg
@ -109,15 +109,16 @@ include /syslinux/root.B.cfg
EOF
info "Emitted ${SYSLINUX_DIR}/syslinux.cfg"
# To change the active target, only this file needs to change.
cat <<EOF | sudo dd of="${SYSLINUX_DIR}/default.cfg" 2>/dev/null
DEFAULT coreos.A
EOF
info "Emitted ${SYSLINUX_DIR}/default.cfg"
# Different files are used so that the updater can only touch the file it
# needs to for a given change. This will minimize any potential accidental
# updates issues, hopefully.
cat <<EOF | sudo dd of="${SYSLINUX_DIR}/boot_kernel.cfg" 2>/dev/null
label boot_kernel
menu label boot_kernel
kernel vmlinuz-boot_kernel
append ${common_args} root=gptprio: cros_legacy
EOF
info "Emitted ${SYSLINUX_DIR}/boot_kernel.cfg"
cat <<EOF | sudo dd of="${SYSLINUX_DIR}/root.A.cfg" 2>/dev/null
label coreos.A
menu label coreos.A

View File

@ -32,6 +32,8 @@ DEFINE_integer to_size -1 \
"Size in bytes of 'to' to use if it is a file. -1 is ignored. (Default: -1)"
DEFINE_string vmlinuz "/tmp/vmlinuz" \
"Path to the vmlinuz file to use (Default: /tmp/vmlinuz)"
DEFINE_string vmlinuz_boot_kernel "/tmp/vmlinuz-boot_kernel" \
"Path to the vmlinuz-boot_kernel file to use (Default: /tmp/vmlinuz)"
# Parse flags
FLAGS "$@" || exit 1
@ -108,6 +110,7 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then
sudo cp -r "${FLAGS_from}"/syslinux/. "${ESP_FS_DIR}"/syslinux
# Stage both kernels with the only one we built.
sudo cp -f "${FLAGS_vmlinuz_boot_kernel}" "${ESP_FS_DIR}"/syslinux/vmlinuz-boot_kernel
sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.A
sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.B