1#!/bin/bash
2#
3# Copyright 2010 Google Inc. All Rights Reserved.
4# Author: bgay@google.com (Bruce Gay)
5#
6# used for flashing bootloader image on sholes
7
8BOOTPART='bootloader'
9
10################################################
11# sets the name of the boot partition and
12# bootfile, then flashes device
13#
14# Globals:
15#   product
16#   ROOT
17#   BOOTPART
18#   bootloaderfile
19#   device
20# Arguments:
21#   None
22# Returns:
23#   None
24################################################
25flash_bootloader_image()
26{
27  if [ $product != "crespo" ]; then
28    log_print "Wrong device type, expected crespo!"
29    exit
30  fi
31  if [ "$bootloaderfile" == '' ]; then
32    log_print "getting bootloader file for $product"
33    bootloaderfile=`ls -1 $ROOT/$product/ | sed -n 's/^\(bootloader\.[0-9A-Za-z_]*.img\)\n*/\1/ p'`
34    if [ "$bootloaderfile" == '' ]; then
35      log_print "bootloader file empty: $bootloaderfile"
36      exit
37    fi
38    if [ ! -e "$ROOT/$product/$bootloaderfile" ]; then
39      log_print "bootloader file not found: ./$product/$bootloaderfile"
40      exit
41    fi
42    log_print "using $ROOT/$product/$bootloaderfile as bootloader image file"
43  fi
44  log_print "downloading bootloader image to $device"
45  flash_partition $BOOTPART $ROOT/$product/$bootloaderfile
46  reboot_into_fastboot_from_fastboot
47}
48
49################################################
50# flashes the userdata partition
51#
52# Globals:
53#   product
54#   ROOT
55# Arguments:
56#   None
57# Returns:
58#   None
59################################################
60flash_userdata_image()
61{
62  #currently not supported so exiting early..."
63  log_print "skipping update of userdata.img, not supported yet."
64}
65
66################################################
67# sets the name of the radio partition and
68# radiofile and flashes device
69#
70# Globals:
71#   product
72#   ROOT
73#   radiofile
74#   radiopart
75#   device
76# Arguments:
77#   None
78# Returns:
79#   None
80################################################
81flash_radio_image()
82{
83  #currently not supported so exiting early..."
84  log_print "skipping update of radio partition, not supported yet."
85}
86