How to run a custom built OpenWrt on qemu

I have an image I have built that I want to run on qemu. Does anyone know the correct command line for running it. It's a mipsel build.

Short answer, you can't - at least not a device specific firmware build.
There are virtual-only mips targets (malta), but those are quite far away from normal device support.

Ok, I'm not interested in a "working" senario. I just want it to boot and get me to a command prompt.

Again, what do you really want to accomplish?

  • check if your (taking a device out of my hat) DIR-860 rev B1 image boots?
    • this doesn't work, qemu doesn't emulate your $DIR-860_revB1, not even the $mt7621a target as such, it only emulates a virtual mips environment (malta target, different target than any real-world-plastic-router, different kernel patches, very different peripherials/ drivers - if malta boots doesn't tell you anything at all about mt7621)
    • if this is your desire, look on the second hand market for a cheap sibling (same model, if you can't get one, at least a similar device sharing the same target and flash type) of your desired test object. rip off the case and solder on serial console pins (and a flash socket, if you want a perfect solution). Test the real deal, have serial console and spi-nor flasher at your disposal. There's no alternative than testing the same hardware (or at least as close to as you can make it).
  • XOR debug mipsel/ musl userland issues
    • only this is possible with qemu
  • XOR test some software on OpenWrt
    • x86_64 images would be much easier (and faster-) to test

Ok, so what I have is a Cudy X1800 that I compiled my own firmware. Works great. I got as a free gift a Cudy R1200 extender. Looks like the same hardware. I've tried to serial but it was a bit of a hack job as they cut the traces. Very small. I have RX but no TX. I looked under a microscope and it looks ok. I tried 5v and 3.3v TTL. 5v seems to echo back but doesn't interrupt the boot. I would need to mess with the firmware on the X1800 to be R16 instead of R14 and there is some special package number (I don't think it's a checksum). Sooo... I was hoping to boot the firmware to make sure it won't brick the extender. I'm not really worried about bricking it but also wanting to not be reckless.

As mentioned before, qemu can't do that - at all.

Ok, going at this from another direction (may need to change topic?) Throwing away all caution. I want to modify Cudy X1800 firmware to comply with the recovery.bin problems as below. Where do I make those changes?: I see the R13 in the first few bytes of the image file, but I'm not sure where the firmware check is.

image name check failed R14 R13

R14 firmware check failed
[05000C09][05000C0B]