#!/bin/bash # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Helper script to generate bootloader configuration files for systems # that predate our new GRUB2 based gptprio bootloader. SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..) . "${SCRIPT_ROOT}/common.sh" || exit 1 # We're invoked only by build_image, which runs in the chroot assert_inside_chroot # Flags. DEFINE_string boot_dir "/tmp/boot" \ "Path to boot directory in root filesystem (Default: /tmp/boot)" # Parse flags FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" switch_to_strict_mode # Common kernel command-line args common_args="console=tty0 ro noswap cros_legacy" common_args="${common_args} ${FLAGS_boot_args}" # Filesystem command line args. root_args="root=LABEL=ROOT rootflags=subvol=root" slot_a_args="${root_args} usr=PARTLABEL=USR-A" slot_b_args="${root_args} usr=PARTLABEL=USR-B" GRUB_DIR="${FLAGS_boot_dir}/grub" SYSLINUX_DIR="${FLAGS_boot_dir}/syslinux" # Build configuration files for pygrub/pvgrub configure_pvgrub() { info "Installing legacy PV-GRUB configuration" sudo mkdir -p "${GRUB_DIR}" # Add hvc0 for hypervisors grub_args="${common_args} console=hvc0" sudo_clobber "${GRUB_DIR}/menu.lst.A" <