mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
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:
parent
ed037ea05c
commit
7ea2b4924f
@ -232,6 +232,7 @@ make_image_bootable() {
|
|||||||
--arch=${FLAGS_arch} \
|
--arch=${FLAGS_arch} \
|
||||||
--to="${bootloader_to}" \
|
--to="${bootloader_to}" \
|
||||||
--from="${FLAGS_rootfs_mountpoint}"/boot \
|
--from="${FLAGS_rootfs_mountpoint}"/boot \
|
||||||
|
--vmlinuz_boot_kernel="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz-boot_kernel \
|
||||||
--vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \
|
--vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \
|
||||||
${bootloader_to_flags}
|
${bootloader_to_flags}
|
||||||
|
|
||||||
|
@ -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
|
cat <<EOF | sudo dd of="${GRUB_DIR}/menu.lst.A" 2>/dev/null
|
||||||
timeout 0
|
timeout 0
|
||||||
|
|
||||||
|
title CoreOS bootengine
|
||||||
|
root (hd0,0)
|
||||||
|
kernel /syslinux/vmlinuz-boot_kernel ${common_args} root=gptprio: cros_legacy
|
||||||
|
|
||||||
title CoreOS A
|
title CoreOS A
|
||||||
root (hd0,0)
|
root (hd0,0)
|
||||||
kernel /syslinux/vmlinuz.A ${common_args} root=${ROOTA} cros_legacy
|
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
|
EOF
|
||||||
info "Emitted ${GRUB_DIR}/menu.lst.A"
|
info "Emitted ${GRUB_DIR}/menu.lst.A"
|
||||||
|
|
||||||
cat <<EOF | sudo dd of="${GRUB_DIR}/menu.lst.B" 2>/dev/null
|
sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst.B
|
||||||
default 1
|
|
||||||
EOF
|
|
||||||
sudo sh -c "cat ${GRUB_DIR}/menu.lst.A >> ${GRUB_DIR}/menu.lst.B"
|
|
||||||
info "Emitted ${GRUB_DIR}/menu.lst.B"
|
info "Emitted ${GRUB_DIR}/menu.lst.B"
|
||||||
|
|
||||||
sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst
|
sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst
|
||||||
|
|
||||||
# /boot/syslinux must be installed in partition 12 as /syslinux/.
|
# /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
|
cat <<EOF | sudo dd of="${SYSLINUX_DIR}/syslinux.cfg" 2>/dev/null
|
||||||
PROMPT 0
|
PROMPT 0
|
||||||
TIMEOUT 0
|
TIMEOUT 0
|
||||||
|
DEFAULT boot_kernel
|
||||||
|
|
||||||
# the actual target
|
include /syslinux/boot_kernel.cfg
|
||||||
include /syslinux/default.cfg
|
|
||||||
|
|
||||||
# coreos.A
|
# coreos.A
|
||||||
include /syslinux/root.A.cfg
|
include /syslinux/root.A.cfg
|
||||||
@ -109,15 +109,16 @@ include /syslinux/root.B.cfg
|
|||||||
EOF
|
EOF
|
||||||
info "Emitted ${SYSLINUX_DIR}/syslinux.cfg"
|
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
|
# 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
|
# needs to for a given change. This will minimize any potential accidental
|
||||||
# updates issues, hopefully.
|
# 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
|
cat <<EOF | sudo dd of="${SYSLINUX_DIR}/root.A.cfg" 2>/dev/null
|
||||||
label coreos.A
|
label coreos.A
|
||||||
menu label coreos.A
|
menu label coreos.A
|
||||||
|
@ -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)"
|
"Size in bytes of 'to' to use if it is a file. -1 is ignored. (Default: -1)"
|
||||||
DEFINE_string vmlinuz "/tmp/vmlinuz" \
|
DEFINE_string vmlinuz "/tmp/vmlinuz" \
|
||||||
"Path to the vmlinuz file to use (Default: /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
|
# Parse flags
|
||||||
FLAGS "$@" || exit 1
|
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
|
sudo cp -r "${FLAGS_from}"/syslinux/. "${ESP_FS_DIR}"/syslinux
|
||||||
|
|
||||||
# Stage both kernels with the only one we built.
|
# 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.A
|
||||||
sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.B
|
sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.B
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user