mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-08 02:41:55 +01:00
configure_bootloaders: add grub install stub code
Not currently used, this configuration which sets up grub to re-use the syslinux configuration only works with recent git versions, not any releases. Compatibility is also limited because the serial configuration in syslinux must be duplicated in the grub config.
This commit is contained in:
parent
0cc06c9c5c
commit
680730cc1a
@ -51,7 +51,7 @@ GRUB_DIR="${FLAGS_boot_dir}/grub"
|
||||
SYSLINUX_DIR="${FLAGS_boot_dir}/syslinux"
|
||||
|
||||
# Build configuration files for pygrub/pvgrub
|
||||
configure_grub() {
|
||||
configure_pvgrub() {
|
||||
sudo mkdir -p "${GRUB_DIR}"
|
||||
|
||||
# Add hvc0 for hypervisors
|
||||
@ -177,12 +177,28 @@ copy_to_esp() {
|
||||
done
|
||||
}
|
||||
|
||||
# Install GRUB2 to the disk image
|
||||
install_grub() {
|
||||
# Install under boot/coreos/grub instead of boot/grub to prevent
|
||||
# more recent versions of pygrub that attempt to read grub2 configs
|
||||
# from finding it, pygrub and pvgrub must stick with using menu.lst
|
||||
sudo mkdir -p "${FLAGS_esp_dir}/coreos/grub"
|
||||
sudo grub-install \
|
||||
--target=i386-pc \
|
||||
--modules=part_gpt \
|
||||
--boot-directory="${FLAGS_esp_dir}/coreos" \
|
||||
"${FLAGS_disk_image}"
|
||||
sudo cp "${BUILD_LIBRARY_DIR}/grub.cfg" \
|
||||
"${FLAGS_esp_dir}/coreos/grub/grub.cfg"
|
||||
}
|
||||
|
||||
[[ -d "${FLAGS_esp_dir}" ]] || die_notrace "--esp_dir is required"
|
||||
[[ -f "${FLAGS_disk_image}" ]] || die_notrace "--disk_image is required"
|
||||
|
||||
if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then
|
||||
configure_grub
|
||||
configure_pvgrub
|
||||
configure_syslinux
|
||||
if [[ -n "${FLAGS_esp_dir}" ]]; then
|
||||
copy_to_esp
|
||||
fi
|
||||
copy_to_esp
|
||||
else
|
||||
error "No bootloader configuration for ${FLAGS_arch}"
|
||||
fi
|
||||
|
||||
9
build_library/grub.cfg
Normal file
9
build_library/grub.cfg
Normal file
@ -0,0 +1,9 @@
|
||||
# Use both default console and ttyS0
|
||||
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
|
||||
terminal_input console serial
|
||||
terminal_output console serial
|
||||
|
||||
# Re-use the existing syslinux configuration
|
||||
echo "Loading SYSLINUX configuration..."
|
||||
insmod syslinuxcfg
|
||||
syslinux_configfile -s /syslinux/syslinux.cfg
|
||||
Loading…
x
Reference in New Issue
Block a user