summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2021-10-27 16:34:31 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-29 03:53:46 +0000
commitf2fa68ad62310243814b6d1b3d56040db0a99495 (patch)
tree5d3916c1927fe0ed0e25ad582544646003b40461 /scripts
parentd02f026a8d6635c0f38743bf257db2526a3143f0 (diff)
downloadvboot-f2fa68ad62310243814b6d1b3d56040db0a99495.tar.gz
COIL: Remove "slave"
In the context of device mapper (dm), use "mapped device". BUG=b:179221734 TEST=make runtests BRANCH=none Change-Id: I9245d8482e59db93bfe6cdcaafa503038ae5c9e3 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3246662 Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/image_signing/sign_official_build.sh32
1 files changed, 17 insertions, 15 deletions
diff --git a/scripts/image_signing/sign_official_build.sh b/scripts/image_signing/sign_official_build.sh
index 53a92645..d96250d1 100755
--- a/scripts/image_signing/sign_official_build.sh
+++ b/scripts/image_signing/sign_official_build.sh
@@ -110,28 +110,30 @@ get_dmparams_from_config() {
get_hash_from_config() {
local kernel_config=$1
local dm_config=$(get_dmparams_from_config "${kernel_config}")
- local vroot_dev=$(get_dm_slave "${dm_config}" vroot)
+ local vroot_dev=$(get_dm_device "${dm_config}" vroot)
echo $(get_verity_arg "${vroot_dev}" root_hexdigest)
}
-# Get the slave device and its args
-# get_dm_ags $dm_config [vboot|vroot]
-# Assumes we have only one slave device per device
-get_dm_slave() {
+# Get the mapped device and its args.
+# Usage:
+# get_dm_device $dm_config [vboot|vroot]
+# Assumes we have only one mapped device per device.
+get_dm_device() {
local dm=$1
local device=$2
echo $(echo "${dm}" | sed -nre "s/.*${device}[^,]*,([^,]*).*/\1/p")
}
-# Set the slave device and its args for a device
-# get_dm_ags $dm_config [vboot|vroot] args
-# Assumes we have only one slave device per device
-set_dm_slave() {
+# Set the mapped device and its args for a device.
+# Usage:
+# set_dm_device $dm_config [vboot|vroot] args
+# Assumes we have only one mapped device per device.
+set_dm_device() {
local dm=$1
local device=$2
- local slave=$3
+ local args=$3
echo $(echo "${dm}" |
- sed -nre "s#(.*${device}[^,]*,)([^,]*)(.*)#\1${slave}\3#p")
+ sed -nre "s#(.*${device}[^,]*,)([^,]*)(.*)#\1${args}\3#p")
}
CALCULATED_KERNEL_CONFIG=
@@ -154,7 +156,7 @@ calculate_rootfs_hash() {
warn "Couldn't grab dm_config. Aborting rootfs hash calculation."
return 1
fi
- local vroot_dev=$(get_dm_slave "${dm_config}" vroot)
+ local vroot_dev=$(get_dm_device "${dm_config}" vroot)
# Extract the key-value parameters from the kernel command line.
local rootfs_sectors=$(get_verity_arg "${vroot_dev}" hashstart)
@@ -169,15 +171,15 @@ calculate_rootfs_hash() {
fi
# Run the verity tool on the rootfs partition.
- local slave=$(sudo verity mode=create \
+ local table=$(sudo verity mode=create \
alg=${verity_algorithm} \
payload="${rootfs_image}" \
payload_blocks=$((rootfs_sectors / 8)) \
hashtree="${hash_image}" ${salt_arg})
# Reconstruct new kernel config command line and replace placeholders.
- slave="$(echo "${slave}" |
+ table="$(echo "${table}" |
sed -s "s|ROOT_DEV|${root_dev}|g;s|HASH_DEV|${hash_dev}|")"
- CALCULATED_DM_ARGS="$(set_dm_slave "${dm_config}" vroot "${slave}")"
+ CALCULATED_DM_ARGS="$(set_dm_device "${dm_config}" vroot "${table}")"
CALCULATED_KERNEL_CONFIG="$(echo "${kernel_config}" |
sed -e 's#\(.*dm="\)\([^"]*\)\(".*\)'"#\1${CALCULATED_DM_ARGS}\3#g")"
}