cpu_rec_rs
cpu_rec_rs copied to clipboard
embed default corpus
hey thanks for this tool, it came in handy identifying 8051 firmware today!
when in doubt, it's always 8051 ;)
anyway, I hit a small snag when trying to just cargo install --git https://github.com/trou/cpu_rec_rs and go (because the corpus wasn't on my local disk). Not too big of a deal, but a self-contained binary would be more convenient than keeping a copy of the corpus files around.
This obviously bloats the binary size. I chose postcard to encode the corpus, which is relatively compact, but the corpus still weighs in around 40MB.
So then I compressed it with lz4 and landed around 32MB for the executable (apple m1 mach-o binary).
In my opinion that's a good tradeoff, what do you think?
Hello. Thank you for your PR. I'd be happy to merge it if there's a way to embed the corpus when using "cargo install". Unfortunately I could not find a simple way to do that. Do you have any idea on how to do this?
That's precisely what this PR does! You can verify with something like
cd /tmp # no corpus here
cargo install --force --git https://github.com/evanrichter/cpu_rec_rs
ls -lah ~/.cargo/bin/cpu_rec_rs # verify binary size is ~32 MB
Sorry, I forgot "only" in embed the corpus only when using "cargo install".
We could make it conditional on release vs. debug, but I don't know a way to change behavior of cargo install more precisely
rebased to fix conflicts