mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-29 06:21:46 +01:00
crosutils/make_factory_package.sh: support full SSD image as target outside chroot
When running outside chroot, we should use locate_cgpt + "$GPT" to invoke cgpt; otherwise it may be not in system PATH. For dealing with a true SSD image (over USB, for example) this CL also improved data writing speed from <2M/s to 8M/s+ (over USB). BUG=chromium-os:10531 TEST=./make_factory_package.sh \ --factory=../build/images/x86-mario/latest/chromiumos_factory_image.bin \ --release=../build/images/x86-mario/latest//chromiumos_image.bin \ --diskimg=/dev/sdb Also tested: --diskimg=blah # local file (chroot) --diskimg=/dev/sdd (chroot) --diskimg=blah Change-Id: I647d97fe388f5b6a6223fa8cacfecdf00265f60c Review URL: http://codereview.chromium.org/6261003
This commit is contained in:
parent
c584cf0e95
commit
4653cbd0e5
@ -185,6 +185,16 @@ image_partition_copy() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Try to use larger buffer if offset/size can be re-aligned.
|
||||||
|
# 2M / 512 = 4096
|
||||||
|
local buffer_ratio=4096
|
||||||
|
local bs=512
|
||||||
|
if [ $((dstoffset % buffer_ratio)) -eq 0 -a \
|
||||||
|
$((length % buffer_ratio)) -eq 0 ]; then
|
||||||
|
dstoffset=$((dstoffset / buffer_ratio))
|
||||||
|
bs=$((bs * buffer_ratio))
|
||||||
|
fi
|
||||||
|
|
||||||
image_dump_partition "${src}" "${srcpart}" |
|
image_dump_partition "${src}" "${srcpart}" |
|
||||||
dd of="${dst}" bs=512 seek="${dstoffset}" conv=notrunc
|
dd of="${dst}" bs="${bs}" seek="${dstoffset}" conv=notrunc oflag=dsync
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,9 +110,10 @@ prepare_img() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create GPT partition table.
|
# Create GPT partition table.
|
||||||
|
locate_gpt
|
||||||
install_gpt "${outdev}" 0 0 "${pmbrcode}" 0 "${force_full}"
|
install_gpt "${outdev}" 0 0 "${pmbrcode}" 0 "${force_full}"
|
||||||
# Activate the correct partition.
|
# Activate the correct partition.
|
||||||
cgpt add -i 2 -S 1 -P 1 "${outdev}"
|
sudo "${GPT}" add -i 2 -S 1 -P 1 "${outdev}"
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_omaha() {
|
prepare_omaha() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user