flatcar-scripts/create_esp.sh
Will Drewry d3c938b85d [PATCH 4/5] update_bootloaders.sh, create_esp.sh: add two helpers
Adds two helpers that are not used yet.  They will be
used in the next CL to unify the bootloaders in use
in build_image.

TEST=used in the next CL but otherwise not called.
BUG=chromium-os:327

Review URL: http://codereview.chromium.org/2829039
2010-07-03 13:32:26 -05:00

35 lines
930 B
Bash
Executable File

#!/bin/bash
# Copyright (c) 2010 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.
# Creates an empty ESP image.
. "$(dirname "$0")/common.sh"
get_default_board
# Flags.
DEFINE_string to "/tmp/esp.img" \
"Path to esp image (Default: /tmp/esp.img)"
# Parse flags
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
set -e
if [[ -e "${FLAGS_to}" ]]; then
info "ESP already exists: ${FLAGS_to}"
exit 0
fi
info "Creating a new esp image at ${FLAGS_to}" anyway.
# Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
# BIOS). We only need this for x86, but it's simpler and safer to keep the
# disk images the same for both x86 and ARM.
# NOTE: The size argument for mkfs.vfat is in 1024-byte blocks.
# We'll hard-code it to 16M for now.
ESP_BLOCKS=16384
/usr/sbin/mkfs.vfat -C "${FLAGS_to}" ${ESP_BLOCKS}