Arduino M0-alike board bootloader

Hello, I'm currently working on a custom board with the same pinout as the Arduino M0, there are just more pins used on the SAMD21G18A than on the original board, so I presume the same bootloader can be used.

Now, the problem is, that I need to burn the bootloader onto the chip:

Arduino IDE won't do it
I selected the board M0, programmer Atmel SAM-ICE, wired it, but the IDE says 'missing parameter erase.params.verbose'. Of course, I tried to google it, but nobody seems to have the same problems with SAMs...

Atmel Studio 7
Trough the device programming, I've set the BOOTPROT fuse value to 0x07, then erased the chip and burned a couple hex files (bootloaders found throughout GitHub and pretty much anywhere else :D). Some of those kept rebooting and i could hear the sound of a device continnuously connecting and disconnecting and some of them won't get even recognized by the system.
Then, I found a pre-built bootloader hex and its source files for the M0 bootloader in arduino board files, so I tried to burn the hex: 'Failed to parse objectfile xxx.hex: Unsupported format.', so I compiled the source files, burned it and it gets successfully recognized by the device manager, but as Arduino Zero, plus I still can't see it in the Arduino IDE...

Is it OK using the original M0 bootloader? Why isn't the Arduino IDE capable of burning an M0 bootloader? How do I modify the SAMD21 bootloader source files for M0?