mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-08 17:05:44 +00:00
image_signing: sign_official_build.sh: use loopbacks kernel configs w/boot loader updates
This is the last place that uses grab_kernel_config. Convert it over to accessing the kernel directly via loopbacks and delete the helper function entirely. This avoids unnecessary copies and prevents any more code from using it. BRANCH=None BUG=chromium:714598 TEST=dump_config still works Change-Id: I16aa2c2568d15c43bb20b9d5dc18060915047506 Reviewed-on: https://chromium-review.googlesource.com/505481 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
fc7b3972bc
commit
ca97b25a33
@@ -99,17 +99,6 @@ VERSION_FILE=$5
|
||||
FIRMWARE_VERSION=1
|
||||
KERNEL_VERSION=1
|
||||
|
||||
# Get current rootfs hash and kernel command line
|
||||
# ARGS: IMAGE KERNELPART
|
||||
grab_kernel_config() {
|
||||
local image=$1
|
||||
local kernelpart=$2 # Kernel partition number to grab.
|
||||
# Grab the existing kernel partition and get the kernel config.
|
||||
temp_kimage=$(make_temp_file)
|
||||
extract_image_partition ${image} ${kernelpart} ${temp_kimage}
|
||||
dump_kernel_config ${temp_kimage}
|
||||
}
|
||||
|
||||
# TODO(gauravsh): These are duplicated from chromeos-setimage. We need
|
||||
# to move all signing and rootfs code to one single place where it can be
|
||||
# reused. crosbug.com/19543
|
||||
@@ -741,10 +730,10 @@ update_recovery_kernel_hash() {
|
||||
}
|
||||
|
||||
# Update the legacy bootloader templates in EFI partition if available.
|
||||
# Args: IMAGE_BIN DM_PARTNO
|
||||
# Args: IMAGE_BIN KERNEL
|
||||
update_legacy_bootloader() {
|
||||
local image="$1"
|
||||
local dm_partno="$2"
|
||||
local loop_kern="$2"
|
||||
|
||||
local esp_partnum=12
|
||||
local esp_offset=$(( $(partoffset "${image}" "${esp_partnum}") * 512 ))
|
||||
@@ -764,10 +753,10 @@ update_legacy_bootloader() {
|
||||
fi
|
||||
|
||||
# If we can't find the dm parameter in the kernel config, bail out now.
|
||||
local kernel_config=$(grab_kernel_config "${image}" "${dm_partno}")
|
||||
local kernel_config=$(sudo dump_kernel_config "${loop_kern}")
|
||||
local root_hexdigest="$(get_hash_from_config "${kernel_config}")"
|
||||
if [[ -z "${root_hexdigest}" ]]; then
|
||||
error "Couldn't grab root_digest from kernel partition ${dm_partno}"
|
||||
error "Couldn't grab root_digest from kernel partition ${loop_kern}"
|
||||
error " (config: ${kernel_config})"
|
||||
return 1
|
||||
fi
|
||||
@@ -842,7 +831,7 @@ sign_image_file() {
|
||||
if [[ "${image_type}" == "recovery" ]]; then
|
||||
update_recovery_kernel_hash "${loopdev}"
|
||||
fi
|
||||
if ! update_legacy_bootloader "${output}" "${dm_partno}"; then
|
||||
if ! update_legacy_bootloader "${output}" "${loop_kern}"; then
|
||||
# Error is already logged.
|
||||
return 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user