the previous patch got upstreamed, but now we need another one
diff --git a/bbb_cape/src/flasher/0001-actually-calculate-and-send-a-checksum-for-individua.patch b/bbb_cape/src/flasher/0001-actually-calculate-and-send-a-checksum-for-individua.patch
deleted file mode 100644
index d137326..0000000
--- a/bbb_cape/src/flasher/0001-actually-calculate-and-send-a-checksum-for-individua.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From f0eaeff48adec36922c610402557e623849fa447 Mon Sep 17 00:00:00 2001
-From: Brian Silverman <brians@dell-inspiron-linux.dlinkrouter>
-Date: Tue, 17 Dec 2013 16:38:20 -0800
-Subject: [PATCH] actually calculate and send a checksum for individual page
- erases
-
-There was a comment saying that is unnecessary, but apparently it is
-necessary on an STM32F205 with bootloader version 0x31.
----
- stm32.c |   10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
-diff --git a/stm32.c b/stm32.c
-index 1af3650..7034c6f 100644
---- a/stm32.c
-+++ b/stm32.c
-@@ -429,8 +429,12 @@ char stm32_erase_memory(const stm32_t *stm, uint8_t spage, uint8_t pages) {
- 		uint8_t pg_byte;
-  		uint8_t cs = 0;
-  
-- 		stm32_send_byte(stm, pages >> 8); // Number of pages to be erased, two bytes, MSB first
-- 		stm32_send_byte(stm, pages & 0xFF);
-+ 		pg_byte = pages >> 8;
-+ 		stm32_send_byte(stm, pg_byte); // Number of pages to be erased, two bytes, MSB first
-+		cs ^= pg_byte;
-+		pg_byte = pages & 0xFF;
-+ 		stm32_send_byte(stm, pg_byte);
-+		cs ^= pg_byte;
-  
-  		for (pg_num = 0; pg_num <= pages; pg_num++) {
-  			pg_byte = pg_num >> 8;
-@@ -440,7 +444,7 @@ char stm32_erase_memory(const stm32_t *stm, uint8_t spage, uint8_t pages) {
-  			cs ^= pg_byte;
-  			stm32_send_byte(stm, pg_byte);
-  		}
-- 		stm32_send_byte(stm, 0x00);  // Ought to need to hand over a valid checksum here...but 0 seems to work!
-+ 		stm32_send_byte(stm, cs);
-  	
-  		if (stm32_read_byte(stm) != STM32_ACK) {
-  			fprintf(stderr, "Page-by-page erase failed. Check the maximum pages your device supports.\n");
--- 
-1.7.10.4
-
diff --git a/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch b/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch
new file mode 100644
index 0000000..c119655
--- /dev/null
+++ b/bbb_cape/src/flasher/0001-fixed-the-page-by-page-erase-logic.patch
@@ -0,0 +1,37 @@
+From 3076652b98d4d33ac50eb546839a47980464c34d Mon Sep 17 00:00:00 2001
+From: Brian <brian@localhost>
+Date: Wed, 1 Jan 2014 16:21:50 -0800
+Subject: [PATCH] fixed the page-by-page erase logic
+
+Previously, it always started at page 0 and erased 1 more page than it
+was told to with bootloaders that support the extended erase command.
+---
+ stm32.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/stm32.c b/stm32.c
+index f724722..dee7959 100644
+--- a/stm32.c
++++ b/stm32.c
+@@ -430,14 +430,14 @@ char stm32_erase_memory(const stm32_t *stm, uint8_t spage, uint8_t pages) {
+ 		uint8_t pg_byte;
+  		uint8_t cs = 0;
+  
+-		pg_byte = pages >> 8;
+-		stm32_send_byte(stm, pg_byte); // Number of pages to be erased, two bytes, MSB first
++		pg_byte = (pages - 1) >> 8;
++		stm32_send_byte(stm, pg_byte); // Number of pages to be erased - 1, two bytes, MSB first
+ 		cs ^= pg_byte;
+-		pg_byte = pages & 0xFF;
++		pg_byte = (pages - 1) & 0xFF;
+ 		stm32_send_byte(stm, pg_byte);
+ 		cs ^= pg_byte;
+  
+- 		for (pg_num = 0; pg_num <= pages; pg_num++) {
++		for (pg_num = spage; pg_num < spage + pages; pg_num++) {
+  			pg_byte = pg_num >> 8;
+  			cs ^= pg_byte;
+  			stm32_send_byte(stm, pg_byte);
+-- 
+1.7.10.4
+
diff --git a/bbb_cape/src/flasher/build.sh b/bbb_cape/src/flasher/build.sh
index cb50569..3c26bc3 100755
--- a/bbb_cape/src/flasher/build.sh
+++ b/bbb_cape/src/flasher/build.sh
@@ -5,6 +5,9 @@
 cd $(dirname $0)
 
 [[ -d stm32flash ]] || ( git clone https://git.gitorious.org/stm32flash/stm32flash.git stm32flash &&
-	cd stm32flash && git checkout 16fbfe6e5854dc36f41712f60b2282cde7571afd && patch -p1 < ../0001-actually-calculate-and-send-a-checksum-for-individua.patch )
+	cd stm32flash && git checkout 5b0e391c539e906df7b97f0b457875d90883ea8e && patch -p1 < ../0001-fixed-the-page-by-page-erase-logic.patch )
+
+# TODO(brians): This breaks the build of the main code. Figure out something
+# better for this stuff.
 
 ../../../aos/build/build.sh atom flasher.gyp no "$@"