summaryrefslogtreecommitdiff
path: root/board/twinkie/build_rw_variant
blob: 865914153b9fb0a760e6a425af13571f33321665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
#
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#

#
# Build a Twinkie firmware image with
# the regular Twinkie sniffer firmware in the RO partition
# and a firmware behaving as a USB PD sink in the RW partition.
#
BOARD=twinkie
VARIANT=sink
RO_SIZE=65536

# Clean build
make BOARD=${BOARD} clean
make BOARD=${BOARD} out=build/${BOARD}_${VARIANT} clean
# Build regular Twinkie sniffer firmware
make BOARD=${BOARD}
# Build Twinkie as a USB PD consumer/producer (defaulting as a sink)
make BOARD=${BOARD} PROJECT=${VARIANT} out=build/${BOARD}_${VARIANT}

# Generate the final image by concatenating the built images
VERSION=$(echo "VERSION" | cpp -P -imacros build/${BOARD}/ec_version.h)
FINAL_IMG=build/${BOARD}/${VERSION//\"}.combined.bin
cp build/${BOARD}/ec.bin ${FINAL_IMG}
dd if=build/${BOARD}_${VARIANT}/${VARIANT}.RW.bin of=${FINAL_IMG} bs=1 seek=${RO_SIZE} conv=notrunc