Skip to content

Optimize flash-script with bmaptool support#1848

Merged
brianmcgillion merged 1 commit intotiiuae:mainfrom
vunnyso:vs-improveFlash
Mar 25, 2026
Merged

Optimize flash-script with bmaptool support#1848
brianmcgillion merged 1 commit intotiiuae:mainfrom
vunnyso:vs-improveFlash

Conversation

@vunnyso
Copy link
Copy Markdown
Collaborator

@vunnyso vunnyso commented Mar 23, 2026

Description of Changes

Optimize flashing by adding bmaptool for sparse-aware copying, reducing flash time for compressed images. Includes .bmap generation, improved device handling and fallback support.

  1. Time taken by this PR to flash on the Samsung 500GB USB SSD
    [Ghaf devshell]$  time sudo ./packages/pkgs-by-name/flash-script/flash.sh -d /dev/sdb  -i result/disk1.raw.zst -f 
      ================ FLASH SUMMARY ================
         Image:  result/disk1.raw.zst
          Size:  128G
        Target:  /dev/sdb
          Size:  465.8G
      ===============================================
      
      Flashing...
      Preparing sparse image for faster flashing...
      Generating block map...
      Flashing with sparse-aware copy...
      bmaptool: info: block map format version 2.0
      bmaptool: info: 33554432 blocks of size 4096 (128.0 GiB), mapped 4890624 blocks (18.7 GiB or 14.6%)
      bmaptool: info: copying image 'disk1.raw.raw' to block device '/dev/sdb' using bmap file 'disk1.raw.raw.bmap'
      bmaptool: info: 100% copied
      Flashing complete
      
      real    4m24.671s
      user    0m0.196s
      sys     0m0.459s
    
  2. Time taken by mainline to flash on the Samsung 500GB USB SSD
    [Ghaf devshell]$  time sudo ./packages/pkgs-by-name/flash-script/flash.sh -d /dev/sdb  -i result/disk1.raw.zst -f  
     ================ FLASH SUMMARY ================
        Image:  result/disk1.raw.zst
         Size:  128G
       Target:  /dev/sdb
         Size:  465.8G
     ===============================================
     
     Flashing complete
     
     real    7m5.495s
     user    0m0.012s
     sys     0m0.018s

Type of Change

  • New Feature
  • Bug Fix
  • Improvement / Refactor

Related Issues / Tickets

Checklist

  • Clear summary in PR description
  • Detailed and meaningful commit message(s)
  • Commits are logically organized and squashed if appropriate
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • Author has run make-checks and it passes
  • All automatic GitHub Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing Instructions

Applicable Targets

  • Orin AGX aarch64
  • Orin NX aarch64
  • Lenovo X1 x86_64
  • Dell Latitude x86_64
  • System 76 x86_64

Installation Method

  • Requires full re-installation
  • Can be updated with nixos-rebuild ... switch
  • Other:

Test Steps To Verify:

  1. Improve flashing time

@vunnyso vunnyso requested review from avnik, brianmcgillion and kajusnau and removed request for kajusnau March 23, 2026 10:56
@milva-unikie
Copy link
Copy Markdown

Flashing times in Jenkins

Mainline This PR
Lenovo X1 7m 42s 2m 29s
Dell 7330 7m 35s 2m 38s
Darter Pro 6m 47s 2m 44s

Note: These times also include connecting and disconnecting the SSD to the test agent. I did not check which test agent was used for each run so that could change the results a bit. However, the trend is very clear.

Optimize flashing by adding bmaptool for sparse-aware
copying, reducing flash time for compressed images.
Includes .bmap generation, improved device handling and
fallback support.

Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
@vunnyso
Copy link
Copy Markdown
Collaborator Author

vunnyso commented Mar 24, 2026

Rebased to latest.

@vunnyso vunnyso requested a review from mbssrc March 25, 2026 07:16
@brianmcgillion brianmcgillion merged commit 71740ef into tiiuae:main Mar 25, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants