diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-03-15 01:30:15 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-21 03:06:24 -0700 |
commit | 1d10236f07a453a438745e9ae541307f69df61ce (patch) | |
tree | 4858ee16f81eeabf96e70733080d4db8049910f4 /extra/usb_updater/Makefile | |
parent | 335bbbf2204a0814f2a1fc09054ed579a0b2cca9 (diff) | |
download | chrome-ec-1d10236f07a453a438745e9ae541307f69df61ce.tar.gz |
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>
Diffstat (limited to 'extra/usb_updater/Makefile')
-rw-r--r-- | extra/usb_updater/Makefile | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/extra/usb_updater/Makefile b/extra/usb_updater/Makefile index 9120b7d4dc..0a2b3a035e 100644 --- a/extra/usb_updater/Makefile +++ b/extra/usb_updater/Makefile @@ -4,8 +4,7 @@ CC ?= gcc PKG_CONFIG ?= pkg-config -PROGRAM := usb_updater -SOURCE := $(PROGRAM).c +PROGRAMS := usb_updater usb_updater2 LIBS := LFLAGS := CFLAGS := -std=gnu99 \ @@ -29,17 +28,28 @@ endif # # Add libusb-1.0 required flags # -LIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0 libcrypto) -CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0 libcrypto) +LIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0) +CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0) +CFLAGS += -I../../include -I../../util -# NOTE: This may be board-specific BOARD ?= cr50 -CFLAGS += -I../../include -I../../board/$(BOARD) -I ../../chip/g -I../../util +LIBS_g = $(shell $(PKG_CONFIG) --libs libcrypto) +CFLAGS_g = $(shell $(PKG_CONFIG) --cflags libcrypto) +CFLAGS_g += -I../../board/$(BOARD) -I ../../chip/g -$(PROGRAM): $(SOURCE) Makefile - $(CC) $(CFLAGS) $(SOURCE) $(LFLAGS) $(LIBS) -o $@ +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 $(PROGRAM) *~ + rm -rf $(PROGRAMS) *~ |