OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Creates an empty ESP image. | 7 # Creates an empty ESP image. |
8 | 8 |
9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
10 | 10 |
11 get_default_board | 11 get_default_board |
12 | 12 |
13 # Flags. | 13 # Flags. |
14 DEFINE_string to "/tmp/esp.img" \ | 14 DEFINE_string to "/tmp/esp.img" \ |
15 "Path to esp image (Default: /tmp/esp.img)" | 15 "Path to esp image (Default: /tmp/esp.img)" |
16 | 16 |
17 # Parse flags | 17 # Parse flags |
18 FLAGS "$@" || exit 1 | 18 FLAGS "$@" || exit 1 |
19 eval set -- "${FLAGS_ARGV}" | 19 eval set -- "${FLAGS_ARGV}" |
20 set -e | 20 set -e |
21 | 21 |
22 if [[ -e "${FLAGS_to}" ]]; then | 22 if [[ -e "${FLAGS_to}" ]]; then |
23 info "ESP already exists: ${FLAGS_to}" | 23 info "ESP already exists: ${FLAGS_to}" |
24 exit 0 | 24 exit 0 |
25 fi | 25 fi |
26 | 26 |
27 info "Creating a new esp image at ${FLAGS_to}" anyway. | 27 info "Creating a new esp image at ${FLAGS_to}" anyway. |
28 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI | 28 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI |
29 # BIOS). We only need this for x86, but it's simpler and safer to keep the | 29 # BIOS). ARM uses this space to determine which partition is bootable. |
30 # disk images the same for both x86 and ARM. | |
31 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. | 30 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. |
32 # We'll hard-code it to 16M for now. | 31 # We'll hard-code it to 16M for now. |
33 ESP_BLOCKS=16384 | 32 ESP_BLOCKS=16384 |
34 /usr/sbin/mkfs.vfat -C "${FLAGS_to}" ${ESP_BLOCKS} | 33 /usr/sbin/mkfs.vfat -C "${FLAGS_to}" ${ESP_BLOCKS} |
OLD | NEW |