linux-sunxi / sunxi-tools

A collection of command line tools for ARM devices with Allwinner SoCs.
http://linux-sunxi.org/
GNU General Public License v2.0
569 stars 420 forks source link

Write .wic file to the SPI flash #209

Open bartiszosti opened 1 month ago

bartiszosti commented 1 month ago

I have an image generated by the Yocto, which is in .wic format. I want to write this image to the SPI flash via the sunxi-fel tool. Does it possible to do so?

apritzel commented 1 month ago

Hi, I am afraid this is not how it works. The SPI NOR flash on most devices is max. 16 MB in size, that's typically not enough for a kernel and root file system. That SPI flash is really only meant for holding the platform firmware (think: "BIOS"), so Trusted Firmware and U-Boot. That takes up about 1 MB, so there is some space left, typically, but there is no real standardised way to store payloads like a kernel in there. The kernel and rootfilesystem are supposed to live on some proper storage device, typically an SD card or eMMC storage. Alternatively you can boot from a USB mass storage device, or via the network. U-Boot supports all these methods, and it should detect them automatically.

Definitely sunxi-fel does not support any particular image formats to write into the SPI flash, it just takes whatever binary file you give it, and burns that into the flash memory as is. The first few bytes of that file need to be in a special format, to be recognised by the BootROM, which is taken care of by the mkimage tool of the U-Boot build system.