diff --git a/07_uart_chainloader/README.md b/07_uart_chainloader/README.md index 273dc97b..6c089d72 100644 --- a/07_uart_chainloader/README.md +++ b/07_uart_chainloader/README.md @@ -36,7 +36,7 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 7856 KiB =======================================🦀 100% 0 KiB/s Time: 00:00:00 +[MP] ⏩ Pushing 7 KiB ==========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now [0] Booting on: Raspberry Pi 3 diff --git a/08_timestamps/README.md b/08_timestamps/README.md index 7be9ffb1..a887f800 100644 --- a/08_timestamps/README.md +++ b/08_timestamps/README.md @@ -23,7 +23,7 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 13152 KiB ======================================🦀 100% 0 KiB/s Time: 00:00:00 +[MP] ⏩ Pushing 12 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now [ 0.585762] Booting on: Raspberry Pi 3 diff --git a/09_hw_debug_JTAG/README.md b/09_hw_debug_JTAG/README.md index a5a8a4aa..5f40c160 100644 --- a/09_hw_debug_JTAG/README.md +++ b/09_hw_debug_JTAG/README.md @@ -164,7 +164,7 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 8232 KiB =======================================🦀 100% 0 KiB/s Time: 00:00:00 +[MP] ⏩ Pushing 8 KiB ==========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now [ 0.372110] Parking CPU core. Please connect over JTAG now. diff --git a/10_privilege_level/README.md b/10_privilege_level/README.md index 5366b5bb..0910e093 100644 --- a/10_privilege_level/README.md +++ b/10_privilege_level/README.md @@ -202,7 +202,7 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 15824 KiB ======================================🦀 100% 0 KiB/s Time: 00:00:00 +[MP] ⏩ Pushing 15 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now [ 0.702482] Booting on: Raspberry Pi 3 diff --git a/11_virtual_memory/README.md b/11_virtual_memory/README.md index f8da264d..539fba04 100644 --- a/11_virtual_memory/README.md +++ b/11_virtual_memory/README.md @@ -256,7 +256,7 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 65568 KiB =====================================🦀 100% 32 KiB/s Time: 00:00:02 +[MP] ⏩ Pushing 64 KiB ========================================🦀 100% 32 KiB/s Time: 00:00:02 [ML] Loaded! Executing the payload now [ 2.932547] Booting on: Raspberry Pi 3 diff --git a/12_cpu_exceptions_part1/README.md b/12_cpu_exceptions_part1/README.md index d850187d..5353deed 100644 --- a/12_cpu_exceptions_part1/README.md +++ b/12_cpu_exceptions_part1/README.md @@ -405,7 +405,7 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 65568 KiB =====================================🦀 100% 32 KiB/s Time: 00:00:02 +[MP] ⏩ Pushing 64 KiB ========================================🦀 100% 32 KiB/s Time: 00:00:02 [ML] Loaded! Executing the payload now [ 2.913260] Booting on: Raspberry Pi 3 diff --git a/doc/minipush_demo_frontpage.gif b/doc/minipush_demo_frontpage.gif index 970591fb..4b0d72dd 100644 Binary files a/doc/minipush_demo_frontpage.gif and b/doc/minipush_demo_frontpage.gif differ diff --git a/utils/devtool.rb b/utils/devtool.rb index c924e728..ca9f66a8 100755 --- a/utils/devtool.rb +++ b/utils/devtool.rb @@ -170,6 +170,15 @@ class DevTool clean end + def ready_for_publish_no_rust + clean + misspell + rubocop + copyright + diff + clean + end + private def tutorials diff --git a/utils/minipush.rb b/utils/minipush.rb index 352347ca..485e7936 100755 --- a/utils/minipush.rb +++ b/utils/minipush.rb @@ -12,6 +12,7 @@ require 'colorize' require 'ruby-progressbar' require 'serialport' require 'timeout' +require_relative 'minipush/progressbar_patch' class ConnectionError < StandardError; end class ProtocolError < StandardError; end @@ -85,7 +86,7 @@ class MiniPush def send_binary pb = ProgressBar.create( total: @binary_size, - format: '[MP] ⏩ Pushing %c KiB %b🦀%i %p%% %r KiB/s %a', + format: '[MP] ⏩ Pushing %k KiB %b🦀%i %p%% %r KiB/s %a', rate_scale: ->(rate) { rate / 1024 }, length: 92 ) diff --git a/utils/minipush/progressbar_patch.rb b/utils/minipush/progressbar_patch.rb new file mode 100644 index 00000000..73454064 --- /dev/null +++ b/utils/minipush/progressbar_patch.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# SPDX-License-Identifier: MIT OR Apache-2.0 +# +# Copyright (c) 2020 Andre Richter + +# Monkey-patch ruby-progressbar so that it supports reporting the progress in KiB instead of Byte. + +class ProgressBar + # Add kibi version of progress + class Progress + def progress_kibi + @progress / 1024 + end + end + + module Format + # Add new formatting option + class Molecule + MOLECULES_EXTENDED = MOLECULES.dup + MOLECULES_EXTENDED[:k] = %i[progressable progress_kibi] + + def initialize(letter) + self.key = letter + self.method_name = MOLECULES_EXTENDED.fetch(key.to_sym) + end + end + end +end