Files
OpenCellular/extra/usb_updater/Makefile
Nicolas Boichat 1d10236f07 usb_updater2: USB updater for common code EC
This is copied chip/g version as of commit 0e5497db6, plus the following
uncommited usb_update patch (CL:458469):
a0176a1cc usb_updater: Flush all data from endpoint before trying to update

On top of that, a good number of common-code specific modifications are
added: new extra commands, new first_response_pdu format, use of FMAP.

BRANCH=none
BUG=b:35587170
TEST=usb_updater binary identical before and after this change.
TEST=make BOARD=hammer -j && \
     ( cd extra/usb_updater && make && \
       time sudo ./usb_updater2 ../../build/hammer/ec.bin )
TEST=cd extra/usb_updater; make
     # Jump to RW
     sudo ./usb_updater2 -j
     sleep 0.5
     # Update RO, then reboot
     sudo ./usb_updater2 ../../build/hammer/ec.bin
     sleep 0.5
     # Update RW (first tell RO to not jump to RW)
     sudo ./usb_updater2 -s
     sudo ./usb_updater2 ../../build/hammer/ec.bin
TEST=cd extra/usb_updater; make
     # Tell RW to jump back to RO
     sudo ./usb_updater2 -w
     sleep 0.5
     # Update RW, then reboot
     sudo ./usb_updater2 -s
     sudo ./usb_updater2 ../../build/hammer/ec.bin
TEST=usb_updater2 can update hammer, and read its version, rollback
     version and key version.

Change-Id: I09da894d83e2b4d6c2e46cab301522c27fa0160c
Reviewed-on: https://chromium-review.googlesource.com/458468
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2017-05-21 03:06:24 -07:00

56 lines
1.2 KiB
Makefile

# Copyright 2015 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.
CC ?= gcc
PKG_CONFIG ?= pkg-config
PROGRAMS := usb_updater usb_updater2
LIBS :=
LFLAGS :=
CFLAGS := -std=gnu99 \
-g \
-Wall \
-Werror \
-Wpointer-arith \
-Wcast-align \
-Wcast-qual \
-Wundef \
-Wsign-compare \
-Wredundant-decls \
-Wmissing-declarations
ifeq (DEBUG,)
CFLAGS += -O3
else
CFLAGS += -O0
endif
#
# Add libusb-1.0 required flags
#
LIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0)
CFLAGS += -I../../include -I../../util
BOARD ?= cr50
LIBS_g = $(shell $(PKG_CONFIG) --libs libcrypto)
CFLAGS_g = $(shell $(PKG_CONFIG) --cflags libcrypto)
CFLAGS_g += -I../../board/$(BOARD) -I ../../chip/g
LIBS_common = -lfmap
all: $(PROGRAMS)
# chip/g updater
usb_updater: usb_updater.c Makefile
$(CC) $(CFLAGS) $(CFLAGS_g) $< $(LFLAGS) $(LIBS) $(LIBS_g) -o $@
# common EC code USB updater
usb_updater2: usb_updater2.c Makefile
$(CC) $(CFLAGS) $< $(LFLAGS) $(LIBS) $(LIBS_common) -o $@
.PHONY: clean
clean:
rm -rf $(PROGRAMS) *~