summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2011-06-28 01:21:49 +0800
committerHung-Te Lin <hungte@chromium.org>2011-06-30 18:15:54 -0700
commitc3b877d8cb2e413816d34ed685c6a35780e07bc8 (patch)
treee15e8149cd8bcdbf091ac9e6f3d995d82e06d725 /scripts
parentfbb52dfa9cf1b38eedc119c84f1f64d5fa7f1fbb (diff)
downloadvboot-c3b877d8cb2e413816d34ed685c6a35780e07bc8.tar.gz
make_dev_ssd: fix ARM device names
BUG=chromium-os:15061 TEST=(on arm) ./make_dev_ssd.sh --remove_rootfs_verification # works Change-Id: I0ed5e02cd566c89b2604a2e77b87413dc957471e Reviewed-on: http://gerrit.chromium.org/gerrit/3375 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/image_signing/common_minimal.sh16
-rwxr-xr-xscripts/image_signing/make_dev_ssd.sh12
2 files changed, 25 insertions, 3 deletions
diff --git a/scripts/image_signing/common_minimal.sh b/scripts/image_signing/common_minimal.sh
index 5063fcdc..a68502e7 100755
--- a/scripts/image_signing/common_minimal.sh
+++ b/scripts/image_signing/common_minimal.sh
@@ -108,6 +108,22 @@ trap "cleanup_temps_and_mounts" EXIT
# Functions for partition management
# ----------------------------------------------------------------------------
+# Construct a partition device name from a whole disk block device and a
+# partition number.
+# This works for [/dev/sda, 3] (-> /dev/sda3) as well as [/dev/mmcblk0, 2]
+# (-> /dev/mmcblk0p2).
+make_partition_dev() {
+ local block="$1"
+ local num="$2"
+ # If the disk block device ends with a number, we add a 'p' before the
+ # partition number.
+ if [ "${block%[0-9]}" = "${block}" ]; then
+ echo "${block}${num}"
+ else
+ echo "${block}p${num}"
+ fi
+}
+
# Read GPT table to find the starting location of a specific partition.
# Args: DEVICE PARTNUM
# Returns: offset (in sectors) of partition PARTNUM
diff --git a/scripts/image_signing/make_dev_ssd.sh b/scripts/image_signing/make_dev_ssd.sh
index caf9e4a2..193c393c 100755
--- a/scripts/image_signing/make_dev_ssd.sh
+++ b/scripts/image_signing/make_dev_ssd.sh
@@ -21,7 +21,7 @@ DEFAULT_PARTITIONS='2 4'
# works more like "make_dev_image". We may change the file name in future.
ROOTDEV="$(rootdev -s 2>/dev/null)"
ROOTDEV_PARTITION="$(echo $ROOTDEV | sed -n 's/.*\([0-9][0-9]*\)$/\1/p')"
-ROOTDEV_DISK="${ROOTDEV%$ROOTDEV_PARTITION}"
+ROOTDEV_DISK="$(rootdev -s -d 2>/dev/null)"
ROOTDEV_KERNEL="$((ROOTDEV_PARTITION - 1))"
# DEFINE_string name default_value description flag
@@ -60,8 +60,13 @@ EXEC_LOG="$(make_temp_file)"
# Removes rootfs verification from kernel boot parameter
remove_rootfs_verification() {
+ # TODO(hungte) replace this with %U when x86 and arm both supports it.
+ local new_root="/dev/sd%D%P"
+ if [ "$(crossystem arch 2>/dev/null)" = "arm" ]; then
+ new_root='/dev/${devname}${rootpart}'
+ fi
echo "$*" | sed '
- s| root=/dev/dm-0 | root=/dev/sd%D%P |
+ s| root=/dev/dm-0 | root='"$new_root"' |
s| dm_verity[^=]*=[-0-9]*||g
s| dm="[^"]*"||
s| ro | rw |'
@@ -118,7 +123,8 @@ find_valid_kernel_partitions() {
local valid_partitions=""
for part_id in $*; do
local name="$(cros_kernel_name $part_id)"
- if [ -z "$(dump_kernel_config $FLAGS_image$part_id 2>"$EXEC_LOG")" ]; then
+ local kernel_part="$(make_partition_dev "$FLAGS_image" "$part_id")"
+ if [ -z "$(dump_kernel_config "$kernel_part" 2>"$EXEC_LOG")" ]; then
echo "INFO: $name: no kernel boot information, ignored." >&2
else
[ -z "$valid_partitions" ] &&