Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: update_bootloaders.sh

Issue 3006006: build_image,update_bootloaders: directly update the built image (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: style and comment nits Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build_image ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_bootloaders.sh
diff --git a/update_bootloaders.sh b/update_bootloaders.sh
index 9fce64abde532e9ef5059c20864bc725d7a8bdfc..bdd7c09a0d7e9b580160d2fca1cb63468823e15e 100755
--- a/update_bootloaders.sh
+++ b/update_bootloaders.sh
@@ -22,6 +22,10 @@ DEFINE_string from "/tmp/boot" \
"Path the legacy bootloader templates are copied from. (Default /tmp/boot)"
DEFINE_string to "/tmp/esp.img" \
"Path to esp image or ARM output MBR (Default: /tmp/esp.img)"
+DEFINE_integer to_offset 0 \
+ "Offset in bytes into 'to' if it is a file (Default: 0)"
+DEFINE_integer to_size -1 \
+ "Size in bytes of 'to' to use if it is a file. -1 is ignored. (Default: -1)"
DEFINE_string vmlinuz "/tmp/vmlinuz" \
"Path to the vmlinuz file to use (Default: /tmp/vmlinuz)"
# The kernel_partition and the kernel_cmdline each are used to supply
@@ -106,13 +110,23 @@ if [[ ! -e "${FLAGS_to}" ]]; then
ESP_BLOCKS=16384
/usr/sbin/mkfs.vfat -C "${FLAGS_to}" ${ESP_BLOCKS}
ESP_DEV=$(sudo losetup -f)
- test -z "${ESP_DEV}" && error "No free loop devices."
+ if [ -z "${ESP_DEV}" ]; then
+ die "No free loop devices."
+ fi
sudo losetup "${ESP_DEV}" "${FLAGS_to}"
else
if [[ -f "${FLAGS_to}" ]]; then
ESP_DEV=$(sudo losetup -f)
- test -z "${ESP_DEV}" && error "No free loop devices."
- sudo losetup "${ESP_DEV}" "${FLAGS_to}"
+ if [ -z "${ESP_DEV}" ]; then
+ die "No free loop devices."
+ fi
+
+ esp_offset="--offset ${FLAGS_to_offset}"
+ esp_size="--sizelimit ${FLAGS_to_size}"
+ if [ ${FLAGS_to_size} -lt 0 ]; then
+ esp_size=
+ fi
+ sudo losetup ${esp_offset} ${esp_size} "${ESP_DEV}" "${FLAGS_to}"
else
# If it is a block device or something else, try to mount it anyway.
ESP_DEV="${FLAGS_to}"
@@ -167,7 +181,7 @@ if [[ "${FLAGS_arch}" = "x86" ]]; then
# we cut over from rootfs booting (extlinux).
if [[ ${FLAGS_install_syslinux} -eq ${FLAGS_TRUE} ]]; then
sudo umount "${ESP_FS_DIR}"
- sudo syslinux -d /syslinux "${FLAGS_to}"
+ sudo syslinux -d /syslinux "${ESP_DEV}"
fi
elif [[ "${FLAGS_arch}" = "arm" ]]; then
# Extract kernel flags
« no previous file with comments | « build_image ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698