update_kernel: Learn arch from board build (redux)
The boot.desc file in a build contains the information about what arch
the build is for. But sometimes that file isn't built, e.g. when a dev
has only built the kernel and not a whole image. Parse the kernel config
file for the architecture instead and pass it along to vbutil. This
avoids SSH to the DUT just to run uname.
BUG=None
TEST=update kernel on Cheza works
Change-Id: I7263ca68b5fd9ab1559630a8e51dd6c93c0155c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/1907980
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Stephen Boyd <swboyd@chromium.org>
Auto-Submit: Stephen Boyd <swboyd@chromium.org>
Commit-Queue: Stephen Boyd <swboyd@chromium.org>
diff --git a/remote_access.sh b/remote_access.sh
index 251621f..4e9f548 100644
--- a/remote_access.sh
+++ b/remote_access.sh
@@ -177,17 +177,6 @@
info "Target reports board is ${FLAGS_board}"
}
-learn_arch() {
- [ -n "${FLAGS_arch}" ] && return
- remote_sh uname -m
- FLAGS_arch=$(echo "${REMOTE_OUT}" | sed -e s/armv7l/arm/ -e s/i686/x86/ )
- if [ -z "${FLAGS_arch}" ]; then
- error "Arch required"
- exit 1
- fi
- info "Target reports arch is ${FLAGS_arch}"
-}
-
# Discover partition numbers from the target.
learn_partition_layout() {
source <(remote_sh_raw cat /usr/sbin/write_gpt.sh)
diff --git a/update_kernel.sh b/update_kernel.sh
index 4944535..13efa02 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -139,11 +139,23 @@
fi
}
+learn_arch() {
+ [ -n "${FLAGS_arch}" ] && return
+ FLAGS_arch=$(sed -n -E 's/^CONFIG_(ARM|ARM64|X86)=y/\1/p' \
+ /build/"${FLAGS_board}"/boot/config-* | \
+ uniq | awk '{print tolower($0)}')
+ if [ -z "${FLAGS_arch}" ]; then
+ error "Arch required"
+ exit 1
+ fi
+ info "Target reports arch is ${FLAGS_arch}"
+}
+
make_kernelimage() {
local bootloader_path
local kernel_image
local config_path="$(mktemp /tmp/config.txt.XXXXX)"
- if [[ "${FLAGS_arch}" == "arm" ]]; then
+ if [[ "${FLAGS_arch}" == "arm" || "${FLAGS_arch}" == "arm64" ]]; then
name="bootloader.bin"
bootloader_path="${SRC_ROOT}/build/images/${FLAGS_board}/latest/${name}"
# If there is no local bootloader stub, create a dummy file. This matches
@@ -271,10 +283,10 @@
remote_access_init
- learn_arch
-
learn_board
+ learn_arch
+
learn_device
learn_partition_layout