Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: update_kernel.sh

Issue 6031005: update_kernel: first cut at arm support (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: trying to diagnose churn Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remote_access.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_kernel.sh
diff --git a/update_kernel.sh b/update_kernel.sh
index d1b735daea471962299589722f609598307d39e7..a2a9b3467b759c1be13e0b6b93c5fb2afa431e83 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -16,7 +16,9 @@
restart_in_chroot_if_needed $*
DEFINE_string board "" "Override board reported by target"
+DEFINE_string device "" "Override boot device reported by target"
DEFINE_string partition "" "Override kernel partition reported by target"
+DEFINE_string arch "" "Override architecture reported by target"
DEFINE_boolean modules false "Update modules on target"
DEFINE_boolean firmware false "Update firmware on target"
@@ -33,14 +35,21 @@ function cleanup {
rm -rf "${TMP}"
}
+function learn_device() {
+ [ -n "${FLAGS_device}" ] && return
+ remote_sh df /mnt/stateful_partition
+ FLAGS_device=$(echo "${REMOTE_OUT}" | awk '/dev/ {print $1}' | sed s/1\$//)
+ info "Target reports root device is ${FLAGS_device}"
+}
+
# Ask the target what the kernel partition is
function learn_partition() {
[ -n "${FLAGS_partition}" ] && return
remote_sh cat /proc/cmdline
- if echo "${REMOTE_OUT}" | grep -q "/dev/sda3"; then
- FLAGS_partition="/dev/sda2"
+ if echo "${REMOTE_OUT}" | egrep -q "${FLAGS_device}3"; then
+ FLAGS_partition="${FLAGS_device}2"
else
- FLAGS_partition="/dev/sda4"
+ FLAGS_partition="${FLAGS_device}4"
fi
if [ -z "${FLAGS_partition}" ]; then
error "Partition required"
@@ -49,6 +58,23 @@ function learn_partition() {
info "Target reports kernel partition is ${FLAGS_partition}"
}
+function make_kernelimage() {
+
+ if [[ "${FLAGS_arch}" == "arm" ]]; then
+ ./build_kernel_image.sh --arch=arm \
+ --root='/dev/${devname}${rootpart}' \
+ --vmlinuz=/build/${FLAGS_board}/boot/vmlinux.uimg --to new_kern.bin
+ else
+ vbutil_kernel --pack new_kern.bin \
+ --keyblock /usr/share/vboot/devkeys/kernel.keyblock \
+ --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
+ --version 1 \
+ --config ../build/images/${FLAGS_board}/latest/config.txt \
+ --bootloader /lib64/bootstub/bootstub.efi \
+ --vmlinuz /build/${FLAGS_board}/boot/vmlinuz
+ fi
+}
+
function main() {
trap cleanup EXIT
@@ -56,21 +82,19 @@ function main() {
remote_access_init
+ learn_arch
+
learn_board
+ learn_device
+
+ learn_partition
+
remote_sh uname -r -v
old_kernel="${REMOTE_OUT}"
- vbutil_kernel --pack new_kern.bin \
- --keyblock /usr/share/vboot/devkeys/kernel.keyblock \
- --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
- --version 1 \
- --config ../build/images/"${FLAGS_board}"/latest/config.txt \
- --bootloader /lib64/bootstub/bootstub.efi \
- --vmlinuz /build/"${FLAGS_board}"/boot/vmlinuz
-
- learn_partition
+ make_kernelimage
remote_cp_to new_kern.bin /tmp
@@ -78,9 +102,9 @@ function main() {
if [[ ${FLAGS_modules} -eq ${FLAGS_TRUE} ]]; then
echo "copying modules"
- tar -C /build/"${FLAGS_board}"/lib/modules -cjf new_modules.tar .
+ tar -C /build/"${FLAGS_board}"/lib/modules -cjf /tmp/new_modules.tar .
- remote_cp_to new_modules.tar /tmp/
+ remote_cp_to /tmp/new_modules.tar /tmp/
remote_sh mount -o remount,rw /
remote_sh tar -C /lib/modules -xjf /tmp/new_modules.tar
@@ -88,9 +112,9 @@ function main() {
if [[ ${FLAGS_firmware} -eq ${FLAGS_TRUE} ]]; then
echo "copying firmware"
- tar -C /build/"${FLAGS_board}"/lib/firmware -cjf new_firmware.tar .
+ tar -C /build/"${FLAGS_board}"/lib/firmware -cjf /tmp/new_firmware.tar .
- remote_cp_to new_firmware.tar /tmp/
+ remote_cp_to /tmp/new_firmware.tar /tmp/
remote_sh mount -o remount,rw /
remote_sh tar -C /lib/firmware -xjf /tmp/new_firmware.tar
@@ -103,4 +127,4 @@ function main() {
info "new kernel: ${REMOTE_OUT}"
}
-main $@
+main "$@"
« no previous file with comments | « remote_access.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698