Flashing Custom OpenWrt on the Router Itself vs Another Linux Machine

Hello, community

I need to build a custom OpenWrt x86-64 image with a custom kernel and eBPF support.

The only Linux machine available to me is my current OpenWrt mini PC router itself. It has a 256 GB SSD and enough resources for building, but it is also my only production router, so I want to avoid risking the current working system.

What is the safest way to test such a build?

Can I repartition the SSD on the running router, write the new image to another partition, and boot from it? Or does OpenWrt x86 not work well that way?

If not, what would you recommend instead:

  • build on the router but keep the current system untouched,
  • test from USB/external SSD first,
  • use some dual-boot or GRUB-based approach,
  • or another safer rollback-friendly method?

My main goal is to avoid losing the current installed packages, configs, nft/firewall setup, custom scripts, and other accumulated changes.

Thank you.

Boot your favourite general purpose 'desktop' linux distribution on an x86_64 system (if totally unavoidable, maybe the router itself), booting a live-USB stick will do (but if you can, keep the buildroot on the internal SSD for speed reasons).