Can you publish open source firmware for closed/commercial hardware (such as routers, motherboards or basically any device) without asking the manufacturer?
To answer your question with a question: "Can you build the firmware without needing to violate the copyright or trade secret protection of the target hardware?' The answer to this question is the answer to your question.
So, if the target hardware is 'just an ARM chip with a conventional boot process', sure, you can write new code for it.
One tricky part is that the most important part of your target is probably not the processor, but rather the peripherals. If you have to reverse-engineer to figure out how to communicate with the radio or ethernet or disk drive or whatever, you may be in dubious territory with respect to the shrink-wrap license you 'accepted' when you unwrapped the box.
Firmware is nothing more than software that lives on a difficult to write to medium. Just as you can can run free software on non-free processors, for example Linux on an Intel i5 processor, you can run free firmware on non-free processors.
To add to bmargulies's answer you need to consider that firmware is a special breed of software.
Firmware, by it's definition, runs on special-purpose hardware. This hardware platform may have highly proprietary components (ASICs for example, or special sensors, etc). Firmware is very intimately aware of that hardware, and usually developed with access to very proprietary information such as:
- Confidential datasheets provided to the hardware manufacturer under an NDA.
- Encryption keys (for streaming data for example)
- Access to the full schematics of the device
- Knowledge of the data format for calibration tables, and how to apply them.
- Software and/or hardware patent licenses
One example would be a complex IC created by a third party vendor and used in the product. I have worked on systems where those chips are supplied with a combination of draconian license terms and a vendor-specific access key.
So, if you are trying to provide an open-source replacement for the existing firmware, you either need access to much of the same information - or to reverse engineer it. If you are trying to repurpose the hardware, you still need much of this information.
In which case, in order to create your own firmware, you are almost certainly going to breach the OEMs patents or copyrights, or those of various components on the target boards. You are also at risk from claims under the DMCA.
While the source lives in your private space, you are getting security through obscurity. The moment you publish your source, you potentially lay yourself open to lawsuits.
So, while it's possible to create and publish open source firmware for a proprietary platform, pragmatically it is so risky as to be highly improbable.