Chromium Code Reviews| Index: update_kernel.sh |
| diff --git a/update_kernel.sh b/update_kernel.sh |
| index b5e26d3198c1ea6aa20a9a5a8eb50dadc985f9da..e1340df88648d49e1a5c7242452a814c419919dc 100755 |
| --- a/update_kernel.sh |
| +++ b/update_kernel.sh |
| @@ -13,7 +13,9 @@ |
| . "$(dirname $0)/remote_access.sh" |
| 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" |
| @@ -22,14 +24,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}" |
|
Kenneth Waters
2010/12/23 18:14:06
This is a bit misleading. It doesn't learn the de
Olof Johansson
2010/12/23 18:48:33
Sure, will do
|
| +} |
| + |
| # 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" |
| @@ -38,6 +47,26 @@ function learn_partition() { |
| info "Target reports kernel partition is ${FLAGS_partition}" |
| } |
| +function make_kernelimage() { |
| + |
| + if [[ "${FLAGS_arch}" == "arm" ]]; then |
| + cmd="./build_kernel_image.sh --arch=arm \ |
| + --root='/dev/\\\${devname}\\\${rootpart}' \ |
| + --vmlinuz=/build/${FLAGS_board}/boot/vmlinux.uimg --to new_kern.bin" |
|
Kenneth Waters
2010/12/23 18:14:06
The quoting it burns. Maybe this one instead? It
Olof Johansson
2010/12/23 18:48:33
Yeah, it's bad. Yours is a little less nasty thoug
|
| + |
| + else |
| + cmd="vbutil_kernel --pack new_kern.bin \ |
|
Kenneth Waters
2010/12/23 18:14:06
I was somewhat upset that this didn't use build_ke
Olof Johansson
2010/12/23 18:48:33
msb, care to comment? I didn't go down that route
Mandeep Singh Baines
2010/12/23 21:34:19
Never considered it. If it works, let's do it. Wou
|
| + --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 |
| + |
| + ./enter_chroot.sh -- ${cmd} |
| +} |
| + |
| function main() { |
| assert_outside_chroot |
| @@ -54,31 +83,27 @@ function main() { |
| remote_access_init |
| + learn_arch |
| + |
| learn_board |
| remote_sh uname -r -v |
| old_kernel="${REMOTE_OUT}" |
| - cmd="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" |
| - |
| - ./enter_chroot.sh -- ${cmd} |
| + learn_device |
| learn_partition |
| + make_kernelimage |
| + |
| remote_cp_to new_kern.bin /tmp |
| remote_sh dd if=/tmp/new_kern.bin of="${FLAGS_partition}" |
| if [[ ${FLAGS_modules} -eq ${FLAGS_TRUE} ]]; then |
| echo "copying modules" |
| - cmd="tar -C /build/${FLAGS_board}/lib/modules -cjf new_modules.tar ." |
| + cmd="sudo tar -C /build/${FLAGS_board}/lib/modules -cjf new_modules.tar ." |
| ./enter_chroot.sh -- ${cmd} |
| remote_cp_to new_modules.tar /tmp/ |
| @@ -89,7 +114,7 @@ function main() { |
| if [[ ${FLAGS_firmware} -eq ${FLAGS_TRUE} ]]; then |
| echo "copying firmware" |
| - cmd="tar -C /build/${FLAGS_board}/lib/firmware -cjf new_firmware.tar ." |
| + cmd="sudo tar -C /build/${FLAGS_board}/lib/firmware -cjf new_firmware.tar ." |
| ./enter_chroot.sh -- ${cmd} |
| remote_cp_to new_firmware.tar /tmp/ |